summaryrefslogtreecommitdiff
path: root/libavcodec/ac3enc_template.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2011-10-22 11:11:08 +0200
committerMichael Niedermayer <michaelni@gmx.at>2011-10-22 11:11:08 +0200
commitd8cae42d72092501be880348ae0c223d2ea220a2 (patch)
tree9f5cd163810d5e7babd864637b10968c99814ab8 /libavcodec/ac3enc_template.c
parentd3d97d43d51840086d86728bbfcd072eea7a5b85 (diff)
parent9d4bbf6d4f3a0b78c4ec7a1f366adf5c3cc8ea1a (diff)
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/ac3enc_template.c')
-rw-r--r--libavcodec/ac3enc_template.c19
1 files changed, 7 insertions, 12 deletions
diff --git a/libavcodec/ac3enc_template.c b/libavcodec/ac3enc_template.c
index 7e2bf3a9ca..85513b1cdd 100644
--- a/libavcodec/ac3enc_template.c
+++ b/libavcodec/ac3enc_template.c
@@ -43,6 +43,9 @@ static void clip_coefficients(DSPContext *dsp, CoefType *coef, unsigned int len)
static CoefType calc_cpl_coord(CoefSumType energy_ch, CoefSumType energy_cpl);
+static void sum_square_butterfly(AC3EncodeContext *s, CoefSumType sum[4],
+ const CoefType *coef0, const CoefType *coef1,
+ int len);
int AC3_NAME(allocate_sample_buffers)(AC3EncodeContext *s)
{
@@ -334,7 +337,7 @@ static void apply_channel_coupling(AC3EncodeContext *s)
static void compute_rematrixing_strategy(AC3EncodeContext *s)
{
int nb_coefs;
- int blk, bnd, i;
+ int blk, bnd;
AC3Block *block, *av_uninit(block0);
if (s->channel_mode != AC3_CHMODE_STEREO)
@@ -362,17 +365,9 @@ static void compute_rematrixing_strategy(AC3EncodeContext *s)
/* calculate calculate sum of squared coeffs for one band in one block */
int start = ff_ac3_rematrix_band_tab[bnd];
int end = FFMIN(nb_coefs, ff_ac3_rematrix_band_tab[bnd+1]);
- CoefSumType sum[4] = {0,};
- for (i = start; i < end; i++) {
- CoefType lt = block->mdct_coef[1][i];
- CoefType rt = block->mdct_coef[2][i];
- CoefType md = lt + rt;
- CoefType sd = lt - rt;
- MAC_COEF(sum[0], lt, lt);
- MAC_COEF(sum[1], rt, rt);
- MAC_COEF(sum[2], md, md);
- MAC_COEF(sum[3], sd, sd);
- }
+ CoefSumType sum[4];
+ sum_square_butterfly(s, sum, block->mdct_coef[1] + start,
+ block->mdct_coef[2] + start, end - start);
/* compare sums to determine if rematrixing will be used for this band */
if (FFMIN(sum[2], sum[3]) < FFMIN(sum[0], sum[1]))