From 2b9cdcebb2b35663d7cc01b91a1bb4a6bfe6a423 Mon Sep 17 00:00:00 2001 From: Andreas Rheinhardt Date: Mon, 24 Feb 2025 19:09:32 +0100 Subject: [PATCH 21/30] avcodec/mpeg4videoenc: Remove dead FF_BUG_MS code Added in 59fa3f96f48d12e189492ca3670991f91c316d4e, yet avctx->workaround_bugs is never copied to MpegEncContext.workaround_bugs, so this code is dead (it seems that this was true even when it was added). Furthermore, workaround_bugs is flagged as decoder-only, so just remove the code. Signed-off-by: Andreas Rheinhardt --- libavcodec/mpeg4videoenc.c | 28 +++++++++------------------- 1 file changed, 9 insertions(+), 19 deletions(-) diff --git a/libavcodec/mpeg4videoenc.c b/libavcodec/mpeg4videoenc.c index bc5375002a..0b31576dc5 100644 --- a/libavcodec/mpeg4videoenc.c +++ b/libavcodec/mpeg4videoenc.c @@ -968,13 +968,9 @@ static void mpeg4_encode_vol_header(MpegEncContext *s, put_bits(&s->pb, 1, 0); /* random access vol */ put_bits(&s->pb, 8, vo_type); /* video obj type indication */ - if (s->workaround_bugs & FF_BUG_MS) { - put_bits(&s->pb, 1, 0); /* is obj layer id= no */ - } else { - put_bits(&s->pb, 1, 1); /* is obj layer id= yes */ - put_bits(&s->pb, 4, vo_ver_id); /* is obj layer ver id */ - put_bits(&s->pb, 3, 1); /* is obj layer priority */ - } + put_bits(&s->pb, 1, 1); /* is obj layer id= yes */ + put_bits(&s->pb, 4, vo_ver_id); /* is obj layer ver id */ + put_bits(&s->pb, 3, 1); /* is obj layer priority */ aspect_ratio_info = ff_h263_aspect_to_info(s->avctx->sample_aspect_ratio); @@ -986,14 +982,10 @@ static void mpeg4_encode_vol_header(MpegEncContext *s, put_bits(&s->pb, 8, s->avctx->sample_aspect_ratio.den); } - if (s->workaround_bugs & FF_BUG_MS) { - put_bits(&s->pb, 1, 0); /* vol control parameters= no @@@ */ - } else { - put_bits(&s->pb, 1, 1); /* vol control parameters= yes */ - put_bits(&s->pb, 2, 1); /* chroma format YUV 420/YV12 */ - put_bits(&s->pb, 1, s->low_delay); - put_bits(&s->pb, 1, 0); /* vbv parameters= no */ - } + put_bits(&s->pb, 1, 1); /* vol control parameters= yes */ + put_bits(&s->pb, 2, 1); /* chroma format YUV 420/YV12 */ + put_bits(&s->pb, 1, s->low_delay); + put_bits(&s->pb, 1, 0); /* vbv parameters= no */ put_bits(&s->pb, 2, RECT_SHAPE); /* vol shape= rectangle */ put_bits(&s->pb, 1, 1); /* marker bit */ @@ -1059,8 +1051,7 @@ int ff_mpeg4_encode_picture_header(MpegEncContext *s) if (s->avctx->strict_std_compliance < FF_COMPLIANCE_VERY_STRICT || s->picture_number == 0) // HACK, the reference sw is buggy mpeg4_encode_vol_header(s, 0, 0); } - if (!(s->workaround_bugs & FF_BUG_MS)) - mpeg4_encode_gop_header(s); + mpeg4_encode_gop_header(s); } s->partitioned_frame = s->data_partitioning && s->pict_type != AV_PICTURE_TYPE_B; @@ -1300,8 +1291,7 @@ static av_cold int encode_init(AVCodecContext *avctx) return AVERROR(ENOMEM); init_put_bits(&s->pb, s->avctx->extradata, 1024); - if (!(s->workaround_bugs & FF_BUG_MS)) - mpeg4_encode_visual_object_header(s); + mpeg4_encode_visual_object_header(s); mpeg4_encode_vol_header(s, 0, 0); // ff_mpeg4_stuffing(&s->pb); ? -- 2.45.2