[xiph-commits] r17931 - trunk/ghost/monty/chirp

xiphmont at svn.xiph.org xiphmont at svn.xiph.org
Thu Apr 21 22:02:52 PDT 2011


Author: xiphmont
Date: 2011-04-21 22:02:52 -0700 (Thu, 21 Apr 2011)
New Revision: 17931

Modified:
   trunk/ghost/monty/chirp/chirp.c
Log:
Modify convergence to continue past fit_tolerance threshold for as log as total basis 
movement keeps dropping.



Modified: trunk/ghost/monty/chirp/chirp.c
===================================================================
--- trunk/ghost/monty/chirp/chirp.c	2011-04-21 15:20:33 UTC (rev 17930)
+++ trunk/ghost/monty/chirp/chirp.c	2011-04-22 05:02:52 UTC (rev 17931)
@@ -133,9 +133,14 @@
   int flag=1;
   float r[len];
 
+  float lasterr=0;
+  float thiserr=0;
+
   /* outer fit iteration */
-  while(flag && iter_limit>0){
+  while((flag || lasterr>thiserr) && iter_limit>0){
     flag=0;
+    lasterr=thiserr;
+    thiserr=0;
 
     /* precompute the portion of the projection/fit estimate shared by
        the zero, first and second order fits.  Subtracts the current
@@ -261,6 +266,7 @@
         float move = (aP*aP + bP*bP)/(c->A*c->A + fit_limit*fit_limit) +
           (cP*cP + dP*dP)/(c->A*c->A + fit_limit*fit_limit) +
           (eP*eP + fP*fP)/(c->A*c->A + fit_limit*fit_limit);
+        thiserr+=move;
 
         if(fit_limit>0 && move>fit_limit*fit_limit)flag=1;
         if(fit_limit<0 && move>1e-14)flag=1;



More information about the commits mailing list