ESP-IDF Firmware
Firmware architecture and call graph
Loading...
Searching...
No Matches
dsps_fir_f32_ansi.c File Reference
#include "dsps_fir.h"
Include dependency graph for dsps_fir_f32_ansi.c:

Go to the source code of this file.

Functions

esp_err_t dsps_fir_f32_ansi (fir_f32_t *fir, const float *input, float *output, int len)
 32 bit floating point FIR filter

Function Documentation

◆ dsps_fir_f32_ansi()

esp_err_t dsps_fir_f32_ansi ( fir_f32_t * fir,
const float * input,
float * output,
int len )

32 bit floating point FIR filter

Function implements FIR filter The extension (_ansi) uses ANSI C and could be compiled and run on any platform. The extension (_ae32) is optimized for ESP32 chip.

Parameters
firpointer to fir filter structure, that must be initialized before
[in]inputinput array
[out]outputarray with the result of FIR filter
[in]lenlength of input and result arrays
Returns
  • ESP_OK on success
  • One of the error codes from DSP library

Definition at line 17 of file dsps_fir_f32_ansi.c.

18{
19 for (int i = 0 ; i < len ; i++) {
20 float acc = 0;
21 int coeff_pos = 0;
22 fir->delay[fir->pos] = input[i];
23 fir->pos++;
24 if (fir->pos >= fir->N) {
25 fir->pos = 0;
26 }
27 for (int n = fir->pos; n < fir->N ; n++) {
28 acc += fir->coeffs[coeff_pos++] * fir->delay[n];
29 }
30 for (int n = 0; n < fir->pos ; n++) {
31 acc += fir->coeffs[coeff_pos++] * fir->delay[n];
32 }
33 output[i] = acc;
34 }
35 return ESP_OK;
36}
#define ESP_OK
Definition esp_err.h:23
float * coeffs
Definition dsps_fir.h:30
int pos
Definition dsps_fir.h:33
float * delay
Definition dsps_fir.h:31
#define N
Definition test_mmult.c:13
const int n
Definition test_mmult.c:17

References fir_f32_s::coeffs, fir_f32_s::delay, ESP_OK, fir_f32_s::N, N, n, and fir_f32_s::pos.

Referenced by test_fir().

Here is the caller graph for this function: