Bug 1309163: P4. Add missing members to SPSData. r?rillian draft
authorJean-Yves Avenard <jyavenard@mozilla.com>
Mon, 24 Oct 2016 23:37:31 +1100
changeset 447692 5dc2cb1bf1f0bfaf5df5b45c7bec941632c79fa2
parent 447691 1e0641d35f534f163e786bd9379f19b9a8ba84cb
child 539089 72bfc1d759c2144175caf4f8841711f91c1e3812
push id38125
push userbmo:jyavenard@mozilla.com
push dateWed, 07 Dec 2016 08:02:04 +0000
reviewersrillian
bugs1309163
milestone53.0a1
Bug 1309163: P4. Add missing members to SPSData. r?rillian Those members are required for DXVA2. MozReview-Commit-ID: 4QRMVuUEJVD
media/libstagefright/binding/H264.cpp
media/libstagefright/binding/include/mp4_demuxer/H264.h
--- a/media/libstagefright/binding/H264.cpp
+++ b/media/libstagefright/binding/H264.cpp
@@ -215,18 +215,18 @@ H264::DecodeSPS(const mozilla::MediaByte
       aDest.profile_idc == 122 || aDest.profile_idc == 244 ||
       aDest.profile_idc == 44 || aDest.profile_idc == 83 ||
       aDest.profile_idc == 86 || aDest.profile_idc == 118 ||
       aDest.profile_idc == 128 || aDest.profile_idc == 138 ||
       aDest.profile_idc == 139 || aDest.profile_idc == 134) {
     if ((aDest.chroma_format_idc = br.ReadUE()) == 3) {
       aDest.separate_colour_plane_flag = br.ReadBit();
     }
-    br.ReadUE();        // bit_depth_luma_minus8
-    br.ReadUE();        // bit_depth_chroma_minus8
+    aDest.bit_depth_luma_minus8 = br.ReadUE();
+    aDest.bit_depth_chroma_minus8 = br.ReadUE();
     br.ReadBit();       // qpprime_y_zero_transform_bypass_flag
     aDest.seq_scaling_matrix_present_flag = br.ReadBit();
     if (aDest.seq_scaling_matrix_present_flag) {
       scaling_list(br, aDest.scaling_matrix4x4[0], Default_4x4_Intra,
                    Default_4x4_Intra);
       scaling_list(br, aDest.scaling_matrix4x4[1], Default_4x4_Intra,
                    aDest.scaling_matrix4x4[0]);
       scaling_list(br, aDest.scaling_matrix4x4[2], Default_4x4_Intra,
@@ -276,17 +276,17 @@ H264::DecodeSPS(const mozilla::MediaByte
   aDest.gaps_in_frame_num_allowed_flag = br.ReadBit();
   aDest.pic_width_in_mbs = br.ReadUE() + 1;
   aDest.pic_height_in_map_units = br.ReadUE() + 1;
   aDest.frame_mbs_only_flag = br.ReadBit();
   if (!aDest.frame_mbs_only_flag) {
     aDest.pic_height_in_map_units *= 2;
     aDest.mb_adaptive_frame_field_flag = br.ReadBit();
   }
-  br.ReadBit(); // direct_8x8_inference_flag
+  aDest.direct_8x8_inference_flag = br.ReadBit();
   aDest.frame_cropping_flag = br.ReadBit();
   if (aDest.frame_cropping_flag) {
     aDest.frame_crop_left_offset = br.ReadUE();
     aDest.frame_crop_right_offset = br.ReadUE();
     aDest.frame_crop_top_offset = br.ReadUE();
     aDest.frame_crop_bottom_offset = br.ReadUE();
   }
 
--- a/media/libstagefright/binding/include/mp4_demuxer/H264.h
+++ b/media/libstagefright/binding/include/mp4_demuxer/H264.h
@@ -77,16 +77,38 @@ struct SPSData
     in the range of 0 to 3, inclusive. When chroma_format_idc is not present,
     it shall be inferred to be equal to 1 (4:2:0 chroma format).
     When profile_idc is equal to 183, chroma_format_idc shall be equal to 0
     (4:0:0 chroma format).
    */
   uint8_t chroma_format_idc;
 
   /*
+    bit_depth_luma_minus8 specifies the bit depth of the samples of the luma
+    array and the value of the luma quantisation parameter range offset
+    QpBdOffset Y , as specified by
+      BitDepth Y = 8 + bit_depth_luma_minus8 (7-3)
+      QpBdOffset Y = 6 * bit_depth_luma_minus8 (7-4)
+    When bit_depth_luma_minus8 is not present, it shall be inferred to be equal
+    to 0. bit_depth_luma_minus8 shall be in the range of 0 to 6, inclusive.
+  */
+  uint8_t bit_depth_luma_minus8;
+
+  /*
+    bit_depth_chroma_minus8 specifies the bit depth of the samples of the chroma
+    arrays and the value of the chroma quantisation parameter range offset
+    QpBdOffset C , as specified by
+      BitDepth C = 8 + bit_depth_chroma_minus8 (7-5)
+      QpBdOffset C = 6 * bit_depth_chroma_minus8 (7-6)
+    When bit_depth_chroma_minus8 is not present, it shall be inferred to be
+    equal to 0. bit_depth_chroma_minus8 shall be in the range of 0 to 6, inclusive.
+  */
+  uint8_t bit_depth_chroma_minus8;
+
+  /*
     separate_colour_plane_flag equal to 1 specifies that the three colour
     components of the 4:4:4 chroma format are coded separately.
     separate_colour_plane_flag equal to 0 specifies that the colour components
     are not coded separately. When separate_colour_plane_flag is not present,
     it shall be inferred to be equal to 0. When separate_colour_plane_flag is
     equal to 1, the primary coded picture consists of three separate components,
     each of which consists of coded samples of one colour plane (Y, Cb or Cr)
     that each use the monochrome coding syntax. In this case, each colour plane
@@ -208,16 +230,24 @@ struct SPSData
     picture. mb_adaptive_frame_field_flag equal to 1 specifies
     the possible use of switching between frame and field
     macroblocks within frames. When mb_adaptive_frame_field_flag
     is not present, it shall be inferred to be equal to 0.
    */
   bool mb_adaptive_frame_field_flag;
 
   /*
+    direct_8x8_inference_flag specifies the method used in the derivation
+    process for luma motion vectors for B_Skip, B_Direct_16x16 and B_Direct_8x8
+    as specified in clause 8.4.1.2. When frame_mbs_only_flag is equal to 0,
+    direct_8x8_inference_flag shall be equal to 1.
+  */
+  bool direct_8x8_inference_flag;
+
+  /*
     frame_cropping_flag equal to 1 specifies that the frame cropping
     offset parameters follow next in the sequence parameter
     set. frame_cropping_flag equal to 0 specifies that the frame
     cropping offset parameters are not present.
    */
   bool frame_cropping_flag;
   uint32_t frame_crop_left_offset;
   uint32_t frame_crop_right_offset;
@@ -372,17 +402,18 @@ struct PPSData
 
   /* bottom_field_pic_order_in_frame_present_flag equal to 1 specifies that the
     syntax  elements delta_pic_order_cnt_bottom (when pic_order_cnt_type is
     equal to 0) or delta_pic_order_cnt[ 1 ] (when pic_order_cnt_type is equal to
     1), which are related to picture order counts for the bottom field of a
     coded frame, are present in the slice headers for coded frames as specified
     in clause 7.3.3. bottom_field_pic_order_in_frame_present_flag equal to 0
     specifies that the syntax elements delta_pic_order_cnt_bottom and
-    delta_pic_order_cnt[ 1 ] are not present inthe slice headers. */
+    delta_pic_order_cnt[ 1 ] are not present in the slice headers.
+    Also known has pic_order_present_flag. */
   bool bottom_field_pic_order_in_frame_present_flag;
 
   /* num_slice_groups_minus1 plus 1 specifies the number of slice groups for a
     picture. When num_slice_groups_minus1 is equal to 0, all slices of the
     picture belong to the same slice group. The allowed range of
     num_slice_groups_minus1 is specified in Annex A. */
   uint8_t num_slice_groups_minus1;