From 83a8b9fac7b03a3a9c703e2a0641ab2cc35efaae Mon Sep 17 00:00:00 2001 From: Andreas Rheinhardt Date: Sat, 1 Oct 2022 22:36:34 +0200 Subject: [PATCH] avcodec/huffyuv: Inline ff_huffyuv_common_init() in its callers This is in preparation for splitting HYuvContext. Signed-off-by: Andreas Rheinhardt --- libavcodec/huffyuv.c | 9 --------- libavcodec/huffyuv.h | 1 - libavcodec/huffyuvdec.c | 5 +++-- libavcodec/huffyuvenc.c | 4 +++- 4 files changed, 6 insertions(+), 13 deletions(-) diff --git a/libavcodec/huffyuv.c b/libavcodec/huffyuv.c index 4a5bd53998..23a2bb2537 100644 --- a/libavcodec/huffyuv.c +++ b/libavcodec/huffyuv.c @@ -68,15 +68,6 @@ av_cold int ff_huffyuv_alloc_temp(HYuvContext *s, int width) return 0; } -av_cold void ff_huffyuv_common_init(AVCodecContext *avctx) -{ - HYuvContext *s = avctx->priv_data; - - s->flags = avctx->flags; - - ff_bswapdsp_init(&s->bdsp); -} - av_cold void ff_huffyuv_common_end(HYuvContext *s) { int i; diff --git a/libavcodec/huffyuv.h b/libavcodec/huffyuv.h index 92e390ad78..823a091809 100644 --- a/libavcodec/huffyuv.h +++ b/libavcodec/huffyuv.h @@ -93,7 +93,6 @@ typedef struct HYuvContext { int non_determ; // non-deterministic, multi-threaded encoder allowed } HYuvContext; -void ff_huffyuv_common_init(AVCodecContext *s); void ff_huffyuv_common_end(HYuvContext *s); int ff_huffyuv_alloc_temp(HYuvContext *s, int width); int ff_huffyuv_generate_bits_table(uint32_t *dst, const uint8_t *len_table, int n); diff --git a/libavcodec/huffyuvdec.c b/libavcodec/huffyuvdec.c index 89db3db65a..093070e348 100644 --- a/libavcodec/huffyuvdec.c +++ b/libavcodec/huffyuvdec.c @@ -300,6 +300,9 @@ static av_cold int decode_init(AVCodecContext *avctx) if (ret < 0) return ret; + s->flags = avctx->flags; + + ff_bswapdsp_init(&s->bdsp); ff_huffyuvdsp_init(&s->hdsp, avctx->pix_fmt); ff_llviddsp_init(&s->llviddsp); memset(s->vlc, 0, 4 * sizeof(VLC)); @@ -545,8 +548,6 @@ static av_cold int decode_init(AVCodecContext *avctx) } } - ff_huffyuv_common_init(avctx); - if ((avctx->pix_fmt == AV_PIX_FMT_YUV422P || avctx->pix_fmt == AV_PIX_FMT_YUV420P) && avctx->width & 1) { av_log(avctx, AV_LOG_ERROR, "width must be even for this colorspace\n"); return AVERROR_INVALIDDATA; diff --git a/libavcodec/huffyuvenc.c b/libavcodec/huffyuvenc.c index 0e9b24c8db..5293d32d2b 100644 --- a/libavcodec/huffyuvenc.c +++ b/libavcodec/huffyuvenc.c @@ -210,7 +210,9 @@ static av_cold int encode_init(AVCodecContext *avctx) const AVPixFmtDescriptor *desc; s->avctx = avctx; - ff_huffyuv_common_init(avctx); + s->flags = avctx->flags; + + ff_bswapdsp_init(&s->bdsp); ff_huffyuvencdsp_init(&s->hencdsp, avctx->pix_fmt); ff_llvidencdsp_init(&s->llvidencdsp);