Don't rebalance bits for itheta=0 or 16384

This commit is contained in:
Jean-Marc Valin 2011-01-27 21:43:24 -05:00
parent a928572055
commit 09213de91c
2 changed files with 6 additions and 6 deletions

View file

@ -991,7 +991,7 @@ static unsigned quant_band(int encode, const CELTMode *m, int i, celt_norm *X, c
lowband, resynth, ec, remaining_bits, LM, next_lowband_out1,
NULL, next_level, seed, stereo ? Q15ONE : MULT16_16_P15(gain,mid), lowband_scratch, fill);
rebalance = mbits - (rebalance-*remaining_bits);
if (rebalance > 3<<BITRES)
if (rebalance > 3<<BITRES && itheta!=0)
sbits += rebalance - (3<<BITRES);
/* For a stereo split, the high bits of fill are always zero, so no
@ -1006,7 +1006,7 @@ static unsigned quant_band(int encode, const CELTMode *m, int i, celt_norm *X, c
next_lowband2, resynth, ec, remaining_bits, LM, NULL,
NULL, next_level, seed, MULT16_16_P15(gain,side), NULL, fill>>B)<<(B0>>1&stereo-1);
rebalance = sbits - (rebalance-*remaining_bits);
if (rebalance > 3<<BITRES)
if (rebalance > 3<<BITRES && itheta!=16384)
mbits += rebalance - (3<<BITRES);
/* In stereo mode, we do not apply a scaling to the mid because we need the normalized
mid for folding later */

View file

@ -318,19 +318,19 @@ CELTMode *celt_mode_create(celt_int32 Fs, int frame_size, int *error)
{
mode->preemph[0] = QCONST16(0.3500061035f, 15);
mode->preemph[1] = -QCONST16(0.1799926758f, 15);
mode->preemph[2] = QCONST16(0.2719726562f, SIG_SHIFT);
mode->preemph[2] = QCONST16(0.2719968125f, SIG_SHIFT); /* exact 1/preemph[3] */
mode->preemph[3] = QCONST16(3.6765136719f, 13);
} else if(Fs < 24000) /* 16 kHz */
{
mode->preemph[0] = QCONST16(0.6000061035f, 15);
mode->preemph[1] = -QCONST16(0.1799926758f, 15);
mode->preemph[2] = QCONST16(0.4425048828f, SIG_SHIFT);
mode->preemph[3] = QCONST16(2.259887f, 13);
mode->preemph[2] = QCONST16(0.4424998650f, SIG_SHIFT); /* exact 1/preemph[3] */
mode->preemph[3] = QCONST16(2.2598876953f, 13);
} else if(Fs < 40000) /* 32 kHz */
{
mode->preemph[0] = QCONST16(0.7799987793f, 15);
mode->preemph[1] = -QCONST16(0.1000061035f, 15);
mode->preemph[2] = QCONST16(.75f, SIG_SHIFT);
mode->preemph[2] = QCONST16(0.7499771125f, SIG_SHIFT); /* exact 1/preemph[3] */
mode->preemph[3] = QCONST16(1.3333740234f, 13);
} else /* 48 kHz */
{