kfrlib / kfr

Fast, modern C++ DSP framework, FFT, Sample Rate Conversion, FIR/IIR/Biquad Filters (SSE, AVX, AVX-512, ARM NEON)
https://www.kfrlib.com
GNU General Public License v2.0
1.62k stars 248 forks source link

Minimum dft size #195

Closed xkzl closed 9 months ago

xkzl commented 9 months ago

Hello @dancazarin

Sorry for the silly question.. but sometimes my programs are crashing because of an unexpected DFT plan size. Sometimes my input are just 0,1,2 bins due to recording process. I know I could handle that by myself, but just for generalization purpose, is there a way KFR could handle DFT with N = 1 and N = 2 internally ?

At this time.. I noticed: For complex to complex, the smallest plan is N = 2 For complex to real it is N = 4.

Actually, scipy and some others just handle well these cases down to N = 0.. It would make users more confident using KFR.

dancazarin commented 9 months ago

Just arrived in dev branch. Will be moved to main once full tests complete. The only requirement now is that real DFT should have even size. This requirement is protected by throwing an exception (can be disabled) in case odd size is passed to dft_real_plan.