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

Go to the source code of this file.

Macros

#define test_size   128

Functions

void xt_iss_profile_disable ()
void xt_iss_profile_enable ()
bool dsp_is_power_of_two (int x)
 check power of two The function check if the argument is power of 2. The implementation use ANSI C and could be compiled and run on any platform
int dsp_power_of_two (int x)
 Power of two The function return power of 2 for values 2^N. The implementation use ANSI C and could be compiled and run on any platform.
void test_fft2r ()

Variables

static float data [128 *2]
static float check_data [128 *2]
static float data_test [128 *2]

Macro Definition Documentation

◆ test_size

#define test_size   128

Definition at line 32 of file test_fft2r.c.

Function Documentation

◆ dsp_is_power_of_two()

bool dsp_is_power_of_two ( int x)

check power of two The function check if the argument is power of 2. The implementation use ANSI C and could be compiled and run on any platform

Returns
  • true if x is power of two
  • false if no

Definition at line 16 of file test_fft2r.c.

17{
18 return (x != 0) && ((x & (x - 1)) == 0);
19}
float x[1024]
Definition test_fir.c:10

References x.

Referenced by dsps_bit_rev4r_direct_fc32_ansi(), dsps_bit_rev_fc32_ansi(), dsps_bit_rev_sc16_ansi(), dsps_cplx2reC_fc32_ansi(), dsps_cplx2reC_sc16(), dsps_cplx_gen_freq_get(), dsps_cplx_gen_init(), dsps_cplx_gen_phase_get(), dsps_fft2r_fc32_ansi_(), dsps_fft2r_sc16_ansi_(), dsps_gen_bitrev2r_table(), dsps_gen_bitrev4r_table(), dsps_gen_w_r2_fc32(), dsps_gen_w_r2_sc16(), dsps_sfdr_f32(), and dsps_snr_f32().

Here is the caller graph for this function:

◆ dsp_power_of_two()

int dsp_power_of_two ( int x)

Power of two The function return power of 2 for values 2^N. The implementation use ANSI C and could be compiled and run on any platform.

Returns
  • power of two

Definition at line 21 of file test_fft2r.c.

22{
23 for (size_t i = 0; i < 16; i++) {
24 x = x >> 1;
25 if (0 == x) {
26 return i;
27 }
28 }
29 return 0;
30}

References x.

Referenced by dsps_bit_rev4r_direct_fc32_ansi(), dsps_cplx2real_sc16_ansi(), dsps_fft2r_init_fc32(), dsps_fft4r_fc32_ansi_(), dsps_fft4r_init_fc32(), and dsps_gen_bitrev4r_table().

Here is the caller graph for this function:

◆ test_fft2r()

void test_fft2r ( )

Definition at line 38 of file test_fft2r.c.

39{
40
41 int N = sizeof(data) / sizeof(float) / 2;
42 int check_bin = 32;
43 float check_ampl = 2000;
44 for (int i = 0 ; i < N ; i++) {
45 data[i * 2 + 0] = check_ampl * sinf(M_PI / N * check_bin * 2 * i) / (N / 2);
46 data[i * 2 + 1] = 2;
47 }
48 for (int i = 0 ; i < N * 2 ; i++) {
49 check_data[i] = data[i];
50 data_test[i] = -1;
51 }
52
53 // Init FFT tables
54 esp_err_t ret = dsps_fft2r_init_fc32(NULL, 4096);
55 TEST_ESP_OK(ret);
56 int N_check = N;
57 // table = (uint16_t *)dsps_fft2r_rev_tables_fc32[6];
58 // table_size = dsps_fft2r_rev_tables_fc32_size[6];
59
61 dsps_fft2r_fc32(data, N_check);
62// dsps_bit_rev_lookup_fc32_ae32(data, N_check, dsps_fft2r_rev_tables_fc32[6]);
64// dsps_bit_rev_lookup_fc32_ae32(data, N_check, dsps_fft2r_rev_tables_fc32[6]);
66
67 for (int i = 0 ; i < N_check ; i++) {
68 if (abs(check_data[i] - data[i]) == 0) {
69 printf("Data[%i] =%8.4f, %8.4f, %f \n", i, data[i], check_data[i], check_data[i] - data[i]);
70 } else {
71 printf("ERROR: Data[%i] =%f, %f, %f \n", i, data[i], check_data[i], check_data[i] - data[i]);
72 }
73 }
74
75
76 printf("Test Pass!\n");
77}
esp_err_t dsps_fft2r_fc32_aes3_(float *data, int N, float *w)
#define dsps_fft2r_fc32
Definition dsps_fft2r.h:248
float * dsps_fft_w_table_fc32
esp_err_t dsps_fft2r_init_fc32(float *fft_table_buff, int table_size)
init fft tables
int esp_err_t
Definition esp_err.h:21
#define M_PI
Definition esp_err.h:26
void xt_iss_profile_disable()
static float data[128 *2]
Definition test_fft2r.c:34
static float data_test[128 *2]
Definition test_fft2r.c:36
static float check_data[128 *2]
Definition test_fft2r.c:35
void xt_iss_profile_enable()
#define N
Definition test_mmult.c:13

References check_data, data, data_test, dsps_fft2r_fc32, dsps_fft2r_fc32_aes3_(), dsps_fft2r_init_fc32(), dsps_fft_w_table_fc32, M_PI, N, xt_iss_profile_disable(), and xt_iss_profile_enable().

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_fft2r(), and test_fir().

Here is the caller graph for this function:

◆ xt_iss_profile_enable()

void xt_iss_profile_enable ( )
extern

Referenced by test_fft2r(), and test_fir().

Here is the caller graph for this function:

Variable Documentation

◆ check_data

float check_data[128 *2]
static

Definition at line 35 of file test_fft2r.c.

Referenced by test_fft2r().

◆ data

◆ data_test

float data_test[128 *2]
static

Definition at line 36 of file test_fft2r.c.

Referenced by test_fft2r().