Compare commits
3 Commits
e7cec37ac5
...
5e36a64acb
| Author | SHA1 | Date | |
|---|---|---|---|
| 5e36a64acb | |||
| 86f488e456 | |||
| 1256c9b807 |
11
.project
Normal file
11
.project
Normal file
@ -0,0 +1,11 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<projectDescription>
|
||||
<name>Theta_fourier</name>
|
||||
<comment></comment>
|
||||
<projects>
|
||||
</projects>
|
||||
<buildSpec>
|
||||
</buildSpec>
|
||||
<natures>
|
||||
</natures>
|
||||
</projectDescription>
|
||||
@ -3,15 +3,28 @@
|
||||
#include <math.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#ifndef FFT_FP_EXTERNAL_TWIDDLES
|
||||
static int64_t twiddle_re[TWIDDLE_L] = {0,};
|
||||
static int64_t twiddle_im[TWIDDLE_L] = {0,};
|
||||
#define PRINTF
|
||||
#endif
|
||||
|
||||
void fft_fp_prepare(void){
|
||||
|
||||
|
||||
void fft_twiddle_gen(int64_t* tw_re, int64_t* tw_im){
|
||||
for (uint32_t k = 0; k < TWIDDLE_L; ++k){
|
||||
double angle = 2.0 * PI * k / DATA_L;
|
||||
twiddle_re[k] = lround(cos(angle) * FP_acc);
|
||||
twiddle_im[k] = lround(-sin(angle) * FP_acc);
|
||||
printf("k, angle, tw_re, tw_im: %u %g %lld %lld\n", k, angle, (long long)twiddle_re[k], (long long)twiddle_im[k]);
|
||||
tw_re[k] = lround(cos(angle) * FP_acc);
|
||||
tw_im[k] = lround(-sin(angle) * FP_acc);
|
||||
}
|
||||
}
|
||||
|
||||
void fft_fp_prepare(void){
|
||||
fft_twiddle_gen(twiddle_re, twiddle_im);
|
||||
for (uint32_t k = 0; k < TWIDDLE_L; ++k){
|
||||
#ifdef PRINTF
|
||||
printf("k, angle, tw_re, tw_im: %u %g %lld %lld\n", k, 2.0 * PI * k / DATA_L, (long long)twiddle_re[k], (long long)twiddle_im[k]);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
@ -82,7 +95,10 @@ void FFT_fp(int64_t* inp, uint32_t inp_L, int64_t* buf){
|
||||
for (uint32_t ii = 0; ii < inp_L; ++ii){
|
||||
buf[ii*2] /= inp_L;
|
||||
buf[ii*2+1] /= inp_L;
|
||||
#ifdef PRINTF
|
||||
printf("re,im: %lld, %lld\n", (long long)buf[ii*2], (long long)buf[ii*2 +1]);
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -19,6 +19,12 @@
|
||||
#define PI 3.141592653589793238462643383279502884197169399375105820974944
|
||||
#endif
|
||||
|
||||
#ifdef FFT_FP_EXTERNAL_TWIDDLES
|
||||
extern volatile int64_t twiddle_re[TWIDDLE_L];
|
||||
extern volatile int64_t twiddle_im[TWIDDLE_L];
|
||||
#endif
|
||||
|
||||
void fft_twiddle_gen(int64_t* twiddle_re, int64_t* twiddle_im);
|
||||
void fft_fp_prepare(void);
|
||||
void FFT_fp(int64_t* inp, uint32_t inp_L, int64_t* buf);
|
||||
|
||||
|
||||
Binary file not shown.
Reference in New Issue
Block a user