summaryrefslogtreecommitdiff
path: root/libavcodec/aacsbr.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2012-06-03 01:46:05 +0200
committerMichael Niedermayer <michaelni@gmx.at>2012-06-03 01:53:10 +0200
commit0e3cec9f7d9353b01ef7af0d67a39a66c4ec899c (patch)
tree237c5ca562e329d84231caf17feb3d547fdbc905 /libavcodec/aacsbr.c
parente95233789c08f55c0b2d0657bada609629a59294 (diff)
downloadffmpeg-0e3cec9f7d9353b01ef7af0d67a39a66c4ec899c.tar.gz
aacsbr: optimize sine level addition
Based-on commit by Måns Rullgård <mans@mansr.com> original: 1424 decicycles in phi, 1024 runs, 0 skips mans code: 1104 decicycles in phi, 1024 runs, 0 skips this change: 734 decicycles in phi, 1024 runs, 0 skips mans code: 1 file changed, 20 insertions(+), 10 deletions(-) this change: 1 file changed, 10 insertions(+), 6 deletions(-) Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec/aacsbr.c')
-rw-r--r--libavcodec/aacsbr.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/libavcodec/aacsbr.c b/libavcodec/aacsbr.c
index 40ee8f5127..9ba3754bef 100644
--- a/libavcodec/aacsbr.c
+++ b/libavcodec/aacsbr.c
@@ -1635,13 +1635,17 @@ static void sbr_hf_assemble(float Y1[38][64][2],
q_filt, indexnoise,
kx, m_max);
} else {
- for (m = 0; m < m_max; m++) {
- Y1[i][m + kx][0] +=
- sbr->s_m[e][m] * phi[0][indexsine];
- Y1[i][m + kx][1] +=
- sbr->s_m[e][m] * (phi[1][indexsine] * phi_sign);
- phi_sign = -phi_sign;
+ int idx = indexsine&1;
+ int A = (1-((indexsine+(kx & 1))&2));
+ int B = (A^(-idx)) + idx;
+ float *out = &Y1[i][kx][idx];
+ float *in = sbr->s_m[e];
+ for (m = 0; m+1 < m_max; m+=2) {
+ out[2*m ] += in[m ] * A;
+ out[2*m+2] += in[m+1] * B;
}
+ if(m_max&1)
+ out[2*m ] += in[m ] * A;
}
indexnoise = (indexnoise + m_max) & 0x1ff;
indexsine = (indexsine + 1) & 3;