git-svn-id: http://moon:8086/svn/software/trunk/libsrc/cfft@1 b431acfa-c32f-4a4a-93f1-934dc6c82436
84 lines
2.6 KiB
C++
Executable File
84 lines
2.6 KiB
C++
Executable File
/***************************************************************************/
|
|
/* FFT.H */
|
|
/* Fast-Fourier-Transformation
|
|
/* Author: Jens Ahrensfeld */
|
|
/* Datum : 24.06.1999 */
|
|
/* letzte Änderung: 09.06.2000 */
|
|
/***************************************************************************/
|
|
/* Tabellen und Funktionen für die FFT */
|
|
/***************************************************************************/
|
|
#ifndef FFT_H
|
|
#define FFT_H
|
|
|
|
#define PI 3.1415926535897932384626433832795
|
|
typedef struct _sCOMPLEX
|
|
{
|
|
double real, imag;
|
|
} COMPLEX;
|
|
|
|
|
|
#ifdef __cplusplus
|
|
class cfft
|
|
{
|
|
public:
|
|
cfft(unsigned);
|
|
~cfft();
|
|
void fft (double*, double*);
|
|
void ifft (double*, double*);
|
|
COMPLEX *pTwiddleTbl;
|
|
|
|
protected:
|
|
unsigned m_numPoints, m_numStages;
|
|
|
|
};
|
|
#endif /* __cplusplus */
|
|
|
|
typedef struct _sFFT
|
|
{
|
|
unsigned m_numPoints, m_numStages;
|
|
COMPLEX *pTwiddleTbl;
|
|
} FFT;
|
|
|
|
typedef struct _sFFT2D
|
|
{
|
|
struct _sFFT *pXfft, *pYfft;
|
|
unsigned m_Nx, m_Ny;
|
|
} FFT2D;
|
|
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif /* __cplusplus */
|
|
|
|
/* DFT functions */
|
|
extern void DFT(double *pDataR, double *pDataI, unsigned N);
|
|
extern void IDFT(double *pDataR, double *pDataI, unsigned N);
|
|
|
|
/* FFT functions */
|
|
extern void FFTinit(FFT *pFFT, unsigned N);
|
|
extern void FFTfree(FFT *pFFT);
|
|
extern void fft (FFT *pFFT, double*, double*);
|
|
extern void ifft (FFT *pFFT, double*, double*);
|
|
extern void FFTCalcTwiddleTable (COMPLEX *pTwfTbl, unsigned numPoints);
|
|
|
|
/* 2D FFT functions */
|
|
extern void FFT2Dinit(struct _sFFT2D *pFFT, unsigned Nx, unsigned Ny);
|
|
extern void FFT2Dfree(struct _sFFT2D *pFFT);
|
|
extern void fft2d(struct _sFFT2D *pFFT, double **ppReal, double **ppImag);
|
|
extern void ifft2d(struct _sFFT2D *pFFT, double **ppReal, double **ppImag);
|
|
|
|
/* Helper functions */
|
|
extern void Scale(double *pRealData, double *pImagData , double scaleFactor, unsigned N);
|
|
extern void Modulus(double *pRealData, double *pImagData, unsigned N);
|
|
extern void Modulus2(double *pRealData, double *pImagData, double *pModulus, unsigned N);
|
|
extern void Hanning (double *pRealData, double *pImagData, unsigned N, unsigned maximum);
|
|
extern double hanning_k (unsigned, unsigned);
|
|
extern double gauss_k(unsigned, unsigned, unsigned);
|
|
extern int BiPower(unsigned int N);
|
|
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif /* __cplusplus */
|
|
|
|
#endif /* FFT_H */
|