Warning, /multimedia/kdenlive/src/lib/external/kiss_fft/README is written in an unsupported language. File is not indexed.
0001 KISS FFT - A mixed-radix Fast Fourier Transform based up on the principle, 0002 "Keep It Simple, Stupid." 0003 0004 There are many great fft libraries already around. Kiss FFT is not trying 0005 to be better than any of them. It only attempts to be a reasonably efficient, 0006 moderately useful FFT that can use fixed or floating data types and can be 0007 incorporated into someone's C program in a few minutes with trivial licensing. 0008 0009 USAGE: 0010 0011 The basic usage for 1-d complex FFT is: 0012 0013 #include "kiss_fft.h" 0014 0015 kiss_fft_cfg cfg = kiss_fft_alloc( nfft ,is_inverse_fft ,0,0 ); 0016 0017 while ... 0018 0019 ... // put kth sample in cx_in[k].r and cx_in[k].i 0020 0021 kiss_fft( cfg , cx_in , cx_out ); 0022 0023 ... // transformed. DC is in cx_out[0].r and cx_out[0].i 0024 0025 free(cfg); 0026 0027 Note: frequency-domain data is stored from dc up to 2pi. 0028 so cx_out[0] is the dc bin of the FFT 0029 and cx_out[nfft/2] is the Nyquist bin (if exists) 0030 0031 Declarations are in "kiss_fft.h", along with a brief description of the 0032 functions you'll need to use. 0033 0034 Code definitions for 1d complex FFTs are in kiss_fft.c. 0035 0036 You can do other cool stuff with the extras you'll find in tools/ 0037 0038 * multi-dimensional FFTs 0039 * real-optimized FFTs (returns the positive half-spectrum: (nfft/2+1) complex frequency bins) 0040 * fast convolution FIR filtering (not available for fixed point) 0041 * spectrum image creation 0042 0043 The core fft and most tools/ code can be compiled to use float, double 0044 or Q15 short samples. The default is float. 0045 0046 0047 BACKGROUND: 0048 0049 I started coding this because I couldn't find a fixed point FFT that didn't 0050 use assembly code. I started with floating point numbers so I could get the 0051 theory straight before working on fixed point issues. In the end, I had a 0052 little bit of code that could be recompiled easily to do ffts with short, float 0053 or double (other types should be easy too). 0054 0055 Once I got my FFT working, I was curious about the speed compared to 0056 a well respected and highly optimized fft library. I don't want to criticize 0057 this great library, so let's call it FFT_BRANDX. 0058 During this process, I learned: 0059 0060 1. FFT_BRANDX has more than 100K lines of code. The core of kiss_fft is about 500 lines (cpx 1-d). 0061 2. It took me an embarrassingly long time to get FFT_BRANDX working. 0062 3. A simple program using FFT_BRANDX is 522KB. A similar program using kiss_fft is 18KB (without optimizing for size). 0063 4. FFT_BRANDX is roughly twice as fast as KISS FFT in default mode. 0064 0065 It is wonderful that free, highly optimized libraries like FFT_BRANDX exist. 0066 But such libraries carry a huge burden of complexity necessary to extract every 0067 last bit of performance. 0068 0069 Sometimes simpler is better, even if it's not better. 0070 0071 FREQUENTLY ASKED QUESTIONS: 0072 Q: Can I use kissfft in a project with a ___ license? 0073 A: Yes. See LICENSE below. 0074 0075 Q: Why don't I get the output I expect? 0076 A: The two most common causes of this are 0077 1) scaling : is there a constant multiplier between what you got and what you want? 0078 2) mixed build environment -- all code must be compiled with same preprocessor 0079 definitions for FIXED_POINT and kiss_fft_scalar 0080 0081 Q: Will you write/debug my code for me? 0082 A: Probably not unless you pay me. I am happy to answer pointed and topical questions, but 0083 I may refer you to a book, a forum, or some other resource. 0084 0085 0086 PERFORMANCE: 0087 (on Athlon XP 2100+, with gcc 2.96, float data type) 0088 0089 Kiss performed 10000 1024-pt cpx ffts in .63 s of cpu time. 0090 For comparison, it took md5sum twice as long to process the same amount of data. 0091 0092 Transforming 5 minutes of CD quality audio takes less than a second (nfft=1024). 0093 0094 DO NOT: 0095 ... use Kiss if you need the Fastest Fourier Transform in the World 0096 ... ask me to add features that will bloat the code 0097 0098 UNDER THE HOOD: 0099 0100 Kiss FFT uses a time decimation, mixed-radix, out-of-place FFT. If you give it an input buffer 0101 and output buffer that are the same, a temporary buffer will be created to hold the data. 0102 0103 No static data is used. The core routines of kiss_fft are thread-safe (but not all of the tools directory). 0104 0105 No scaling is done for the floating point version (for speed). 0106 Scaling is done both ways for the fixed-point version (for overflow prevention). 0107 0108 Optimized butterflies are used for factors 2,3,4, and 5. 0109 0110 The real (i.e. not complex) optimization code only works for even length ffts. It does two half-length 0111 FFTs in parallel (packed into real&imag), and then combines them via twiddling. The result is 0112 nfft/2+1 complex frequency bins from DC to Nyquist. If you don't know what this means, search the web. 0113 0114 The fast convolution filtering uses the overlap-scrap method, slightly 0115 modified to put the scrap at the tail. 0116 0117 LICENSE: 0118 Revised BSD License, see COPYING for verbiage. 0119 Basically, "free to use&change, give credit where due, no guarantees" 0120 Note this license is compatible with GPL at one end of the spectrum and closed, commercial software at 0121 the other end. See http://www.fsf.org/licensing/licenses 0122 0123 A commercial license is available which removes the requirement for attribution. Contact me for details. 0124 0125 0126 TODO: 0127 *) Add real optimization for odd length FFTs 0128 *) Document/revisit the input/output fft scaling 0129 *) Make doc describing the overlap (tail) scrap fast convolution filtering in kiss_fastfir.c 0130 *) Test all the ./tools/ code with fixed point (kiss_fastfir.c doesn't work, maybe others) 0131 0132 AUTHOR: 0133 Mark Borgerding 0134 Mark@Borgerding.net