gen_audio_resampler_filter.c: Precalculate loop-invariant bessel(beta).

Minor optimization in offline code.
This commit is contained in:
Ryan C. Gordon 2022-05-26 10:44:01 -04:00
parent 822cf0b34b
commit 5968f3d828
No known key found for this signature in database
GPG Key ID: FA148B892AB48044
1 changed files with 2 additions and 1 deletions

View File

@ -74,11 +74,12 @@ kaiser_and_sinc(float *table, float *diffs, const int tablelen, const double bet
{
const int lenm1 = tablelen - 1;
const int lenm1div2 = lenm1 / 2;
const double bessel_beta = bessel(beta);
int i;
table[0] = 1.0f;
for (i = 1; i < tablelen; i++) {
const double kaiser = bessel(beta * sqrt(1.0 - pow(((i - lenm1) / 2.0) / lenm1div2, 2.0))) / bessel(beta);
const double kaiser = bessel(beta * sqrt(1.0 - pow(((i - lenm1) / 2.0) / lenm1div2, 2.0))) / bessel_beta;
table[tablelen - i] = (float) kaiser;
}