shithub: opus

Download patch

ref: 1cca151671509a2c0f7383fe98a1298c37d4fdbd
parent: 331130e0b3af95297065ca19a0ae26e24a717b37
author: Jean-Marc Valin <[email protected]>
date: Sat May 23 18:28:04 EDT 2009

This fixes a bug in the new stereo code triggered only at ridiculously high
bitrates. It was caused by excessive "balance" bits leading to qb>14.

--- a/libcelt/bands.c
+++ b/libcelt/bands.c
@@ -610,6 +610,8 @@
          qb = (b>>BITRES)-1;
       if (qb<0)
          qb = 0;
+      if (qb>14)
+         qb = 14;
       
       if (qb==0)
          point_stereo_mix(m, X, bandE, i, 1);
@@ -963,6 +965,8 @@
       qb = (b-2*(N-1)*(40-log2_frac(N,4)))/(32*(N-1));
       if (qb > (b>>BITRES)-1)
          qb = (b>>BITRES)-1;
+      if (qb>14)
+         qb = 14;
       if (qb<0)
          qb = 0;
       qalloc = log2_frac((1<<qb)+1,4);