diff options
author | Diego Biurrun <diego@biurrun.de> | 2013-12-30 12:09:03 +0100 |
---|---|---|
committer | Diego Biurrun <diego@biurrun.de> | 2014-03-20 05:03:23 -0700 |
commit | 5169e688956be3378adb3b16a93962fe0048f1c9 (patch) | |
tree | 5c76aaaa9cbc38575f3eb02269dd6704725882de /libavcodec/arm | |
parent | cf7a2167570e6ccb9dfbd62e9d8ba8f4f065b17e (diff) | |
download | ffmpeg-5169e688956be3378adb3b16a93962fe0048f1c9.tar.gz |
dsputil: Propagate bit depth information to all (sub)init functions
This avoids recalculating the value over and over again.
Diffstat (limited to 'libavcodec/arm')
-rw-r--r-- | libavcodec/arm/dsputil_arm.h | 9 | ||||
-rw-r--r-- | libavcodec/arm/dsputil_init_arm.c | 11 | ||||
-rw-r--r-- | libavcodec/arm/dsputil_init_armv5te.c | 5 | ||||
-rw-r--r-- | libavcodec/arm/dsputil_init_armv6.c | 20 | ||||
-rw-r--r-- | libavcodec/arm/dsputil_init_neon.c | 7 |
5 files changed, 28 insertions, 24 deletions
diff --git a/libavcodec/arm/dsputil_arm.h b/libavcodec/arm/dsputil_arm.h index cc14b2c4f3..6080203960 100644 --- a/libavcodec/arm/dsputil_arm.h +++ b/libavcodec/arm/dsputil_arm.h @@ -24,8 +24,11 @@ #include "libavcodec/avcodec.h" #include "libavcodec/dsputil.h" -void ff_dsputil_init_armv5te(DSPContext *c, AVCodecContext *avctx); -void ff_dsputil_init_armv6(DSPContext *c, AVCodecContext *avctx); -void ff_dsputil_init_neon(DSPContext *c, AVCodecContext *avctx); +void ff_dsputil_init_armv5te(DSPContext *c, AVCodecContext *avctx, + unsigned high_bit_depth); +void ff_dsputil_init_armv6(DSPContext *c, AVCodecContext *avctx, + unsigned high_bit_depth); +void ff_dsputil_init_neon(DSPContext *c, AVCodecContext *avctx, + unsigned high_bit_depth); #endif /* AVCODEC_ARM_DSPUTIL_ARM_H */ diff --git a/libavcodec/arm/dsputil_init_arm.c b/libavcodec/arm/dsputil_init_arm.c index 2c348ecb0d..33109088ee 100644 --- a/libavcodec/arm/dsputil_init_arm.c +++ b/libavcodec/arm/dsputil_init_arm.c @@ -64,14 +64,15 @@ static void simple_idct_arm_add(uint8_t *dest, int line_size, int16_t *block) ff_add_pixels_clamped(block, dest, line_size); } -av_cold void ff_dsputil_init_arm(DSPContext *c, AVCodecContext *avctx) +av_cold void ff_dsputil_init_arm(DSPContext *c, AVCodecContext *avctx, + unsigned high_bit_depth) { int cpu_flags = av_get_cpu_flags(); ff_put_pixels_clamped = c->put_pixels_clamped; ff_add_pixels_clamped = c->add_pixels_clamped; - if (avctx->bits_per_raw_sample <= 8) { + if (!high_bit_depth) { if (avctx->idct_algo == FF_IDCT_AUTO || avctx->idct_algo == FF_IDCT_ARM) { c->idct_put = j_rev_dct_arm_put; @@ -89,9 +90,9 @@ av_cold void ff_dsputil_init_arm(DSPContext *c, AVCodecContext *avctx) c->add_pixels_clamped = ff_add_pixels_clamped_arm; if (have_armv5te(cpu_flags)) - ff_dsputil_init_armv5te(c, avctx); + ff_dsputil_init_armv5te(c, avctx, high_bit_depth); if (have_armv6(cpu_flags)) - ff_dsputil_init_armv6(c, avctx); + ff_dsputil_init_armv6(c, avctx, high_bit_depth); if (have_neon(cpu_flags)) - ff_dsputil_init_neon(c, avctx); + ff_dsputil_init_neon(c, avctx, high_bit_depth); } diff --git a/libavcodec/arm/dsputil_init_armv5te.c b/libavcodec/arm/dsputil_init_armv5te.c index ac6f1cb629..eb45b72088 100644 --- a/libavcodec/arm/dsputil_init_armv5te.c +++ b/libavcodec/arm/dsputil_init_armv5te.c @@ -29,9 +29,10 @@ void ff_simple_idct_armv5te(int16_t *data); void ff_simple_idct_put_armv5te(uint8_t *dest, int line_size, int16_t *data); void ff_simple_idct_add_armv5te(uint8_t *dest, int line_size, int16_t *data); -av_cold void ff_dsputil_init_armv5te(DSPContext *c, AVCodecContext *avctx) +av_cold void ff_dsputil_init_armv5te(DSPContext *c, AVCodecContext *avctx, + unsigned high_bit_depth) { - if (avctx->bits_per_raw_sample <= 8 && + if (!high_bit_depth && (avctx->idct_algo == FF_IDCT_AUTO || avctx->idct_algo == FF_IDCT_SIMPLEARMV5TE)) { c->idct_put = ff_simple_idct_put_armv5te; diff --git a/libavcodec/arm/dsputil_init_armv6.c b/libavcodec/arm/dsputil_init_armv6.c index f412ff2a94..d385e78fe3 100644 --- a/libavcodec/arm/dsputil_init_armv6.c +++ b/libavcodec/arm/dsputil_init_armv6.c @@ -52,17 +52,17 @@ int ff_sse16_armv6(void *s, uint8_t *blk1, uint8_t *blk2, int ff_pix_norm1_armv6(uint8_t *pix, int line_size); int ff_pix_sum_armv6(uint8_t *pix, int line_size); -av_cold void ff_dsputil_init_armv6(DSPContext *c, AVCodecContext *avctx) +av_cold void ff_dsputil_init_armv6(DSPContext *c, AVCodecContext *avctx, + unsigned high_bit_depth) { - const int high_bit_depth = avctx->bits_per_raw_sample > 8; - - if (avctx->bits_per_raw_sample <= 8 && - (avctx->idct_algo == FF_IDCT_AUTO || - avctx->idct_algo == FF_IDCT_SIMPLEARMV6)) { - c->idct_put = ff_simple_idct_put_armv6; - c->idct_add = ff_simple_idct_add_armv6; - c->idct = ff_simple_idct_armv6; - c->idct_permutation_type = FF_LIBMPEG2_IDCT_PERM; + if (!high_bit_depth) { + if (avctx->idct_algo == FF_IDCT_AUTO || + avctx->idct_algo == FF_IDCT_SIMPLEARMV6) { + c->idct_put = ff_simple_idct_put_armv6; + c->idct_add = ff_simple_idct_add_armv6; + c->idct = ff_simple_idct_armv6; + c->idct_permutation_type = FF_LIBMPEG2_IDCT_PERM; + } } c->add_pixels_clamped = ff_add_pixels_clamped_armv6; diff --git a/libavcodec/arm/dsputil_init_neon.c b/libavcodec/arm/dsputil_init_neon.c index c39fcc172a..16e052dddd 100644 --- a/libavcodec/arm/dsputil_init_neon.c +++ b/libavcodec/arm/dsputil_init_neon.c @@ -47,11 +47,10 @@ int32_t ff_scalarproduct_int16_neon(const int16_t *v1, const int16_t *v2, int le int32_t ff_scalarproduct_and_madd_int16_neon(int16_t *v1, const int16_t *v2, const int16_t *v3, int len, int mul); -av_cold void ff_dsputil_init_neon(DSPContext *c, AVCodecContext *avctx) +av_cold void ff_dsputil_init_neon(DSPContext *c, AVCodecContext *avctx, + unsigned high_bit_depth) { - const int high_bit_depth = avctx->bits_per_raw_sample > 8; - - if (avctx->bits_per_raw_sample <= 8) { + if (!high_bit_depth) { if (avctx->idct_algo == FF_IDCT_AUTO || avctx->idct_algo == FF_IDCT_SIMPLENEON) { c->idct_put = ff_simple_idct_put_neon; |