shithub: opus

Download patch

ref: aaca4a713f3cc190425b34e0cd4f59fc8e8450a5
parent: 665da0ba4ddad2b35a9be0e00e70e318a1d98fdb
author: Jean-Marc Valin <[email protected]>
date: Sun Jan 30 16:19:06 EST 2011

Making sure that itheta=0 or 16384 really cuts allocation to one band

--- a/libcelt/bands.c
+++ b/libcelt/bands.c
@@ -964,7 +964,7 @@
          celt_int32 rebalance;
 
          /* Give more bits to low-energy MDCTs than they would otherwise deserve */
-         if (B0>1 && !stereo)
+         if (B0>1 && !stereo && (itheta&0x3fff))
          {
             if (itheta > 8192)
                /* Rough approximation for pre-echo masking */
@@ -1194,7 +1194,7 @@
       if (i <= codedBands-1)
       {
          curr_balance = balance / IMIN(3, codedBands-i);
-         b = IMAX(0, IMIN(16384, IMIN(remaining_bits+1,pulses[i]+curr_balance)));
+         b = IMAX(0, IMIN(16383, IMIN(remaining_bits+1,pulses[i]+curr_balance)));
       } else {
          b = 0;
       }