aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec/svq1enc.c
diff options
context:
space:
mode:
authorAndreas Rheinhardt <andreas.rheinhardt@outlook.com>2023-10-03 17:22:44 +0200
committerAndreas Rheinhardt <andreas.rheinhardt@outlook.com>2023-10-06 20:47:53 +0200
commit4c422de1dbce3bc4a1920c726ecba9d612cb1190 (patch)
tree839402b39197c8d8513f07dc6d711e16ab3de755 /libavcodec/svq1enc.c
parent27fcc8dd9f9fea7a520e9c4be043f3a05bf324cd (diff)
downloadffmpeg-4c422de1dbce3bc4a1920c726ecba9d612cb1190.tar.gz
avcodec/mpegvideo: Move allocating new_picture to the encoder
It is only used by encoders; this unfortunately necessitated to add separate allocations to the SVQ1 encoder which uses motion estimation without being a full member of mpegvideo. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Diffstat (limited to 'libavcodec/svq1enc.c')
-rw-r--r--libavcodec/svq1enc.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/libavcodec/svq1enc.c b/libavcodec/svq1enc.c
index 46a484e15f..894ae552bb 100644
--- a/libavcodec/svq1enc.c
+++ b/libavcodec/svq1enc.c
@@ -570,6 +570,7 @@ static av_cold int svq1_encode_end(AVCodecContext *avctx)
av_frame_free(&s->current_picture);
av_frame_free(&s->last_picture);
+ av_frame_free(&s->m.new_picture);
return 0;
}
@@ -632,10 +633,11 @@ static av_cold int svq1_encode_init(AVCodecContext *avctx)
s->dummy = av_mallocz((s->y_block_width + 1) *
s->y_block_height * sizeof(int32_t));
s->m.me.map = av_mallocz(2 * ME_MAP_SIZE * sizeof(*s->m.me.map));
+ s->m.new_picture = av_frame_alloc();
s->svq1encdsp.ssd_int8_vs_int16 = ssd_int8_vs_int16_c;
- if (!s->m.me.temp || !s->m.me.scratchpad || !s->m.me.map ||
- !s->mb_type || !s->dummy)
+ if (!s->m.me.scratchpad || !s->m.me.map ||
+ !s->mb_type || !s->dummy || !s->m.new_picture)
return AVERROR(ENOMEM);
s->m.me.score_map = s->m.me.map + ME_MAP_SIZE;