Fixes a silly bug where only the left channel was used for depth estimation
authorJean-Marc Valin <jmvalin@jmvalin.ca>
Tue, 14 Aug 2012 04:37:47 +0000 (00:37 -0400)
committerJean-Marc Valin <jmvalin@jmvalin.ca>
Tue, 14 Aug 2012 04:37:47 +0000 (00:37 -0400)
Result was that stereo files with silence on the left would result in an
extremely low bitrate

celt/celt.c

index f3db223..b3d3508 100644 (file)
@@ -1470,7 +1470,7 @@ int celt_encode_with_ec(CELTEncoder * restrict st, const opus_val16 * pcm, int f
                   +QCONST16(.5f,DB_SHIFT)+SHL16(9-st->lsb_depth,DB_SHIFT)-SHL16(eMeans[i],6)
                   +MULT16_16(QCONST16(.0062,DB_SHIFT),(i+5)*(i+5));
             follower[c*st->mode->nbEBands+i] = MAX16(follower[c*st->mode->nbEBands+i], noise_floor);
-            maxDepth = MAX16(maxDepth, bandLogE[i]-noise_floor);
+            maxDepth = MAX16(maxDepth, bandLogE[c*st->mode->nbEBands+i]-noise_floor);
          }
       } while (++c<C);
       if (C==2)