shithub: opus

Download patch

ref: 9b3a3ad7ff3db7f43640be02faa0f869ecff5b99
parent: 6218cba258ae3e29af08253bebe46cfea3c3d39b
author: Jean-Marc Valin <[email protected]>
date: Tue Jan 21 11:23:24 EST 2014

Unrolled version of the comb filter for ARM (eliminates MOVs)

--- a/celt/celt.c
+++ b/celt/celt.c
@@ -97,7 +97,7 @@
    x3 = SHL32(x[-T-1], 1);
    x2 = SHL32(x[-T], 1);
    x1 = SHL32(x[-T+1], 1);
-   for (i=0;i<N;i++)
+   for (i=0;i<N-4;i+=5)
    {
       opus_val32 t;
       x0=SHL32(x[i-T+2],1);
@@ -105,12 +105,42 @@
       t = MAC16_32_Q16(t, g11, ADD32(x1,x3));
       t = MAC16_32_Q16(t, g12, ADD32(x0,x4));
       y[i] = t;
+      x4=SHL32(x[i-T+3],1);
+      t = MAC16_32_Q16(x[i+1], g10, x1);
+      t = MAC16_32_Q16(t, g11, ADD32(x0,x2));
+      t = MAC16_32_Q16(t, g12, ADD32(x4,x3));
+      y[i+1] = t;
+      x3=SHL32(x[i-T+4],1);
+      t = MAC16_32_Q16(x[i+2], g10, x0);
+      t = MAC16_32_Q16(t, g11, ADD32(x4,x1));
+      t = MAC16_32_Q16(t, g12, ADD32(x3,x2));
+      y[i+2] = t;
+      x2=SHL32(x[i-T+5],1);
+      t = MAC16_32_Q16(x[i+3], g10, x4);
+      t = MAC16_32_Q16(t, g11, ADD32(x3,x0));
+      t = MAC16_32_Q16(t, g12, ADD32(x2,x1));
+      y[i+3] = t;
+      x1=SHL32(x[i-T+6],1);
+      t = MAC16_32_Q16(x[i+4], g10, x3);
+      t = MAC16_32_Q16(t, g11, ADD32(x2,x4));
+      t = MAC16_32_Q16(t, g12, ADD32(x1,x0));
+      y[i+4] = t;
+   }
+#ifdef CUSTOM_MODES
+   for (;i<N;i++)
+   {
+      opus_val32 t;
+      x0=SHL32(x[i-T+2],1);
+      t = MAC16_32_Q16(x[i], g10, x2);
+      t = MAC16_32_Q16(t, g11, ADD32(x1,x3));
+      t = MAC16_32_Q16(t, g12, ADD32(x0,x4));
+      y[i] = t;
       x4=x3;
       x3=x2;
       x2=x1;
       x1=x0;
    }
-
+#endif
 }
 #else
 static void comb_filter_const(opus_val32 *y, opus_val32 *x, int T, int N,