/*****************************************************************************
* param_eq.c:
*****************************************************************************
- * Copyright © 2006 the VideoLAN team
+ * Copyright © 2006 VLC authors and VideoLAN
* $Id$
*
* Authors: Antti Huovilainen
* Sigmund A. Helberg <dnumgis@videolan.org>
*
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation; either version 2.1 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
*
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
/*****************************************************************************
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
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;