diff options
author | Andreas Rheinhardt <andreas.rheinhardt@outlook.com> | 2025-05-20 22:55:53 +0200 |
---|---|---|
committer | Andreas Rheinhardt <andreas.rheinhardt@outlook.com> | 2025-05-26 04:50:34 +0200 |
commit | 2e8a3e664504e44611fb018b1cf9d5b3cfa7a190 (patch) | |
tree | 497afe202b4342611d9aa09bb646093581bc98e4 | |
parent | 6349a3324dd825e8f834a7519d1cdff5e69c7384 (diff) | |
download | ffmpeg-2e8a3e664504e44611fb018b1cf9d5b3cfa7a190.tar.gz |
avcodec/idctdsp: Only try to initialize xvid idct if it is used
This allows to remove checks from ff_xvid_idct_init()
(and also the AVCodecContext* parameter).
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
-rw-r--r-- | libavcodec/idctdsp.c | 7 | ||||
-rw-r--r-- | libavcodec/xvididct.c | 8 | ||||
-rw-r--r-- | libavcodec/xvididct.h | 3 |
3 files changed, 6 insertions, 12 deletions
diff --git a/libavcodec/idctdsp.c b/libavcodec/idctdsp.c index 4259a117dc..8a71c7ef77 100644 --- a/libavcodec/idctdsp.c +++ b/libavcodec/idctdsp.c @@ -276,6 +276,10 @@ av_cold void ff_idctdsp_init(IDCTDSPContext *c, AVCodecContext *avctx) c->idct = ff_faanidct; c->perm_type = FF_IDCT_PERM_NONE; #endif /* CONFIG_FAANIDCT */ +#if CONFIG_MPEG4_DECODER + } else if (avctx->idct_algo == FF_IDCT_XVID) { + ff_xvid_idct_init(c); +#endif } else { // accurate/default c->idct_put = ff_simple_idct_put_int16_8bit; c->idct_add = ff_simple_idct_add_int16_8bit; @@ -289,9 +293,6 @@ av_cold void ff_idctdsp_init(IDCTDSPContext *c, AVCodecContext *avctx) c->put_signed_pixels_clamped = put_signed_pixels_clamped_c; c->add_pixels_clamped = ff_add_pixels_clamped_c; - if (CONFIG_MPEG4_DECODER && avctx->idct_algo == FF_IDCT_XVID) - ff_xvid_idct_init(c, avctx); - #if ARCH_AARCH64 ff_idctdsp_init_aarch64(c, avctx, high_bit_depth); #elif ARCH_ARM diff --git a/libavcodec/xvididct.c b/libavcodec/xvididct.c index f50d8b7695..317e4e82cd 100644 --- a/libavcodec/xvididct.c +++ b/libavcodec/xvididct.c @@ -32,7 +32,6 @@ #include "config.h" #include "libavutil/attributes.h" -#include "avcodec.h" #include "idctdsp.h" #include "xvididct.h" @@ -330,13 +329,8 @@ static void xvid_idct_add(uint8_t *dest, ptrdiff_t line_size, int16_t *block) ff_add_pixels_clamped_c(block, dest, line_size); } -av_cold void ff_xvid_idct_init(IDCTDSPContext *c, AVCodecContext *avctx) +av_cold void ff_xvid_idct_init(IDCTDSPContext *c) { - const unsigned high_bit_depth = avctx->bits_per_raw_sample > 8; - - if (high_bit_depth || avctx->lowres) - return; - c->idct_put = xvid_idct_put; c->idct_add = xvid_idct_add; c->idct = ff_xvid_idct; diff --git a/libavcodec/xvididct.h b/libavcodec/xvididct.h index 1395cfd8e1..496071a034 100644 --- a/libavcodec/xvididct.h +++ b/libavcodec/xvididct.h @@ -21,12 +21,11 @@ #include <stdint.h> -#include "avcodec.h" #include "idctdsp.h" void ff_xvid_idct(int16_t *const in); -void ff_xvid_idct_init(IDCTDSPContext *c, AVCodecContext *avctx); +void ff_xvid_idct_init(IDCTDSPContext *c); void ff_xvid_idct_init_x86(IDCTDSPContext *c); void ff_xvid_idct_init_mips(IDCTDSPContext *c); |