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

jm at svn.xiph.org jm at svn.xiph.org
Sat Nov 18 18:33:09 PST 2006


Author: jm
Date: 2006-11-18 18:33:03 -0800 (Sat, 18 Nov 2006)
New Revision: 12131

Modified:
   trunk/speex/libspeex/filters.c
   trunk/speex/libspeex/nb_celp.c
   trunk/speex/libspeex/sb_celp.c
Log:
Fixed an overflow in the excitation decoding (again on heavily-clipped signal)
and made operators mode explicit.


Modified: trunk/speex/libspeex/filters.c
===================================================================
--- trunk/speex/libspeex/filters.c	2006-11-17 22:37:39 UTC (rev 12130)
+++ trunk/speex/libspeex/filters.c	2006-11-19 02:33:03 UTC (rev 12131)
@@ -650,19 +650,19 @@
          a1 = a[j+1];
          x1 = xx[N-2+j-i];
 
-         y0 = ADD32(y0,SHR(MULT16_16(a0, x1),2));
-         y1 = ADD32(y1,SHR(MULT16_16(a1, x1),2));
-         y2 = ADD32(y2,SHR(MULT16_16(a0, x0),2));
-         y3 = ADD32(y3,SHR(MULT16_16(a1, x0),2));
+         y0 = ADD32(y0,SHR32(MULT16_16(a0, x1),2));
+         y1 = ADD32(y1,SHR32(MULT16_16(a1, x1),2));
+         y2 = ADD32(y2,SHR32(MULT16_16(a0, x0),2));
+         y3 = ADD32(y3,SHR32(MULT16_16(a1, x0),2));
 
          a0 = a[j+2];
          a1 = a[j+3];
          x0 = xx[N+j-i];
 
-         y0 = ADD32(y0,SHR(MULT16_16(a0, x0),2));
-         y1 = ADD32(y1,SHR(MULT16_16(a1, x0),2));
-         y2 = ADD32(y2,SHR(MULT16_16(a0, x1),2));
-         y3 = ADD32(y3,SHR(MULT16_16(a1, x1),2));
+         y0 = ADD32(y0,SHR32(MULT16_16(a0, x0),2));
+         y1 = ADD32(y1,SHR32(MULT16_16(a1, x0),2));
+         y2 = ADD32(y2,SHR32(MULT16_16(a0, x1),2));
+         y3 = ADD32(y3,SHR32(MULT16_16(a1, x1),2));
       }
       y[i] = y0;
       y[i+1] = y1;

Modified: trunk/speex/libspeex/nb_celp.c
===================================================================
--- trunk/speex/libspeex/nb_celp.c	2006-11-17 22:37:39 UTC (rev 12130)
+++ trunk/speex/libspeex/nb_celp.c	2006-11-19 02:33:03 UTC (rev 12131)
@@ -1621,7 +1621,7 @@
             }
          } else {
             for (i=0;i<st->subframeSize;i++)
-               exc[i]=PSHR32(ADD32(SHL32(exc32[i],1),innov[i]),SIG_SHIFT);
+               exc[i]=EXTRACT16(SATURATE32(PSHR32(ADD32(SHL32(exc32[i],1),innov[i]),SIG_SHIFT),32767));
             /*print_vec(exc, 40, "innov");*/
          }
          if (innov_save)

Modified: trunk/speex/libspeex/sb_celp.c
===================================================================
--- trunk/speex/libspeex/sb_celp.c	2006-11-17 22:37:39 UTC (rev 12130)
+++ trunk/speex/libspeex/sb_celp.c	2006-11-19 02:33:03 UTC (rev 12131)
@@ -210,7 +210,7 @@
    {
       spx_word32_t tmp;
 #ifdef FIXED_POINT
-      tmp=PSHR(x0[i]-x1[i],SIG_SHIFT-1);
+      tmp=PSHR32(SUB32(x0[i],x1[i]),SIG_SHIFT-1);
 #else
       tmp=2*(x0[i]-x1[i]);
 #endif
@@ -219,7 +219,7 @@
       else if (tmp<-32767)
          out[i] = -32767;
       else
-         out[i] = tmp;
+         out[i] = EXTRACT16(tmp);
    }
 }
 



More information about the commits mailing list