class ComplexFFT

This class represents a tool for Fast Fourier Transformation

Inheritance:

ComplexFFT


Public Classes

enum WindowFunc
windowing functions which can be used.

Public Fields

typedef Complex <Float> ComplexSample
complex type used by the FFT.
typedef vector <ComplexSample> ComplexWave
vector used by the FFT to store a single "window".
typedef double Float
floating point type used by FFT

Public Methods

size_t bits()
returns the window size in bits
static size_t bitsFor(size_t samples)
calculates the number of bits which is needed to represent the given number of samples
ComplexFFT(const size_t samples, const WindowFunc winFunc = NONE)
creates the tool for the FFT
virtual void fft(ComplexWave& wave)
Here is the real work-horse
virtual void invfft(ComplexWave& wave)
performs the inverse FFT on the given vector
virtual void printOn(ostream& os)
prints the FFT parameter on the given output stream
size_t samples()
returns the window size in samples
virtual void set(const size_t samples, const WindowFunc winFunc)
specifies FFT parameters
WindowFunc windowFunc()
returns the used windowing function
virtual ~ComplexFFT()
destroy the object.

Public

enum WindowFunc
windowing functions which can be used.

Protected Fields

size_t vBits
Number of bits in one "frame".
size_t vSamples
Number of samples in one "frame".
WindowFunc vWindowFunc
Windowing function used by the FFT.

Protected Methods

virtual void init(const size_t samples, const WindowFunc winFunc)
initializer for FFT routines

Private Fields

Float* CosineTable
Table of values used for faster computation.
Float* SineTable
Table of values used for faster computation.
Float* WinTable
Table of values used for faster computation.

Private Methods

void reorder(ComplexWave& wave)
put the samples back in order after the FFT scrambles them
const unsigned int reverse(unsigned int val)
bit reverser for unsigned ints
void scale(ComplexWave& wave)
scale sampled values
void unwindow(ComplexWave& wave)
undo the window function to restore full magnitude
void window(ComplexWave& wave)
apply some windowing function to the samples

Documentation

This class represents a tool for Fast Fourier Transformation.
enum WindowFunc
windowing functions which can be used.

typedef double Float
floating point type used by FFT

typedef Complex <Float> ComplexSample
complex type used by the FFT.

typedef vector <ComplexSample> ComplexWave
vector used by the FFT to store a single "window".

ComplexFFT(const size_t samples, const WindowFunc winFunc = NONE)
creates the tool for the FFT.
Parameters:
samples - specifies the used window size
winFunc - specifies the windowing function

virtual ~ComplexFFT()
destroy the object.

virtual void set(const size_t samples, const WindowFunc winFunc)
specifies FFT parameters. This method can be used to change the window size or the windowing function after the tool was created.
Parameters:
samples - specifies the used window size
winFunc - specifies the windowing function

virtual void fft(ComplexWave& wave)
Here is the real work-horse. It's a generic FFT, so nothing is lost or approximated. The samples in wave should be in order, and they will be decimated when fft() returns.
Parameters:
wave - vector containing samples (time domain of a signal)

virtual void invfft(ComplexWave& wave)
performs the inverse FFT on the given vector. The values in wave should be in order, and they will be decimated when invfft() returns.
Parameters:
vector - containg the frequency domain of a signal

size_t bits()
returns the window size in bits. samples = pow(2, bits).
Returns:
window size in bits

size_t samples()
returns the window size in samples. samples = pow(2, bits).
Returns:
window size in samples.

WindowFunc windowFunc()
returns the used windowing function.
Returns:
kind of windowing function

static size_t bitsFor(size_t samples)
calculates the number of bits which is needed to represent the given number of samples. bits = Max { x | pow(2,x) <= samples }
Returns:
number of bits needed
Parameters:
samples - number of samples

virtual void printOn(ostream& os)
prints the FFT parameter on the given output stream.
Parameters:
os - output stream

virtual void init(const size_t samples, const WindowFunc winFunc)
initializer for FFT routines. Currently only sets up tables. Generates scaled lookup tables for sin() and cos(). Fills a table for a window function; possible windows: Hamming, Hanning, None
Throws:
Exception , if memory allocation fails
Parameters:
samples - specifies the used window size
winFunc - specifies the windowing function

size_t vBits
Number of bits in one "frame".

size_t vSamples
Number of samples in one "frame".

WindowFunc vWindowFunc
Windowing function used by the FFT.

const unsigned int reverse(unsigned int val)
bit reverser for unsigned ints. Reverses 'bits' bits.

void reorder(ComplexWave& wave)
put the samples back in order after the FFT scrambles them. (Decimation-in-frequecy)

void scale(ComplexWave& wave)
scale sampled values

void window(ComplexWave& wave)
apply some windowing function to the samples

void unwindow(ComplexWave& wave)
undo the window function to restore full magnitude. Only works if there are NO zeros in WinTable!

Float* SineTable
Table of values used for faster computation.

Float* CosineTable
Table of values used for faster computation.

Float* WinTable
Table of values used for faster computation.


Direct child classes:
LinearFFT
Author:
Silvia Pfeiffer, Peter Tomczyk
Version:
$Id: compfft.h,v 1.6 1998/04/14 10:26:27 tomczyk Exp $

alphabetic index hierarchy of classes


this page has been generated automatically by doc++

(c)opyright by Malte Zöckler, Roland Wunderling
contact: doc++@zib.de