80 lines
1.2 KiB
C
80 lines
1.2 KiB
C
|
|
|
|||
|
|
|
|||
|
|
#ifndef __FILTER_H__
|
|||
|
|
#define __FILTER_H__
|
|||
|
|
|
|||
|
|
#include "config.h"
|
|||
|
|
|
|||
|
|
//----------------------------------------------------------
|
|||
|
|
|
|||
|
|
// <20><>λֵƽ<D6B5><C6BD><EFBFBD>˲<EFBFBD><CBB2><EFBFBD>
|
|||
|
|
int MAFilter(int * pBuff, int len);
|
|||
|
|
|
|||
|
|
//----------------------------------------------------------
|
|||
|
|
|
|||
|
|
// <20><>Ȩ<EFBFBD><C8A8><EFBFBD><EFBFBD>ƽ<EFBFBD><C6BD><EFBFBD>˲<EFBFBD><CBB2><EFBFBD>(<28><><EFBFBD><EFBFBD>Ȩֵ)
|
|||
|
|
int WRAFilter(int * pBuff, int len);
|
|||
|
|
|
|||
|
|
//----------------------------------------------------------
|
|||
|
|
|
|||
|
|
// һ<><EFBFBD>ͨ<EFBFBD>˲<EFBFBD>
|
|||
|
|
typedef struct
|
|||
|
|
{
|
|||
|
|
float f1value;
|
|||
|
|
float lowpassxs;
|
|||
|
|
}LPF1stData;
|
|||
|
|
|
|||
|
|
#ifdef _IN_FILTER_C
|
|||
|
|
// <20>ο<EFBFBD>Ĭ<EFBFBD><C4AC>ֵ
|
|||
|
|
const LPF1stData defaultLPF1st =
|
|||
|
|
{
|
|||
|
|
-1,
|
|||
|
|
0.5f,
|
|||
|
|
};
|
|||
|
|
#else
|
|||
|
|
extern const LPF1stData defaultLPF1st;
|
|||
|
|
#endif
|
|||
|
|
|
|||
|
|
int LPF1st(LPF1stData * pLpf1st, int newData);
|
|||
|
|
|
|||
|
|
//----------------------------------------------------------
|
|||
|
|
// <20><><EFBFBD><EFBFBD><EFBFBD>˲<EFBFBD>
|
|||
|
|
typedef struct
|
|||
|
|
{
|
|||
|
|
float f2value;
|
|||
|
|
//
|
|||
|
|
float b0;
|
|||
|
|
float a1;
|
|||
|
|
float a2;
|
|||
|
|
|
|||
|
|
float preout;
|
|||
|
|
float lastout;
|
|||
|
|
}LPF2ndData;
|
|||
|
|
|
|||
|
|
#ifdef _IN_FILTER_C
|
|||
|
|
// <20>ο<EFBFBD>Ĭ<EFBFBD><C4AC>ֵ
|
|||
|
|
// <20><>ֹƵ<D6B9><C6B5>(<28><><EFBFBD><EFBFBD>Ƶ<EFBFBD><C6B5>f0):30Hz <20><><EFBFBD><EFBFBD>Ƶ<EFBFBD><C6B5>fs:500Hz
|
|||
|
|
const LPF2ndData defaultLPF2nd =
|
|||
|
|
{
|
|||
|
|
-1,
|
|||
|
|
0.1883633f,
|
|||
|
|
1.023694f,
|
|||
|
|
0.2120577f,
|
|||
|
|
0,
|
|||
|
|
0,
|
|||
|
|
};
|
|||
|
|
#else
|
|||
|
|
extern const LPF2ndData defaultLPF2nd;
|
|||
|
|
#endif
|
|||
|
|
|
|||
|
|
int LPF2nd(LPF2ndData * pLpf2nd, int newData);
|
|||
|
|
|
|||
|
|
//----------------------------------------------------------
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
#endif
|
|||
|
|
|