CSL  6.0
FFTReal.h
Go to the documentation of this file.
1 /*****************************************************************************
2 * *
3 * DIGITAL SIGNAL PROCESSING TOOLS *
4 * Version 1.01, 1999/11/07 *
5 * (c) 1999 - Laurent de Soras *
6 * *
7 * FFTReal.h *
8 * Fourier transformation of real number arrays. *
9 * Portable ISO C++ *
10 * *
11 *****************************************************************************/
12 
13 #if defined (FFTReal_CURRENT_HEADER)
14  #error Recursive inclusion of FFTReal header file.
15 #endif
16 #define FFTReal_CURRENT_HEADER
17 
18 #if ! defined (FFTReal_HEADER_INCLUDED)
19 #define FFTReal_HEADER_INCLUDED
20 
21 #if defined (_MSC_VER)
22 #pragma pack (push, 8)
23 #endif // _MSC_VER
24 
25 class FFTReal {
26 
27 /*\\\ PUBLIC \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
28 
29 public:
30  /* Change this typedef to use a different floating point type in your FFTs
31  (i.e. float, double or long double). */
32  typedef float flt_t;
33 
34  explicit FFTReal (const long length);
35  ~FFTReal ();
36  void do_fft (flt_t f [], const flt_t x []) const;
37  void do_ifft (const flt_t f [], flt_t x []) const;
38  void rescale (flt_t x []) const;
39 
40 /*\\\ PRIVATE \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
41 
42 private:
43 
44  /* Bit-reversed look-up table nested class */
46  public:
47  explicit BitReversedLUT (const int nbr_bits);
48  ~BitReversedLUT ();
49  const long * get_ptr () const {
50  return (_ptr);
51  }
52  private:
53  long * _ptr;
54  };
55 
56  /* Trigonometric look-up table nested class */
57  class TrigoLUT {
58  public:
59  explicit TrigoLUT (const int nbr_bits);
60  ~TrigoLUT ();
61  const flt_t * get_ptr (const int level) const {
62  return (_ptr + (1L << (level - 1)) - 4);
63  };
64  private:
65  flt_t * _ptr;
66  };
67 
70  const flt_t _sqrt2_2;
71  const long _length;
72  const int _nbr_bits;
73  flt_t * _buffer_ptr;
74 
75 /*\\\ FORBIDDEN MEMBER FUNCTIONS \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
76 
77 private:
78  FFTReal (const FFTReal &other);
79  const FFTReal& operator = (const FFTReal &other);
80  int operator == (const FFTReal &other);
81  int operator != (const FFTReal &other);
82 };
83 
84 #if defined (_MSC_VER)
85 #pragma pack (pop)
86 #endif // _MSC_VER
87 
88 #endif // FFTReal_HEADER_INCLUDED
89 
90 #undef FFTReal_CURRENT_HEADER
91 
92 /*****************************************************************************
93 
94  LEGAL
95 
96  Source code may be freely used for any purpose, including commercial
97  applications. Programs must display in their "About" dialog-box (or
98  documentation) a text telling they use these routines by Laurent de Soras.
99  Modified source code can be distributed, but modifications must be clearly
100  indicated.
101 
102  CONTACT
103 
104  Laurent de Soras
105  92 avenue Albert 1er
106  92500 Rueil-Malmaison
107  France
108 
109  ldesoras@club-internet.fr
110 
111 *****************************************************************************/
TrigoLUT(const int nbr_bits)
Definition: FFTReal.cpp:524
int operator!=(const FFTReal &other)
void do_fft(flt_t f[], const flt_t x[]) const
Definition: FFTReal.cpp:76
const int _nbr_bits
Definition: FFTReal.h:72
~FFTReal()
Definition: FFTReal.cpp:56
float flt_t
Definition: FFTReal.h:32
const long * get_ptr() const
Definition: FFTReal.h:49
void rescale(flt_t x[]) const
Definition: FFTReal.cpp:458
flt_t * _ptr
Definition: FFTReal.h:63
int operator==(const FFTReal &other)
const long _length
Definition: FFTReal.h:71
const TrigoLUT _trigo_lut
Definition: FFTReal.h:69
const flt_t * get_ptr(const int level) const
Definition: FFTReal.h:61
BitReversedLUT(const int nbr_bits)
Definition: FFTReal.cpp:481
const BitReversedLUT _bit_rev_lut
Definition: FFTReal.h:68
flt_t * _buffer_ptr
Definition: FFTReal.h:73
FFTReal(const long length)
Definition: FFTReal.cpp:36
const flt_t _sqrt2_2
Definition: FFTReal.h:70
const FFTReal & operator=(const FFTReal &other)
void do_ifft(const flt_t f[], flt_t x[]) const
Definition: FFTReal.cpp:263