Commit 6f7b2c43 authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

param_eq: single precision math

parent 0896977b
......@@ -200,15 +200,15 @@ static void CalcPeakEQCoeffs( float f0, float Q, float gainDB, float Fs,
if (gainDB < -40) gainDB = -40;
if (gainDB > 40) gainDB = 40;
A = pow(10, gainDB/40);
w0 = 2*3.141593f*f0/Fs;
alpha = sin(w0)/(2*Q);
A = powf(10, gainDB/40);
w0 = 2*((float)M_PI)*f0/Fs;
alpha = sinf(w0)/(2*Q);
b0 = 1 + alpha*A;
b1 = -2*cos(w0);
b1 = -2*cosf(w0);
b2 = 1 - alpha*A;
a0 = 1 + alpha/A;
a1 = -2*cos(w0);
a1 = -2*cosf(w0);
a2 = 1 - alpha/A;
// Store values to coeffs and normalize by 1/a0
......@@ -244,27 +244,27 @@ static void CalcShelfEQCoeffs( float f0, float slope, float gainDB, int high,
if (gainDB < -40) gainDB = -40;
if (gainDB > 40) gainDB = 40;
A = pow(10, gainDB/40);
A = powf(10, gainDB/40);
w0 = 2*3.141593f*f0/Fs;
alpha = sin(w0)/2 * sqrt( (A + 1/A)*(1/slope - 1) + 2 );
alpha = sinf(w0)/2 * sqrtf( (A + 1/A)*(1/slope - 1) + 2 );
if (high)
{
b0 = A*( (A+1) + (A-1)*cos(w0) + 2*sqrt(A)*alpha );
b1 = -2*A*( (A-1) + (A+1)*cos(w0) );
b2 = A*( (A+1) + (A-1)*cos(w0) - 2*sqrt(A)*alpha );
a0 = (A+1) - (A-1)*cos(w0) + 2*sqrt(A)*alpha;
a1 = 2*( (A-1) - (A+1)*cos(w0) );
a2 = (A+1) - (A-1)*cos(w0) - 2*sqrt(A)*alpha;
b0 = A*( (A+1) + (A-1)*cosf(w0) + 2*sqrtf(A)*alpha );
b1 = -2*A*( (A-1) + (A+1)*cosf(w0) );
b2 = A*( (A+1) + (A-1)*cosf(w0) - 2*sqrtf(A)*alpha );
a0 = (A+1) - (A-1)*cosf(w0) + 2*sqrtf(A)*alpha;
a1 = 2*( (A-1) - (A+1)*cosf(w0) );
a2 = (A+1) - (A-1)*cosf(w0) - 2*sqrtf(A)*alpha;
}
else
{
b0 = A*( (A+1) - (A-1)*cos(w0) + 2*sqrt(A)*alpha );
b1 = 2*A*( (A-1) - (A+1)*cos(w0));
b2 = A*( (A+1) - (A-1)*cos(w0) - 2*sqrt(A)*alpha );
a0 = (A+1) + (A-1)*cos(w0) + 2*sqrt(A)*alpha;
a1 = -2*( (A-1) + (A+1)*cos(w0));
a2 = (A+1) + (A-1)*cos(w0) - 2*sqrt(A)*alpha;
b0 = A*( (A+1) - (A-1)*cosf(w0) + 2*sqrtf(A)*alpha );
b1 = 2*A*( (A-1) - (A+1)*cosf(w0));
b2 = A*( (A+1) - (A-1)*cosf(w0) - 2*sqrtf(A)*alpha );
a0 = (A+1) + (A-1)*cosf(w0) + 2*sqrtf(A)*alpha;
a1 = -2*( (A-1) + (A+1)*cosf(w0));
a2 = (A+1) + (A-1)*cosf(w0) - 2*sqrtf(A)*alpha;
}
// Store values to coeffs and normalize by 1/a0
coeffs[0] = b0/a0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment