diff options
author | Andreas Rheinhardt <andreas.rheinhardt@outlook.com> | 2022-10-25 02:51:21 +0200 |
---|---|---|
committer | Andreas Rheinhardt <andreas.rheinhardt@outlook.com> | 2022-10-29 13:37:41 +0200 |
commit | 4200ed2e91d248ef62f7fb701a7679d0e0afa654 (patch) | |
tree | 29c1c9b12809d68a0a030202edf8e3fb672c29c0 /libavcodec/snowenc.c | |
parent | 20ee12c677c6f58afbae643f039ba06e7d6f070a (diff) | |
download | ffmpeg-4200ed2e91d248ef62f7fb701a7679d0e0afa654.tar.gz |
avcodec/mpegvideo: Allocate map and score_map buffers jointly
Reduces the amounts of allocs, frees and allocation checks.
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Diffstat (limited to 'libavcodec/snowenc.c')
-rw-r--r-- | libavcodec/snowenc.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/libavcodec/snowenc.c b/libavcodec/snowenc.c index ada24f7895..7fad95b69a 100644 --- a/libavcodec/snowenc.c +++ b/libavcodec/snowenc.c @@ -82,11 +82,11 @@ static av_cold int encode_init(AVCodecContext *avctx) s->m.me.temp = s->m.me.scratchpad = av_calloc(avctx->width + 64, 2*16*2*sizeof(uint8_t)); - s->m.me.map = av_mallocz(ME_MAP_SIZE*sizeof(uint32_t)); - s->m.me.score_map = av_mallocz(ME_MAP_SIZE*sizeof(uint32_t)); s->m.sc.obmc_scratchpad= av_mallocz(MB_SIZE*MB_SIZE*12*sizeof(uint32_t)); - if (!s->m.me.scratchpad || !s->m.me.map || !s->m.me.score_map || !s->m.sc.obmc_scratchpad) + s->m.me.map = av_mallocz(2 * ME_MAP_SIZE * sizeof(*s->m.me.map)); + if (!s->m.me.scratchpad || !s->m.me.map || !s->m.sc.obmc_scratchpad) return AVERROR(ENOMEM); + s->m.me.score_map = s->m.me.map + ME_MAP_SIZE; ff_h263_encode_init(&s->m); //mv_penalty |