[vlc-commits] packetizer: hevc: fill colorimetry

Thomas Guillem git at videolan.org
Sun Apr 17 13:14:16 CEST 2016


vlc | branch: master | Thomas Guillem <thomas at gllm.fr> | Sat Apr 16 18:05:42 2016 +0300| [8c5e982d804e30783c64fce85ee0ef24b6bf9056] | committer: Thomas Guillem

packetizer: hevc: fill colorimetry

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

 modules/packetizer/hevc.c     |    5 +++++
 modules/packetizer/hevc_nal.c |   18 ++++++++++++++++++
 modules/packetizer/hevc_nal.h |    6 ++++++
 3 files changed, 29 insertions(+)

diff --git a/modules/packetizer/hevc.c b/modules/packetizer/hevc.c
index 2c61627..9be48fa 100644
--- a/modules/packetizer/hevc.c
+++ b/modules/packetizer/hevc.c
@@ -378,6 +378,11 @@ static block_t *ParseNonVCL(decoder_t *p_dec, uint8_t i_nal_type, block_t *p_nal
                     (void) hevc_get_frame_rate( p_sps, p_dec->p_sys->rgi_p_decvps,
                                                 &p_dec->fmt_out.video.i_frame_rate,
                                                 &p_dec->fmt_out.video.i_frame_rate_base );
+                    (void) hevc_get_colorimetry( p_sps,
+                                                 &p_dec->fmt_out.video.primaries,
+                                                 &p_dec->fmt_out.video.transfer,
+                                                 &p_dec->fmt_out.video.space,
+                                                 &p_dec->fmt_out.video.b_color_range_full);
                 }
             }
         }
diff --git a/modules/packetizer/hevc_nal.c b/modules/packetizer/hevc_nal.c
index d97d106..8be77d9 100644
--- a/modules/packetizer/hevc_nal.c
+++ b/modules/packetizer/hevc_nal.c
@@ -1040,6 +1040,24 @@ bool hevc_get_frame_rate( const hevc_sequence_parameter_set_t *p_sps,
     return false;
 }
 
+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 )
+{
+    if( !p_sps->vui_parameters_present_flag )
+        return false;
+    *p_primaries =
+        hxxx_colour_primaries_to_vlc( p_sps->vui.vs.colour.colour_primaries );
+    *p_transfer =
+        hxxx_transfer_characteristics_to_vlc( p_sps->vui.vs.colour.transfer_characteristics );
+    *p_colorspace =
+        hxxx_matrix_coeffs_to_vlc( p_sps->vui.vs.colour.matrix_coeffs );
+    *p_full_range = p_sps->vui.vs.video_full_range_flag;
+    return true;
+}
+
 static bool hevc_parse_slice_segment_header_rbsp( bs_t *p_bs,
                                                   uint8_t i_nal_type,
                                                   hevc_sequence_parameter_set_t **pp_sps,
diff --git a/modules/packetizer/hevc_nal.h b/modules/packetizer/hevc_nal.h
index 2e785c2..2dca630 100644
--- a/modules/packetizer/hevc_nal.h
+++ b/modules/packetizer/hevc_nal.h
@@ -21,6 +21,7 @@
 # define HEVC_NAL_H
 
 # include <vlc_common.h>
+# include <vlc_es.h>
 
 #define HEVC_VPS_MAX 16
 #define HEVC_SPS_MAX 16
@@ -174,6 +175,11 @@ bool hevc_get_picture_size( const hevc_sequence_parameter_set_t *, unsigned *p_w
 bool hevc_get_frame_rate( const hevc_sequence_parameter_set_t *,
                           hevc_video_parameter_set_t ** /* HEVC_MAX_VPS || NULL */,
                           unsigned *pi_num, unsigned *pi_den );
+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 );
 bool hevc_get_slice_type( const hevc_slice_segment_header_t *, enum hevc_slice_type_e * );
 
 #endif /* HEVC_NAL_H */



More information about the vlc-commits mailing list