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

jm at svn.xiph.org jm at svn.xiph.org
Fri Nov 10 19:48:26 PST 2006


Author: jm
Date: 2006-11-10 19:48:23 -0800 (Fri, 10 Nov 2006)
New Revision: 12083

Modified:
   trunk/speex/libspeex/mdf.c
   trunk/speex/libspeex/preprocess.c
Log:
a few checks just to be on the same (>0) side.


Modified: trunk/speex/libspeex/mdf.c
===================================================================
--- trunk/speex/libspeex/mdf.c	2006-11-11 02:35:07 UTC (rev 12082)
+++ trunk/speex/libspeex/mdf.c	2006-11-11 03:48:23 UTC (rev 12083)
@@ -666,10 +666,23 @@
    /* Compute a bunch of correlations */
    Sey = mdf_inner_prod(st->e+st->frame_size, st->y+st->frame_size, st->frame_size);
    See = mdf_inner_prod(st->e+st->frame_size, st->e+st->frame_size, st->frame_size);
-   See = ADD32(See, SHR32(MULT16_16(N, 100),6));
+   See = MAX32(See, SHR32(MULT16_16(N, 100),6));
    Syy = mdf_inner_prod(st->y+st->frame_size, st->y+st->frame_size, st->frame_size);
    Sxx = mdf_inner_prod(st->x+st->frame_size, st->x+st->frame_size, st->frame_size);
 
+   /* Just in case something went really wrong */
+#ifdef FIXED_POINT
+   if (Syy<0)
+   {
+      speex_warning_int ("Syy is negative: ", Syy);
+      Syy = 0;
+   }
+   if (Sxx<0)
+   {
+      speex_warning_int ("Sxx is negative: ", Sxx);
+      Sxx = 0;
+   }
+#endif
    /* Convert error to frequency domain */
    spx_fft(st->fft_table, st->e, st->E);
    for (i=0;i<st->frame_size;i++)

Modified: trunk/speex/libspeex/preprocess.c
===================================================================
--- trunk/speex/libspeex/preprocess.c	2006-11-11 02:35:07 UTC (rev 12082)
+++ trunk/speex/libspeex/preprocess.c	2006-11-11 03:48:23 UTC (rev 12083)
@@ -760,7 +760,7 @@
    for (i=0;i<N;i++)
    {
       if (!st->update_prob[i] || st->ps[i] < PSHR32(st->noise[i], NOISE_SHIFT))
-         st->noise[i] = MULT16_32_Q15(beta_1,st->noise[i]) + MULT16_32_Q15(beta,SHL32(st->ps[i],NOISE_SHIFT));
+         st->noise[i] = MAX32(EXTEND32(0),MULT16_32_Q15(beta_1,st->noise[i]) + MULT16_32_Q15(beta,SHL32(st->ps[i],NOISE_SHIFT)));
    }
    filterbank_compute_bank32(st->bank, st->noise, st->noise+N);
 



More information about the commits mailing list