ref: 4117ff027515f0a85ac88e9b87385efcfa4cad99
parent: 504f8c2597d0e63cb97e011126c8af0fec955688
author: Jean-Marc Valin <[email protected]>
date: Tue Aug 5 18:03:34 EDT 2008
Preventing encoder/decoder mismatch when coarse energy budget is busted
--- a/libcelt/quant_bands.c
+++ b/libcelt/quant_bands.c
@@ -130,11 +130,14 @@
/* If we don't have enough bits to encode all the energy, just assume something safe.
We allow slightly busting the budget here */
if (ec_enc_tell(enc, 0) - bits > budget)
+ {
qi = -1;
- else
+ error[i] = 128;
+ } else {
ec_laplace_encode_start(enc, &qi, prob[2*i], prob[2*i+1]);
+ error[i] = f - SHL16(qi,8);
+ }
q = qi*base_resolution;
- error[i] = f - SHL16(qi,8);
oldEBands[i] = mean+MULT16_16_Q15(coef,oldEBands[i])+prev+q;
if (oldEBands[i] < -QCONST16(12.f,8))