FFTReal.h Example File
demos/spectrum/3rdparty/fftreal/FFTReal.h
#if ! defined (FFTReal_HEADER_INCLUDED)
#define FFTReal_HEADER_INCLUDED
#if defined (_MSC_VER)
#pragma once
#pragma warning (4 : 4250) // "Inherits via dominance."
#endif
#include "def.h"
#include "DynArray.h"
#include "OscSinCos.h"
template <class DT>
class FFTReal
{
public:
enum { MAX_BIT_DEPTH = 30 };
typedef DT DataType;
explicit FFTReal (long length);
virtual ~FFTReal () {}
long get_length () const;
void do_fft (DataType f [], const DataType x []) const;
void do_ifft (const DataType f [], DataType x []) const;
void rescale (DataType x []) const;
DataType * use_buffer () const;
protected:
private:
enum { TRIGO_BD_LIMIT = 12 };
typedef OscSinCos <DataType> OscType;
void init_br_lut ();
void init_trigo_lut ();
void init_trigo_osc ();
FORCEINLINE const long *
get_br_ptr () const;
FORCEINLINE const DataType *
get_trigo_ptr (int level) const;
FORCEINLINE long
get_trigo_level_index (int level) const;
inline void compute_fft_general (DataType f [], const DataType x []) const;
inline void compute_direct_pass_1_2 (DataType df [], const DataType x []) const;
inline void compute_direct_pass_3 (DataType df [], const DataType sf []) const;
inline void compute_direct_pass_n (DataType df [], const DataType sf [], int pass) const;
inline void compute_direct_pass_n_lut (DataType df [], const DataType sf [], int pass) const;
inline void compute_direct_pass_n_osc (DataType df [], const DataType sf [], int pass) const;
inline void compute_ifft_general (const DataType f [], DataType x []) const;
inline void compute_inverse_pass_n (DataType df [], const DataType sf [], int pass) const;
inline void compute_inverse_pass_n_osc (DataType df [], const DataType sf [], int pass) const;
inline void compute_inverse_pass_n_lut (DataType df [], const DataType sf [], int pass) const;
inline void compute_inverse_pass_3 (DataType df [], const DataType sf []) const;
inline void compute_inverse_pass_1_2 (DataType x [], const DataType sf []) const;
const long _length;
const int _nbr_bits;
DynArray <long>
_br_lut;
DynArray <DataType>
_trigo_lut;
mutable DynArray <DataType>
_buffer;
mutable DynArray <OscType>
_trigo_osc;
private:
FFTReal ();
FFTReal (const FFTReal &other);
FFTReal & operator = (const FFTReal &other);
bool operator == (const FFTReal &other);
bool operator != (const FFTReal &other);
};
#include "FFTReal.hpp"
#endif // FFTReal_HEADER_INCLUDED