diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2011-10-22 11:11:08 +0200 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2011-10-22 11:11:08 +0200 |
commit | d8cae42d72092501be880348ae0c223d2ea220a2 (patch) | |
tree | 9f5cd163810d5e7babd864637b10968c99814ab8 /libavcodec/ac3dsp.c | |
parent | d3d97d43d51840086d86728bbfcd072eea7a5b85 (diff) | |
parent | 9d4bbf6d4f3a0b78c4ec7a1f366adf5c3cc8ea1a (diff) | |
download | ffmpeg-d8cae42d72092501be880348ae0c223d2ea220a2.tar.gz |
Merge remote-tracking branch 'mans/ac3'
* mans/ac3:
ac3enc: slightly faster quantize_mantissas_blk_ch()
ac3enc: NEON optimised sum_square_butterfly_float
ac3enc: neon optimised sum_square_butterfly_int32
ac3enc: move inner loop of compute_rematrixing_strategy to ac3dsp
Conflicts:
libavcodec/ac3enc_template.c
Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec/ac3dsp.c')
-rw-r--r-- | libavcodec/ac3dsp.c | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/libavcodec/ac3dsp.c b/libavcodec/ac3dsp.c index 96bd123e6f..a414db4107 100644 --- a/libavcodec/ac3dsp.c +++ b/libavcodec/ac3dsp.c @@ -23,6 +23,7 @@ #include "avcodec.h" #include "ac3.h" #include "ac3dsp.h" +#include "mathops.h" static void ac3_exponent_min_c(uint8_t *exp, int num_reuse_blocks, int nb_coefs) { @@ -169,6 +170,48 @@ static void ac3_extract_exponents_c(uint8_t *exp, int32_t *coef, int nb_coefs) } } +static void ac3_sum_square_butterfly_int32_c(int64_t sum[4], + const int32_t *coef0, + const int32_t *coef1, + int len) +{ + int i; + + sum[0] = sum[1] = sum[2] = sum[3] = 0; + + for (i = 0; i < len; i++) { + int lt = coef0[i]; + int rt = coef1[i]; + int md = lt + rt; + int sd = lt - rt; + MAC64(sum[0], lt, lt); + MAC64(sum[1], rt, rt); + MAC64(sum[2], md, md); + MAC64(sum[3], sd, sd); + } +} + +static void ac3_sum_square_butterfly_float_c(float sum[4], + const float *coef0, + const float *coef1, + int len) +{ + int i; + + sum[0] = sum[1] = sum[2] = sum[3] = 0; + + for (i = 0; i < len; i++) { + float lt = coef0[i]; + float rt = coef1[i]; + float md = lt + rt; + float sd = lt - rt; + sum[0] += lt * lt; + sum[1] += rt * rt; + sum[2] += md * md; + sum[3] += sd * sd; + } +} + av_cold void ff_ac3dsp_init(AC3DSPContext *c, int bit_exact) { c->ac3_exponent_min = ac3_exponent_min_c; @@ -180,6 +223,8 @@ av_cold void ff_ac3dsp_init(AC3DSPContext *c, int bit_exact) c->update_bap_counts = ac3_update_bap_counts_c; c->compute_mantissa_size = ac3_compute_mantissa_size_c; c->extract_exponents = ac3_extract_exponents_c; + c->sum_square_butterfly_int32 = ac3_sum_square_butterfly_int32_c; + c->sum_square_butterfly_float = ac3_sum_square_butterfly_float_c; if (ARCH_ARM) ff_ac3dsp_init_arm(c, bit_exact); |