Commit 74bfb4e9 authored by Steve Lhomme's avatar Steve Lhomme

h264/hevc: read the color range as a video_color_range_t

parent 36c95034
...@@ -961,7 +961,7 @@ hxxx_helper_get_colorimetry(const struct hxxx_helper *hh, ...@@ -961,7 +961,7 @@ hxxx_helper_get_colorimetry(const struct hxxx_helper *hh,
video_color_primaries_t *p_primaries, video_color_primaries_t *p_primaries,
video_transfer_func_t *p_transfer, video_transfer_func_t *p_transfer,
video_color_space_t *p_colorspace, video_color_space_t *p_colorspace,
bool *p_full_range) video_color_range_t *p_full_range)
{ {
switch (hh->i_codec) switch (hh->i_codec)
{ {
......
...@@ -114,4 +114,4 @@ int hxxx_helper_get_colorimetry(const struct hxxx_helper *hh, ...@@ -114,4 +114,4 @@ int hxxx_helper_get_colorimetry(const struct hxxx_helper *hh,
video_color_primaries_t *p_primaries, video_color_primaries_t *p_primaries,
video_transfer_func_t *p_transfer, video_transfer_func_t *p_transfer,
video_color_space_t *p_colorspace, video_color_space_t *p_colorspace,
bool *p_full_range); video_color_range_t *p_full_range);
...@@ -478,7 +478,7 @@ static bool ConfigureVoutH264(decoder_t *p_dec) ...@@ -478,7 +478,7 @@ static bool ConfigureVoutH264(decoder_t *p_dec)
video_color_primaries_t primaries; video_color_primaries_t primaries;
video_transfer_func_t transfer; video_transfer_func_t transfer;
video_color_space_t colorspace; video_color_space_t colorspace;
bool full_range; video_color_range_t full_range;
if (hxxx_helper_get_colorimetry(&p_sys->hh, if (hxxx_helper_get_colorimetry(&p_sys->hh,
&primaries, &primaries,
&transfer, &transfer,
...@@ -488,7 +488,7 @@ static bool ConfigureVoutH264(decoder_t *p_dec) ...@@ -488,7 +488,7 @@ static bool ConfigureVoutH264(decoder_t *p_dec)
p_dec->fmt_out.video.primaries = primaries; p_dec->fmt_out.video.primaries = primaries;
p_dec->fmt_out.video.transfer = transfer; p_dec->fmt_out.video.transfer = transfer;
p_dec->fmt_out.video.space = colorspace; 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;
} }
} }
......
...@@ -228,12 +228,10 @@ static void ActivateSets( decoder_t *p_dec, const h264_sequence_parameter_set_t ...@@ -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 ) if( p_dec->fmt_in.video.primaries == COLOR_PRIMARIES_UNDEF )
{ {
bool color_full;
h264_get_colorimetry( p_sps, &p_dec->fmt_out.video.primaries, h264_get_colorimetry( p_sps, &p_dec->fmt_out.video.primaries,
&p_dec->fmt_out.video.transfer, &p_dec->fmt_out.video.transfer,
&p_dec->fmt_out.video.space, &p_dec->fmt_out.video.space,
&color_full ); &p_dec->fmt_out.video.color_range );
p_dec->fmt_out.video.color_range = color_full ? COLOR_RANGE_FULL : COLOR_RANGE_LIMITED;
} }
} }
......
...@@ -802,7 +802,7 @@ bool h264_get_colorimetry( const h264_sequence_parameter_set_t *p_sps, ...@@ -802,7 +802,7 @@ bool h264_get_colorimetry( const h264_sequence_parameter_set_t *p_sps,
video_color_primaries_t *p_primaries, video_color_primaries_t *p_primaries,
video_transfer_func_t *p_transfer, video_transfer_func_t *p_transfer,
video_color_space_t *p_colorspace, video_color_space_t *p_colorspace,
bool *p_full_range ) video_color_range_t *p_full_range )
{ {
if( !p_sps->vui.b_valid ) if( !p_sps->vui.b_valid )
return false; return false;
...@@ -812,7 +812,7 @@ bool h264_get_colorimetry( const h264_sequence_parameter_set_t *p_sps, ...@@ -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 ); iso_23001_8_tc_to_vlc_xfer( p_sps->vui.colour.i_transfer_characteristics );
*p_colorspace = *p_colorspace =
iso_23001_8_mc_to_vlc_coeffs( p_sps->vui.colour.i_matrix_coefficients ); 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; return true;
} }
......
...@@ -192,7 +192,7 @@ bool h264_get_colorimetry( const h264_sequence_parameter_set_t *p_sps, ...@@ -192,7 +192,7 @@ bool h264_get_colorimetry( const h264_sequence_parameter_set_t *p_sps,
video_color_primaries_t *p_primaries, video_color_primaries_t *p_primaries,
video_transfer_func_t *p_transfer, video_transfer_func_t *p_transfer,
video_color_space_t *p_colorspace, video_color_space_t *p_colorspace,
bool *p_full_range ); video_color_range_t *p_full_range );
/* Get level and Profile from DecoderConfigurationRecord */ /* Get level and Profile from DecoderConfigurationRecord */
bool h264_get_profile_level(const es_format_t *p_fmt, uint8_t *pi_profile, bool h264_get_profile_level(const es_format_t *p_fmt, uint8_t *pi_profile,
......
...@@ -560,13 +560,11 @@ static void ActivateSets(decoder_t *p_dec, ...@@ -560,13 +560,11 @@ static void ActivateSets(decoder_t *p_dec,
if(p_dec->fmt_in.video.primaries == COLOR_PRIMARIES_UNDEF) if(p_dec->fmt_in.video.primaries == COLOR_PRIMARIES_UNDEF)
{ {
bool color_full;
(void) hevc_get_colorimetry( p_sps, (void) hevc_get_colorimetry( p_sps,
&p_dec->fmt_out.video.primaries, &p_dec->fmt_out.video.primaries,
&p_dec->fmt_out.video.transfer, &p_dec->fmt_out.video.transfer,
&p_dec->fmt_out.video.space, &p_dec->fmt_out.video.space,
&color_full); &p_dec->fmt_out.video.color_range);
p_dec->fmt_out.video.color_range = color_full ? COLOR_RANGE_FULL : COLOR_RANGE_LIMITED;
} }
unsigned sizes[4]; unsigned sizes[4];
......
...@@ -1193,7 +1193,7 @@ bool hevc_get_colorimetry( const hevc_sequence_parameter_set_t *p_sps, ...@@ -1193,7 +1193,7 @@ bool hevc_get_colorimetry( const hevc_sequence_parameter_set_t *p_sps,
video_color_primaries_t *p_primaries, video_color_primaries_t *p_primaries,
video_transfer_func_t *p_transfer, video_transfer_func_t *p_transfer,
video_color_space_t *p_colorspace, video_color_space_t *p_colorspace,
bool *p_full_range ) video_color_range_t *p_full_range )
{ {
if( !p_sps->vui_parameters_present_flag ) if( !p_sps->vui_parameters_present_flag )
return false; return false;
...@@ -1203,7 +1203,7 @@ bool hevc_get_colorimetry( const hevc_sequence_parameter_set_t *p_sps, ...@@ -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 ); iso_23001_8_tc_to_vlc_xfer( p_sps->vui.vs.colour.transfer_characteristics );
*p_colorspace = *p_colorspace =
iso_23001_8_mc_to_vlc_coeffs( p_sps->vui.vs.colour.matrix_coeffs ); 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; return true;
} }
......
...@@ -191,7 +191,7 @@ bool hevc_get_colorimetry( const hevc_sequence_parameter_set_t *p_sps, ...@@ -191,7 +191,7 @@ bool hevc_get_colorimetry( const hevc_sequence_parameter_set_t *p_sps,
video_color_primaries_t *p_primaries, video_color_primaries_t *p_primaries,
video_transfer_func_t *p_transfer, video_transfer_func_t *p_transfer,
video_color_space_t *p_colorspace, 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 ); 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 * ); bool hevc_get_slice_type( const hevc_slice_segment_header_t *, enum hevc_slice_type_e * );
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment