README 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. KISS FFT - A mixed-radix Fast Fourier Transform based up on the principle,
  2. "Keep It Simple, Stupid."
  3. There are many great fft libraries already around. Kiss FFT is not trying
  4. to be better than any of them. It only attempts to be a reasonably efficient,
  5. moderately useful FFT that can use fixed or floating data types and can be
  6. incorporated into someone's C program in a few minutes with trivial licensing.
  7. USAGE:
  8. The basic usage for 1-d complex FFT is:
  9. #include "kiss_fft.h"
  10. kiss_fft_cfg cfg = kiss_fft_alloc( nfft ,is_inverse_fft ,0,0 );
  11. while ...
  12. ... // put kth sample in cx_in[k].r and cx_in[k].i
  13. kiss_fft( cfg , cx_in , cx_out );
  14. ... // transformed. DC is in cx_out[0].r and cx_out[0].i
  15. free(cfg);
  16. Note: frequency-domain data is stored from dc up to 2pi.
  17. so cx_out[0] is the dc bin of the FFT
  18. and cx_out[nfft/2] is the Nyquist bin (if exists)
  19. Declarations are in "kiss_fft.h", along with a brief description of the
  20. functions you'll need to use.
  21. Code definitions for 1d complex FFTs are in kiss_fft.c.
  22. You can do other cool stuff with the extras you'll find in tools/
  23. * multi-dimensional FFTs
  24. * real-optimized FFTs (returns the positive half-spectrum: (nfft/2+1) complex frequency bins)
  25. * fast convolution FIR filtering (not available for fixed point)
  26. * spectrum image creation
  27. The core fft and most tools/ code can be compiled to use float, double,
  28. Q15 short or Q31 samples. The default is float.
  29. FREQUENTLY ASKED QUESTIONS:
  30. Q: Can I use kissfft in a project with a ___ license?
  31. A: Yes. See LICENSE below.
  32. Q: Why don't I get the output I expect?
  33. A: The two most common causes of this are
  34. 1) scaling : is there a constant multiplier between what you got and what you want?
  35. 2) mixed build environment -- all code must be compiled with same preprocessor
  36. definitions for FIXED_POINT and kiss_fft_scalar
  37. PERFORMANCE:
  38. (on Athlon XP 2100+, with gcc 2.96, float data type)
  39. Kiss performed 10000 1024-pt cpx ffts in .63 s of cpu time.
  40. For comparison, it took md5sum twice as long to process the same amount of data.
  41. Transforming 5 minutes of CD quality audio takes less than a second (nfft=1024).
  42. DO NOT:
  43. ... use Kiss if you need the Fastest Fourier Transform in the World
  44. ... ask me to add features that will bloat the code
  45. UNDER THE HOOD:
  46. Kiss FFT uses a time decimation, mixed-radix, out-of-place FFT. If you give it an input buffer
  47. and output buffer that are the same, a temporary buffer will be created to hold the data.
  48. No static data is used. The core routines of kiss_fft are thread-safe (but not all of the tools directory).
  49. No scaling is done for the floating point version (for speed).
  50. Scaling is done both ways for the fixed-point version (for overflow prevention).
  51. Optimized butterflies are used for factors 2,3,4, and 5.
  52. The real (i.e. not complex) optimization code only works for even length ffts. It does two half-length
  53. FFTs in parallel (packed into real&imag), and then combines them via twiddling. The result is
  54. nfft/2+1 complex frequency bins from DC to Nyquist. If you don't know what this means, search the web.
  55. The fast convolution filtering uses the overlap-scrap method, slightly modified to put
  56. the scrap at the tail.
  57. LICENSE:
  58. BSD-3-Clause License, see LICENSE for verbiage.
  59. Basically, "free to use&change, give credit where due, no guarantees"
  60. Note this license is compatible with GPL at one end of the spectrum and closed, commercial software at
  61. the other end. See http://www.fsf.org/licensing/licenses
  62. This fork of the library always requires attribution. Contrary to the original version of the library,
  63. written by a sole developer, no exception to the license is available that allows use without attribution
  64. because of contributed code.
  65. TO-DO:
  66. *) Add real optimization for odd length FFTs
  67. *) Document/revisit the input/output fft scaling
  68. *) Make doc describing the overlap (tail) scrap fast convolution filtering in kiss_fastfir.c
  69. *) Test all the ./tools/ code with fixed point (kiss_fastfir.c doesn't work, maybe others)
  70. AUTHORS:
  71. Mark Borgerding (mark@borgerding.net)
  72. Mark Straver BASc (moonchild@palemoon.org)