ESP-IDF Firmware
Firmware architecture and call graph
Loading...
Searching...
No Matches
test_fir.c
Go to the documentation of this file.
1#include <stdio.h>
2#include <stdlib.h>
3#include <string.h>
4#include <math.h>
5
6#include "dsp_common.h"
7
8#include "dsps_fir.h"
9
10float x[1024];
11float y[1024];
12float y_compare[1024];
13
14float coeffs[256];
15float delay[256];
16float delay_compare[256];
17
18
20{
21 int len = sizeof(x) / sizeof(float);
22 int fir_len = sizeof(coeffs) / sizeof(float);
23
24 fir_f32_t fir1;
25 fir_f32_t fir2;
26 for (int i = 0 ; i < fir_len ; i++) {
27 coeffs[i] = i;
28 }
29
30 for (int i = 0 ; i < len ; i++) {
31 x[i] = 0;
32 }
33 x[0] = 1;
34
35 for (int i = 0 ; i < fir_len ; i++) {
36 coeffs[i] = i;
37 }
38
39 for (int i = 0 ; i < len ; i++) {
40 x[i] = i;
41 }
42 x[0] = 1;
43 dsps_fir_init_f32(&fir1, coeffs, delay, fir_len / 4);
44 dsps_fir_init_f32(&fir2, coeffs, delay_compare, fir_len);
45
47 dsps_fir_f32_aes3(&fir1, x, y, len);
48 dsps_fir_f32_ansi(&fir2, x, y_compare, len);
50
51 printf("Test Pass!\n");
52}
struct fir_f32_s fir_f32_t
Data struct of f32 fir filter.
esp_err_t dsps_fir_f32_aes3(fir_f32_t *fir, const float *input, float *output, int len)
esp_err_t dsps_fir_f32_ansi(fir_f32_t *fir, const float *input, float *output, int len)
32 bit floating point FIR filter
esp_err_t dsps_fir_init_f32(fir_f32_t *fir, float *coeffs, float *delay, int coeffs_len)
initialize structure for 32 bit FIR filter
void xt_iss_profile_disable()
void xt_iss_profile_enable()
float y_compare[1024]
Definition test_fir.c:12
float y[1024]
Definition test_fir.c:11
void test_fir()
Definition test_fir.c:19
float x[1024]
Definition test_fir.c:10
float delay[256]
Definition test_fir.c:15
float coeffs[256]
Definition test_fir.c:14
float delay_compare[256]
Definition test_fir.c:16