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

jm at svn.xiph.org jm at svn.xiph.org
Wed Oct 11 06:09:29 PDT 2006


Author: jm
Date: 2006-10-11 06:09:26 -0700 (Wed, 11 Oct 2006)
New Revision: 11912

Modified:
   trunk/speex/libspeex/preprocess.c
Log:
replaced frame probability (Pframe)


Modified: trunk/speex/libspeex/preprocess.c
===================================================================
--- trunk/speex/libspeex/preprocess.c	2006-10-11 12:33:42 UTC (rev 11911)
+++ trunk/speex/libspeex/preprocess.c	2006-10-11 13:09:26 UTC (rev 11912)
@@ -531,6 +531,8 @@
             (1.f-gamma)* (.8*st->gain[i]*st->gain[i]*st->old_ps[i]/tot_noise + .2*st->prior[i]);
       if (st->prior[i]>100.f)
          st->prior[i]=100.f;
+      if (st->prior[i]<.01f)
+         st->prior[i]=.01f;
    }
 
    /*print_vec(st->prior, N+M, "prior");*/
@@ -548,18 +550,14 @@
       st->zeta[i] = .7f*st->zeta[i] + .3f*st->prior[i];
    }
 
-   {
-      int freq_start = (int)(300.0f*2.f*N/st->sampling_rate);
-      int freq_end   = (int)(2000.0f*2.f*N/st->sampling_rate);
-      for (i=freq_start;i<freq_end;i++)
-      {
-         Zframe += st->zeta[i];         
-      }
-      Zframe /= (freq_end-freq_start);
-   }
-
+   Zframe = 0;
+   for (i=N;i<N+M;i++)
+      Zframe += st->zeta[i];
+   Zframe /= st->nbands;
    Pframe = qcurve(Zframe);
-
+   if (Pframe < .2)
+      Pframe = .2;
+   /*print_vec(&Pframe, 1, "");*/
    /*fprintf (stderr, "%f\n", Pframe);*/
    /* Compute gain according to the Ephraim-Malah algorithm */
    for (i=0;i<N+M;i++)
@@ -579,10 +577,11 @@
       else
          zeta1 = .25f*st->zeta[i-1] + .5f*st->zeta[i] + .25f*st->zeta[i+1];
       P1 = qcurve (zeta1);
-      
+      if (P1 < .2)
+         P1 = .2;
       /* FIXME: add global prob (P2) */
       q = 1-Pframe*P1;
-      q = 1-P1;
+      /*q = 1-P1;*/
       if (q>.95f)
          q=.95f;
       p=1.f/(1.f + (q/(1.f-q))*(1.f+st->prior[i])*exp(-theta));



More information about the commits mailing list