Go to file
Mark Borgerding 30c4ee30f5 Dog slow, but does mixed radix!
'make test' output :

### testing SNR for  1024 point FFTs
#### DOUBLE
snr_t2f = 295.52
snr_f2t = 307.98
#### FLOAT
snr_t2f = 144.62
snr_f2t = 143.23
#### SHORT
snr_t2f = -31.515
snr_f2t = -60.836

#### timing 10000 x 1024 point FFTs
#### DOUBLE
Elapsed:0:44.17 user:35.11 sys:0.27
#### FLOAT
Elapsed:0:24.22 user:19.66 sys:0.16
#### SHORT
Elapsed:0:30.39 user:25.07 sys:0.09
2003-10-11 02:21:48 +00:00
test pick the peak frequency from a stereo input 2003-08-14 00:48:51 +00:00
tools broken 2003-08-16 23:40:14 +00:00
COPYING Initial revision 2003-08-09 00:59:17 +00:00
fft.py Dog slow, but does mixed radix! 2003-10-11 02:21:48 +00:00
kiss_fft.c Dog slow, but does mixed radix! 2003-10-11 02:21:48 +00:00
kiss_fft.h took utility/test code out of main source file and moved down to sample_code 2003-08-10 15:39:15 +00:00
Makefile broken 2003-08-16 23:40:14 +00:00
README slight restructuring, clean up 2003-08-09 14:22:30 +00:00

KISS FFT - A power-of-two Fast Fourier Transform based up on the principle, 
"Keep It Simple, Stupid."

    There are many great fft libraries already around.  Kiss FFT is not trying
to be better than any of them.  It only attempts to be a reasonably efficient, 
moderately useful FFT that can use fixed or floating data types and can be 
incorporated into someone's C program in a few minutes with trivial licensing.

USAGE:

    The basic usage is:

        void * cfg = kiss_fft_alloc( nfft ,inverse_fft );
        while ...
            ... // put kth sample in cx_buf_in_out[k].r and cx_buf_in_out[k].i
            kiss_fft( cfg , cx_buf_in_out );
            ... // transformed 
        free(cfg);
        
    Note: frequency-domain data is stored from dc to 2pi.
    so cx_buf_in_out[0] is the dc bin of the FFT
    and cx_buf_in_out[nfft/2] is the Nyquist bin

    Declarations are in "kiss_fft.h", along with a brief description of the 
two functions you'll need to use. Code definitions are in kiss_fft.c, along 
with sample usage code.


    The code can be easily recompiled to work with 16bit fixed point data,
or various floating point types.  The default is float.


BACKGROUND:

    I started coding this because I couldn't find a fixed point FFT that didn't 
use assembly code.  I started with floating point numbers so I could get the 
theory straight before working on fixed point issues.  In the end, I had a 
little bit of code that could be recompiled easily to do ffts with short, float,
or double (other types should be easy too).  

    Once I got my FFT working, I wanted to get some performance numbers against 
a well respected and highly optimized fft library.  I don't want to criticize 
this great library, so let's call it FFT_BRANDX.  
During this process, I learned:

    1. FFT_BRANDX has 500 times as many lines of code as Kiss 
        (and that's just the C code).
    2. It took me an embarrassingly long time to get FFT_BRANDX working.
    3. FFT_BRANDX is almost 3 times faster than Kiss

    It is wonderful that free, highly optimized libraries like FFT_BRANDX exist.
But such libraries carry a huge burden of complexity necessary to extract every 
last bit of performance.  

    Sometimes simpler is better, even if it's not better.

PERFORMANCE:
    (on Athlon XP 2100+, with gcc 2.96, optimization O3, float data type)

    Kiss performed 1000 1024-pt ffts in 110 ms of cpu time (132ms real time). 
    For comparison, it took md5sum 160ms cputime to process the same amount of data

DO NOT:
    ... use Kiss if you need the absolute fastest fft in the world
    ... use Kiss if you need mixed radix FFTs 
    ... ask me to add features that will bloat the code

UNDER THE HOOD:

    Kiss uses a complex-only, frequency decimation, radix 2, in-place FFT. Bit reversed 
addressing is corrected as the last step in the transform.  No scaling is done.

LICENSE:
    BSD, see COPYING for details. Basically, "free to use, give credit where due, no guarantees"

TODO:
    *) Add sample code for parallel ffts (stereo) packed into re,im components of time sequence.
    *) Add simple windowing function, e.g. Hamming : w(i)=.54-.46*cos(2pi*i/(n-1))
    *) Could mixed-radix FFTs be made simple enough to stand by the KISS principle?
    *) Make the fixed point scaling and bit shifts more easily configurable.
    *) Document/revisit the input/output fft scaling
    *) See if the fixed point code can be optimized a little without adding complexity.

AUTHOR:
    Mark Borgerding
    Mark@Borgerding.net