git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@13476 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
Michael Jerris 2009-05-27 23:22:15 +00:00
parent 3fb3e146c3
commit 3ab5aa8206
1 changed files with 139 additions and 139 deletions

View File

@ -1,139 +1,139 @@
/***************************************************************************** /*****************************************************************************
* * * *
* DIGITAL SIGNAL PROCESSING TOOLS * * DIGITAL SIGNAL PROCESSING TOOLS *
* Version 1.03, 2001/06/15 * * Version 1.03, 2001/06/15 *
* (c) 1999 - Laurent de Soras * * (c) 1999 - Laurent de Soras *
* * * *
* FFTReal.h * * FFTReal.h *
* Fourier transformation of real number arrays. * * Fourier transformation of real number arrays. *
* Portable ISO C++ * * Portable ISO C++ *
* * * *
* Tab = 3 * * Tab = 3 *
*****************************************************************************/ *****************************************************************************/
#if defined (FFTReal_CURRENT_HEADER) #if defined (FFTReal_CURRENT_HEADER)
#error Recursive inclusion of FFTReal header file. #error Recursive inclusion of FFTReal header file.
#endif #endif
#define FFTReal_CURRENT_HEADER #define FFTReal_CURRENT_HEADER
#if ! defined (FFTReal_HEADER_INCLUDED) #if ! defined (FFTReal_HEADER_INCLUDED)
#define FFTReal_HEADER_INCLUDED #define FFTReal_HEADER_INCLUDED
#if defined (_MSC_VER) #if defined (_MSC_VER)
#pragma pack (push, 8) #pragma pack (push, 8)
#endif // _MSC_VER #endif // _MSC_VER
class FFTReal class FFTReal
{ {
/*\\\ PUBLIC \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ /*\\\ PUBLIC \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
public: public:
/* Change this typedef to use a different floating point type in your FFTs /* Change this typedef to use a different floating point type in your FFTs
(i.e. float, double or long double). */ (i.e. float, double or long double). */
typedef float flt_t; typedef float flt_t;
explicit FFTReal (const long length); explicit FFTReal (const long length);
~FFTReal (); ~FFTReal ();
void do_fft (flt_t f [], const flt_t x []) const; void do_fft (flt_t f [], const flt_t x []) const;
void do_ifft (const flt_t f [], flt_t x []) const; void do_ifft (const flt_t f [], flt_t x []) const;
void rescale (flt_t x []) const; void rescale (flt_t x []) const;
/*\\\ PRIVATE \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ /*\\\ PRIVATE \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
private: private:
/* Bit-reversed look-up table nested class */ /* Bit-reversed look-up table nested class */
class BitReversedLUT class BitReversedLUT
{ {
public: public:
explicit BitReversedLUT (const int nbr_bits); explicit BitReversedLUT (const int nbr_bits);
~BitReversedLUT (); ~BitReversedLUT ();
const long * get_ptr () const const long * get_ptr () const
{ {
return (_ptr); return (_ptr);
} }
private: private:
long * _ptr; long * _ptr;
}; };
/* Trigonometric look-up table nested class */ /* Trigonometric look-up table nested class */
class TrigoLUT class TrigoLUT
{ {
public: public:
explicit TrigoLUT (const int nbr_bits); explicit TrigoLUT (const int nbr_bits);
~TrigoLUT (); ~TrigoLUT ();
const flt_t * get_ptr (const int level) const const flt_t * get_ptr (const int level) const
{ {
return (_ptr + (1L << (level - 1)) - 4); return (_ptr + (1L << (level - 1)) - 4);
}; };
private: private:
flt_t * _ptr; flt_t * _ptr;
}; };
const BitReversedLUT _bit_rev_lut; const BitReversedLUT _bit_rev_lut;
const TrigoLUT _trigo_lut; const TrigoLUT _trigo_lut;
const flt_t _sqrt2_2; const flt_t _sqrt2_2;
const long _length; const long _length;
const int _nbr_bits; const int _nbr_bits;
flt_t * _buffer_ptr; flt_t * _buffer_ptr;
/*\\\ FORBIDDEN MEMBER FUNCTIONS \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ /*\\\ FORBIDDEN MEMBER FUNCTIONS \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
private: private:
FFTReal (const FFTReal &other); FFTReal (const FFTReal &other);
const FFTReal& operator = (const FFTReal &other); const FFTReal& operator = (const FFTReal &other);
int operator == (const FFTReal &other); int operator == (const FFTReal &other);
int operator != (const FFTReal &other); int operator != (const FFTReal &other);
}; };
#if defined (_MSC_VER) #if defined (_MSC_VER)
#pragma pack (pop) #pragma pack (pop)
#endif // _MSC_VER #endif // _MSC_VER
#endif // FFTReal_HEADER_INCLUDED #endif // FFTReal_HEADER_INCLUDED
#undef FFTReal_CURRENT_HEADER #undef FFTReal_CURRENT_HEADER
/***************************************************************************** /*****************************************************************************
LEGAL LEGAL
Source code may be freely used for any purpose, including commercial Source code may be freely used for any purpose, including commercial
applications. Programs must display in their "About" dialog-box (or applications. Programs must display in their "About" dialog-box (or
documentation) a text telling they use these routines by Laurent de Soras. documentation) a text telling they use these routines by Laurent de Soras.
Modified source code can be distributed, but modifications must be clearly Modified source code can be distributed, but modifications must be clearly
indicated. indicated.
CONTACT CONTACT
Laurent de Soras Laurent de Soras
92 avenue Albert 1er 92 avenue Albert 1er
92500 Rueil-Malmaison 92500 Rueil-Malmaison
France France
ldesoras@club-internet.fr ldesoras@club-internet.fr
*****************************************************************************/ *****************************************************************************/
/*\\\ EOF \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ /*\\\ EOF \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/