37 #define MAX_FILTER_WIDTH 16
53 0.5176f, 1.4142f, 1.9319f,
56 0.4450f, 1.2470f, 1.8019f,
59 0.3902f, 1.1111f, 1.6629f, 1.9616f
87 float f = 1.0f / tanf((
float)M_PI*cutoff*dT);
91 b->
b0 = 1.0f / (1.0f + q*f + f*
f);
92 b->
a1 = 2.0f * (f*f - 1.0f) * b->
b0;
93 b->
a2 = -(1.0f - q*f + f*f) * b->
b0;
111 for(
int i = 2;
i < o;
i++)
117 for(
int i = 0;
i < len;
i++)
154 }
else if(order > 8) order = 8;
172 filter->
order = order;
173 filter->
width = width;
182 if(axis >= filter->
width) {
186 int order = filter->
order;
201 for(
int i = 0;
i < order;
i++)
206 float y = b->
b0 * (sample + 2.0f * s->
x1 + s->
x2) + b->
a1 * s->
y1 + b->
a2 * s->
y2;
223 int order = filter->
order;
226 if(order == 0)
return;
230 for(
int i = 0;
i < filter->
width;
i++)
240 for(
int i = 0;
i < order;
i++)
244 for(
int j = 0;
j < filter->
width;
j++)
248 float y = b->
b0 * (sample[
j] + 2.0f * s->
x1 + s->
x2) + b->
a1 * s->
y1 + b->
a2 * s->
y2;
Main PiOS header to include all the compiled in PiOS options.
struct lpfilter_biquad * biquad[4]
void * PIOS_malloc_no_dma(size_t size)
void lpfilter_run(lpfilter_state_t filter, float *sample)
void lpfilter_construct_single_biquad(struct lpfilter_biquad *b, float cutoff, float dT, float q, uint8_t width)
static const float lpfilter_butterworth_factors[16]
float lpfilter_run_single(lpfilter_state_t filter, uint8_t axis, float sample)
void lpfilter_create(lpfilter_state_t *filter_ptr, float cutoff, float dT, uint8_t order, uint8_t width)
void lpfilter_construct_biquads(lpfilter_state_t filt, float cutoff, float dT, int o, uint8_t width)
struct lpfilter_first_order * first_order
#define PIOS_Assert(test)
struct lpfilter_biquad_state * s