shithub: opus

Download patch

ref: d9f6ec3f044cf285de55402f89a438891feda254
parent: c2095a2930497e7d2b1a227568d8598186aef976
author: Jean-Marc Valin <[email protected]>
date: Mon Jan 10 05:52:51 EST 2011

Changes the N=2 stereo case to use the same sign convention as N=1

--- a/libcelt/bands.c
+++ b/libcelt/bands.c
@@ -751,7 +751,7 @@
       if (N==2 && stereo)
       {
          int c;
-         int sign=1;
+         int sign=0;
          celt_norm *x2, *y2;
          mbits = b-qalloc;
          sbits = 0;
@@ -769,13 +769,13 @@
             if (encode)
             {
                /* Here we only need to encode a sign for the side */
-               sign = x2[0]*y2[1] - x2[1]*y2[0] > 0;
+               sign = x2[0]*y2[1] - x2[1]*y2[0] < 0;
                ec_enc_bits((ec_enc*)ec, sign, 1);
             } else {
                sign = ec_dec_bits((ec_dec*)ec, 1);
             }
          }
-         sign = 2*sign - 1;
+         sign = 1-2*sign;
          quant_band(encode, m, i, x2, NULL, N, mbits, spread, B, intensity, tf_change, lowband, resynth, ec, remaining_bits, LM, lowband_out, NULL, level, seed, gain, lowband_scratch, fill);
          y2[0] = -sign*x2[1];
          y2[1] = sign*x2[0];