From b9005093a317e0398d63b31de63112589d336b59 Mon Sep 17 00:00:00 2001 From: Andreas Rheinhardt Date: Thu, 1 May 2025 22:31:36 +0200 Subject: [PATCH 42/44] avcodec/mpeg4videodec,h263dec: Only set skipped_last_frame for !vop_coded This is more in line with the spec and avoids a branch. Signed-off-by: Andreas Rheinhardt --- libavcodec/h263dec.c | 1 - libavcodec/mpeg4videodec.c | 3 +++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/libavcodec/h263dec.c b/libavcodec/h263dec.c index 33dccfad2c..cfeaf1520f 100644 --- a/libavcodec/h263dec.c +++ b/libavcodec/h263dec.c @@ -476,7 +476,6 @@ int ff_h263_decode_frame(AVCodecContext *avctx, AVFrame *pict, #endif } else if (CONFIG_MPEG4_DECODER && avctx->codec_id == AV_CODEC_ID_MPEG4) { ret = ff_mpeg4_decode_picture_header(s); - s->skipped_last_frame = (ret == FRAME_SKIPPED); } else if (CONFIG_H263I_DECODER && s->codec_id == AV_CODEC_ID_H263I) { ret = ff_intel_h263_decode_picture_header(s); } else if (CONFIG_FLV_DECODER && s->h263_flv) { diff --git a/libavcodec/mpeg4videodec.c b/libavcodec/mpeg4videodec.c index d6740c8872..6d26eb6c8e 100644 --- a/libavcodec/mpeg4videodec.c +++ b/libavcodec/mpeg4videodec.c @@ -3259,6 +3259,7 @@ static int decode_vop_header(Mpeg4DecContext *ctx, GetBitContext *gb, if (get_bits1(gb) != 1) { if (s->avctx->debug & FF_DEBUG_PICT_INFO) av_log(s->avctx, AV_LOG_ERROR, "vop not coded\n"); + s->skipped_last_frame = 1; return FRAME_SKIPPED; } if (ctx->new_pred) @@ -3685,6 +3686,8 @@ int ff_mpeg4_decode_picture_header(MpegEncContext *s) { Mpeg4DecContext *const ctx = (Mpeg4DecContext*)s; + s->skipped_last_frame = 0; + if (ctx->bitstream_buffer) { int buf_size = get_bits_left(&s->gb) / 8U; int bitstream_buffer_size = ctx->bitstream_buffer->size; -- 2.45.2