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/huffyuvdec.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/huffyuvdec.c')
-rw-r--r-- | libavcodec/huffyuvdec.c | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/libavcodec/huffyuvdec.c b/libavcodec/huffyuvdec.c index 29e5419d91..e390380867 100644 --- a/libavcodec/huffyuvdec.c +++ b/libavcodec/huffyuvdec.c @@ -323,7 +323,11 @@ static av_cold int decode_end(AVCodecContext *avctx) HYuvDecContext *s = avctx->priv_data; int i; - ff_huffyuv_common_end(s->temp, s->temp16); + for (int i = 0; i < 3; i++) { + av_freep(&s->temp[i]); + s->temp16[i] = NULL; + } + av_freep(&s->bitstream_buffer); for (i = 0; i < 8; i++) @@ -599,8 +603,12 @@ static av_cold int decode_init(AVCodecContext *avctx) return AVERROR_INVALIDDATA; } - if ((ret = ff_huffyuv_alloc_temp(s->temp, s->temp16, avctx->width)) < 0) - return ret; + 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; } |