00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014 #if defined (FFTReal_CURRENT_HEADER)
00015 #error Recursive inclusion of FFTReal header file.
00016 #endif
00017 #define FFTReal_CURRENT_HEADER
00018
00019 #if ! defined (FFTReal_HEADER_INCLUDED)
00020 #define FFTReal_HEADER_INCLUDED
00021
00022 #if defined (_MSC_VER)
00023 #pragma pack (push, 8)
00024 #endif // _MSC_VER
00025
00026 class FFTReal {
00027
00028
00029
00030 public:
00031
00032
00033 typedef float flt_t;
00034
00035 explicit FFTReal (const long length);
00036 ~FFTReal ();
00037 void do_fft (flt_t f [], const flt_t x []) const;
00038 void do_ifft (const flt_t f [], flt_t x []) const;
00039 void rescale (flt_t x []) const;
00040
00041
00042
00043 private:
00044
00045
00046 class BitReversedLUT {
00047 public:
00048 explicit BitReversedLUT (const int nbr_bits);
00049 ~BitReversedLUT ();
00050 const long * get_ptr () const {
00051 return (_ptr);
00052 }
00053 private:
00054 long * _ptr;
00055 };
00056
00057
00058 class TrigoLUT {
00059 public:
00060 explicit TrigoLUT (const int nbr_bits);
00061 ~TrigoLUT ();
00062 const flt_t * get_ptr (const int level) const {
00063 return (_ptr + (1L << (level - 1)) - 4);
00064 };
00065 private:
00066 flt_t * _ptr;
00067 };
00068
00069 const BitReversedLUT _bit_rev_lut;
00070 const TrigoLUT _trigo_lut;
00071 const flt_t _sqrt2_2;
00072 const long _length;
00073 const int _nbr_bits;
00074 flt_t * _buffer_ptr;
00075
00076
00077
00078 private:
00079 FFTReal (const FFTReal &other);
00080 const FFTReal& operator = (const FFTReal &other);
00081 int operator == (const FFTReal &other);
00082 int operator != (const FFTReal &other);
00083 };
00084
00085 #if defined (_MSC_VER)
00086 #pragma pack (pop)
00087 #endif // _MSC_VER
00088
00089 #endif // FFTReal_HEADER_INCLUDED
00090
00091 #undef FFTReal_CURRENT_HEADER
00092
00093
00094
00095
00096
00097
00098
00099
00100
00101
00102
00103
00104
00105
00106
00107
00108
00109
00110
00111
00112
00113
00114