Use B0 instead of B for decisions in quant_band().

B contains the number of blocks _after_ splitting.
We were using it to decide a) when to use a uniform PDF instead of a
 triangular one for theta and b) whether to bias the bit allocation
 towards the lower bins.
Using B0 (the number of blocks before the split) instead for a)
 gives a PEAQ gain of 0.003 ODG (as high as 0.1 ODG on s02a samples
 006, 083, and 097) for 240-sample frames at 96kbps mono.
Using B0 instead for b) gives a gain of only 0.00002.
This commit is contained in:
Timothy B. Terriberry 2011-01-04 10:26:15 -08:00 committed by Jean-Marc Valin
parent 1cb32aa057
commit a714994bf8

View file

@ -648,7 +648,7 @@ static void quant_band(int encode, const CELTMode *m, int i, celt_norm *X, celt_
/* Entropy coding of the angle. We use a uniform pdf for the
first stereo split but a triangular one for the rest. */
if (stereo || B>1)
if (stereo || B0>1)
{
if (encode)
ec_enc_uint((ec_enc*)ec, itheta, qn+1);
@ -800,7 +800,7 @@ static void quant_band(int encode, const CELTMode *m, int i, celt_norm *X, celt_
int next_level=0;
/* Give more bits to low-energy MDCTs than they would otherwise deserve */
if (B>1 && !stereo)
if (B0>1 && !stereo)
{
if (itheta > 8192)
delta -= delta>>(4+level-LM);