diff options
author | Andreas Rheinhardt <andreas.rheinhardt@outlook.com> | 2024-04-04 05:53:09 +0200 |
---|---|---|
committer | Andreas Rheinhardt <andreas.rheinhardt@outlook.com> | 2024-04-07 21:59:32 +0200 |
commit | eef5d60ac6200e0d4790d936c4e57656fe8502cc (patch) | |
tree | d03862ea2334cf505b4931ee5eacfe82c334033f /libavcodec/huffyuvenc.c | |
parent | cebf1d59a56991b775f9bea92d8efd2f810c39ba (diff) | |
download | ffmpeg-eef5d60ac6200e0d4790d936c4e57656fe8502cc.tar.gz |
avcodec/huffyuv: Inline common alloc/free functions in their callers
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Diffstat (limited to 'libavcodec/huffyuvenc.c')
-rw-r--r-- | libavcodec/huffyuvenc.c | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/libavcodec/huffyuvenc.c b/libavcodec/huffyuvenc.c index 0222565245..8329666fc0 100644 --- a/libavcodec/huffyuvenc.c +++ b/libavcodec/huffyuvenc.c @@ -430,12 +430,15 @@ static av_cold int encode_init(AVCodecContext *avctx) s->stats[i][j]= 0; } - ret = ff_huffyuv_alloc_temp(s->temp, s->temp16, avctx->width); - if (ret < 0) - return ret; - s->picture_number=0; + for (int i = 0; i < 3; i++) { + s->temp[i] = av_malloc(4 * avctx->width + 16); + if (!s->temp[i]) + return AVERROR(ENOMEM); + s->temp16[i] = (uint16_t*)s->temp[i]; + } + return 0; } static int encode_422_bitstream(HYuvEncContext *s, int offset, int count) @@ -1035,10 +1038,13 @@ static av_cold int encode_end(AVCodecContext *avctx) { HYuvEncContext *s = avctx->priv_data; - ff_huffyuv_common_end(s->temp, s->temp16); - av_freep(&avctx->stats_out); + for (int i = 0; i < 3; i++) { + av_freep(&s->temp[i]); + s->temp16[i] = NULL; + } + return 0; } |