shithub: opus

Download patch

ref: a714994bf8b1c923454d0a97be2ded70a18c7904
parent: 1cb32aa057d356ec4a0d2398e950aface7eaa5ec
author: Timothy B. Terriberry <[email protected]>
date: Tue Jan 4 05:26:15 EST 2011

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.

--- a/libcelt/bands.c
+++ b/libcelt/bands.c
@@ -648,7 +648,7 @@
 
          /* 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 @@
          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);