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

jm at svn.xiph.org jm at svn.xiph.org
Fri Oct 27 03:35:57 PDT 2006


Author: jm
Date: 2006-10-27 03:35:54 -0700 (Fri, 27 Oct 2006)
New Revision: 11958

Modified:
   trunk/speex/libspeex/preprocess.c
Log:
Now using fixed-point FFTs in the preprocessor.


Modified: trunk/speex/libspeex/preprocess.c
===================================================================
--- trunk/speex/libspeex/preprocess.c	2006-10-27 02:28:50 UTC (rev 11957)
+++ trunk/speex/libspeex/preprocess.c	2006-10-27 10:35:54 UTC (rev 11958)
@@ -112,8 +112,8 @@
    SpeexEchoState *echo_state;
    
    /* DSP-related arrays */
-   float *frame;             /**< Processing frame (2*ps_size) */
-   float *ft;                /**< Processing frame in freq domain (2*ps_size) */
+   spx_word16_t *frame;      /**< Processing frame (2*ps_size) */
+   spx_word16_t *ft;         /**< Processing frame in freq domain (2*ps_size) */
    float *ps;                /**< Current power spectrum */
    float *gain2;             /**< Adjusted gains */
    float *gain_floor;        /**< Minimum gain allowed */
@@ -264,9 +264,9 @@
    M = st->nbands;
    st->bank = filterbank_new(M, sampling_rate, N, 1);
    
-   st->frame = (float*)speex_alloc(2*N*sizeof(float));
+   st->frame = (spx_word16_t*)speex_alloc(2*N*sizeof(float));
    st->window = (float*)speex_alloc(2*N*sizeof(float));
-   st->ft = (float*)speex_alloc(2*N*sizeof(float));
+   st->ft = (spx_word16_t*)speex_alloc(2*N*sizeof(float));
    
    st->ps = (float*)speex_alloc((N+M)*sizeof(float));
    st->noise = (float*)speex_alloc((N+M)*sizeof(float));
@@ -455,12 +455,12 @@
       st->frame[i] *= st->window[i];
 
    /* Perform FFT */
-   spx_fft_float(st->fft_lookup, st->frame, st->ft);
+   spx_fft(st->fft_lookup, st->frame, st->ft);
          
    /* Power spectrum */
    ps[0]=1;
    for (i=1;i<N;i++)
-      ps[i]=1+st->ft[2*i-1]*st->ft[2*i-1] + st->ft[2*i]*st->ft[2*i];
+      ps[i]=1+MULT16_16(st->ft[2*i-1],st->ft[2*i-1]) + MULT16_16(st->ft[2*i],st->ft[2*i]);
 
    filterbank_compute_bank(st->bank, ps, ps+N);
 }
@@ -729,7 +729,7 @@
    st->ft[2*N-1] *= st->gain2[N-1];
 
    /* Inverse FFT with 1/N scaling */
-   spx_ifft_float(st->fft_lookup, st->ft, st->frame);
+   spx_ifft(st->fft_lookup, st->ft, st->frame);
 
    {
       float max_sample=0;



More information about the commits mailing list