ffmpeg | branch: master | Andreas Rheinhardt <andreas.rheinha...@outlook.com> | 
Sun Apr 21 00:11:56 2024 +0200| [caac9740f84681f28bc6c6bf285fd0a25dc99060] | 
committer: Andreas Rheinhardt

avcodec/mpegvideo: Only allocate cbp_table, pred_dir_table when needed

Namely for the MPEG-4 decoder.

Signed-off-by: Andreas Rheinhardt <andreas.rheinha...@outlook.com>

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

 libavcodec/mpegvideo.c | 13 ++++++-------
 1 file changed, 6 insertions(+), 7 deletions(-)

diff --git a/libavcodec/mpegvideo.c b/libavcodec/mpegvideo.c
index ca6e637920..2ef69a5224 100644
--- a/libavcodec/mpegvideo.c
+++ b/libavcodec/mpegvideo.c
@@ -593,13 +593,12 @@ int ff_mpv_init_context_frame(MpegEncContext *s)
                 tmp += mv_table_size;
             }
         }
-    }
-
-    if (s->out_format == FMT_H263) {
-        /* cbp, ac_pred, pred_dir */
-        if (!(s->cbp_table        = av_mallocz(mb_array_size)) ||
-            !(s->pred_dir_table   = av_mallocz(mb_array_size)))
-            return AVERROR(ENOMEM);
+        if (s->codec_id == AV_CODEC_ID_MPEG4 && !s->encoding) {
+            /* cbp, pred_dir */
+            if (!(s->cbp_table      = av_mallocz(mb_array_size)) ||
+                !(s->pred_dir_table = av_mallocz(mb_array_size)))
+                return AVERROR(ENOMEM);
+        }
     }
 
     if (s->msmpeg4_version >= 3) {

_______________________________________________
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog

To unsubscribe, visit link above, or email
ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".

Reply via email to