shithub: opus

Download patch

ref: 06c67dbce2f214d58981ce4ed84bc2ec06d57bd8
parent: 5215623dcd5a26474239f6f817c153b7f3e02d73
author: Jean-Marc Valin <[email protected]>
date: Wed Feb 13 12:41:37 EST 2008

Simplified exp_spreading by unifying both directions. Have to admit I don't
fully understand why that works!

--- a/libcelt/bands.c
+++ b/libcelt/bands.c
@@ -43,47 +43,24 @@
    int i, k;
    float c, s;
    c = cos(theta);
-   s = sin(theta);
-   if (dir > 0)
+   s = dir*sin(theta);
+   for (k=0;k<iter;k++)
    {
-      for (k=0;k<iter;k++)
+      for (i=0;i<len-stride;i++)
       {
-         for (i=0;i<len-stride;i++)
-         {
-            float x1, x2;
-            x1 = X[i];
-            x2 = X[i+stride];
-            X[i] = c*x1 - s*x2;
-            X[i+stride] = c*x2 + s*x1;
-         }
-         for (i=len-2*stride-1;i>=0;i--)
-         {
-            float x1, x2;
-            x1 = X[i];
-            x2 = X[i+stride];
-            X[i] = c*x1 - s*x2;
-            X[i+stride] = c*x2 + s*x1;
-         }
+         float x1, x2;
+         x1 = X[i];
+         x2 = X[i+stride];
+         X[i] = c*x1 - s*x2;
+         X[i+stride] = c*x2 + s*x1;
       }
-   } else {
-      for (k=0;k<iter;k++)
+      for (i=len-2*stride-1;i>=0;i--)
       {
-         for (i=0;i<len-2*stride;i++)
-         {
-            float x1, x2;
-            x1 = X[i];
-            x2 = X[i+stride];
-            X[i] = c*x1 + s*x2;
-            X[i+stride] = c*x2 - s*x1;
-         }
-         for (i=len-stride-1;i>=0;i--)
-         {
-            float x1, x2;
-            x1 = X[i];
-            x2 = X[i+stride];
-            X[i] = c*x1 + s*x2;
-            X[i+stride] = c*x2 - s*x1;
-         }
+         float x1, x2;
+         x1 = X[i];
+         x2 = X[i+stride];
+         X[i] = c*x1 - s*x2;
+         X[i+stride] = c*x2 + s*x1;
       }
    }
 }