shithub: opus

Download patch

ref: aa3a599caa2aa2e4f3036eb0e3b848bf3946821e
parent: 259e166648832ba5bf4ed4d08aca87e8f5e8fe5c
author: Jean-Marc Valin <[email protected]>
date: Mon Dec 3 10:40:01 EST 2012

Fixes forward MDCT for overlaps that aren't a multiple of 4

Adds more sizes to test_unit_mdct.c

--- a/celt/mdct.c
+++ b/celt/mdct.c
@@ -133,7 +133,7 @@
       kiss_fft_scalar * OPUS_RESTRICT yp = f;
       const opus_val16 * OPUS_RESTRICT wp1 = window+(overlap>>1);
       const opus_val16 * OPUS_RESTRICT wp2 = window+(overlap>>1)-1;
-      for(i=0;i<(overlap>>2);i++)
+      for(i=0;i<((overlap+3)>>2);i++)
       {
          /* Real part arranged as -d-cR, Imag part arranged as -b+aR*/
          *yp++ = MULT16_32_Q15(*wp2, xp1[N2]) + MULT16_32_Q15(*wp1,*xp2);
@@ -145,7 +145,7 @@
       }
       wp1 = window;
       wp2 = window+overlap-1;
-      for(;i<N4-(overlap>>2);i++)
+      for(;i<N4-((overlap+3)>>2);i++)
       {
          /* Real part arranged as a-bR, Imag part arranged as -c-dR */
          *yp++ = *xp2;
--- a/celt/tests/test_unit_mdct.c
+++ b/celt/tests/test_unit_mdct.c
@@ -183,9 +183,17 @@
         test1d(256,1);
         test1d(512,0);
         test1d(512,1);
+        test1d(1024,0);
+        test1d(1024,1);
+        test1d(2048,0);
+        test1d(2048,1);
 #ifndef RADIX_TWO_ONLY
+        test1d(36,0);
+        test1d(36,1);
         test1d(40,0);
         test1d(40,1);
+        test1d(60,0);
+        test1d(60,1);
         test1d(120,0);
         test1d(120,1);
         test1d(240,0);
@@ -192,6 +200,10 @@
         test1d(240,1);
         test1d(480,0);
         test1d(480,1);
+        test1d(960,0);
+        test1d(960,1);
+        test1d(1920,0);
+        test1d(1920,1);
 #endif
     }
     return ret;