VVSDK  1.0
The VVAmbisonic Library
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 * Tab = 3 *
12 *****************************************************************************/
13 
14 
15 
16 #if defined (FFTReal_CURRENT_HEADER)
17  #error Recursive inclusion of FFTReal header file.
18 #endif
19 #define FFTReal_CURRENT_HEADER
20 
21 #if ! defined (FFTReal_HEADER_INCLUDED)
22 #define FFTReal_HEADER_INCLUDED
23 
24 
25 
26 #if defined (_MSC_VER)
27 #pragma pack (push, 8)
28 #endif // _MSC_VER
29 
30 
31 
32 class FFTReal
33 {
34 
35 /*\\\ PUBLIC \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
36 
37 public:
38 
39  /* Change this typedef to use a different floating point type in your FFTs
40  (i.e. float, double or long double). */
41  typedef double flt_t;
42 
43  explicit FFTReal (const long length);
44  ~FFTReal ();
45  void do_fft (flt_t f [], const flt_t x []) const;
46  void do_ifft (const flt_t f [], flt_t x []) const;
47  void rescale (flt_t x []) const;
48 
49 
50 
51 /*\\\ PRIVATE \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
52 
53 private:
54 
55  /* Bit-reversed look-up table nested class */
56  class BitReversedLUT
57  {
58  public:
59  explicit BitReversedLUT (const int nbr_bits);
60  ~BitReversedLUT ();
61  const long * get_ptr () const
62  {
63  return (_ptr);
64  }
65  private:
66  long * _ptr;
67  };
68 
69  /* Trigonometric look-up table nested class */
70  class TrigoLUT
71  {
72  public:
73  explicit TrigoLUT (const int nbr_bits);
74  ~TrigoLUT ();
75  const flt_t * get_ptr (const int level) const
76  {
77  return (_ptr + (1LL << (level - 1)) - 4);
78  };
79  private:
80  flt_t * _ptr;
81  };
82 
83  const BitReversedLUT _bit_rev_lut;
84  const TrigoLUT _trigo_lut;
85  const flt_t _sqrt2_2;
86  const long _length;
87  const int _nbr_bits;
88  flt_t * _buffer_ptr;
89 
90 
91 
92 /*\\\ FORBIDDEN MEMBER FUNCTIONS \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
93 
94 private:
95 
96  FFTReal (const FFTReal &other);
97  const FFTReal& operator = (const FFTReal &other);
98  int operator == (const FFTReal &other);
99  int operator != (const FFTReal &other);
100 };
101 
102 
103 
104 #if defined (_MSC_VER)
105 #pragma pack (pop)
106 #endif // _MSC_VER
107 
108 
109 
110 #endif // FFTReal_HEADER_INCLUDED
111 
112 #undef FFTReal_CURRENT_HEADER
113 
114 
115 
116 /*****************************************************************************
117 
118  LEGAL
119 
120  Source code may be freely used for any purpose, including commercial
121  applications. Programs must display in their "About" dialog-box (or
122  documentation) a text telling they use these routines by Laurent de Soras.
123  Modified source code can be distributed, but modifications must be clearly
124  indicated.
125 
126  CONTACT
127 
128  Laurent de Soras
129  92 avenue Albert 1er
130  92500 Rueil-Malmaison
131  France
132 
133  ldesoras@club-internet.fr
134 
135 *****************************************************************************/
136 
137 
138 
139 /*\\\ EOF \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
void do_fft(flt_t f[], const flt_t x[]) const
Definition: FFTReal.cpp:86
~FFTReal()
Definition: FFTReal.cpp:65
double flt_t
Definition: FFTReal.h:41
void rescale(flt_t x[]) const
Definition: FFTReal.cpp:473
Definition: FFTReal.h:32
FFTReal(const long length)
Definition: FFTReal.cpp:43
void do_ifft(const flt_t f[], flt_t x[]) const
Definition: FFTReal.cpp:275