[vlc-commits] [Git][videolan/vlc][master] 4 commits: packetizer:av1: fix debug formatting
Jean-Baptiste Kempf (@jbk)
gitlab at videolan.org
Wed Jun 1 15:35:17 UTC 2022
Jean-Baptiste Kempf pushed to branch master at VideoLAN / VLC
Commits:
db1a38ff by Steve Lhomme at 2022-06-01T14:53:04+00:00
packetizer:av1: fix debug formatting
- - - - -
fe5c91cf by Steve Lhomme at 2022-06-01T14:53:04+00:00
packetizer:av1: remove always true test
- - - - -
d675af28 by Steve Lhomme at 2022-06-01T14:53:04+00:00
packetizer:av1: add a function to compare sequence headers
A change in a sequence header means the stream has changed.
- - - - -
e65c74fd by Steve Lhomme at 2022-06-01T14:53:04+00:00
packetizer:av1: detect sequence header changes
When the sequence header changes we need to know it has changed so the output
values can be reset.
In particular the visible size was not reset since it was set initially by the
demuxer. The first sequence header received is still not used to overwrite the
visible size after this patch.
The extra data were not reset even though they contain the sequence header.
Because there changes were not detected the new output format is never
forwarded.
Fixes #26811
- - - - -
3 changed files:
- modules/packetizer/av1.c
- modules/packetizer/av1_obu.c
- modules/packetizer/av1_obu.h
Changes:
=====================================
modules/packetizer/av1.c
=====================================
@@ -52,6 +52,7 @@ typedef struct
block_t *p_sequence_header_block;
av1_OBU_sequence_header_t *p_sequence_header;
+ bool b_sequence_header_changed;
struct
{
bool b_has_visible_frame;
@@ -116,7 +117,8 @@ static void UpdateDecoderFormat(decoder_t *p_dec)
unsigned wnum, hden;
AV1_get_frame_max_dimensions(p_sys->p_sequence_header, &wnum, &hden);
if((!p_dec->fmt_in.video.i_visible_height ||
- !p_dec->fmt_in.video.i_visible_width) &&
+ !p_dec->fmt_in.video.i_visible_width ||
+ p_sys->b_sequence_header_changed) &&
(p_dec->fmt_out.video.i_visible_width != wnum ||
p_dec->fmt_out.video.i_visible_width != hden))
{
@@ -153,6 +155,12 @@ static void UpdateDecoderFormat(decoder_t *p_dec)
p_dec->fmt_out.video.color_range = full;
}
+ if (p_sys->b_sequence_header_changed && p_dec->fmt_out.p_extra)
+ {
+ free(p_dec->fmt_out.p_extra);
+ p_dec->fmt_out.i_extra = 0;
+ }
+
if(!p_dec->fmt_in.i_extra && !p_dec->fmt_out.i_extra)
{
p_dec->fmt_out.i_extra =
@@ -162,6 +170,7 @@ static void UpdateDecoderFormat(decoder_t *p_dec)
(const uint8_t **)&p_sys->p_sequence_header_block->p_buffer,
&p_sys->p_sequence_header_block->i_buffer);
}
+ p_sys->b_sequence_header_changed = false;
}
static block_t * OutputQueues(decoder_t *p_dec, bool b_valid)
@@ -224,7 +233,7 @@ static block_t *GatherAndValidateChain(decoder_t *p_dec, block_t *p_outputchain)
if(p_outputchain)
{
#ifdef DEBUG_AV1_PACKETIZER
- msg_Dbg(p_dec, "TU output %ld", p_outputchain->i_dts);
+ msg_Dbg(p_dec, "TU output %" PRId64, p_outputchain->i_dts);
for(block_t *p = p_outputchain; p; p=p->p_next)
{
enum av1_obu_type_e OBUtype = AV1_OBUGetType(p->p_buffer);
@@ -237,7 +246,7 @@ static block_t *GatherAndValidateChain(decoder_t *p_dec, block_t *p_outputchain)
p_sys->p_sequence_header);
if(p_fh)
{
- msg_Dbg(p_dec,"OBU TYPE %d sz %ld dts %ld type %d %d",
+ msg_Dbg(p_dec,"OBU TYPE %d sz %zu dts %" PRId64 " type %d %d",
OBUtype, p->i_buffer, p->i_dts,
AV1_get_frame_type(p_fh),
AV1_get_frame_visibility(p_fh));
@@ -245,7 +254,7 @@ static block_t *GatherAndValidateChain(decoder_t *p_dec, block_t *p_outputchain)
AV1_release_frame_header(p_fh);
}
}
- else msg_Dbg(p_dec, "OBU TYPE %d sz %ld dts %ld", OBUtype, p->i_buffer, p->i_dts);
+ else msg_Dbg(p_dec, "OBU TYPE %d sz %zu dts %" PRId64, OBUtype, p->i_buffer, p->i_dts);
}
#endif
if(p_outputchain->i_flags & BLOCK_FLAG_DROP)
@@ -289,9 +298,21 @@ static block_t *ParseOBUBlock(decoder_t *p_dec, block_t *p_obu)
p_sys->p_sequence_header_block = block_Duplicate(p_obu);
}
- if(p_sys->p_sequence_header)
- AV1_release_sequence_header(p_sys->p_sequence_header);
- p_sys->p_sequence_header = AV1_OBU_parse_sequence_header(p_obu->p_buffer, p_obu->i_buffer);
+ av1_OBU_sequence_header_t *new_seq_header;
+ new_seq_header = AV1_OBU_parse_sequence_header(p_obu->p_buffer, p_obu->i_buffer);
+ if (likely(new_seq_header))
+ {
+ if (!p_sys->p_sequence_header ||
+ !AV1_sequence_header_equal(p_sys->p_sequence_header, new_seq_header))
+ {
+ if (p_sys->p_sequence_header)
+ {
+ AV1_release_sequence_header(p_sys->p_sequence_header);
+ p_sys->b_sequence_header_changed = true;
+ }
+ p_sys->p_sequence_header = new_seq_header;
+ }
+ }
}
PUSHQ(tu.pre, p_obu);
} break;
@@ -315,7 +336,7 @@ static block_t *ParseOBUBlock(decoder_t *p_dec, block_t *p_obu)
if(p_fh)
{
if((p_sys->i_seen & AV1_OBU_TEMPORAL_DELIMITER) && p_sys->tu.b_has_visible_frame)
- p_output = OutputQueues(p_dec, p_sys->p_sequence_header != NULL);
+ p_output = OutputQueues(p_dec, true);
switch(AV1_get_frame_type(p_fh))
{
@@ -383,6 +404,7 @@ static void PacketizeFlush(decoder_t *p_dec)
{
AV1_release_sequence_header(p_sys->p_sequence_header);
p_sys->p_sequence_header = NULL;
+ p_sys->b_sequence_header_changed = true;
}
if(p_sys->p_sequence_header_block)
{
@@ -531,6 +553,7 @@ static int Open(vlc_object_t *p_this)
INITQ(obus);
p_sys->p_sequence_header_block = NULL;
p_sys->p_sequence_header = NULL;
+ p_sys->b_sequence_header_changed = false;
p_sys->tu.b_has_visible_frame = false;
p_sys->tu.dts = VLC_TICK_INVALID;
p_sys->tu.pts = VLC_TICK_INVALID;
=====================================
modules/packetizer/av1_obu.c
=====================================
@@ -657,3 +657,88 @@ size_t AV1_create_DecoderConfigurationRecord(uint8_t **pp_buffer,
*pp_buffer = p_buffer;
return i_buffer;
}
+
+bool AV1_sequence_header_equal(const av1_OBU_sequence_header_t *seq1,const av1_OBU_sequence_header_t *seq2)
+{
+#define DIFF(field) \
+ seq1->field != seq2->field ||
+
+ if (
+ DIFF(obu_header.obu_type)
+ DIFF(obu_header.temporal_id)
+ DIFF(obu_header.spatial_id)
+ DIFF(seq_profile)
+ DIFF(still_picture)
+ DIFF(reduced_still_picture_header)
+ DIFF(timing_info_present_flag)
+ DIFF(timing_info.num_units_in_display_tick)
+ DIFF(timing_info.time_scale)
+ DIFF(timing_info.equal_picture_interval)
+ DIFF(timing_info.num_ticks_per_picture_minus_1)
+ DIFF(decoder_model_info_present_flag)
+ DIFF(decoder_model_info.buffer_delay_length_minus_1)
+ DIFF(decoder_model_info.num_units_in_decoding_tick)
+ DIFF(decoder_model_info.buffer_removal_time_length_minus_1)
+ DIFF(decoder_model_info.frame_presentation_time_length_minus_1)
+ DIFF(initial_display_delay_present_flag)
+ DIFF(operating_points_cnt_minus_1)
+ DIFF(max_frame_width_minus_1)
+ DIFF(max_frame_height_minus_1)
+ DIFF(frame_id_numbers_present_flag)
+ DIFF(delta_frame_id_length_minus_2)
+ DIFF(additional_frame_id_length_minus_1)
+ DIFF(use_128x128_superblock)
+ DIFF(enable_filter_intra)
+ DIFF(enable_intra_edge_filter)
+
+ DIFF(enable_interintra_compound)
+ DIFF(enable_masked_compound)
+ DIFF(enable_warped_motion)
+ DIFF(enable_dual_filter)
+ DIFF(enable_order_hint)
+ DIFF(enable_jnt_comp)
+ DIFF(enable_ref_frame_mvs)
+ DIFF(seq_force_screen_content_tools)
+ DIFF(seq_force_integer_mv)
+ DIFF(order_hint_bits_minus_1)
+
+ DIFF(enable_superres)
+ DIFF(enable_cdef)
+ DIFF(enable_restoration)
+ DIFF(color_config.high_bitdepth)
+ DIFF(color_config.twelve_bit)
+ DIFF(color_config.mono_chrome)
+ DIFF(color_config.color_description_present_flag)
+ DIFF(color_config.color_primaries)
+ DIFF(color_config.transfer_characteristics)
+ DIFF(color_config.matrix_coefficients)
+ DIFF(color_config.color_range)
+ DIFF(color_config.subsampling_x)
+ DIFF(color_config.subsampling_y)
+ DIFF(color_config.chroma_sample_position)
+ DIFF(color_config.separate_uv_delta_q)
+ DIFF(color_config.i_chroma)
+ DIFF(film_grain_params_present)
+ false
+ )
+ return false;
+
+ for (size_t i=0; i<ARRAY_SIZE(seq1->operating_points); i++)
+ {
+ if (
+ DIFF(operating_points[i].operating_point_idc)
+ DIFF(operating_points[i].seq_level_idx)
+ DIFF(operating_points[i].seq_tier)
+ DIFF(operating_points[i].decoder_model_present_for_this_op)
+ DIFF(operating_points[i].operating_parameters_info.decoder_buffer_delay)
+ DIFF(operating_points[i].operating_parameters_info.encoder_buffer_delay)
+ DIFF(operating_points[i].operating_parameters_info.low_delay_mode_flag)
+ DIFF(operating_points[i].initial_display_delay_present_for_this_op)
+ DIFF(operating_points[i].initial_display_delay_minus_1)
+ false
+ )
+ return false;
+ }
+
+ return true;
+}
=====================================
modules/packetizer/av1_obu.h
=====================================
@@ -169,6 +169,8 @@ bool AV1_get_colorimetry( const av1_OBU_sequence_header_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 *);
+bool AV1_sequence_header_equal(const av1_OBU_sequence_header_t *,const av1_OBU_sequence_header_t *);
+
/* FRAME_HEADER properties */
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/0b0eebfefdc99ed1597217532ababdd5c7dbf8d2...e65c74fdab537df17bfeadf554b1c1d2873120ea
--
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/0b0eebfefdc99ed1597217532ababdd5c7dbf8d2...e65c74fdab537df17bfeadf554b1c1d2873120ea
You're receiving this email because of your account on code.videolan.org.
VideoLAN code repository instance
More information about the vlc-commits
mailing list