Comments, low bit-rate busting avoidance

This commit is contained in:
Jean-Marc Valin 2010-12-16 14:11:48 -05:00
parent df6620eb0b
commit 5c80391b35
4 changed files with 7 additions and 7 deletions

View file

@ -830,14 +830,14 @@ static void quant_band(int encode, const CELTMode *m, int i, celt_norm *X, celt_
{
if (spread==2 && B<=1)
{
/* Folded spectrum */
/* Noise */
for (j=0;j<N;j++)
{
*seed = lcg_rand(*seed);
X[j] = (int)(*seed)>>20;
}
} else {
/* Noise */
/* Folded spectrum */
for (j=0;j<N;j++)
X[j] = lowband[j];
}

View file

@ -822,7 +822,7 @@ int celt_encode_with_ec_float(CELTEncoder * restrict st, const celt_sig * pcm, i
} while (++c<C);
#ifdef ENABLE_POSTFILTER
if (LM != 0 && nbAvailableBytes>10)
if (LM != 0 && nbAvailableBytes>10*C)
{
VARDECL(celt_word16, pitch_buf);
ALLOC(pitch_buf, (COMBFILTER_MAXPERIOD+N)>>1, celt_word16);
@ -946,7 +946,7 @@ int celt_encode_with_ec_float(CELTEncoder * restrict st, const celt_sig * pcm, i
tf_encode(st->start, st->end, isTransient, tf_res, LM, tf_select, enc);
if (shortBlocks || st->complexity < 3)
if (shortBlocks || st->complexity < 3 || nbAvailableBytes < 10*C)
{
if (st->complexity == 0)
{

View file

@ -141,7 +141,7 @@ void compute_pulse_cache(CELTMode *m, int LM)
#define ALLOC_STEPS 6
static inline int interp_bits2pulses(const CELTMode *m, int start, int end,
int *bits1, int *bits2, const int *thresh, int total, int *bits,
const int *bits1, const int *bits2, const int *thresh, int total, int *bits,
int *ebits, int *fine_priority, int len, int _C, int LM, void *ec, int encode, int prev)
{
int psum;
@ -357,7 +357,7 @@ static inline int interp_bits2pulses(const CELTMode *m, int start, int end,
return codedBands;
}
int compute_allocation(const CELTMode *m, int start, int end, int *offsets, int alloc_trim,
int compute_allocation(const CELTMode *m, int start, int end, const int *offsets, int alloc_trim,
int total, int *pulses, int *ebits, int *fine_priority, int _C, int LM, void *ec, int encode, int prev)
{
int lo, hi, len, j;

View file

@ -102,7 +102,7 @@ celt_int16 **compute_alloc_cache(CELTMode *m, int M);
@param pulses Number of pulses per band (returned)
@return Total number of bits allocated
*/
int compute_allocation(const CELTMode *m, int start, int end, int *offsets, int alloc_trim,
int compute_allocation(const CELTMode *m, int start, int end, const int *offsets, int alloc_trim,
int total, int *pulses, int *ebits, int *fine_priority, int _C, int LM, void *ec, int encode, int prev);