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

jm at svn.xiph.org jm at svn.xiph.org
Mon Oct 23 03:56:24 PDT 2006


Author: jm
Date: 2006-10-23 03:56:21 -0700 (Mon, 23 Oct 2006)
New Revision: 11938

Modified:
   trunk/speex/libspeex/preprocess.c
Log:
code cleanup


Modified: trunk/speex/libspeex/preprocess.c
===================================================================
--- trunk/speex/libspeex/preprocess.c	2006-10-22 03:24:40 UTC (rev 11937)
+++ trunk/speex/libspeex/preprocess.c	2006-10-23 10:56:21 UTC (rev 11938)
@@ -643,20 +643,21 @@
          st->gain[i]=1.f;
       
       st->reverb_estimate[i] = st->reverb_decay*st->reverb_estimate[i] + st->reverb_decay*st->reverb_level*st->gain[i]*st->gain[i]*st->ps[i];
-      if (st->denoise_enabled)
-      {
-         /* Compute the gain floor based on different floors for the background noise and residual echo */
-         float gain_floor = (noise_floor*st->noise[i] + echo_floor*st->echo_noise[i])/(1+st->noise[i] + st->echo_noise[i]);
-         gain_floor = sqrt(gain_floor);
-
-         /* Take into account speech probability of presence (what's the best rule to use?) */
-         if (st->gain[i] < gain_floor)
-            st->gain[i] = gain_floor;
-         st->gain2[i]=(p*sqrt(st->gain[i])+sqrt(gain_floor)*(1-p)) * (p*sqrt(st->gain[i])+sqrt(gain_floor)*(1-p));
-         /*st->gain2[i] = pow(st->gain[i], p) * pow(gain_floor,1.f-p);*/
-      } else {
+      /* Compute the gain floor based on different floors for the background noise and residual echo */
+      float gain_floor = (noise_floor*st->noise[i] + echo_floor*st->echo_noise[i])/(1+st->noise[i] + st->echo_noise[i]);
+      gain_floor = sqrt(gain_floor);
+      
+      /* Take into account speech probability of presence (what's the best rule to use?) */
+      if (st->gain[i] < gain_floor)
+         st->gain[i] = gain_floor;
+      st->gain2[i]=(p*sqrt(st->gain[i])+sqrt(gain_floor)*(1-p)) * (p*sqrt(st->gain[i])+sqrt(gain_floor)*(1-p));
+      /*st->gain2[i] = pow(st->gain[i], p) * pow(gain_floor,1.f-p);*/
+   }
+   
+   if (!st->denoise_enabled)
+   {
+      for (i=0;i<N+M;i++)
          st->gain2[i]=1.f;
-      }
    }
    
    /* Enable this to only use the filterbank gains */



More information about the commits mailing list