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

xiphmont at svn.xiph.org xiphmont at svn.xiph.org
Sun Apr 17 23:05:51 PDT 2011


Author: xiphmont
Date: 2011-04-17 23:05:51 -0700 (Sun, 17 Apr 2011)
New Revision: 17922

Modified:
   trunk/ghost/monty/chirp/chirptest.c
   trunk/ghost/monty/chirp/window.c
Log:
Add one of gmaxwell's interesting windows for play, also put updates on a time limit



Modified: trunk/ghost/monty/chirp/chirptest.c
===================================================================
--- trunk/ghost/monty/chirp/chirptest.c	2011-04-18 05:39:44 UTC (rev 17921)
+++ trunk/ghost/monty/chirp/chirptest.c	2011-04-18 06:05:51 UTC (rev 17922)
@@ -26,6 +26,7 @@
 #include <string.h>
 #include <cairo/cairo.h>
 #include <pthread.h>
+#include <sys/time.h>
 
 float circular_distance(float A,float B){
   float ret = A-B;
@@ -317,6 +318,9 @@
   float ret_maxRMS[y_n];
   float ret_maxiter[y_n];
 
+  struct timeval last;
+  gettimeofday(&last,NULL);
+
   /* determine ~ padding needed */
   setup_graphs(arg->x0,arg->x1,arg->xmajor,
                arg->y0,arg->y1,arg->ymajor,
@@ -740,24 +744,31 @@
       }
     }
 
-    if((x&15)==0){
-      to_png(cC,filebase,"converge");
-      to_png(cA,filebase,"Aerror");
-      to_png(cP,filebase,"Perror");
-      to_png(cW,filebase,"Werror");
-      to_png(cdA,filebase,"dAerror");
-      to_png(cdW,filebase,"dWerror");
-      to_png(cddA,filebase,"ddAerror");
-      to_png(cRMS,filebase,"RMSerror");
+    /* dump a graph update every 10 seconds */
+    {
+      struct timeval now;
+      gettimeofday(&now,NULL);
+      if(now.tv_sec-last.tv_sec + (now.tv_usec-last.tv_usec)/1000000. > 10.){
+        last=now;
 
-      to_png(cC_d,filebase,"convdelta");
-      to_png(cA_d,filebase,"Adelta");
-      to_png(cP_d,filebase,"Pdelta");
-      to_png(cW_d,filebase,"Wdelta");
-      to_png(cdA_d,filebase,"dAdelta");
-      to_png(cdW_d,filebase,"dWdelta");
-      to_png(cddA_d,filebase,"ddAdelta");
-      to_png(cRMS_d,filebase,"RMSdelta");
+        to_png(cC,filebase,"converge");
+        to_png(cA,filebase,"Aerror");
+        to_png(cP,filebase,"Perror");
+        to_png(cW,filebase,"Werror");
+        to_png(cdA,filebase,"dAerror");
+        to_png(cdW,filebase,"dWerror");
+        to_png(cddA,filebase,"ddAerror");
+        to_png(cRMS,filebase,"RMSerror");
+
+        to_png(cC_d,filebase,"convdelta");
+        to_png(cA_d,filebase,"Adelta");
+        to_png(cP_d,filebase,"Pdelta");
+        to_png(cW_d,filebase,"Wdelta");
+        to_png(cdA_d,filebase,"dAdelta");
+        to_png(cdW_d,filebase,"dWdelta");
+        to_png(cddA_d,filebase,"ddAdelta");
+        to_png(cRMS_d,filebase,"RMSdelta");
+      }
     }
 
   }
@@ -771,7 +782,7 @@
     /* subtitle1 */     "graphtest1",
     /* subtitle2 */     "graphtest2",
     /* subtitle3 */     "graphtest3",
-    /* blocksize */     2048,
+    /* blocksize */     256,
     /* threads */       8,
 
     /* x0 */            0,

Modified: trunk/ghost/monty/chirp/window.c
===================================================================
--- trunk/ghost/monty/chirp/window.c	2011-04-18 05:39:44 UTC (rev 17921)
+++ trunk/ghost/monty/chirp/window.c	2011-04-18 06:05:51 UTC (rev 17922)
@@ -103,11 +103,27 @@
   }
 }
 
+/* sidelobeless window machine optimized for fast convergence */
+static void maxwell1(float *x, int n){
+  int i;
+  float scale = 2*M_PI/n;
+  for(i=0;i<n;i++){
+    float i5 = i+.5;
+    x[i] = pow( 119.72981
+                - 119.24098*cos(scale*i5)
+                + 0.10283622*cos(2*scale*i5)
+                + 0.044013144*cos(3*scale*i5)
+                + 0.97203713*cos(4*scale*i5),
+                1.9730763)/50000.;
+  }
+}
+
 window_bundle window_functions = {
   rectangle,
   hanning,
   vorbis,
   blackmann_harris,
   tgauss_deep,
-  dolphcheb
+  dolphcheb,
+  maxwell1,
 };



More information about the commits mailing list