summaryrefslogtreecommitdiff
path: root/libavcodec/sbrdsp.c
diff options
context:
space:
mode:
authorChristophe GISQUET <christophe.gisquet@gmail.com>2012-02-22 17:48:59 +0100
committerRonald S. Bultje <rsbultje@gmail.com>2012-03-07 10:29:52 -0800
commitdabf8dd34afdbb6dc9dc7603d7a5228fc67de4c8 (patch)
tree4cfc3e3f3e3e5d04365b1e117f4f4bd50253b344 /libavcodec/sbrdsp.c
parent294c05ce8a7fbe3de74023065c264c1d720ec3cd (diff)
SBR DSP: unroll sum_square
The length is even, so some unrolling can be performed. Timings are for x86: - 32bits: 102c -> 82c - 64bits: 82c -> 69c Signed-off-by: Ronald S. Bultje <rsbultje@gmail.com>
Diffstat (limited to 'libavcodec/sbrdsp.c')
-rw-r--r--libavcodec/sbrdsp.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/libavcodec/sbrdsp.c b/libavcodec/sbrdsp.c
index f942759aa7..8c88fb3329 100644
--- a/libavcodec/sbrdsp.c
+++ b/libavcodec/sbrdsp.c
@@ -35,13 +35,18 @@ static void sbr_sum64x5_c(float *z)
static float sbr_sum_square_c(float (*x)[2], int n)
{
- float sum = 0.0f;
+ float sum0 = 0.0f, sum1 = 0.0f;
int i;
- for (i = 0; i < n; i++)
- sum += x[i][0] * x[i][0] + x[i][1] * x[i][1];
+ for (i = 0; i < n; i += 2)
+ {
+ sum0 += x[i + 0][0] * x[i + 0][0];
+ sum1 += x[i + 0][1] * x[i + 0][1];
+ sum0 += x[i + 1][0] * x[i + 1][0];
+ sum1 += x[i + 1][1] * x[i + 1][1];
+ }
- return sum;
+ return sum0 + sum1;
}
static void sbr_neg_odd_64_c(float *x)