improved energy quantisation/prediction
This commit is contained in:
parent
06311335b5
commit
aeb4467d7f
2 changed files with 7 additions and 6 deletions
|
@ -163,14 +163,13 @@ void quant_bands(const CELTMode *m, float *X, float *P)
|
|||
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);
|
||||
|
|
|
@ -43,21 +43,23 @@ void quant_energy(CELTMode *m, float *eBands, float *oldEBands)
|
|||
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");
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue