From 5c80391b3529bcb3fc8afd3b83d7562bae4991ae Mon Sep 17 00:00:00 2001 From: Jean-Marc Valin Date: Thu, 16 Dec 2010 14:11:48 -0500 Subject: [PATCH] Comments, low bit-rate busting avoidance --- libcelt/bands.c | 4 ++-- libcelt/celt.c | 4 ++-- libcelt/rate.c | 4 ++-- libcelt/rate.h | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/libcelt/bands.c b/libcelt/bands.c index 88c44003..920a9e96 100644 --- a/libcelt/bands.c +++ b/libcelt/bands.c @@ -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>20; } } else { - /* Noise */ + /* Folded spectrum */ for (j=0;j10) + 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) { diff --git a/libcelt/rate.c b/libcelt/rate.c index 43647320..1892944c 100644 --- a/libcelt/rate.c +++ b/libcelt/rate.c @@ -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; diff --git a/libcelt/rate.h b/libcelt/rate.h index 283875ac..0e6391a9 100644 --- a/libcelt/rate.h +++ b/libcelt/rate.h @@ -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);