[vlc-commits] h264/hevc: read the color range as a video_color_range_t

Steve Lhomme git at videolan.org
Mon Dec 17 13:20:37 CET 2018


vlc | branch: master | Steve Lhomme <robux4 at ycbcr.xyz> | Thu Dec 13 15:41:12 2018 +0100| [74bfb4e97ed5cccc0ad52596ff36e18de0d96d22] | committer: Steve Lhomme

h264/hevc: read the color range as a video_color_range_t

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=74bfb4e97ed5cccc0ad52596ff36e18de0d96d22
---

 modules/codec/hxxx_helper.c   | 2 +-
 modules/codec/hxxx_helper.h   | 2 +-
 modules/codec/videotoolbox.m  | 4 ++--
 modules/packetizer/h264.c     | 4 +---
 modules/packetizer/h264_nal.c | 4 ++--
 modules/packetizer/h264_nal.h | 2 +-
 modules/packetizer/hevc.c     | 4 +---
 modules/packetizer/hevc_nal.c | 4 ++--
 modules/packetizer/hevc_nal.h | 2 +-
 9 files changed, 12 insertions(+), 16 deletions(-)

diff --git a/modules/codec/hxxx_helper.c b/modules/codec/hxxx_helper.c
index c8e4b0a1b9..33df5f6bce 100644
--- a/modules/codec/hxxx_helper.c
+++ b/modules/codec/hxxx_helper.c
@@ -961,7 +961,7 @@ hxxx_helper_get_colorimetry(const struct hxxx_helper *hh,
                             video_color_primaries_t *p_primaries,
                             video_transfer_func_t *p_transfer,
                             video_color_space_t *p_colorspace,
-                            bool *p_full_range)
+                            video_color_range_t *p_full_range)
 {
     switch (hh->i_codec)
     {
diff --git a/modules/codec/hxxx_helper.h b/modules/codec/hxxx_helper.h
index 62fd0760e2..12577e8948 100644
--- a/modules/codec/hxxx_helper.h
+++ b/modules/codec/hxxx_helper.h
@@ -114,4 +114,4 @@ int hxxx_helper_get_colorimetry(const struct hxxx_helper *hh,
                                 video_color_primaries_t *p_primaries,
                                 video_transfer_func_t *p_transfer,
                                 video_color_space_t *p_colorspace,
-                                bool *p_full_range);
+                                video_color_range_t *p_full_range);
diff --git a/modules/codec/videotoolbox.m b/modules/codec/videotoolbox.m
index 755779ff63..b01b5d4511 100644
--- a/modules/codec/videotoolbox.m
+++ b/modules/codec/videotoolbox.m
@@ -478,7 +478,7 @@ static bool ConfigureVoutH264(decoder_t *p_dec)
         video_color_primaries_t primaries;
         video_transfer_func_t transfer;
         video_color_space_t colorspace;
-        bool full_range;
+        video_color_range_t full_range;
         if (hxxx_helper_get_colorimetry(&p_sys->hh,
                                         &primaries,
                                         &transfer,
@@ -488,7 +488,7 @@ static bool ConfigureVoutH264(decoder_t *p_dec)
             p_dec->fmt_out.video.primaries = primaries;
             p_dec->fmt_out.video.transfer = transfer;
             p_dec->fmt_out.video.space = colorspace;
-            p_dec->fmt_out.video.color_range = full_range ? COLOR_RANGE_FULL : COLOR_RANGE_LIMITED;
+            p_dec->fmt_out.video.color_range = full_range;
         }
     }
 
diff --git a/modules/packetizer/h264.c b/modules/packetizer/h264.c
index 463aa3bee5..dc558ac9e4 100644
--- a/modules/packetizer/h264.c
+++ b/modules/packetizer/h264.c
@@ -228,12 +228,10 @@ static void ActivateSets( decoder_t *p_dec, const h264_sequence_parameter_set_t
             }
             if( p_dec->fmt_in.video.primaries == COLOR_PRIMARIES_UNDEF )
             {
-                bool color_full;
                 h264_get_colorimetry( p_sps, &p_dec->fmt_out.video.primaries,
                                       &p_dec->fmt_out.video.transfer,
                                       &p_dec->fmt_out.video.space,
-                                      &color_full );
-                p_dec->fmt_out.video.color_range = color_full ? COLOR_RANGE_FULL : COLOR_RANGE_LIMITED;
+                                      &p_dec->fmt_out.video.color_range );
             }
         }
 
diff --git a/modules/packetizer/h264_nal.c b/modules/packetizer/h264_nal.c
index 74d4ba6b85..0cf35899ab 100644
--- a/modules/packetizer/h264_nal.c
+++ b/modules/packetizer/h264_nal.c
@@ -802,7 +802,7 @@ bool h264_get_colorimetry( const h264_sequence_parameter_set_t *p_sps,
                            video_color_primaries_t *p_primaries,
                            video_transfer_func_t *p_transfer,
                            video_color_space_t *p_colorspace,
-                           bool *p_full_range )
+                           video_color_range_t *p_full_range )
 {
     if( !p_sps->vui.b_valid )
         return false;
@@ -812,7 +812,7 @@ bool h264_get_colorimetry( const h264_sequence_parameter_set_t *p_sps,
         iso_23001_8_tc_to_vlc_xfer( p_sps->vui.colour.i_transfer_characteristics );
     *p_colorspace =
         iso_23001_8_mc_to_vlc_coeffs( p_sps->vui.colour.i_matrix_coefficients );
-    *p_full_range = p_sps->vui.colour.b_full_range;
+    *p_full_range = p_sps->vui.colour.b_full_range ? COLOR_RANGE_FULL : COLOR_RANGE_LIMITED;
     return true;
 }
 
diff --git a/modules/packetizer/h264_nal.h b/modules/packetizer/h264_nal.h
index 4a58a61a0f..b3a3001f23 100644
--- a/modules/packetizer/h264_nal.h
+++ b/modules/packetizer/h264_nal.h
@@ -192,7 +192,7 @@ bool h264_get_colorimetry( const h264_sequence_parameter_set_t *p_sps,
                            video_color_primaries_t *p_primaries,
                            video_transfer_func_t *p_transfer,
                            video_color_space_t *p_colorspace,
-                           bool *p_full_range );
+                           video_color_range_t *p_full_range );
 
 /* Get level and Profile from DecoderConfigurationRecord */
 bool h264_get_profile_level(const es_format_t *p_fmt, uint8_t *pi_profile,
diff --git a/modules/packetizer/hevc.c b/modules/packetizer/hevc.c
index b773adfdb9..297b8ae19b 100644
--- a/modules/packetizer/hevc.c
+++ b/modules/packetizer/hevc.c
@@ -560,13 +560,11 @@ static void ActivateSets(decoder_t *p_dec,
 
         if(p_dec->fmt_in.video.primaries == COLOR_PRIMARIES_UNDEF)
         {
-            bool color_full;
             (void) hevc_get_colorimetry( p_sps,
                                          &p_dec->fmt_out.video.primaries,
                                          &p_dec->fmt_out.video.transfer,
                                          &p_dec->fmt_out.video.space,
-                                         &color_full);
-            p_dec->fmt_out.video.color_range = color_full ? COLOR_RANGE_FULL : COLOR_RANGE_LIMITED;
+                                         &p_dec->fmt_out.video.color_range);
         }
 
         unsigned sizes[4];
diff --git a/modules/packetizer/hevc_nal.c b/modules/packetizer/hevc_nal.c
index 1a281b74ec..e6370e4dfc 100644
--- a/modules/packetizer/hevc_nal.c
+++ b/modules/packetizer/hevc_nal.c
@@ -1193,7 +1193,7 @@ bool hevc_get_colorimetry( const hevc_sequence_parameter_set_t *p_sps,
                            video_color_primaries_t *p_primaries,
                            video_transfer_func_t *p_transfer,
                            video_color_space_t *p_colorspace,
-                           bool *p_full_range )
+                           video_color_range_t *p_full_range )
 {
     if( !p_sps->vui_parameters_present_flag )
         return false;
@@ -1203,7 +1203,7 @@ bool hevc_get_colorimetry( const hevc_sequence_parameter_set_t *p_sps,
         iso_23001_8_tc_to_vlc_xfer( p_sps->vui.vs.colour.transfer_characteristics );
     *p_colorspace =
         iso_23001_8_mc_to_vlc_coeffs( p_sps->vui.vs.colour.matrix_coeffs );
-    *p_full_range = p_sps->vui.vs.video_full_range_flag;
+    *p_full_range = p_sps->vui.vs.video_full_range_flag ? COLOR_RANGE_FULL : COLOR_RANGE_LIMITED;
     return true;
 }
 
diff --git a/modules/packetizer/hevc_nal.h b/modules/packetizer/hevc_nal.h
index 27fec6d89c..69cacb6be1 100644
--- a/modules/packetizer/hevc_nal.h
+++ b/modules/packetizer/hevc_nal.h
@@ -191,7 +191,7 @@ bool hevc_get_colorimetry( const hevc_sequence_parameter_set_t *p_sps,
                            video_color_primaries_t *p_primaries,
                            video_transfer_func_t *p_transfer,
                            video_color_space_t *p_colorspace,
-                           bool *p_full_range );
+                           video_color_range_t *p_full_range );
 uint8_t hevc_get_max_num_reorder( const hevc_video_parameter_set_t *p_vps );
 bool hevc_get_slice_type( const hevc_slice_segment_header_t *, enum hevc_slice_type_e * );
 



More information about the vlc-commits mailing list