[xiph-commits] r18441 - trunk/spectrum

xiphmont at svn.xiph.org xiphmont at svn.xiph.org
Tue Jul 3 18:37:29 PDT 2012


Author: xiphmont
Date: 2012-07-03 18:37:29 -0700 (Tue, 03 Jul 2012)
New Revision: 18441

Modified:
   trunk/spectrum/io.c
   trunk/spectrum/version.h
   trunk/spectrum/wave_process.c
Log:
Correct an error in blockslice_frac updating / blockslice calculation within the waveform util



Modified: trunk/spectrum/io.c
===================================================================
--- trunk/spectrum/io.c	2012-07-03 23:21:50 UTC (rev 18440)
+++ trunk/spectrum/io.c	2012-07-04 01:37:29 UTC (rev 18441)
@@ -577,11 +577,12 @@
   }
 }
 
+static int blockslice_frac_prev;
 static void blockslice_init(void){
 
   /* strict determinism is nice */
   if(!blockslice_started){
-    int frac = blockslice_frac;
+    int frac = blockslice_frac_prev = blockslice_frac;
     int fi;
 
     blockslice_count=0;
@@ -598,10 +599,11 @@
 static void blockslice_advance(void){
   int fi;
   int frac = blockslice_frac;
-  int count = blockslice_count + (1000000/frac);
+  int count = blockslice_count + (1000000/blockslice_frac_prev);
 
   blockslice_count = count;
   count += (1000000/frac);
+  blockslice_frac_prev = frac;
 
   for(fi=0;fi<inputs;fi++){
     int nextsample = rint((double)rate[fi]*count/1000000);

Modified: trunk/spectrum/version.h
===================================================================
--- trunk/spectrum/version.h	2012-07-03 23:21:50 UTC (rev 18440)
+++ trunk/spectrum/version.h	2012-07-04 01:37:29 UTC (rev 18441)
@@ -1,2 +1,2 @@
 #define VERSION "$Id$ "
-/* DO NOT EDIT: Automated versioning hack [Tue Jul  3 02:19:53 EDT 2012] */
+/* DO NOT EDIT: Automated versioning hack [Tue Jul  3 21:04:57 EDT 2012] */

Modified: trunk/spectrum/wave_process.c
===================================================================
--- trunk/spectrum/wave_process.c	2012-07-03 23:21:50 UTC (rev 18440)
+++ trunk/spectrum/wave_process.c	2012-07-04 01:37:29 UTC (rev 18441)
@@ -277,7 +277,7 @@
                 /* linear interpolation can further refine the result in most cases */
                 float x = *lap / (*lap-prev);
                 float ret = (t->triggersearch+x)/
-                  (float)(t->rate*t->oversample_factor);
+                  (t->rate*t->oversample_factor);
                 /* apply holdoff */
                 t->triggersearch -= t->rate*t->oversample_factor/t->holdoffd;
                 /* return trigger */
@@ -289,7 +289,7 @@
                 /* linear interpolation can further refine the result in most cases */
                 float x = *lap / (*lap-prev);
                 float ret = (t->triggersearch+x)/
-                  (float)(t->rate*t->oversample_factor);
+                  (t->rate*t->oversample_factor);
                 /* apply holdoff */
                 t->triggersearch -= t->rate*t->oversample_factor/t->holdoffd;
                 /* return trigger */



More information about the commits mailing list