[FFmpeg-devel] [PATCH 06/11] dcadsp: scan linearly coeffs instead.

Christophe Gisquet christophe.gisquet at gmail.com
Thu Feb 6 01:41:57 CET 2014


Win32: 1680 cycles to 1580.
---
 libavcodec/dcadsp.c | 13 ++++++-------
 1 file changed, 6 insertions(+), 7 deletions(-)

diff --git a/libavcodec/dcadsp.c b/libavcodec/dcadsp.c
index 6600fef..75a1446 100644
--- a/libavcodec/dcadsp.c
+++ b/libavcodec/dcadsp.c
@@ -36,9 +36,9 @@ static inline void
 dca_lfe_fir(float *out, const float *in, const float *coefs,
             int decifactor, float scale)
 {
-    float *out2 = out + decifactor;
+    float *out2 = out + 2*decifactor-1;
     const float *cf0 = coefs;
-    const float *cf1 = coefs + 256;
+    int num_coeffs = 256 / decifactor;
     float scaled_in[8];
     int j, k;
 
@@ -49,13 +49,12 @@ dca_lfe_fir(float *out, const float *in, const float *coefs,
     for (k = 0; k < decifactor; k++) {
         float v0 = 0.0;
         float v1 = 0.0;
-        for (j = 0; j < 256 / decifactor; j++) {
-            float s = scaled_in[j];
-            v0 += s * *cf0++;
-            v1 += s * *--cf1;
+        for (j = 0; j < num_coeffs; j++, cf0++) {
+            v0 += scaled_in[              j] * *cf0;
+            v1 += scaled_in[num_coeffs-1 -j] * *cf0;
         }
         *out++  = v0;
-        *out2++ = v1;
+        *out2-- = v1;
     }
 }
 
-- 
1.8.0.msysgit.0



More information about the ffmpeg-devel mailing list