-
Notifications
You must be signed in to change notification settings - Fork 72
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1,280 changed files
with
166,358 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
/* | ||
* PCM time-domain equalizer | ||
* | ||
* Copyright (C) 2002-2006 Felipe Rivera <liebremx at users.sourceforge.net> | ||
* | ||
* 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 | ||
* (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. | ||
* | ||
* 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., 675 Mass Ave, Cambridge, MA 02139, USA. | ||
* | ||
* $Id: eq.c,v 1.12 2006/01/15 00:13:49 liebremx Exp $ | ||
*/ | ||
#include "iir.h" | ||
#include <stdio.h> | ||
#include <string.h> | ||
|
||
#include <math.h> | ||
#include "eq.h" | ||
|
||
static bool on = false; | ||
void init_equliazer(int nBand) | ||
{ | ||
if(nBand != 0 && nBand < EQ_MAX_BANDS) | ||
{ | ||
//nBand = nBand; | ||
} | ||
else | ||
{ | ||
nBand = 10; | ||
} | ||
init_iir(nBand); | ||
} | ||
|
||
void uninit_equliazer() | ||
{ | ||
clean_history(); | ||
} | ||
|
||
|
||
void set_eq_value(float value, int index, int chn) | ||
{ | ||
/* Map the gain and preamp values */ | ||
if (index >= 0) | ||
{ | ||
set_gain(index, chn, 2.5220207857061455181125E-01 * exp(8.0178361802353992349168E-02 * value) - 2.5220207852836562523180E-01 , value); | ||
} | ||
else | ||
{ | ||
/* -12dB .. 12dB mapping */ | ||
set_preamp(chn, 9.9999946497217584440165E-01 * exp(6.9314738656671842642609E-02 * value) + 3.7119444716771825623636E-07); | ||
} | ||
} | ||
|
||
/* | ||
* The main stuff | ||
*/ | ||
int do_equliazer(short * d, int length, int srate, int nch) | ||
{ | ||
return iir(d, length, srate, nch); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
/* | ||
* PCM time-domain equalizer | ||
* | ||
* Copyright (C) 2002 Felipe Rivera <liebremx at users.sourceforge.net> | ||
* | ||
* 19.08.2002 Initial release for XMMS | ||
* | ||
* | ||
* 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 | ||
* (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. | ||
* | ||
* 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., 675 Mass Ave, Cambridge, MA 02139, USA. | ||
* | ||
* $Id: eq.h,v 1.6 2006/01/15 00:16:08 liebremx Exp $ | ||
*/ | ||
#ifndef EQ_H | ||
#define EQ_H | ||
void init_equliazer(int nBand = 0 ); | ||
void uninit_equliazer() ; | ||
void set_eq_value(float value, int index, int chn); | ||
int do_equliazer(short * d, int length, int srate, int nch); | ||
int get_eq_band_count(); | ||
float get_eq_value(int index , int chn); | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
/* | ||
* PCM time-domain equalizer | ||
* | ||
* Copyright (C) 2002-2006 Felipe Rivera <liebremx at users.sourceforge.net> | ||
* | ||
* 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 | ||
* (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. | ||
* | ||
* 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., 675 Mass Ave, Cambridge, MA 02139, USA. | ||
* | ||
* $Id: iir.h,v 1.13 2006/01/15 00:26:32 liebremx Exp $ | ||
*/ | ||
#ifndef IIR_H | ||
#define IIR_H | ||
|
||
#include "iir_cfs.h" | ||
|
||
/* | ||
* Flush-to-zero to avoid flooding the CPU with underflow exceptions | ||
*/ | ||
#ifdef SSE_MATH | ||
#define FTZ 0x8000 | ||
#define FTZ_ON { \ | ||
unsigned int mxcsr; \ | ||
__asm__ __volatile__ ("stmxcsr %0" : "=m" (*&mxcsr)); \ | ||
mxcsr |= FTZ; \ | ||
__asm__ __volatile__ ("ldmxcsr %0" : : "m" (*&mxcsr)); \ | ||
} | ||
#define FTZ_OFF { \ | ||
unsigned int mxcsr; \ | ||
__asm__ __volatile__ ("stmxcsr %0" : "=m" (*&mxcsr)); \ | ||
mxcsr &= ~FTZ; \ | ||
__asm__ __volatile__ ("ldmxcsr %0" : : "m" (*&mxcsr)); \ | ||
} | ||
#else | ||
#define FTZ_ON | ||
#define FTZ_OFF | ||
#endif | ||
|
||
|
||
|
||
typedef double sample_t; | ||
typedef sample_t level_t; | ||
|
||
/* Max bands supported by the code | ||
FIXME: 31 bands processing IS HARD ON THE PROCESSOR | ||
On a PIII@900Mhz I got ~45% of CPU usage | ||
Have to improve the filter implementation | ||
Got it down to ~20% for 31 Bands | ||
Still MMX/3DNow!/SSE whatever, can bring it down */ | ||
#define EQ_MAX_BANDS 32 | ||
/* Number of channels (Stereo) */ | ||
#define EQ_CHANNELS 2 | ||
|
||
#define EXTRA_FILTER true | ||
|
||
/* | ||
* Function prototypes | ||
*/ | ||
void init_iir(int nBand); | ||
void clean_history(); | ||
void set_gain(int index, int chn, double val , float rawValue); | ||
void set_preamp(int chn, double val); | ||
int iir(short * d, int length, int srate, int nch); | ||
//extern sIIRCoefficients *iir_cf; | ||
|
||
|
||
|
||
|
||
#endif /* #define IIR_H */ | ||
|
Oops, something went wrong.