From 9ed3d027616e299af4968889824ecc6e664ccefe Mon Sep 17 00:00:00 2001 From: Jean-Marc Valin <jmvalin@jmvalin.ca> Date: Thu, 8 Nov 2012 21:50:05 -0500 Subject: [PATCH] Fixes a quant_coarse_energy() hybrid mode bug max_decay was being computed based on the small number of bits allocated to CELT. It's now set to the max value (16) when in hybrid mode. --- celt/quant_bands.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/celt/quant_bands.c b/celt/quant_bands.c index 241392f16..f09edc7ec 100644 --- a/celt/quant_bands.c +++ b/celt/quant_bands.c @@ -283,12 +283,15 @@ void quant_coarse_energy(const CELTMode *m, int start, int end, int effEnd, /* Encode the global flags using a simple probability model (first symbols in the stream) */ + max_decay = QCONST16(16.f,DB_SHIFT); + if (end-start>10) + { #ifdef FIXED_POINT - max_decay = MIN32(QCONST16(16.f,DB_SHIFT), SHL32(EXTEND32(nbAvailableBytes),DB_SHIFT-3)); + max_decay = MIN32(max_decay, SHL32(EXTEND32(nbAvailableBytes),DB_SHIFT-3)); #else - max_decay = MIN32(16.f, .125f*nbAvailableBytes); + max_decay = MIN32(max_decay, .125f*nbAvailableBytes); #endif - + } enc_start_state = *enc; ALLOC(oldEBands_intra, C*m->nbEBands, opus_val16); -- GitLab