[vlc-devel] [PATCH 2/2] packetizer: hevc: fill colorimetry
Thomas Guillem
thomas at gllm.fr
Sat Apr 16 17:06:17 CEST 2016
---
modules/packetizer/hevc.c | 4 ++++
modules/packetizer/hevc_nal.c | 19 +++++++++++++++++++
modules/packetizer/hevc_nal.h | 5 +++++
3 files changed, 28 insertions(+)
diff --git a/modules/packetizer/hevc.c b/modules/packetizer/hevc.c
index 2c61627..48227df 100644
--- a/modules/packetizer/hevc.c
+++ b/modules/packetizer/hevc.c
@@ -378,6 +378,10 @@ 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 );
}
}
}
diff --git a/modules/packetizer/hevc_nal.c b/modules/packetizer/hevc_nal.c
index d97d106..e9307b7 100644
--- a/modules/packetizer/hevc_nal.c
+++ b/modules/packetizer/hevc_nal.c
@@ -1040,6 +1040,25 @@ 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 )
+{
+ 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_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..1c802c9 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,10 @@ 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 hevc_get_slice_type( const hevc_slice_segment_header_t *, enum hevc_slice_type_e * );
#endif /* HEVC_NAL_H */
--
2.8.0.rc3
More information about the vlc-devel
mailing list