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

jm at svn.xiph.org jm at svn.xiph.org
Tue Feb 14 00:37:41 PST 2006


Author: jm
Date: 2006-02-14 00:37:38 -0800 (Tue, 14 Feb 2006)
New Revision: 10822

Modified:
   trunk/speex/libspeex/ltp.c
   trunk/speex/libspeex/vbr.c
Log:
fixed potential problems with float rounding causing NaNs


Modified: trunk/speex/libspeex/ltp.c
===================================================================
--- trunk/speex/libspeex/ltp.c	2006-02-13 20:57:15 UTC (rev 10821)
+++ trunk/speex/libspeex/ltp.c	2006-02-14 08:37:38 UTC (rev 10822)
@@ -205,6 +205,8 @@
    {
       /* Update energy for next pitch*/
       energy[i-start+1] = SUB32(ADD32(energy[i-start],SHR32(MULT16_16(swn[-i-1],swn[-i-1]),6)), SHR32(MULT16_16(swn[-i+len-1],swn[-i+len-1]),6));
+      if (energy[i-start+1] < 0)
+         energy[i-start+1] = 0;
    }
 
    pitch_xcorr(swn, swn-end, corr, len, end-start+1, stack);

Modified: trunk/speex/libspeex/vbr.c
===================================================================
--- trunk/speex/libspeex/vbr.c	2006-02-13 20:57:15 UTC (rev 10821)
+++ trunk/speex/libspeex/vbr.c	2006-02-14 08:37:38 UTC (rev 10822)
@@ -248,7 +248,7 @@
          qual-=0.5*(log(3.0 + vbr->consec_noise)-log(3));
       if (qual<0)
          qual=0;
-      qual += .3*log(ener/60000.0);
+      qual += .3*log(.0001+ener/60000.0);
    }
    if (qual<-1)
       qual=-1;



More information about the commits mailing list