[FFmpeg-cvslog] aacsbr: optimize sine level addition

Michael Niedermayer git at videolan.org
Sun Jun 3 01:55:29 CEST 2012


ffmpeg | branch: master | Michael Niedermayer <michaelni at gmx.at> | Sun Jun  3 01:46:05 2012 +0200| [0e3cec9f7d9353b01ef7af0d67a39a66c4ec899c] | committer: Michael Niedermayer

aacsbr: optimize sine level addition

Based-on commit by Måns Rullgård <mans at 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 at gmx.at>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=0e3cec9f7d9353b01ef7af0d67a39a66c4ec899c
---

 libavcodec/aacsbr.c |   16 ++++++++++------
 1 file changed, 10 insertions(+), 6 deletions(-)

diff --git a/libavcodec/aacsbr.c b/libavcodec/aacsbr.c
index 40ee8f5..9ba3754 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;



More information about the ffmpeg-cvslog mailing list