More energy quantisation work
authorJean-Marc Valin <jean-marc.valin@usherbrooke.ca>
Thu, 6 Dec 2007 00:13:56 +0000 (11:13 +1100)
committerJean-Marc Valin <jean-marc.valin@usherbrooke.ca>
Thu, 6 Dec 2007 00:13:56 +0000 (11:13 +1100)
libcelt/quant_bands.c

index c0a64f1..eaf4e2e 100644 (file)
@@ -43,17 +43,21 @@ void quant_energy(CELTMode *m, float *eBands, float *oldEBands)
       float q;
       float res;
       float x;
       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;
       
       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);
       q = qi*res;
       
       //printf("%f %f ", pred+prev+q, x);
+      //printf("%d ", qi);
       
       oldEBands[i] = pred+prev+q;
       
       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");
 }
    }
    //printf ("\n");
 }