[xiph-commits] r13445 - trunk/ghost/libghost

jm at svn.xiph.org jm at svn.xiph.org
Sun Aug 5 06:04:54 PDT 2007


Author: jm
Date: 2007-08-05 06:04:53 -0700 (Sun, 05 Aug 2007)
New Revision: 13445

Modified:
   trunk/ghost/libghost/sinusoids.c
Log:
putting the t*sin and t*cos terms at the end (improves convergence)


Modified: trunk/ghost/libghost/sinusoids.c
===================================================================
--- trunk/ghost/libghost/sinusoids.c	2007-08-04 17:25:06 UTC (rev 13444)
+++ trunk/ghost/libghost/sinusoids.c	2007-08-05 13:04:53 UTC (rev 13445)
@@ -437,8 +437,7 @@
          for (i=0;i<N;i++)
          {
             float tmp1=0, tmp2=0;
-            float tmp3=0, tmp4=0;
-            /* For each of the four basis functions, project the residual (symmetric or 
+            /* For the first two of the four basis functions, project the residual (symmetric or 
                anti-symmetric) onto the basis function, then update the residual. */
             for (j=0;j<L2;j++)
                tmp1 += sym[j]*cos_table[i][j];
@@ -450,6 +449,14 @@
             for (j=0;j<L2;j++)
                anti[j] -= (2*tmp2)*sin_table[i][j];
 
+            ai[i] += tmp1;
+            bi[i] += tmp2;
+         }
+         for (i=0;i<N;i++)
+         {
+            float tmp3=0, tmp4=0;
+            /* For the last two of the four basis functions, project the residual (symmetric or 
+            anti-symmetric) onto the basis function, then update the residual. */
             for (j=0;j<L2;j++)
                tmp3 += anti[j]*tcos_table[i][j];
             for (j=0;j<L2;j++)
@@ -459,9 +466,7 @@
                tmp4 += sym[j]*tsin_table[i][j];
             for (j=0;j<L2;j++)
                sym[j] -= (2*tmp4)*tsin_table[i][j];
-         
-            ai[i] += tmp1;
-            bi[i] += tmp2;
+            
             ci[i] += tmp3;
             di[i] += tmp4;
          }



More information about the commits mailing list