📄 fft_lib.h
字号:
#ifndef __FFT_LIB
#define __FFT_LIB
#include <stdio.h>
#include <math.h>
#include <memory.h>
#define MAXN 1024
#define PI 3.1416
#define COMPLEX_ADD(c,a,b) \
(c)->real=(a)->real+(b)->real;\
(c)->imag=(a)->imag+(b)->imag;
#define COMPLEX_SUB(c,a,b) \
(c)->real=(a)->real-(b)->real;\
(c)->imag=(a)->imag-(b)->imag;
#define COMPLEX_MUL(c,a,b) \
(c)->real=(a)->real*(b)->real-(a)->imag*(b)->imag;\
(c)->imag=(a)->real*(b)->imag+(a)->imag*(b)->real;
#define COMPLEX_ASG(a,b)\
(a)->real=(b)->real;\
(a)->imag=(b)->imag;
#define COMPLEX_INIT(c,a,b)\
(c)->real=(a);\
(c)->imag=(b);
#define COMPLEX_CONJ(a,b)\
(a)->real=(b)->real;\
(a)->imag=-(b)->imag;
typedef struct _COMPLEX{
double real;
double imag;
}*PCOMPLEX,COMPLEX;
#ifdef __cplusplus
extern "C"{
#endif
int LOG2(int n);
void COMPLEX_PRINT(const COMPLEX * pcplx);
void COMPLEX_ARR_PRINT(const COMPLEX ArrCplx[],int size);
void COMPLEX_POW(COMPLEX * destCplx,const COMPLEX *baseCplx,double exp);
void FFT_Power2(COMPLEX destArrCplx[],
const COMPLEX srcArrCplx[],
int size);
void IFFT_Power2(COMPLEX destArrCplx[],
const COMPLEX srcArrCplx[],
int size);
void CZT(COMPLEX destArrCplx[],
int N,
const COMPLEX ArrCplx[],
int M,
const COMPLEX * pA,
const COMPLEX * pW
);
void FFT(COMPLEX destArrCplx[],
const COMPLEX srcArrCplx[],
int size);
void IFFT(COMPLEX destArrCplx[],
const COMPLEX srcArrCplx[],
int size);
#ifdef __cplusplus
}
#endif
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -