Update README.md

This commit is contained in:
lucifetsmith 2019-01-26 11:59:54 +08:00 committed by GitHub
parent 6668a8214b
commit 5ba824ceec
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -2,20 +2,18 @@
KISS FFT - A mixed-radix Fast Fourier Transform based up on the principle, KISS FFT - A mixed-radix Fast Fourier Transform based up on the principle,
"Keep It Simple, Stupid." "Keep It Simple, Stupid."
There are many great fft libraries already around. Kiss FFT is not trying 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, 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 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. incorporated into someone's C program in a few minutes with trivial licensing.
USAGE: ## USAGE:
The basic usage for 1-d complex FFT is: The basic usage for 1-d complex FFT is:
```c
#include "kiss_fft.h" #include "kiss_fft.h"
kiss_fft_cfg cfg = kiss_fft_alloc( nfft ,is_inverse_fft ,0,0 ); kiss_fft_cfg cfg = kiss_fft_alloc( nfft ,is_inverse_fft ,0,0 );
while ... while ...
... // put kth sample in cx_in[k].r and cx_in[k].i ... // put kth sample in cx_in[k].r and cx_in[k].i
@ -25,8 +23,8 @@ USAGE:
... // transformed. DC is in cx_out[0].r and cx_out[0].i ... // transformed. DC is in cx_out[0].r and cx_out[0].i
kiss_fft_free(cfg); kiss_fft_free(cfg);
```
Note: frequency-domain data is stored from dc up to 2pi. - **Note**: frequency-domain data is stored from dc up to 2pi.
so cx_out[0] is the dc bin of the FFT so cx_out[0] is the dc bin of the FFT
and cx_out[nfft/2] is the Nyquist bin (if exists) and cx_out[nfft/2] is the Nyquist bin (if exists)
@ -36,17 +34,17 @@ functions you'll need to use.
Code definitions for 1d complex FFTs are in kiss_fft.c. Code definitions for 1d complex FFTs are in kiss_fft.c.
You can do other cool stuff with the extras you'll find in tools/ You can do other cool stuff with the extras you'll find in tools/
> - multi-dimensional FFTs
* multi-dimensional FFTs > - real-optimized FFTs (returns the positive half-spectrum:
* real-optimized FFTs (returns the positive half-spectrum: (nfft/2+1) complex frequency bins) (nfft/2+1) complex frequency bins)
* fast convolution FIR filtering (not available for fixed point) > - fast convolution FIR filtering (not available for fixed point)
* spectrum image creation > - spectrum image creation
The core fft and most tools/ code can be compiled to use float, double, The core fft and most tools/ code can be compiled to use float, double,
Q15 short or Q31 samples. The default is float. Q15 short or Q31 samples. The default is float.
BACKGROUND: ## BACKGROUND
I started coding this because I couldn't find a fixed point FFT that didn't 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 use assembly code. I started with floating point numbers so I could get the
@ -59,45 +57,44 @@ a well respected and highly optimized fft library. I don't want to criticize
this great library, so let's call it FFT_BRANDX. this great library, so let's call it FFT_BRANDX.
During this process, I learned: During this process, I learned:
1. FFT_BRANDX has more than 100K lines of code. The core of kiss_fft is about 500 lines (cpx 1-d). > 1. FFT_BRANDX has more than 100K lines of code. The core of kiss_fft is about 500 lines (cpx 1-d).
2. It took me an embarrassingly long time to get FFT_BRANDX working. > 2. It took me an embarrassingly long time to get FFT_BRANDX working.
3. A simple program using FFT_BRANDX is 522KB. A similar program using kiss_fft is 18KB (without optimizing for size). > 3. A simple program using FFT_BRANDX is 522KB. A similar program using kiss_fft is 18KB (without optimizing for size).
4. FFT_BRANDX is roughly twice as fast as KISS FFT in default mode. > 4. FFT_BRANDX is roughly twice as fast as KISS FFT in default mode.
It is wonderful that free, highly optimized libraries like FFT_BRANDX exist. 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 But such libraries carry a huge burden of complexity necessary to extract every
last bit of performance. last bit of performance.
Sometimes simpler is better, even if it's not better. **Sometimes simpler is better, even if it's not better.**
FREQUENTLY ASKED QUESTIONS: ## FREQUENTLY ASKED QUESTIONS:
Q: Can I use kissfft in a project with a ___ license? > Q: Can I use kissfft in a project with a ___ license?
A: Yes. See LICENSE below. > A: Yes. See LICENSE below.
Q: Why don't I get the output I expect? >Q: Why don't I get the output I expect?
A: The two most common causes of this are > A: The two most common causes of this are
1) scaling : is there a constant multiplier between what you got and what you want? > 1) scaling : is there a constant multiplier between what you got and what you want?
2) mixed build environment -- all code must be compiled with same preprocessor > 2) mixed build environment -- all code must be compiled with same preprocessor
definitions for FIXED_POINT and kiss_fft_scalar > definitions for FIXED_POINT and kiss_fft_scalar
Q: Will you write/debug my code for me? > Q: Will you write/debug my code for me?
A: Probably not unless you pay me. I am happy to answer pointed and topical questions, but > A: Probably not unless you pay me. I am happy to answer pointed and topical questions, but
I may refer you to a book, a forum, or some other resource. > I may refer you to a book, a forum, or some other resource.
PERFORMANCE: ## PERFORMANCE
(on Athlon XP 2100+, with gcc 2.96, float data type) (on Athlon XP 2100+, with gcc 2.96, float data type)
Kiss performed 10000 1024-pt cpx ffts in .63 s of cpu time. Kiss performed 10000 1024-pt cpx ffts in .63 s of cpu time.
For comparison, it took md5sum twice as long to process the same amount of data. For comparison, it took md5sum twice as long to process the same amount of data.
Transforming 5 minutes of CD quality audio takes less than a second (nfft=1024). Transforming 5 minutes of CD quality audio takes less than a second (nfft=1024).
DO NOT: **DO NOT:**
... use Kiss if you need the Fastest Fourier Transform in the World - use Kiss if you need the Fastest Fourier Transform in the World
... ask me to add features that will bloat the code - ask me to add features that will bloat the code
UNDER THE HOOD: ## UNDER THE HOOD
Kiss FFT uses a time decimation, mixed-radix, out-of-place FFT. If you give it an input buffer Kiss FFT uses a time decimation, mixed-radix, out-of-place FFT. If you give it an input buffer
and output buffer that are the same, a temporary buffer will be created to hold the data. and output buffer that are the same, a temporary buffer will be created to hold the data.
@ -116,18 +113,18 @@ UNDER THE HOOD:
The fast convolution filtering uses the overlap-scrap method, slightly The fast convolution filtering uses the overlap-scrap method, slightly
modified to put the scrap at the tail. modified to put the scrap at the tail.
LICENSE: ## LICENSE
Revised BSD License, see COPYING for verbiage. Revised BSD License, see COPYING for verbiage.
Basically, "free to use&change, give credit where due, no guarantees" Basically, "free to use&change, give credit where due, no guarantees"
Note this license is compatible with GPL at one end of the spectrum and closed, commercial software at Note this license is compatible with GPL at one end of the spectrum and closed, commercial software at
the other end. See http://www.fsf.org/licensing/licenses the other end. See http://www.fsf.org/licensing/licenses
TODO: ## TODO
*) Add real optimization for odd length FFTs - Add real optimization for odd length FFTs
*) Document/revisit the input/output fft scaling - Document/revisit the input/output fft scaling
*) Make doc describing the overlap (tail) scrap fast convolution filtering in kiss_fastfir.c - Make doc describing the overlap (tail) scrap fast convolution filtering in kiss_fastfir.c
*) Test all the ./tools/ code with fixed point (kiss_fastfir.c doesn't work, maybe others) - Test all the ./tools/ code with fixed point (kiss_fastfir.c doesn't work, maybe others)
AUTHOR: ## AUTHOR
Mark Borgerding Mark Borgerding
Mark@Borgerding.net Mark@Borgerding.net