kendryte / kendryte-standalone-sdk

Standalone SDK for kendryte K210
https://kendryte.com
Apache License 2.0
440 stars 161 forks source link

FFT数据结构体是否有误? #138

Open TheOnlyoe opened 1 year ago

TheOnlyoe commented 1 year ago

BUG REPORT

FFT数据结构体实部与虚部顺序不对应

根据寄存器手册,SDK中的数据模式为64bit,虚实交替(RIRI),但是fft.h中的结构题定义顺序确是(IRIR),在虽然不影响FFT对结果影响不大,因为大多数应用中会对结果求绝对值,但是如果进行IFFT,则无法恢复成原始数据。


typedef struct _complex_hard
{
    int16_t real;
    int16_t imag;
} complex_hard_t;

typedef struct _fft_data
{
    int16_t I1;
    int16_t R1;
    int16_t I2;
    int16_t R2;
} fft_data_t;```

### Actual behavior
在交换fft_data_t结构体中虚实顺序为RIRI后,可以正常IFFT可以正常恢复到原始数据