Improves CELT bit allocation at very low bitrates

We now try not to fold below band 17 since that produces a lot of harshness.
This mostly helps around 32-40 kb/s.
parent f1deb29c
...@@ -348,12 +348,17 @@ static OPUS_INLINE int interp_bits2pulses(const CELTMode *m, int start, int end, ...@@ -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 /*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 is not a mandatory part of the bitstream: any bands we choose to
skip here must be explicitly signaled.*/ skip here must be explicitly signaled.*/
/*Choose a threshold with some hysteresis to keep bands from int depth_threshold;
fluctuating in and out.*/ /*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 #ifdef FUZZING
if ((rand()&0x1) == 0) if ((rand()&0x1) == 0)
#else #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 #endif
{ {
ec_enc_bit_logp(ec, 1, 1); ec_enc_bit_logp(ec, 1, 1);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment