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

jm at svn.xiph.org jm at svn.xiph.org
Fri Oct 27 06:24:49 PDT 2006


Author: jm
Date: 2006-10-27 06:24:47 -0700 (Fri, 27 Oct 2006)
New Revision: 11961

Modified:
   trunk/speex/libspeex/preprocess.c
Log:
Last bits of the easy fixed-point conversions.


Modified: trunk/speex/libspeex/preprocess.c
===================================================================
--- trunk/speex/libspeex/preprocess.c	2006-10-27 12:35:08 UTC (rev 11960)
+++ trunk/speex/libspeex/preprocess.c	2006-10-27 13:24:47 UTC (rev 11961)
@@ -119,8 +119,8 @@
    float *gain_floor;        /**< Minimum gain allowed */
    float *window;            /**< Analysis/Synthesis window */
    spx_word32_t *noise;      /**< Noise estimate */
-   float *reverb_estimate;   /**< Estimate of reverb energy */
-   float *old_ps;            /**< Power spectrum for last frame */
+   spx_word32_t *reverb_estimate; /**< Estimate of reverb energy */
+   spx_word32_t *old_ps;     /**< Power spectrum for last frame */
    float *gain;              /**< Ephraim Malah gain */
    float *prior;             /**< A-priori SNR */
    float *post;              /**< A-posteriori SNR */
@@ -272,8 +272,8 @@
    st->noise = (spx_word32_t*)speex_alloc((N+M)*sizeof(float));
    st->echo_noise = (spx_word32_t*)speex_alloc((N+M)*sizeof(float));
    st->residual_echo = (spx_word32_t*)speex_alloc((N+M)*sizeof(float));
-   st->reverb_estimate = (float*)speex_alloc((N+M)*sizeof(float));
-   st->old_ps = (float*)speex_alloc((N+M)*sizeof(float));
+   st->reverb_estimate = (spx_word32_t*)speex_alloc((N+M)*sizeof(float));
+   st->old_ps = (spx_word32_t*)speex_alloc((N+M)*sizeof(float));
    st->prior = (float*)speex_alloc((N+M)*sizeof(float));
    st->post = (float*)speex_alloc((N+M)*sizeof(float));
    st->gain = (float*)speex_alloc((N+M)*sizeof(float));
@@ -586,12 +586,12 @@
    for (i=0;i<N+M;i++)
    {
       float gamma = .1;
-      float tot_noise = 1.f+ st->noise[i] + st->echo_noise[i] + st->reverb_estimate[i];
-      st->post[i] = ps[i]/tot_noise - 1.f;
+      spx_word32_t tot_noise = 1+st->noise[i] + st->echo_noise[i] + st->reverb_estimate[i];
+      st->post[i] = 1.f*ps[i]/tot_noise - 1.f;
       if (st->post[i]>100.f)
          st->post[i]=100.f;
       /*gamma = .15+.85*st->prior[i]*st->prior[i]/((1+st->prior[i])*(1+st->prior[i]));*/
-      gamma = .1+.9*(st->old_ps[i]/(1+st->old_ps[i]+tot_noise))*(st->old_ps[i]/(1+st->old_ps[i]+tot_noise));
+      gamma = .1+.9*(st->old_ps[i]/(1.f+st->old_ps[i]+tot_noise))*(st->old_ps[i]/(1.f+st->old_ps[i]+tot_noise));
       /* A priori SNR update */
       st->prior[i] = gamma*max(0.0f,st->post[i]) + (1.f-gamma)*st->old_ps[i]/tot_noise;
       if (st->prior[i]>100.f)



More information about the commits mailing list