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

jm at svn.xiph.org jm at svn.xiph.org
Wed Jan 17 13:59:52 PST 2007


Author: jm
Date: 2007-01-17 13:59:49 -0800 (Wed, 17 Jan 2007)
New Revision: 12341

Modified:
   trunk/speex/libspeex/resample.c
Log:
output looks almost (but not quite) correct.


Modified: trunk/speex/libspeex/resample.c
===================================================================
--- trunk/speex/libspeex/resample.c	2007-01-17 14:58:52 UTC (rev 12340)
+++ trunk/speex/libspeex/resample.c	2007-01-17 21:59:49 UTC (rev 12341)
@@ -34,6 +34,9 @@
 #include <math.h>
 #include <stdio.h>
             
+//#define float double
+#define FILTER_SIZE 64
+      
 typedef struct {
    int in_rate;
    int out_rate;
@@ -64,7 +67,7 @@
       }
    }
    st->last_sample = 0;
-   st->filt_len = 64;
+   st->filt_len = FILTER_SIZE;
    st->mem = speex_alloc((st->filt_len-1) * sizeof(float));
    for (i=0;i<st->filt_len-1;i++)
       st->mem[i] = 0;
@@ -83,7 +86,7 @@
       return 1;
    else if (fabs(x) > .5f*N)
       return 0;
-   return sin(M_PI*x)/(M_PI*x) * (.5-.5*cos(2*x*M_PI/N));
+   return sin(M_PI*x)/(M_PI*x) * (.5+.5*cos(2*x*M_PI/N));
 }
 
 int speex_resample_float(SpeexResamplerState *st, const float *in, int len, float *out)



More information about the commits mailing list