Commit 69feb2de authored by François Cartegnie's avatar François Cartegnie 🤞

packetizer: h264: add h264_get_chroma_luma

parent 9e19a0db
......@@ -273,20 +273,20 @@ static bool h264_parse_sequence_parameter_set_rbsp( bs_t *p_bs,
i_profile_idc == PROFILE_H264_MFC_HIGH )
{
/* chroma_format_idc */
const int i_chroma_format_idc = bs_read_ue( p_bs );
if( i_chroma_format_idc == 3 )
p_sps->i_chroma_idc = bs_read_ue( p_bs );
if( p_sps->i_chroma_idc == 3 )
bs_skip( p_bs, 1 ); /* separate_colour_plane_flag */
/* bit_depth_luma_minus8 */
bs_read_ue( p_bs );
p_sps->i_bit_depth_luma = bs_read_ue( p_bs ) + 8;
/* bit_depth_chroma_minus8 */
bs_read_ue( p_bs );
p_sps->i_bit_depth_chroma = bs_read_ue( p_bs ) + 8;
/* qpprime_y_zero_transform_bypass_flag */
bs_skip( p_bs, 1 );
/* seq_scaling_matrix_present_flag */
i_tmp = bs_read( p_bs, 1 );
if( i_tmp )
{
for( int i = 0; i < ((3 != i_chroma_format_idc) ? 8 : 12); i++ )
for( int i = 0; i < ((3 != p_sps->i_chroma_idc) ? 8 : 12); i++ )
{
/* seq_scaling_list_present_flag[i] */
i_tmp = bs_read( p_bs, 1 );
......@@ -606,6 +606,17 @@ bool h264_get_picture_size( const h264_sequence_parameter_set_t *p_sps, unsigned
return true;
}
bool h264_get_chroma_luma( const h264_sequence_parameter_set_t *p_sps, uint8_t *pi_chroma_format,
uint8_t *pi_depth_luma, uint8_t *pi_depth_chroma )
{
if( p_sps->i_bit_depth_luma == 0 )
return false;
*pi_chroma_format = p_sps->i_chroma_idc;
*pi_depth_luma = p_sps->i_bit_depth_luma;
*pi_depth_chroma = p_sps->i_bit_depth_chroma;
return true;
}
bool h264_get_profile_level(const es_format_t *p_fmt, size_t *p_profile,
size_t *p_level, uint8_t *pi_nal_length_size)
{
......
......@@ -94,6 +94,11 @@ struct h264_sequence_parameter_set_t
{
int i_id;
int i_profile, i_profile_compatibility, i_level;
/* according to avcC, 3 bits max for those */
uint8_t i_chroma_idc;
uint8_t i_bit_depth_luma;
uint8_t i_bit_depth_chroma;
uint32_t pic_width_in_mbs_minus1;
uint32_t pic_height_in_map_units_minus1;
struct
......@@ -170,6 +175,9 @@ uint8_t * h264_avcC_to_AnnexB_NAL( const uint8_t *p_buf, size_t i_buf,
bool h264_get_picture_size( const h264_sequence_parameter_set_t *, unsigned *p_w, unsigned *p_h,
unsigned *p_vw, unsigned *p_vh );
bool h264_get_chroma_luma( const h264_sequence_parameter_set_t *, uint8_t *pi_chroma_format,
uint8_t *pi_depth_luma, uint8_t *pi_depth_chroma );
/* Get level and Profile */
bool h264_get_profile_level(const es_format_t *p_fmt, size_t *p_profile,
size_t *p_level, uint8_t *p_nal_length_size);
......
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