[vlc-devel] [PATCH 1/2] packetizer: av1: provide the OBU chroma and bitdepth
Steve Lhomme
robux4 at ycbcr.xyz
Wed Sep 9 16:11:11 CEST 2020
VLC_CODEC_GREY is used for monochrome.
This is the chroma without the bitdepth applied (so not xxx_10L or xxx_12L).
---
modules/packetizer/av1_obu.c | 23 +++++++++++++++++++++++
modules/packetizer/av1_obu.h | 2 ++
2 files changed, 25 insertions(+)
diff --git a/modules/packetizer/av1_obu.c b/modules/packetizer/av1_obu.c
index 9778beb2123..a1219374cac 100644
--- a/modules/packetizer/av1_obu.c
+++ b/modules/packetizer/av1_obu.c
@@ -158,6 +158,8 @@ struct av1_color_config_s
obu_u1_t subsampling_y;
obu_u2_t chroma_sample_position;
obu_u1_t separate_uv_delta_q;
+
+ vlc_fourcc_t i_chroma;
};
static bool av1_parse_color_config(bs_t *p_bs,
@@ -191,12 +193,14 @@ static bool av1_parse_color_config(bs_t *p_bs,
if(p_cc->mono_chrome)
{
p_cc->color_range = bs_read1(p_bs) ? COLOR_RANGE_FULL : COLOR_RANGE_LIMITED;
+ p_cc->i_chroma = VLC_CODEC_GREY;
}
else if( p_cc->color_primaries == 1 &&
p_cc->transfer_characteristics == 13 &&
p_cc->matrix_coefficients == 0 )
{
p_cc->color_range = COLOR_RANGE_FULL;
+ p_cc->i_chroma = VLC_CODEC_I444;
}
else
{
@@ -213,7 +217,16 @@ static bool av1_parse_color_config(bs_t *p_bs,
{
p_cc->subsampling_x = 1;
}
+ p_cc->i_chroma = p_cc->subsampling_x ?
+ p_cc->subsampling_y ? VLC_CODEC_I420 :
+ VLC_CODEC_I422 :
+ VLC_CODEC_I444;
}
+ else if(seq_profile == 1)
+ p_cc->i_chroma = VLC_CODEC_I444;
+ else
+ p_cc->i_chroma = VLC_CODEC_I420;
+
if(p_cc->subsampling_x && p_cc->subsampling_y)
p_cc->chroma_sample_position = bs_read(p_bs, 2);
}
@@ -544,6 +557,16 @@ bool AV1_get_colorimetry(const av1_OBU_sequence_header_t *p_seq,
return true;
}
+vlc_fourcc_t AV1_get_chroma(const av1_OBU_sequence_header_t *p_seq)
+{
+ return p_seq->color_config.i_chroma;
+}
+
+int AV1_get_bitdepth(const av1_OBU_sequence_header_t *p_seq)
+{
+ return p_seq->color_config.high_bitdepth + p_seq->color_config.twelve_bit;
+}
+
size_t AV1_create_DecoderConfigurationRecord(uint8_t **pp_buffer,
const av1_OBU_sequence_header_t *p_seq,
size_t i_obu, const uint8_t *p_obus[],
diff --git a/modules/packetizer/av1_obu.h b/modules/packetizer/av1_obu.h
index b3082a759d2..0abe95d422d 100644
--- a/modules/packetizer/av1_obu.h
+++ b/modules/packetizer/av1_obu.h
@@ -167,6 +167,8 @@ bool AV1_get_colorimetry( const av1_OBU_sequence_header_t *,
video_color_primaries_t *, video_transfer_func_t *,
video_color_space_t *, video_color_range_t *);
bool AV1_get_frame_rate(const av1_OBU_sequence_header_t *, unsigned *, unsigned *);
+vlc_fourcc_t AV1_get_chroma(const av1_OBU_sequence_header_t *);
+int AV1_get_bitdepth(const av1_OBU_sequence_header_t *);
--
2.26.2
More information about the vlc-devel
mailing list