DSP
1.1.0
|
00001 #ifndef FFTPRIVATE_H 00002 #define FFTPRIVATE_H 00003 00004 #include <QObject> 00005 #include "DSP.h" 00006 00007 //class FFT; 00008 00009 /***************************************************************************** 00010 * * 00011 * DIGITAL SIGNAL PROCESSING TOOLS * 00012 * Version 1.03, 2001/06/15 * 00013 * (c) 1999 - Laurent de Soras * 00014 * * 00015 * FFTPrivate.h * 00016 * Fourier transformation of real number arrays. * 00017 * Portable ISO C++ * 00018 * * 00019 * Tab = 3 * 00020 *****************************************************************************/ 00021 00022 #if defined (FFTPrivate_CURRENT_HEADER) 00023 #error Recursive inclusion of FFTPrivate header file. 00024 #endif 00025 #define FFTPrivate_CURRENT_HEADER 00026 00027 #if ! defined (FFTPrivate_HEADER_INCLUDED) 00028 #define FFTPrivate_HEADER_INCLUDED 00029 00030 #if defined (_MSC_VER) 00031 #pragma pack (push, 8) 00032 #endif // _MSC_VER 00033 00034 class FFTPrivate : public QObject 00035 { 00036 Q_OBJECT 00037 00038 public: 00039 00040 // Change this typedef to use a different floating point type in your FFTs 00041 // (i.e. float, double or long double). 00042 typedef float flt_t; 00043 //typedef TReal flt_t; 00044 00045 explicit FFTPrivate (const long length, DSP::FFT* aPublicAPI = 0); 00046 ~FFTPrivate (); 00047 void do_fft (flt_t f [], const flt_t x []) const; 00048 void do_ifft (const flt_t f [], flt_t x []) const; 00049 void rescale (flt_t x []) const; 00050 00051 00052 00053 /*\\\ PRIVATE \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 00054 00055 private: 00056 00057 /* Bit-reversed look-up table nested class */ 00058 class BitReversedLUT 00059 { 00060 public: 00061 explicit BitReversedLUT (const int nbr_bits); 00062 ~BitReversedLUT (); 00063 const long * get_ptr () const 00064 { 00065 return (_ptr); 00066 } 00067 private: 00068 long * _ptr; 00069 }; 00070 00071 /* Trigonometric look-up table nested class */ 00072 class TrigoLUT 00073 { 00074 public: 00075 explicit TrigoLUT (const int nbr_bits); 00076 ~TrigoLUT (); 00077 const flt_t * get_ptr (const int level) const 00078 { 00079 return (_ptr + (1L << (level - 1)) - 4); 00080 }; 00081 private: 00082 flt_t * _ptr; 00083 }; 00084 00085 const BitReversedLUT _bit_rev_lut; 00086 const TrigoLUT _trigo_lut; 00087 const flt_t _sqrt2_2; 00088 const long _length; 00089 const int _nbr_bits; 00090 flt_t * _buffer_ptr; 00091 00092 00093 00094 /*\\\ FORBIDDEN MEMBER FUNCTIONS \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 00095 00096 private: 00097 00098 FFTPrivate (const FFTPrivate &other); 00099 const FFTPrivate& operator = (const FFTPrivate &other); 00100 int operator == (const FFTPrivate &other); 00101 int operator != (const FFTPrivate &other); 00102 00103 private: 00104 DSP::FFT* d; 00105 friend class DSP::FFT; 00106 00107 }; 00108 00109 00110 00111 #if defined (_MSC_VER) 00112 #pragma pack (pop) 00113 #endif // _MSC_VER 00114 00115 00116 00117 #endif // FFTPrivate_HEADER_INCLUDED 00118 00119 #undef FFTPrivate_CURRENT_HEADER 00120 00121 00122 00123 /***************************************************************************** 00124 00125 LEGAL 00126 00127 Source code may be freely used for any purpose, including commercial 00128 applications. Programs must display in their "About" dialog-box (or 00129 documentation) a text telling they use these routines by Laurent de Soras. 00130 Modified source code can be distributed, but modifications must be clearly 00131 indicated. 00132 00133 CONTACT 00134 00135 Laurent de Soras 00136 92 avenue Albert 1er 00137 92500 Rueil-Malmaison 00138 France 00139 00140 ldesoras@club-internet.fr 00141 00142 *****************************************************************************/ 00143 00144 00145 00146 /*\\\ EOF \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 00147 00148 00149 #endif // FFTPRIVATE_H