summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndreas Rheinhardt <[email protected]>2024-04-21 00:11:56 +0200
committerAndreas Rheinhardt <[email protected]>2024-06-12 11:00:57 +0200
commitcaac9740f84681f28bc6c6bf285fd0a25dc99060 (patch)
tree7b0950482d1d6758e659b62ff268e79f2730fb04
parent582d828f754f580cab9342e9c8a8ca09b906d69a (diff)
avcodec/mpegvideo: Only allocate cbp_table, pred_dir_table when needed
Namely for the MPEG-4 decoder. Signed-off-by: Andreas Rheinhardt <[email protected]>
-rw-r--r--libavcodec/mpegvideo.c13
1 files 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) {