summaryrefslogtreecommitdiffstats
path: root/media
diff options
context:
space:
mode:
authordamienv@chromium.org <damienv@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-12-18 17:34:49 +0000
committerdamienv@chromium.org <damienv@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-12-18 17:34:49 +0000
commit86cb2c35ece1ab5fdd4f4990e1e14b1ddfc00e6e (patch)
treec6cb1a11221982f3477cfe5fdbad02a9f4af94c1 /media
parent6f5a57150402a3491978611945c36046141584aa (diff)
downloadchromium_src-86cb2c35ece1ab5fdd4f4990e1e14b1ddfc00e6e.zip
chromium_src-86cb2c35ece1ab5fdd4f4990e1e14b1ddfc00e6e.tar.gz
chromium_src-86cb2c35ece1ab5fdd4f4990e1e14b1ddfc00e6e.tar.bz2
Update the h.264 SPS parser based on the latest spec.
BUG=254214 Review URL: https://codereview.chromium.org/117853002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@241584 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'media')
-rw-r--r--media/mp2t/es_parser_h264.cc38
1 files changed, 32 insertions, 6 deletions
diff --git a/media/mp2t/es_parser_h264.cc b/media/mp2t/es_parser_h264.cc
index 30764c9..48519c7 100644
--- a/media/mp2t/es_parser_h264.cc
+++ b/media/mp2t/es_parser_h264.cc
@@ -18,12 +18,12 @@ static const int kExtendedSar = 255;
// ISO 14496 part 10
// VUI parameters: Table E-1 "Meaning of sample aspect ratio indicator"
-static const int kTableSarWidth[14] = {
- 0, 1, 12, 10, 16, 40, 24, 20, 32, 80, 18, 15, 64, 160
+static const int kSarTableSize = 17;
+static const int kTableSarWidth[kSarTableSize] = {
+ 0, 1, 12, 10, 16, 40, 24, 20, 32, 80, 18, 15, 64, 160, 4, 3, 2
};
-
-static const int kTableSarHeight[14] = {
- 0, 1, 11, 11, 11, 33, 11, 11, 11, 33, 11, 11, 33, 99
+static const int kTableSarHeight[kSarTableSize] = {
+ 0, 1, 11, 11, 11, 33, 11, 11, 11, 33, 11, 11, 33, 99, 3, 2, 1
};
// Remove the start code emulation prevention ( 0x000003 )
@@ -369,6 +369,32 @@ bool EsParserH264::ProcessSPS(const uint8* buf, int size) {
RCHECK(bit_reader.ReadBits(8, &constraint_setX_flag));
RCHECK(bit_reader.ReadBits(8, &level_idc));
RCHECK(bit_reader.ReadBitsExpGolomb(&seq_parameter_set_id));
+
+ if (profile_idc == 100 || profile_idc == 110 ||
+ profile_idc == 122 || profile_idc == 244 ||
+ profile_idc == 44 || profile_idc == 83 ||
+ profile_idc == 86 || profile_idc == 118 ||
+ profile_idc == 128) {
+ uint32 chroma_format_idc;
+ RCHECK(bit_reader.ReadBitsExpGolomb(&chroma_format_idc));
+ if (chroma_format_idc == 3) {
+ int separate_colour_plane_flag;
+ RCHECK(bit_reader.ReadBits(1, &separate_colour_plane_flag));
+ }
+ uint32 bit_depth_luma_minus8;
+ uint32 bit_depth_chroma_minus8;
+ int qpprime_y_zero_transform_bypass_flag;
+ int seq_scaling_matrix_present_flag;
+ RCHECK(bit_reader.ReadBitsExpGolomb(&bit_depth_luma_minus8));
+ RCHECK(bit_reader.ReadBitsExpGolomb(&bit_depth_chroma_minus8));
+ RCHECK(bit_reader.ReadBits(1, &qpprime_y_zero_transform_bypass_flag));
+ RCHECK(bit_reader.ReadBits(1, &seq_scaling_matrix_present_flag));
+ if (seq_scaling_matrix_present_flag) {
+ int skip_count = (chroma_format_idc != 3) ? 8 : 12;
+ RCHECK(bit_reader.SkipBits(skip_count));
+ }
+ }
+
RCHECK(bit_reader.ReadBitsExpGolomb(&log2_max_frame_num_minus4));
RCHECK(bit_reader.ReadBitsExpGolomb(&pic_order_cnt_type));
@@ -442,7 +468,7 @@ bool EsParserH264::ProcessSPS(const uint8* buf, int size) {
if (aspect_ratio_idc == kExtendedSar) {
RCHECK(bit_reader.ReadBits(16, &sar_width));
RCHECK(bit_reader.ReadBits(16, &sar_height));
- } else if (aspect_ratio_idc < 14) {
+ } else if (aspect_ratio_idc < kSarTableSize) {
sar_width = kTableSarWidth[aspect_ratio_idc];
sar_height = kTableSarHeight[aspect_ratio_idc];
}