powf() has to handle the general case of any floating-point x,y - as a result it's comparatively very slow in the special case y == 2. Replace with a simple multiply.

This commit is contained in:
9pt7 2015-02-27 16:08:56 -04:00
parent 6c4e4357bf
commit 284edaeffe
1 changed files with 5 additions and 5 deletions

View File

@ -126,12 +126,12 @@ mbe_spectralAmpEnhance (mbe_parms * cur_mp)
Rm1 = 0;
for (l = 1; l <= cur_mp->L; l++)
{
Rm0 = Rm0 + powf (cur_mp->Ml[l], (float) 2);
Rm1 = Rm1 + (powf (cur_mp->Ml[l], (float) 2) * cosf (cur_mp->w0 * (float) l));
Rm0 = Rm0 + (cur_mp->Ml[l] * cur_mp->Ml[l]);
Rm1 = Rm1 + ((cur_mp->Ml[l] * cur_mp->Ml[l]) * cosf (cur_mp->w0 * (float) l));
}
R2m0 = powf (Rm0, (float) 2);
R2m1 = powf (Rm1, (float) 2);
R2m0 = (Rm0*Rm0);
R2m1 = (Rm1*Rm1);
for (l = 1; l <= cur_mp->L; l++)
{
@ -166,7 +166,7 @@ mbe_spectralAmpEnhance (mbe_parms * cur_mp)
{
M = -M;
}
sum += powf (M, 2);
sum += (M*M);
}
if (sum == 0)
{