[FFmpeg-cvslog] avcodec/mpegvideo_dec: Don't alloc framesize-bufs in update_thread_ctx

Andreas Rheinhardt git at videolan.org
Thu Jun 20 20:00:22 EEST 2024


ffmpeg | branch: master | Andreas Rheinhardt <andreas.rheinhardt at outlook.com> | Tue Jun  4 11:39:25 2024 +0200| [39660bf964df6361896e0f2289f33379c383dad7] | committer: Andreas Rheinhardt

avcodec/mpegvideo_dec: Don't alloc framesize-bufs in update_thread_ctx

It is always allocated in ff_mpv_frame_start(), so the only
reason to put it into ff_mpeg_update_thread_context()
would be for the case that a frame-threaded decoder
that supports coded fields implements frame-threading.

The only mpegvideo-decoders supporting coded fields
are MPEG-1/2 and VC-1. The latter's bitstream requires
both coded fields to be part of the same access unit/packet,
so that every frame thread will always call ff_mpv_frame_start()
itself. The former only "need" the framesize buffers when
using lowres. If MPEG-1/2 gains frame-threading, one could either
perform framesize allocation in its update_thread_context
or when starting a field.

(Given that the next packet may trigger a reinitialization
due to a frame size change, it was possible for the buffers
that were allocated here to be thrown away unused.)

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at outlook.com>

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

 libavcodec/mpegvideo_dec.c | 8 --------
 1 file changed, 8 deletions(-)

diff --git a/libavcodec/mpegvideo_dec.c b/libavcodec/mpegvideo_dec.c
index ad35505819..b3753b6ad2 100644
--- a/libavcodec/mpegvideo_dec.c
+++ b/libavcodec/mpegvideo_dec.c
@@ -160,14 +160,6 @@ int ff_mpeg_update_thread_context(AVCodecContext *dst,
                s1->bitstream_buffer_size);
     }
 
-    // linesize-dependent scratch buffer allocation
-    ret = ff_mpv_framesize_alloc(s->avctx, &s->sc, s1->linesize);
-    if (ret < 0) {
-        av_log(s->avctx, AV_LOG_ERROR, "Failed to allocate context "
-               "scratch buffers.\n");
-        return ret;
-    }
-
     // MPEG-2/interlacing info
     memcpy(&s->progressive_sequence, &s1->progressive_sequence,
            (char *) &s1->rtp_mode - (char *) &s1->progressive_sequence);



More information about the ffmpeg-cvslog mailing list