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

Unified Diff: media/filters/h264_parser.cc

Issue 2345123002: Attach color space information to hardware decoded NV12 video frames. (Closed)
Patch Set: compile fix Created 4 years, 3 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/filters/h264_parser.h ('k') | media/gpu/android_video_decode_accelerator.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/filters/h264_parser.cc
diff --git a/media/filters/h264_parser.cc b/media/filters/h264_parser.cc
index 991599e2accd577a09e05c85edb52b596e599ffb..9dee01b169bef14689f1d6b7748a0baf311d2084 100644
--- a/media/filters/h264_parser.cc
+++ b/media/filters/h264_parser.cc
@@ -68,7 +68,8 @@ base::Optional<gfx::Size> H264SPS::GetCodedSize() const {
map_unit * (pic_height_in_map_units_minus1 + 1));
}
-// Also based on section 7.4.2.1.1.
+// Based on T-REC-H.264 E.2.1, "VUI parameters semantics",
+// available from http://www.itu.int/rec/T-REC-H.264.
base::Optional<gfx::Rect> H264SPS::GetVisibleRect() const {
base::Optional<gfx::Size> coded_size = GetCodedSize();
if (!coded_size)
@@ -122,6 +123,23 @@ base::Optional<gfx::Rect> H264SPS::GetVisibleRect() const {
coded_size->height() - crop_top - crop_bottom);
}
+// Comers from VUI section SPS. (E
sandersd (OOO until July 31) 2016/09/23 00:33:50 Comment seems to have gotten corrupted?
+gfx::ColorSpace H264SPS::GetColorSpace() const {
+ if (colour_description_present_flag) {
+ return gfx::ColorSpace(
+ colour_primaries, transfer_characteristics, matrix_coefficients,
+ video_full_range_flag ? gfx::ColorSpace::RangeID::FULL
+ : gfx::ColorSpace::RangeID::LIMITED);
+ } else {
+ return gfx::ColorSpace(gfx::ColorSpace::PrimaryID::UNSPECIFIED,
+ gfx::ColorSpace::TransferID::UNSPECIFIED,
+ gfx::ColorSpace::MatrixID::UNSPECIFIED,
+ video_full_range_flag
+ ? gfx::ColorSpace::RangeID::FULL
+ : gfx::ColorSpace::RangeID::LIMITED);
+ }
+}
+
H264PPS::H264PPS() {
memset(this, 0, sizeof(*this));
}
@@ -816,13 +834,17 @@ H264Parser::Result H264Parser::ParseVUIParameters(H264SPS* sps) {
if (data)
READ_BOOL_OR_RETURN(&data); // overscan_appropriate_flag
- READ_BOOL_OR_RETURN(&data); // video_signal_type_present_flag
- if (data) {
- READ_BITS_OR_RETURN(3, &data); // video_format
- READ_BOOL_OR_RETURN(&data); // video_full_range_flag
- READ_BOOL_OR_RETURN(&data); // colour_description_present_flag
- if (data)
- READ_BITS_OR_RETURN(24, &data); // color description syntax elements
+ READ_BOOL_OR_RETURN(&sps->video_signal_type_present_flag);
+ if (sps->video_signal_type_present_flag) {
+ READ_BITS_OR_RETURN(3, &sps->video_format);
+ READ_BOOL_OR_RETURN(&sps->video_full_range_flag);
+ READ_BOOL_OR_RETURN(&sps->colour_description_present_flag);
+ if (sps->colour_description_present_flag) {
+ // color description syntax elements
+ READ_BITS_OR_RETURN(8, &sps->colour_primaries);
+ READ_BITS_OR_RETURN(8, &sps->transfer_characteristics);
+ READ_BITS_OR_RETURN(8, &sps->matrix_coefficients);
+ }
}
READ_BOOL_OR_RETURN(&data); // chroma_loc_info_present_flag
« no previous file with comments | « media/filters/h264_parser.h ('k') | media/gpu/android_video_decode_accelerator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698