Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(431)

Unified Diff: media/base/video_frame.cc

Issue 2745743002: Added BitsPerChannel method to video frame class. (Closed)
Patch Set: Added BitsPerChannel method to video frame class. Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « media/base/video_frame.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/base/video_frame.cc
diff --git a/media/base/video_frame.cc b/media/base/video_frame.cc
index d2808356111d86c56b19644a2f6a51d602c4ca2b..7ff020f687205baf49d344a9ef5b93d1c9320c48 100644
--- a/media/base/video_frame.cc
+++ b/media/base/video_frame.cc
@@ -795,6 +795,53 @@ std::string VideoFrame::AsHumanReadableString() {
return s.str();
}
+int VideoFrame::BitsPerChannel(VideoPixelFormat format) {
+ int bits_per_channel = 0;
+ switch (format) {
+ case media::PIXEL_FORMAT_UNKNOWN:
+ NOTREACHED();
+ // Fall through!
+ case media::PIXEL_FORMAT_I420:
+ case media::PIXEL_FORMAT_YV12:
+ case media::PIXEL_FORMAT_YV16:
+ case media::PIXEL_FORMAT_YV12A:
+ case media::PIXEL_FORMAT_YV24:
+ case media::PIXEL_FORMAT_NV12:
+ case media::PIXEL_FORMAT_NV21:
+ case media::PIXEL_FORMAT_UYVY:
+ case media::PIXEL_FORMAT_YUY2:
+ case media::PIXEL_FORMAT_ARGB:
+ case media::PIXEL_FORMAT_XRGB:
+ case media::PIXEL_FORMAT_RGB24:
+ case media::PIXEL_FORMAT_RGB32:
+ case media::PIXEL_FORMAT_MJPEG:
+ case media::PIXEL_FORMAT_MT21:
+ case media::PIXEL_FORMAT_Y8:
+ case media::PIXEL_FORMAT_I422:
+ bits_per_channel = 8;
+ break;
+ case media::PIXEL_FORMAT_YUV420P9:
+ case media::PIXEL_FORMAT_YUV422P9:
+ case media::PIXEL_FORMAT_YUV444P9:
+ bits_per_channel = 9;
+ break;
+ case media::PIXEL_FORMAT_YUV420P10:
+ case media::PIXEL_FORMAT_YUV422P10:
+ case media::PIXEL_FORMAT_YUV444P10:
+ bits_per_channel = 10;
+ break;
+ case media::PIXEL_FORMAT_YUV420P12:
+ case media::PIXEL_FORMAT_YUV422P12:
+ case media::PIXEL_FORMAT_YUV444P12:
+ bits_per_channel = 12;
+ break;
+ case media::PIXEL_FORMAT_Y16:
+ bits_per_channel = 16;
+ break;
+ }
+ return bits_per_channel;
+}
+
// static
scoped_refptr<VideoFrame> VideoFrame::WrapExternalStorage(
VideoPixelFormat format,
« no previous file with comments | « media/base/video_frame.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698