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 | 276 | c->idct = ff_faanidct; |
| 277 | 277 | c->perm_type = FF_IDCT_PERM_NONE; |
| 278 | 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 | 283 | } else { // accurate/default |
| 280 | 284 | c->idct_put = ff_simple_idct_put_int16_8bit; |
| 281 | 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 | 293 | c->put_signed_pixels_clamped = put_signed_pixels_clamped_c; |
| 290 | 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 | 296 | #if ARCH_AARCH64 |
| 296 | 297 | ff_idctdsp_init_aarch64(c, avctx, high_bit_depth); |
| 297 | 298 | #elif ARCH_ARM |
| @@ -32,7 +32,6 @@ · 31 unmodified lines | ||
| 32 | 32 | |
| 33 | 33 | #include "config.h" |
| 34 | 34 | #include "libavutil/attributes.h" |
| 35 | −#include "avcodec.h" | |
| 36 | 35 | #include "idctdsp.h" |
| 37 | 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 | 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 | 334 | c->idct_put = xvid_idct_put; |
| 341 | 335 | c->idct_add = xvid_idct_add; |
| 342 | 336 | c->idct = ff_xvid_idct; |
| @@ -21,12 +21,11 @@ · 20 unmodified lines | ||
| 21 | 21 | |
| 22 | 22 | #include <stdint.h> |
| 23 | 23 | |
| 24 | −#include "avcodec.h" | |
| 25 | 24 | #include "idctdsp.h" |
| 26 | 25 | |
| 27 | 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 | 30 | void ff_xvid_idct_init_x86(IDCTDSPContext *c); |
| 32 | 31 | void ff_xvid_idct_init_mips(IDCTDSPContext *c); |