ref: aeb4467d7fa64b88fd9de7670512a8114cf09a68
parent: 06311335b55b925b006bd31ac005878e656d76f4
author: Jean-Marc Valin <[email protected]>
date: Thu Dec 6 08:50:14 EST 2007
improved energy quantisation/prediction
--- a/libcelt/bands.c
+++ b/libcelt/bands.c
@@ -163,14 +163,13 @@
alg_quant2(X+B*eBands[i], B*(eBands[i+1]-eBands[i]), q, P+B*eBands[i]);
for (j=B*eBands[i];j<B*eBands[i+1];j++)
norm[j] = X[j] * n;
- //bits += log2(ncwrs(B*(qbank[i+1]-qbank[i]), q));
+ //bits += log2(ncwrs(B*(eBands[i+1]-eBands[i]), q));
} else {
float n = sqrt(B*(eBands[i+1]-eBands[i]));
copy_quant(X+B*eBands[i], B*(eBands[i+1]-eBands[i]), -q, norm, B, eBands[i]);
for (j=B*eBands[i];j<B*eBands[i+1];j++)
norm[j] = X[j] * n;
- //bits += 1+log2(qbank[i])+log2(ncwrs(B*(qbank[i+1]-qbank[i]), -q));
- //noise_quant(X+B*qbank[i], B*(qbank[i+1]-qbank[i]), q, P+B*qbank[i]);
+ //bits += 1+log2(eBands[i])+log2(ncwrs(B*(eBands[i+1]-eBands[i]), -q));
}
}
//printf ("%f\n", bits);
--- a/libcelt/quant_bands.c
+++ b/libcelt/quant_bands.c
@@ -43,21 +43,23 @@
float q;
float res;
float x;
- float pred = .9*oldEBands[i];
+ float pred = .7*oldEBands[i];
x = 20*log10(.3+eBands[i]);
- res = 1.0f;
+ res = .25f*(i+3.f);
+ //res = 1;
qi = (int)floor(.5+(x-pred-prev)/res);
q = qi*res;
//printf("%f %f ", pred+prev+q, x);
//printf("%d ", qi);
+ //printf("%f ", x-pred-prev);
oldEBands[i] = pred+prev+q;
eBands[i] = pow(10, .05*oldEBands[i])-.3;
if (eBands[i] < 0)
eBands[i] = 0;
- prev = .65*q;
+ prev = (prev + .5*q);
}
//printf ("\n");
}