ESP-IDF Firmware
Firmware architecture and call graph
Loading...
Searching...
No Matches
test_iir_biquad.c File Reference
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include "dsp_common.h"
#include "dsps_biquad.h"
Include dependency graph for test_iir_biquad.c:

Go to the source code of this file.

Macros

#define N_SAMPLES   1024

Functions

void xt_iss_profile_disable ()
void xt_iss_profile_enable ()
esp_err_t dsps_biquad_f32_aes3 (const float *input, float *output, int len, float *coef, float *w)
void test_iir_biquad ()

Variables

int N = 1024
float d [1024]
float y [1024]
float y_ref [1024]

Macro Definition Documentation

◆ N_SAMPLES

#define N_SAMPLES   1024

Definition at line 10 of file test_iir_biquad.c.

Function Documentation

◆ dsps_biquad_f32_aes3()

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

Referenced by test_iir_biquad().

Here is the caller graph for this function:

◆ test_iir_biquad()

void test_iir_biquad ( )

Definition at line 22 of file test_iir_biquad.c.

23{
24 float coeffs_lpf[5] = {0.073802, 0.147603, 0.073802, -1.250516, 0.545723};
25 float w_lpf[5] = {0, 0};
26 float w_lpf_ref[5] = {0, 0};
27 esp_err_t ret = ESP_OK;
28
29 for (size_t i = 0; i < N; i++) {
30 d[i] = 0;
31 }
32 d[0] = 1;
34 ret = dsps_biquad_f32_ansi(d, y_ref, N, coeffs_lpf, w_lpf_ref);
36 if (ret != ESP_OK) {
37 printf("dsps_biquad_f32 error = %i\n", ret);
38 return;
39 }
41 ret = dsps_biquad_f32_aes3(d, y, N, coeffs_lpf, w_lpf);
43 if (ret != ESP_OK) {
44 printf("dsps_biquad_f32 error = %i\n", ret);
45 return;
46 }
47 for (size_t i = 0; i < N; i++) {
48 if (((y[i] - y_ref[i]) > 0.0000001) || (y[i] - y_ref[i]) < -0.0000001) {
49 printf("ERROR result[%i]: %f, expect = %f, diff=%f\n", i, y[i], y_ref[i], y[i] - y_ref[i]);
50 return;
51
52 }
53 }
54 printf("Test Correct!\n");
55
56}
esp_err_t dsps_biquad_f32_ansi(const float *input, float *output, int len, float *coef, float *w)
IIR filter.
int esp_err_t
Definition esp_err.h:21
#define ESP_OK
Definition esp_err.h:23
float y[1024]
Definition test_fir.c:11
void xt_iss_profile_disable()
float d[1024]
float y_ref[1024]
esp_err_t dsps_biquad_f32_aes3(const float *input, float *output, int len, float *coef, float *w)
void xt_iss_profile_enable()
#define N
Definition test_mmult.c:13

References d, dsps_biquad_f32_aes3(), dsps_biquad_f32_ansi(), ESP_OK, N, xt_iss_profile_disable(), xt_iss_profile_enable(), y, and y_ref.

Referenced by main().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ xt_iss_profile_disable()

void xt_iss_profile_disable ( )
extern

Referenced by test_iir_biquad().

Here is the caller graph for this function:

◆ xt_iss_profile_enable()

void xt_iss_profile_enable ( )
extern

Referenced by test_iir_biquad().

Here is the caller graph for this function:

Variable Documentation

◆ d

float d[1024]

Definition at line 13 of file test_iir_biquad.c.

Referenced by test_iir_biquad().

◆ N

int N = 1024

Definition at line 11 of file test_iir_biquad.c.

◆ y

float y[1024]

Definition at line 15 of file test_iir_biquad.c.

◆ y_ref

float y_ref[1024]

Definition at line 16 of file test_iir_biquad.c.

Referenced by test_iir_biquad().