Initial import
git-svn-id: http://moon:8086/svn/software/trunk/libsrc/iir@1 b431acfa-c32f-4a4a-93f1-934dc6c82436
This commit is contained in:
@@ -0,0 +1,97 @@
|
||||
/******************************************************************************/
|
||||
/* iir.h */
|
||||
/******************************************************************************/
|
||||
#ifndef IIR_H
|
||||
#define IIR_H
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#ifndef pi
|
||||
#define pi 3.1415926535897932384626433832795
|
||||
#endif
|
||||
|
||||
#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
|
||||
|
||||
|
||||
/******************************************************************************/
|
||||
#ifndef iir_float_t
|
||||
#define iir_float_t float
|
||||
#endif
|
||||
|
||||
typedef struct _sComplex
|
||||
{
|
||||
iir_float_t pRealData, pImagData;
|
||||
} Complex;
|
||||
|
||||
typedef struct _siir_coef_t
|
||||
{
|
||||
|
||||
iir_float_t ak0, ak1, ak2;
|
||||
iir_float_t bk0, bk1, bk2;
|
||||
|
||||
} iir_coef_t;
|
||||
|
||||
typedef struct _siir_state_t
|
||||
{
|
||||
|
||||
iir_float_t xn1, xn2;
|
||||
iir_float_t yn1, yn2;
|
||||
|
||||
} iir_state_t;
|
||||
|
||||
typedef struct _sIIRParam
|
||||
{
|
||||
/* General Params */
|
||||
iir_float_t fg, Qf;
|
||||
|
||||
/* for shelving EQs */
|
||||
iir_float_t beta;
|
||||
|
||||
/* for peaking and shelving EQs */
|
||||
iir_float_t A;
|
||||
}IIRPARAM;
|
||||
|
||||
typedef struct _siir_lin_t
|
||||
{
|
||||
unsigned order;
|
||||
iir_float_t *pX, *pY;
|
||||
} iir_lin_t;
|
||||
|
||||
|
||||
/******************************************************************************/
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
void IIRInit(iir_state_t *pState, unsigned order);
|
||||
int IIRCalcPartFilterCoeff1(iir_coef_t *pCoeff, iir_float_t fa, iir_float_t fg, iir_float_t qp, unsigned filterType);
|
||||
int IIRCalcPartFilterCoeff2(iir_coef_t *pCoeff, iir_float_t A, iir_float_t fa, iir_float_t fg, iir_float_t qp, unsigned filterType);
|
||||
void IIRCalcFilterCoeff(iir_coef_t *pCoeff, iir_float_t fa, iir_float_t fg, iir_float_t q, unsigned order, unsigned filterType);
|
||||
|
||||
iir_float_t IIRBilTrans(iir_float_t fg, iir_float_t fa);
|
||||
iir_float_t IIRCalcQp(unsigned p, unsigned N);
|
||||
void IIR(iir_state_t *pState, iir_coef_t *pCoeff, iir_float_t *xn, iir_float_t *yn, unsigned order, unsigned numPoints);
|
||||
iir_float_t IIRS(iir_state_t *pState, iir_coef_t *pCoeff, iir_float_t xn, unsigned order);
|
||||
|
||||
void IIRSSE(iir_coef_t *pCoeff, iir_float_t *xn, iir_float_t *yn, unsigned order, unsigned numPoints);
|
||||
void IIRPrintCoeff(FILE *pFile, iir_coef_t *pCoeff, unsigned N);
|
||||
void ScaleCoeff(iir_coef_t *pCoeff);
|
||||
iir_float_t MinMag(iir_float_t val1, iir_float_t val2);
|
||||
iir_float_t MaxMag(iir_float_t val1, iir_float_t val2);
|
||||
|
||||
void IIR_lin_init(iir_lin_t *pObj, unsigned order);
|
||||
void IIR_lin_free(iir_lin_t *pObj);
|
||||
iir_float_t IIR_lin_process(iir_lin_t *pObj, iir_float_t *pB, iir_float_t *pA, iir_float_t x);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif // IIR_H
|
||||
/******************************************************************************/
|
||||
Reference in New Issue
Block a user