4#include "nmtl/tcmplx.h"
8#define PI 3.14159265359
12template<
int power>
void expFFT(
int arg,
float* re,
float* im)
14 float rad=-2.0*PI/power*arg;
19template<
int power>
void expIFFT(
int arg,
float* re,
float* im)
21 float rad=2.0*PI/power*arg;
27template<
int power>
void expFFT(
int arg,
int amplitude,
nm32sc* z)
31 expFFT<power>(arg,&re,&im);
32 z->re=floor(amplitude*re+0.5);
33 z->im=floor(amplitude*im+0.5);
36template<
int power>
void expFFT127(
int arg,
int amplitude,
nm32sc* z)
40 expFFT<power>(arg,&re,&im);
41 z->re=floor(amplitude*re+0.5);
42 z->im=floor(amplitude*im+0.5);
43 z->re= z->re > 127 ? 127:z->re;
44 z->im= z->im > 127 ? 127:z->im;
47template<
int power>
void expIFFT127(
int arg,
int amplitude,
nm32sc* z)
51 expIFFT<power>(arg,&re,&im);
52 z->re=floor(amplitude*re+0.5);
53 z->im=floor(amplitude*im+0.5);
54 z->re= z->re > 127 ? 127:z->re;
55 z->im= z->im > 127 ? 127:z->im;
58template<
int power>
void expFFT127(
int arg,
int amplitude, cmplx<int>* z)
62 expFFT<power>(arg,&re,&im);
63 z->re=floor(amplitude*re+0.5);
64 z->im=floor(amplitude*im+0.5);
65 z->re= z->re > 127 ? 127:z->re;
66 z->im= z->im > 127 ? 127:z->im;
69template<
int power>
void expIFFT127(
int arg,
int amplitude, cmplx<int>* z)
73 expIFFT<power>(arg,&re,&im);
74 z->re=floor(amplitude*re+0.5);
75 z->im=floor(amplitude*im+0.5);
76 z->re= z->re > 127 ? 127:z->re;
77 z->im= z->im > 127 ? 127:z->im;
80template<
int power> cmplx<int> expFFT127(
int arg,
int amplitude=128)
85 expFFT<power>(arg,&re,&im);
86 z.re=floor(amplitude*re+0.5);
87 z.im=floor(amplitude*im+0.5);
88 z.re= z.re > 127 ? 127:z.re;
89 z.im= z.im > 127 ? 127:z.im;
94template<
int power> cmplx<int> expFFT(
int arg,
int amplitude)
98 expFFT<power>(arg,&re,&im);
100 z.re=floor(amplitude*re+0.5);
101 z.im=floor(amplitude*im+0.5);
105template<
int power> cmplx<long long> lexpFFT(
int arg,
int amplitude)
109 expFFT<power>(arg, &re, &im);
111 z.re = floor(amplitude*re + 0.5);
112 z.im = floor(amplitude*im + 0.5);
117template<
int power> cmplx<int> expIFFT(
int arg,
int amplitude)
121 expIFFT<power>(arg,&re,&im);
123 z.re=floor(amplitude*re+0.5);
124 z.im=floor(amplitude*im+0.5);
130template<
int power> cmplx<double> expFFT(
int arg)
133 double im=-2.0*PI/power*arg;
138template<
int power> cmplx<double> expIFFT(
int arg)
141 double im=2.0*PI/power*arg;
147void load_wfifo(
nm64s* wfifoData,
int wfifoStep,
int size);
148void load_wfifo(cmplx<int>* wcoef,
int wstep,
int size);
149void load_wfifo(
nm32sc* wcoef,
int wstep,
int size);
151void vsum_data(
nm8s* data,
nm32sc* afifo,
int vr);
153void vsum_data(
nm8s* data, cmplx<int>* afifo,
int vr);
long long nm64s
Definition: nmtype.h:375
short nm16s
Definition: nmtype.h:243
char nm8s
Definition: nmtype.h:167
Definition: nmtype.h:1301