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

jm at svn.xiph.org jm at svn.xiph.org
Thu Dec 15 03:27:44 PST 2005


Author: jm
Date: 2005-12-15 03:27:41 -0800 (Thu, 15 Dec 2005)
New Revision: 10600

Modified:
   trunk/speex/libspeex/fftwrap.c
Log:
cleaned up the fixed-point version


Modified: trunk/speex/libspeex/fftwrap.c
===================================================================
--- trunk/speex/libspeex/fftwrap.c	2005-12-15 08:14:37 UTC (rev 10599)
+++ trunk/speex/libspeex/fftwrap.c	2005-12-15 11:27:41 UTC (rev 10600)
@@ -157,20 +157,34 @@
    speex_free(table);
 }
 
+#ifdef FIXED_POINT
+
 void spx_fft(void *table, spx_word16_t *in, spx_word16_t *out)
 {
    int i;
-   float scale;
-#ifdef FIXED_POINT
    int shift;
-#endif
    struct kiss_config *t = (struct kiss_config *)table;
-#ifdef FIXED_POINT
-   scale = 1;
    shift = maximize_range(in, in, 32000, t->N);
+   kiss_fftr(t->forward, in, t->freq_data);
+   out[0] = t->freq_data[0].r;
+   for (i=1;i<t->N>>1;i++)
+   {
+      out[(i<<1)-1] = t->freq_data[i].r;
+      out[(i<<1)] = t->freq_data[i].i;
+   }
+   out[(i<<1)-1] = t->freq_data[i].r;
+   renorm_range(in, in, shift, t->N);
+   renorm_range(out, out, shift, t->N);
+}
+
 #else
+
+void spx_fft(void *table, spx_word16_t *in, spx_word16_t *out)
+{
+   int i;
+   float scale;
+   struct kiss_config *t = (struct kiss_config *)table;
    scale = 1./t->N;
-#endif
    kiss_fftr(t->forward, in, t->freq_data);
    out[0] = scale*t->freq_data[0].r;
    for (i=1;i<t->N>>1;i++)
@@ -179,11 +193,8 @@
       out[(i<<1)] = scale*t->freq_data[i].i;
    }
    out[(i<<1)-1] = scale*t->freq_data[i].r;
-#ifdef FIXED_POINT
-   renorm_range(in, in, shift, t->N);
-   renorm_range(out, out, shift, t->N);
+}
 #endif
-}
 
 void spx_ifft(void *table, spx_word16_t *in, spx_word16_t *out)
 {



More information about the commits mailing list