diff options
author | Jean-Marc Valin <jmvalin@jmvalin.ca> | 2016-11-02 17:59:32 -0400 |
---|---|---|
committer | Jean-Marc Valin <jmvalin@jmvalin.ca> | 2016-11-02 18:01:14 -0400 |
commit | 92282c1ae42187c3a5606cddd8cddabdcc7ed8bd (patch) | |
tree | 4b46f9bfecf7701b0e44eab493b75d7ebb172486 | |
parent | f1deb29cd6fe2a83d6972c4f24e7b591b37704c5 (diff) | |
download | opus-92282c1ae42187c3a5606cddd8cddabdcc7ed8bd.tar.gz |
Improves CELT bit allocation at very low bitratesv1.2-alpha
We now try not to fold below band 17 since that produces a lot of harshness.
This mostly helps around 32-40 kb/s.
-rw-r--r-- | celt/rate.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/celt/rate.c b/celt/rate.c index 7dfa5be8..ca4cc870 100644 --- a/celt/rate.c +++ b/celt/rate.c @@ -348,12 +348,17 @@ static OPUS_INLINE int interp_bits2pulses(const CELTMode *m, int start, int end, /*This if() block is the only part of the allocation function that is not a mandatory part of the bitstream: any bands we choose to skip here must be explicitly signaled.*/ - /*Choose a threshold with some hysteresis to keep bands from - fluctuating in and out.*/ + int depth_threshold; + /*We choose a threshold with some hysteresis to keep bands from + fluctuating in and out, but we try not to fold below a certain point. */ + if (codedBands > 17) + depth_threshold = j<prev ? 7 : 9; + else + depth_threshold = 0; #ifdef FUZZING if ((rand()&0x1) == 0) #else - if (codedBands<=start+2 || (band_bits > ((j<prev?7:9)*band_width<<LM<<BITRES)>>4 && j<=signalBandwidth)) + if (codedBands<=start+2 || (band_bits > (depth_threshold*band_width<<LM<<BITRES)>>4 && j<=signalBandwidth)) #endif { ec_enc_bit_logp(ec, 1, 1); |