ESP-IDF Firmware
Firmware architecture and call graph
Loading...
Searching...
No Matches
dsps_biquad.h File Reference
#include "dsp_err.h"
#include "dsps_biquad_platform.h"
Include dependency graph for dsps_biquad.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define dsps_biquad_f32   dsps_biquad_f32_ansi
#define dsps_biquad_sf32   dsps_biquad_sf32_ansi

Functions

esp_err_t dsps_biquad_f32_ansi (const float *input, float *output, int len, float *coef, float *w)
 IIR filter.
esp_err_t dsps_biquad_f32_ae32 (const float *input, float *output, int len, float *coef, float *w)
esp_err_t dsps_biquad_f32_aes3 (const float *input, float *output, int len, float *coef, float *w)
esp_err_t dsps_biquad_f32_arp4 (const float *input, float *output, int len, float *coef, float *w)
esp_err_t dsps_biquad_sf32_ansi (const float *input, float *output, int len, float *coef, float *w)
 IIR filter for stereo data.
esp_err_t dsps_biquad_sf32_ae32 (const float *input, float *output, int len, float *coef, float *w)
esp_err_t dsps_biquad_sf32_aes3 (const float *input, float *output, int len, float *coef, float *w)
esp_err_t dsps_biquad_sf32_arp4 (const float *input, float *output, int len, float *coef, float *w)

Macro Definition Documentation

◆ dsps_biquad_f32

#define dsps_biquad_f32   dsps_biquad_f32_ansi

Definition at line 99 of file dsps_biquad.h.

Referenced by audio_read_task(), audio_read_task(), and audio_read_task().

◆ dsps_biquad_sf32

#define dsps_biquad_sf32   dsps_biquad_sf32_ansi

Definition at line 100 of file dsps_biquad.h.

Function Documentation

◆ dsps_biquad_f32_ae32()

esp_err_t dsps_biquad_f32_ae32 ( const float * input,
float * output,
int len,
float * coef,
float * w )

◆ dsps_biquad_f32_aes3()

esp_err_t dsps_biquad_f32_aes3 ( const float * input,
float * output,
int len,
float * coef,
float * w )

◆ dsps_biquad_f32_ansi()

esp_err_t dsps_biquad_f32_ansi ( const float * input,
float * output,
int len,
float * coef,
float * w )

IIR filter.

IIR filter 2nd order direct form II (bi quad) The extension (_ansi) use ANSI C and could be compiled and run on any platform. The extension (_ae32) is optimized for ESP32 chip.

Parameters
[in]inputinput array
outputoutput array
lenlength of input and output vectors
coefarray of coefficients. b0,b1,b2,a1,a2 expected that a0 = 1. b0..b2 - numerator, a0..a2 - denominator
wdelay line w0,w1. Length of 2.
Returns
  • ESP_OK on success
  • One of the error codes from DSP library

Definition at line 19 of file dsps_biquad_f32_ansi.c.

20{
21 for (int i = 0 ; i < len ; i++) {
22 float d0 = input[i] - coef[3] * w[0] - coef[4] * w[1];
23 output[i] = coef[0] * d0 + coef[1] * w[0] + coef[2] * w[1];
24 w[1] = w[0];
25 w[0] = d0;
26 }
27 return ESP_OK;
28}
#define ESP_OK
Definition esp_err.h:23

References ESP_OK.

Referenced by test_iir_biquad().

Here is the caller graph for this function:

◆ dsps_biquad_f32_arp4()

esp_err_t dsps_biquad_f32_arp4 ( const float * input,
float * output,
int len,
float * coef,
float * w )

◆ dsps_biquad_sf32_ae32()

esp_err_t dsps_biquad_sf32_ae32 ( const float * input,
float * output,
int len,
float * coef,
float * w )

◆ dsps_biquad_sf32_aes3()

esp_err_t dsps_biquad_sf32_aes3 ( const float * input,
float * output,
int len,
float * coef,
float * w )

◆ dsps_biquad_sf32_ansi()

esp_err_t dsps_biquad_sf32_ansi ( const float * input,
float * output,
int len,
float * coef,
float * w )

IIR filter for stereo data.

IIR filter 2nd order direct form II (bi quad) The extension (_ansi) use ANSI C and could be compiled and run on any platform. The extension (_ae32) is optimized for ESP32 chip.

Parameters
[in]inputinput array of two channels: L/R/L/R/L/R
outputoutput array of two channels: L/R/L/R/L/R
lennumber of samples in one channel
coefarray of coefficients. b0,b1,b2,a1,a2 expected that a0 = 1. b0..b2 - numerator, a0..a2 - denominator
wdelay line w0,w1,w2,w3. Length of 4. w0,w1 - channel0, w2,w3 - channel1
Returns
  • ESP_OK on success
  • One of the error codes from DSP library

Definition at line 19 of file dsps_biquad_sf32_ansi.c.

20{
21 for (int i = 0 ; i < len ; i++) {
22 float d0 = input[i * 2 + 0] - coef[3] * w[0] - coef[4] * w[1];
23 output[i * 2 + 0] = coef[0] * d0 + coef[1] * w[0] + coef[2] * w[1];
24 w[1] = w[0];
25 w[0] = d0;
26
27 d0 = input[i * 2 + 1] - coef[3] * w[2] - coef[4] * w[3];
28 output[i * 2 + 1] = coef[0] * d0 + coef[1] * w[2] + coef[2] * w[3];
29 w[3] = w[2];
30 w[2] = d0;
31 }
32 return ESP_OK;
33}

References ESP_OK.

◆ dsps_biquad_sf32_arp4()

esp_err_t dsps_biquad_sf32_arp4 ( const float * input,
float * output,
int len,
float * coef,
float * w )