This allows to remove checks from ff_xvid_idct_init() (and also the AVCodecContext* parameter).
Unified · Split
| @@ -276,6 +276,10 @@ av_cold void ff_idctdsp_init(IDCTDSPContext *c, AVCodecContext *avctx) · 275 unmodified lines | |||
| 276 | c->idct = ff_faanidct; | 276 | c->idct = ff_faanidct; |
| 277 | c->perm_type = FF_IDCT_PERM_NONE; | 277 | c->perm_type = FF_IDCT_PERM_NONE; |
| 278 | #endif /* CONFIG_FAANIDCT */ | 278 | #endif /* CONFIG_FAANIDCT */ |
| 279 | #if CONFIG_MPEG4_DECODER | ||
| 280 | } else if (avctx->idct_algo == FF_IDCT_XVID) { | ||
| 281 | ff_xvid_idct_init(c); | ||
| 282 | #endif | ||
| 279 | } else { // accurate/default | 283 | } else { // accurate/default |
| 280 | c->idct_put = ff_simple_idct_put_int16_8bit; | 284 | c->idct_put = ff_simple_idct_put_int16_8bit; |
| 281 | c->idct_add = ff_simple_idct_add_int16_8bit; | 285 | c->idct_add = ff_simple_idct_add_int16_8bit; |
| @@ -289,9 +293,6 @@ av_cold void ff_idctdsp_init(IDCTDSPContext *c, AVCodecContext *avctx) · 7 unmodified lines | |||
| 289 | c->put_signed_pixels_clamped = put_signed_pixels_clamped_c; | 293 | c->put_signed_pixels_clamped = put_signed_pixels_clamped_c; |
| 290 | c->add_pixels_clamped = ff_add_pixels_clamped_c; | 294 | c->add_pixels_clamped = ff_add_pixels_clamped_c; |
| 291 | 295 | ||
| 292 | if (CONFIG_MPEG4_DECODER && avctx->idct_algo == FF_IDCT_XVID) | ||
| 293 | ff_xvid_idct_init(c, avctx); | ||
| 294 | |||
| 295 | #if ARCH_AARCH64 | 296 | #if ARCH_AARCH64 |
| 296 | ff_idctdsp_init_aarch64(c, avctx, high_bit_depth); | 297 | ff_idctdsp_init_aarch64(c, avctx, high_bit_depth); |
| 297 | #elif ARCH_ARM | 298 | #elif ARCH_ARM |
| @@ -32,7 +32,6 @@ · 31 unmodified lines | |||
| 32 | 32 | ||
| 33 | #include "config.h" | 33 | #include "config.h" |
| 34 | #include "libavutil/attributes.h" | 34 | #include "libavutil/attributes.h" |
| 35 | #include "avcodec.h" | ||
| 36 | #include "idctdsp.h" | 35 | #include "idctdsp.h" |
| 37 | #include "xvididct.h" | 36 | #include "xvididct.h" |
| 38 | 37 | ||
| @@ -330,13 +329,8 @@ static void xvid_idct_add(uint8_t *dest, ptrdiff_t line_size, int16_t *block) · 291 unmodified lines | |||
| 330 | ff_add_pixels_clamped_c(block, dest, line_size); | 329 | ff_add_pixels_clamped_c(block, dest, line_size); |
| 331 | } | 330 | } |
| 332 | 331 | ||
| 333 | av_cold void ff_xvid_idct_init(IDCTDSPContext *c, AVCodecContext *avctx) | 332 | av_cold void ff_xvid_idct_init(IDCTDSPContext *c) |
| 334 | { | 333 | { |
| 335 | const unsigned high_bit_depth = avctx->bits_per_raw_sample > 8; | ||
| 336 | |||
| 337 | if (high_bit_depth || avctx->lowres) | ||
| 338 | return; | ||
| 339 | |||
| 340 | c->idct_put = xvid_idct_put; | 334 | c->idct_put = xvid_idct_put; |
| 341 | c->idct_add = xvid_idct_add; | 335 | c->idct_add = xvid_idct_add; |
| 342 | c->idct = ff_xvid_idct; | 336 | c->idct = ff_xvid_idct; |
| @@ -21,12 +21,11 @@ · 20 unmodified lines | |||
| 21 | 21 | ||
| 22 | #include <stdint.h> | 22 | #include <stdint.h> |
| 23 | 23 | ||
| 24 | #include "avcodec.h" | ||
| 25 | #include "idctdsp.h" | 24 | #include "idctdsp.h" |
| 26 | 25 | ||
| 27 | void ff_xvid_idct(int16_t *const in); | 26 | void ff_xvid_idct(int16_t *const in); |
| 28 | 27 | ||
| 29 | void ff_xvid_idct_init(IDCTDSPContext *c, AVCodecContext *avctx); | 28 | void ff_xvid_idct_init(IDCTDSPContext *c); |
| 30 | 29 | ||
| 31 | void ff_xvid_idct_init_x86(IDCTDSPContext *c); | 30 | void ff_xvid_idct_init_x86(IDCTDSPContext *c); |
| 32 | void ff_xvid_idct_init_mips(IDCTDSPContext *c); | 31 | void ff_xvid_idct_init_mips(IDCTDSPContext *c); |