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.64k stars 252 forks source link

Fix bug: incorrect result of real dft when input size != 4N #141

Closed gopher2008 closed 1 year ago

gopher2008 commented 2 years ago

The implementation of real DFT has bug: when input size is even but not equal to 4N, the result is incorrect. This is due to:

  1. incorrect calculation of twiddle factors
  2. to_fmt/from_fmt also needs special process according to csize is even/odd

An new unit test has also been added showing this bug.