shithub: opus

Download patch

ref: ccd51fe9478abba60bc97fa1a85a16781d680673
parent: ccd5a61a6979c889981df3ff1410e0b873bb7221
author: Jean-Marc Valin <[email protected]>
date: Wed Oct 13 07:48:17 EDT 2010

No longer filling the stereo side with noise.

--- a/libcelt/bands.c
+++ b/libcelt/bands.c
@@ -909,7 +909,6 @@
       int curr_balance;
       celt_norm * restrict X, * restrict Y;
       int tf_change=0;
-      celt_norm *effective_lowband;
       
       X = _X+M*eBands[i];
       if (_Y!=NULL)
@@ -953,12 +952,8 @@
             Y = norm;
       }
 
-      if (tf_change==0 && !shortBlocks && fold==2)
-         effective_lowband = NULL;
-      else
-         effective_lowband = lowband;
       quant_band(encode, m, i, X, Y, N, b, fold, B, tf_change,
-            effective_lowband, resynth, ec, &remaining_bits, LM,
+            lowband, resynth, ec, &remaining_bits, LM,
             norm+M*eBands[i], bandE, 0, &seed, Q15ONE, lowband_scratch);
 
       balance += pulses[i] + tell;
--- a/libcelt/vq.c
+++ b/libcelt/vq.c
@@ -183,17 +183,23 @@
    {
       if (lowband != NULL && resynth)
       {
-         for (j=0;j<N;j++)
-            X[j] = lowband[j];
+         if (spread==2 && B<=1)
+         {
+            for (j=0;j<N;j++)
+            {
+               *seed = lcg_rand(*seed);
+               X[j] = (int)(*seed)>>20;
+            }
+         } else {
+            for (j=0;j<N;j++)
+               X[j] = lowband[j];
+         }
+         renormalise_vector(X, N, gain);
       } else {
          /* This is important for encoding the side in stereo mode */
          for (j=0;j<N;j++)
-         {
-            *seed = lcg_rand(*seed);
-            X[j] = (int)(*seed)>>20;
-         }
+            X[j] = 0;
       }
-      renormalise_vector(X, N, gain);
       return;
    }
    K = get_pulses(K);
@@ -361,17 +367,23 @@
    {
       if (lowband != NULL)
       {
-         for (i=0;i<N;i++)
-            X[i] = lowband[i];
+         if (spread==2 && B<=1)
+         {
+            for (i=0;i<N;i++)
+            {
+               *seed = lcg_rand(*seed);
+               X[i] = (int)(*seed)>>20;
+            }
+         } else {
+            for (i=0;i<N;i++)
+               X[i] = lowband[i];
+         }
+         renormalise_vector(X, N, gain);
       } else {
          /* This is important for encoding the side in stereo mode */
          for (i=0;i<N;i++)
-         {
-            *seed = lcg_rand(*seed);
-            X[i] = (int)(*seed)>>20;
-         }
+            X[i] = 0;
       }
-      renormalise_vector(X, N, gain);
       return;
    }
    K = get_pulses(K);