I have been recently searching for a viable FFT library for my own development. There are libraries such as the FFTW, but they have their limitations – the GPL licence (General Public). This means, you are unable to use it in your own application unless you reveal the full code as well, which can be quite a limiting factor if you don’t want to reveal something. Then there is an option to buy a licence. But I am really not sure how much that costs. Fortunately, I was thinking of using a different one: Kiss FFT developed by Mark Borgerding. Its a simple library, which really works, unfortunately it was written for C and not for CPP. There is no compatibility with std::complex for example. Not to mention the horrible MACRO’s used everywhere. Another problem comes if you intent to use both double and single precision version. A standard option is to use a template, which is of course not supported.
I have therefore rewritten the core so that it is compatible with CPP and made a few alternations as well:
- Renamed kiss_fft to SwiftKiss.
- To create a plan: SwiftKiss<Type>(int NFFT,bool Inverse)
- FFT Functions are located within the class:
- KissFFT(std::complex<Type> *In,std::complex<Type> *Out);
- StrideKiss(std::complex<Type>*In,std::complex<Type>*Out, int Stride);
As you can see, using the library is incredibly simple. There is however one bad thing: There is no support for multithreading the calculation. I was thinking of using std::async or threadpool, but I believe they will not work because of how the library is written – it uses the pointer arithmetic and I don’t want to go deep into the core as modifying it may result in unworking state of the library. I would normally give it a try, but another problem is that it is recursively implemented – These 2 options (Recursive and Pointer Arithmetic) are really hard to get over, so I am right now thinking of writing my own FFT library.