git-svn-id: http://moon:8086/svn/software/trunk/libsrc/iir@1 b431acfa-c32f-4a4a-93f1-934dc6c82436
70 lines
2.1 KiB
Plaintext
Executable File
70 lines
2.1 KiB
Plaintext
Executable File
/******************************************************************************/
|
|
/* iir.h
|
|
/******************************************************************************/
|
|
#ifndef IIR_H
|
|
#define IIR_H
|
|
|
|
#define pi 3.1415926535897932384626433832795
|
|
|
|
#define IIR_FILTERTYPE_UNKNOWN 0x00000000
|
|
#define IIR_FILTERTYPE_LOWPASS 0x00000001
|
|
#define IIR_FILTERTYPE_HIGHPASS 0x00000002
|
|
#define IIR_FILTERTYPE_BANDPASS 0x00000003
|
|
#define IIR_FILTERTYPE_BANDSTOP 0x00000004
|
|
#define IIR_FILTERTYPE_PEAKING 0x00000005
|
|
#define IIR_FILTERTYPE_LOWSHELF 0x00000006
|
|
#define IIR_FILTERTYPE_HIGHSHELF 0x00000007
|
|
|
|
|
|
/******************************************************************************/
|
|
typedef struct _sComplex
|
|
{
|
|
double pRealData, pImagData;
|
|
} Complex;
|
|
|
|
typedef struct _sIIRCoeff
|
|
{
|
|
|
|
double ak0, ak1, ak2;
|
|
double bk0, bk1, bk2;
|
|
double xn1, xn2;
|
|
double yn1, yn2;
|
|
|
|
}IIRCOEFF;
|
|
|
|
typedef struct _sIIRParam
|
|
{
|
|
/* General Params */
|
|
double fg, Qf;
|
|
|
|
/* for shelving EQs */
|
|
double beta;
|
|
|
|
/* for peaking and shelving EQs */
|
|
double A;
|
|
}IIRPARAM;
|
|
|
|
/******************************************************************************/
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
|
|
void IIRInit(struct _sIIRCoeff *pCoeff, unsigned order);
|
|
int IIRCalcPartFilterCoeff1(struct _sIIRCoeff *pCoeff, double fa, double fg, double qp, unsigned filterType);
|
|
int IIRCalcPartFilterCoeff2(struct _sIIRCoeff *pCoeff, double A, double fa, double fg, double qp, unsigned filterType);
|
|
void IIRCalcFilterCoeff(struct _sIIRCoeff *pCoeff, double fa, double fg, double q, unsigned order, unsigned filterType);
|
|
|
|
double IIRBilTrans(double fg, double fa);
|
|
double IIRCalcQp(unsigned p, unsigned N);
|
|
void IIR(struct _sIIRCoeff *pCoeff, double *xn, double *yn, unsigned order, unsigned numPoints);
|
|
void IIRPrintCoeff(FILE *pFile, struct _sIIRCoeff *pCoeff, unsigned N);
|
|
void ScaleCoeff(struct _sIIRCoeff *pCoeff);
|
|
double MinMag(double val1, double val2);
|
|
double MaxMag(double val1, double val2);
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|
|
#endif // IIR_H
|
|
/******************************************************************************/
|