Professional Documents
Culture Documents
FFTReal
Version 2.11
Fourier transformation (FFT, IFFT) library specialised for real data
Portable ISO C++
Copyright (c) 1999-2010 Laurent de Soras
Object Pascal port (c) Frederic Vanmol
==============================================================================
Contents:
1. Legal
2. Content
3. Using FFTReal
3.1 FFTReal - Length fixed at run-time
3.2 FFTRealFixLen - Length fixed at compile-time
3.3 Data organisation
4. Compilation and testing
5. History
6. Contact
1. Legal
-------FFTReal is distributed under the terms of the Do What The Fuck You Want To
Public License.
Check the file license.txt to get full information about the license.
2. Content
---------FFTReal is a library to compute Discrete Fourier Transforms (DFT) with the
FFT algorithm (Fast Fourier Transform) on arrays of real numbers. It can
also compute the inverse transform.
You should find in this
particular interest:
- readme.txt
:
- ffft/FFTReal.h
:
- ffft/FFTRealFixLen.h:
- delphi/FFTReal.pas :
3. Using FFTReal
---------------Important - if you were using older versions of FFTReal (up to 1.03), some
things have changed. FFTReal is now a template. Therefore use FFTReal<float>
#include "ffft/FFTRealFixLen.h"
...
// 1024-point (2^10) FFT object constructed.
ffft::FFTRealFixLen <10> fft_object;
Warning: long FFT objects may take a very long time to compile, depending on
the compiler and its optimisation options. If compilation time is too high,
encapsulate the FFT object in a seprate class whose header doesn't need
to include FFTRealFixLen.h, so you just have to compile the wrapper once
and only link it the other times. For example (quick, dirty and incomplete):
ffft/FFTWrapper.h:
class FFTWrapper
{
public:
FFTWrapper ();
~FFTWrapper ();
void do_fft (...);
void do_ifft (...);
private:
void *_impl_ptr;
}
|
|
|
|
|
|
|
|
|
|
|
|
ffft/FFTWrapper.cpp:
#include "ffft/FFTRealFixLen.h"
#include "ffft/FFTWrapper.h"
FFTWrapper::FFTWrapper ()
: _impl_ptr ((void*) new FTRealFixLen <10>)
{
}
...
length/2-1
length/2
length/2+1
...
length-1
|
|
|
|
|
f
f
f
f
f
[length/2-1]
[length/2]
[length/2-1]
[...]
[1]
|
|
|
|
|
f [length-1]
0
-f [length-1]
-f [...]
-f [length/2+1]
|
|
|
|
|
-f [length-1]
0
f [length-1]
f [...]
f [length/2+1]
f [] coefficients have the same layout for FFT and IFFT functions. You may
notice that scaling must be done if you want to retrieve x after FFT and IFFT.
Actually, IFFT (FFT (x)) = x * length(x). This is a not a problem because
most of the applications don't care about absolute values. Thus, the operation
requires less calculation. If you want to use the FFT and IFFT to transform a
signal, you have to apply post- (or pre-) processing yourself. Multiplying
or dividing floating point numbers by a power of 2 doesn't generate extra
computation noise.
5. History
---------v2.11 (2010.09.12)
- The LGPL was not well suited to 100% template code, therefore I changed
the license again. Everything is released under the WTFPL.
- Removed warnings in the testcode on MSVC++ 8.0
- Fixed the multiple definition linking error with template specialisations
on GCC 4.
v2.10 (2008.05.28)
- Classes are now in the ffft namespace
- Changed directory structure
- Fixed compilation information in the documentation
v2.00 (2005.10.18)
- Turned FFTReal class into template (data type as parameter)
- Added FFTRealFixLen
- Trigonometric tables are size-limited in order to preserve cache memory;
over a given size, sin/cos functions are computed on the fly.
- Better test bench for accuracy and speed
- Changed license to LGPL
v1.03 (2001.06.15)
- Thanks to Frederic Vanmol for the Pascal port (works with Delphi).
- Documentation improvement
v1.02 (2001.03.25)
- sqrt() is now precomputed when the object FFTReal is constructed, resulting
in speed impovement for small size FFT.
v1.01 (2000)
- Small modifications, I don't remember what.
v1.00 (1999.08.14)
- First version released
6. Contact
---------Please address any comment, bug report or flame to:
Laurent de Soras
laurent.de.soras@free.fr
http://ldesoras.free.fr
For the Pascal port:
Frederic Vanmol
frederic@fruityloops.com