[FFmpeg-cvslog] avcodec/mpeg4videodec,h263dec: Only set skipped_last_frame for !vop_coded

Andreas Rheinhardt git at videolan.org
Fri May 16 03:15:08 EEST 2025


ffmpeg | branch: master | Andreas Rheinhardt <andreas.rheinhardt at outlook.com> | Thu May  1 22:31:36 2025 +0200| [2865ebd1fb62e1479161095c92fb93a201dc1720] | committer: Andreas Rheinhardt

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 <andreas.rheinhardt at outlook.com>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=2865ebd1fb62e1479161095c92fb93a201dc1720
---

 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 9785d6e343..2f8bd73665 100644
--- a/libavcodec/h263dec.c
+++ b/libavcodec/h263dec.c
@@ -463,7 +463,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 461f452f40..8bdc82b9a9 100644
--- a/libavcodec/mpeg4videodec.c
+++ b/libavcodec/mpeg4videodec.c
@@ -3265,6 +3265,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)
@@ -3691,6 +3692,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;



More information about the ffmpeg-cvslog mailing list