CSL 5.2

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- File List
- File Members

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