summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Rheinhardt <andreas.rheinhardt@outlook.com>2022-01-01 12:12:22 +0100
committerAndreas Rheinhardt <andreas.rheinhardt@outlook.com>2022-01-09 09:26:57 +0100
commit4fc4cf49315c96531a7675140502df222ae8e942 (patch)
tree5ab81a26abc9d06c00aaa398fd043abba77929b8
parent750c765ca421ba4546461f803f9ce2396399fb67 (diff)
avcodec/mpegvideo: Don't unnecessarily allocate buffers
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
-rw-r--r--libavcodec/mpegvideo.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/libavcodec/mpegvideo.c b/libavcodec/mpegvideo.c
index 1c2b28f450..af433153f2 100644
--- a/libavcodec/mpegvideo.c
+++ b/libavcodec/mpegvideo.c
@@ -371,17 +371,17 @@ static int init_duplicate_context(MpegEncContext *s)
s->pblocks[i] = &s->block[i];
}
- if (!(s->block32 = av_mallocz(sizeof(*s->block32))) ||
- !(s->dpcm_macroblock = av_mallocz(sizeof(*s->dpcm_macroblock))))
- return AVERROR(ENOMEM);
- s->dpcm_direction = 0;
-
if (s->avctx->codec_tag == AV_RL32("VCR2")) {
// exchange uv
FFSWAP(void *, s->pblocks[4], s->pblocks[5]);
}
if (s->out_format == FMT_H263) {
+ if (!(s->block32 = av_mallocz(sizeof(*s->block32))) ||
+ !(s->dpcm_macroblock = av_mallocz(sizeof(*s->dpcm_macroblock))))
+ return AVERROR(ENOMEM);
+ s->dpcm_direction = 0;
+
/* ac values */
if (!FF_ALLOCZ_TYPED_ARRAY(s->ac_val_base, yc_size))
return AVERROR(ENOMEM);