[xiph-commits] r12474 - trunk/speex/libspeex

jm at svn.xiph.org jm at svn.xiph.org
Wed Feb 14 19:48:17 PST 2007


Author: jm
Date: 2007-02-14 19:48:15 -0800 (Wed, 14 Feb 2007)
New Revision: 12474

Modified:
   trunk/speex/libspeex/resample.c
Log:
Fixed the window, so it doesn't get shrunk by the "cutoff" factor.


Modified: trunk/speex/libspeex/resample.c
===================================================================
--- trunk/speex/libspeex/resample.c	2007-02-14 21:39:51 UTC (rev 12473)
+++ trunk/speex/libspeex/resample.c	2007-02-15 03:48:15 UTC (rev 12474)
@@ -232,26 +232,26 @@
 static spx_word16_t sinc(float cutoff, float x, int N, struct FuncDef *window_func)
 {
    /*fprintf (stderr, "%f ", x);*/
-   x *= cutoff;
+   float xx = x * cutoff;
    if (fabs(x)<1e-6f)
       return WORD2INT(32768.*cutoff);
    else if (fabs(x) > .5f*N)
       return 0;
    /*FIXME: Can it really be any slower than this? */
-   return WORD2INT(32768.*cutoff*sin(M_PI*x)/(M_PI*x) * compute_func(fabs(2.*x/N), window_func));
+   return WORD2INT(32768.*cutoff*sin(M_PI*xx)/(M_PI*xx) * compute_func(fabs(2.*x/N), window_func));
 }
 #else
 /* The slow way of computing a sinc for the table. Should improve that some day */
 static spx_word16_t sinc(float cutoff, float x, int N, struct FuncDef *window_func)
 {
    /*fprintf (stderr, "%f ", x);*/
-   x *= cutoff;
+   float xx = x * cutoff;
    if (fabs(x)<1e-6)
       return cutoff;
    else if (fabs(x) > .5*N)
       return 0;
    /*FIXME: Can it really be any slower than this? */
-   return cutoff*sin(M_PI*x)/(M_PI*x) * compute_func(fabs(2.*x/N), window_func);
+   return cutoff*sin(M_PI*xx)/(M_PI*xx) * compute_func(fabs(2.*x/N), window_func);
 }
 #endif
 



More information about the commits mailing list