shithub: opus

Download patch

ref: 9ed3d027616e299af4968889824ecc6e664ccefe
parent: 1fd1d7dd49c34c7d64bf26f60782afc17dab6842
author: Jean-Marc Valin <[email protected]>
date: Thu Nov 8 16:50:05 EST 2012

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.

--- a/celt/quant_bands.c
+++ b/celt/quant_bands.c
@@ -283,12 +283,15 @@
    /* 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);