输入输出的数据如代码注释
fft
// arm cfft, 复数
// float[256] as complex[128] => float[256] as complex[128]
// out:
// DC 0,64's R
// conj 1~63, 65~127
for (int i = 0; i < 128; i++) {
buffer[i * 2] = xn[i].real;
buffer[i * 2 + 1] = xn[i].imaginary;
}
arm_cfft_f32(&arm_cfft_sR_f32_len128, (float*)buffer, 0, 1); // forward FFT
// arm rfft, 实部
// float[128] => float[128] as complex[64]
// out:
// DC 0's R and I
// complex 1~63
for (int i = 0; i < 128; i++) {
buffer[i] = xn[i].real;
}
arm_rfft_fast_f32(&arm_rfft_fast_sR_f32_len128, (float*)buffer, (float*)buffer_out, 0);
ifft
// arm cfft, 复数
// float[256] as complex[128] => float[256] as complex[128]
// in:
// DC 0,64's R
// conj 1~63, 65~127
for (int i = 0; i < 128; i++) {
buffer[i * 2] = xk[i].real;
buffer[i * 2 + 1] = xk[i].imaginary;
}
arm_cfft_f32(&arm_cfft_sR_f32_len128, (float*)buffer, 1, 1); // forward FFT
// arm rfft, 实部
// float[128] => float[128] as complex[64]
// in:
// DC 0's R and I
// complex 1~63
for (int i = 0; i < 128; i++) {
buffer[i * 2] = xk[i].real;
buffer[i * 2 + 1] = xk[i].imaginary;
}
buffer[1] = xk[64].real;
arm_rfft_fast_f32(&arm_rfft_fast_sR_f32_len128, (float*)buffer, (float*)buffer_out, 1);
欢迎阅读更多 BES专栏文章
|