[vlc-devel] [PATCH 4/5] packetizer: h264: fill colour_desc

Thomas Guillem thomas at gllm.fr
Sat Apr 16 16:30:33 CEST 2016


---
 modules/packetizer/h264_nal.c | 15 +++++++++++++--
 modules/packetizer/h264_nal.h |  6 ++++++
 modules/packetizer/hxxx_nal.h |  8 ++++----
 3 files changed, 23 insertions(+), 6 deletions(-)

diff --git a/modules/packetizer/h264_nal.c b/modules/packetizer/h264_nal.c
index 71d946f..a4cdf23 100644
--- a/modules/packetizer/h264_nal.c
+++ b/modules/packetizer/h264_nal.c
@@ -427,11 +427,22 @@ static bool h264_parse_sequence_parameter_set_rbsp( bs_t *p_bs,
         i_tmp = bs_read( p_bs, 1 );
         if( i_tmp )
         {
-            bs_read( p_bs, 4 );
+            bs_read( p_bs, 3 );
+            p_sps->vui.colour_desc.b_full_range = bs_read( p_bs, 1 );
             /* colour desc */
             i_tmp = bs_read( p_bs, 1 );
             if ( i_tmp )
-                bs_read( p_bs, 24 );
+            {
+                p_sps->vui.colour_desc.i_colour_primaries = bs_read( p_bs, 8 );
+                p_sps->vui.colour_desc.i_transfer_characteristics = bs_read( p_bs, 8 );
+                p_sps->vui.colour_desc.i_matrix_coefficients = bs_read( p_bs, 8 );
+            }
+            else
+            {
+                p_sps->vui.colour_desc.i_colour_primaries = HXXX_PRIMARIES_UNSPECIFIED;
+                p_sps->vui.colour_desc.i_transfer_characteristics = HXXX_TRANSFER_UNSPECIFIED;
+                p_sps->vui.colour_desc.i_matrix_coefficients = HXXX_MATRIX_UNSPECIFIED;
+            }
         }
 
         /* chroma loc info */
diff --git a/modules/packetizer/h264_nal.h b/modules/packetizer/h264_nal.h
index f59148a..b9277e4 100644
--- a/modules/packetizer/h264_nal.h
+++ b/modules/packetizer/h264_nal.h
@@ -112,6 +112,12 @@ struct h264_sequence_parameter_set_t
     struct {
         bool b_valid;
         int i_sar_num, i_sar_den;
+        struct {
+            bool b_full_range;
+            uint8_t i_colour_primaries;
+            uint8_t i_transfer_characteristics;
+            uint8_t i_matrix_coefficients;
+        } colour_desc;
         bool b_timing_info_present_flag;
         uint32_t i_num_units_in_tick;
         uint32_t i_time_scale;
diff --git a/modules/packetizer/hxxx_nal.h b/modules/packetizer/hxxx_nal.h
index 134bf8a..e437796 100644
--- a/modules/packetizer/hxxx_nal.h
+++ b/modules/packetizer/hxxx_nal.h
@@ -88,9 +88,9 @@ enum hxxx_transfer_characteristics
     HXXX_TRANSFER_IEC61966_2_4      = 11,
     HXXX_TRANSFER_BT1361            = 12,
     HXXX_TRANSFER_IEC61966_2_1      = 13,
-    HXXX_TRANSFER_BT2020_V14        = 14
-    HXXX_TRANSFER_BT2020_V15        = 15
-    HXXX_TRANSFER_SMPTE_ST_2084     = 16
+    HXXX_TRANSFER_BT2020_V14        = 14,
+    HXXX_TRANSFER_BT2020_V15        = 15,
+    HXXX_TRANSFER_SMPTE_ST_2084     = 16,
     HXXX_TRANSFER_SMPTE_ST_428      = 17
 };
 
@@ -130,7 +130,7 @@ hxxx_transfer_characteristics_to_vlc( enum hxxx_transfer_characteristics i_trans
 /* Annex E: Matrix coefficients */
 enum hxxx_matrix_coeffs
 {
-    HXXX_MATRIX_IDENTIFY            = 0,
+    HXXX_MATRIX_IDENTITY            = 0,
     HXXX_MATRIX_BT709               = 1,
     HXXX_MATRIX_UNSPECIFIED         = 2,
     HXXX_MATRIX_RESERVED            = 3,
-- 
2.8.0.rc3



More information about the vlc-devel mailing list