FFTReal.h

Go to the documentation of this file.
00001 /*****************************************************************************
00002 *                                                                            *
00003 *       DIGITAL SIGNAL PROCESSING TOOLS                                      *
00004 *       Version 1.01, 1999/11/07                                             *
00005 *       (c) 1999 - Laurent de Soras                                          *
00006 *                                                                            *
00007 *       FFTReal.h                                                            *
00008 *       Fourier transformation of real number arrays.                        *
00009 *       Portable ISO C++                                                     *
00010 *                                                                            *
00011 * Tab = 3                                                                    *
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 /*\\\ PUBLIC \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
00029 
00030 public:
00031     /* Change this typedef to use a different floating point type in your FFTs
00032         (i.e. float, double or long double). */
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 /*\\\ PRIVATE \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
00042 
00043 private:
00044 
00045     /* Bit-reversed look-up table nested class */
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     /* Trigonometric look-up table nested class */
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 /*\\\ FORBIDDEN MEMBER FUNCTIONS \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
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     LEGAL
00096 
00097     Source code may be freely used for any purpose, including commercial
00098     applications. Programs must display in their "About" dialog-box (or
00099     documentation) a text telling they use these routines by Laurent de Soras.
00100     Modified source code can be distributed, but modifications must be clearly
00101     indicated.
00102 
00103     CONTACT
00104 
00105     Laurent de Soras
00106     92 avenue Albert 1er
00107     92500 Rueil-Malmaison
00108     France
00109 
00110     ldesoras@club-internet.fr
00111 
00112 *****************************************************************************/
00113 
00114 /*\\\ EOF \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/

Generated on Sat Oct 17 14:12:30 2009 for CSL by  doxygen 1.4.5-20051010