22 bool begin(
int len)
override {
25 p_data =
new float[len*2];
27 LOGE(
"not enough memory");
30 assert(p_data!=
nullptr);
31 ret = dsps_fft2r_init_fc32(NULL, CONFIG_DSP_MAX_FFT_SIZE);
33 LOGE(
"dsps_fft2r_init_fc32 %d", ret);
35 return p_data!=
nullptr && ret == ESP_OK;
39 dsps_fft2r_deinit_fc32();
48 p_data[idx*2] = value;
49 p_data[idx*2 + 1] = 0.0f;
53 float getValue(
int idx)
override {
return p_data[idx * 2]; }
56 ret = dsps_fft2r_fc32(p_data, len);
58 LOGE(
"dsps_fft2r_fc32 %d", ret);
61 ret = dsps_bit_rev_fc32(p_data, len);
63 LOGE(
"dsps_bit_rev_fc32 %d", ret);
66 ret = dsps_cplx2reC_fc32(p_data, len);
68 LOGE(
"dsps_cplx2reC_fc32 %d", ret);
74 ret = dsps_fft2r_fc32(p_data, len);
76 LOGE(
"dsps_fft2r_fc32 %d", ret);
80 ret = dsps_bit_rev_fc32(p_data, len);
82 LOGE(
"dsps_bit_rev_fc32 %d", ret);
85 ret = dsps_cplx2reC_fc32(p_data, len);
87 LOGE(
"dsps_cplx2reC_fc32 %d", ret);
93 for (
int j=0;j<len;j++){
106 return (p_data[idx*2] * p_data[idx*2] + p_data[idx*2+1] * p_data[idx*2+1]);
108 bool setBin(
int pos,
float real,
float img)
override {
109 if (pos>=len)
return false;
110 p_data[pos*2] = real;
111 p_data[pos*2+1] = img;
118 if (pos>=len)
return false;
119 bin.real = p_data[pos*2];
120 bin.img = p_data[pos*2+1];
126 bool isValid()
override{
return p_data!=
nullptr && ret==ESP_OK; }
129 float *p_data =
nullptr;
145 return driverEx()->p_data;