shithub: opus

Download patch

ref: ecefde3d4a616b88c89066570f5bd97fdb437c0f
parent: 8cfda4a3017e309d1f6ab1e81087f3db3f425877
author: Jean-Marc Valin <[email protected]>
date: Tue Jan 11 04:20:39 EST 2011

Fixes the recombining stride and the deinterleaving stride

Previously, recombining only worked when going all the way back to
frequency domain.

--- a/libcelt/bands.c
+++ b/libcelt/bands.c
@@ -573,13 +573,13 @@
 
       for (k=0;k<recombine;k++)
       {
-         B>>=1;
-         N_B<<=1;
          if (encode)
-            haar1(X, N_B, B);
+            haar1(X, N>>k, 1<<k);
          if (lowband)
-            haar1(lowband, N_B, B);
+            haar1(lowband, N>>k, 1<<k);
       }
+      B>>=recombine;
+      N_B<<=recombine;
 
       /* Increasing the time resolution */
       while ((N_B&1) == 0 && tf_change<0)
@@ -600,9 +600,9 @@
       if (B0>1)
       {
          if (encode)
-            deinterleave_hadamard(X, N_B, B0, longBlocks);
+            deinterleave_hadamard(X, N_B>>recombine, B0<<recombine, longBlocks);
          if (lowband)
-            deinterleave_hadamard(lowband, N_B, B0, longBlocks);
+            deinterleave_hadamard(lowband, N_B>>recombine, B0<<recombine, longBlocks);
       }
    }
 
@@ -912,7 +912,7 @@
 
          /* Undo the sample reorganization going from time order to frequency order */
          if (B0>1)
-            interleave_hadamard(X, N_B, B0, longBlocks);
+            interleave_hadamard(X, N_B>>recombine, B0<<recombine, longBlocks);
 
          /* Undo time-freq changes that we did earlier */
          N_B = N_B0;
@@ -925,11 +925,9 @@
          }
 
          for (k=0;k<recombine;k++)
-         {
-            haar1(X, N_B, B);
-            N_B>>=1;
-            B <<= 1;
-         }
+            haar1(X, N0>>k, 1<<k);
+         B<<=recombine;
+         N_B>>=recombine;
 
          /* Scale output for later folding */
          if (lowband_out)