shithub: opus

Download patch

ref: 06311335b55b925b006bd31ac005878e656d76f4
parent: 8b0137aa42b552f18d83a90b27c0c5e8be1dc78d
author: Jean-Marc Valin <[email protected]>
date: Thu Dec 6 06:13:56 EST 2007

More energy quantisation work

--- a/libcelt/quant_bands.c
+++ b/libcelt/quant_bands.c
@@ -43,17 +43,21 @@
       float q;
       float res;
       float x;
-      float pred = .8*oldEBands[i];
+      float pred = .9*oldEBands[i];
       
       x = 20*log10(.3+eBands[i]);
       res = 1.0f;
-      qi = (int)floor(.5+res*(x-pred-prev)/res);
+      qi = (int)floor(.5+(x-pred-prev)/res);
       q = qi*res;
       
       //printf("%f %f ", pred+prev+q, x);
+      //printf("%d ", qi);
       
       oldEBands[i] = pred+prev+q;
-      prev = .7*q;
+      eBands[i] = pow(10, .05*oldEBands[i])-.3;
+      if (eBands[i] < 0)
+         eBands[i] = 0;
+      prev = .65*q;
    }
    //printf ("\n");
 }