shithub: opus

Download patch

ref: 5503f11a3d77b68c6f5b7b229fdd7d8ce2bff005
parent: 210ccafaff81c6759301613ed493a5e4d5e68444
author: Jean-Marc Valin <[email protected]>
date: Fri Mar 12 17:00:10 EST 2010

Using the mean energy even when start>0

--- a/libcelt/quant_bands.c
+++ b/libcelt/quant_bands.c
@@ -114,7 +114,7 @@
          celt_word16 q;   /* dB */
          celt_word16 x;   /* dB */
          celt_word16 f;   /* Q8 */
-         celt_word16 mean =  (i < E_MEANS_SIZE) ? MULT16_16_P15(Q15ONE-coef,eMeans[i]) : 0;
+         celt_word16 mean =  (i-start < E_MEANS_SIZE) ? MULT16_16_P15(Q15ONE-coef,eMeans[i-start]) : 0;
          x = eBands[i+c*m->nbEBands];
 #ifdef FIXED_POINT
          f = x-mean -MULT16_16_P15(coef,oldEBands[i+c*m->nbEBands])-prev[c];
@@ -243,7 +243,7 @@
       do {
          int qi;
          celt_word16 q;
-         celt_word16 mean =  (i < E_MEANS_SIZE) ? MULT16_16_P15(Q15ONE-coef,eMeans[i]) : 0;
+         celt_word16 mean =  (i-start < E_MEANS_SIZE) ? MULT16_16_P15(Q15ONE-coef,eMeans[i-start]) : 0;
          /* If we didn't have enough bits to encode all the energy, just assume something safe.
             We allow slightly busting the budget here */
          if (ec_dec_tell(dec, 0) > budget)