Compare commits
4 Commits
aa5945e8b2
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
| 5e36a64acb | |||
| 86f488e456 | |||
| 1256c9b807 | |||
| e7cec37ac5 |
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 <math.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
|
#ifndef FFT_FP_EXTERNAL_TWIDDLES
|
||||||
static int64_t twiddle_re[TWIDDLE_L] = {0,};
|
static int64_t twiddle_re[TWIDDLE_L] = {0,};
|
||||||
static int64_t twiddle_im[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){
|
for (uint32_t k = 0; k < TWIDDLE_L; ++k){
|
||||||
double angle = 2.0 * PI * k / DATA_L;
|
double angle = 2.0 * PI * k / DATA_L;
|
||||||
twiddle_re[k] = lround(cos(angle) * FP_acc);
|
tw_re[k] = lround(cos(angle) * FP_acc);
|
||||||
twiddle_im[k] = lround(-sin(angle) * FP_acc);
|
tw_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]);
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
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){
|
for (uint32_t ii = 0; ii < inp_L; ++ii){
|
||||||
buf[ii*2] /= inp_L;
|
buf[ii*2] /= inp_L;
|
||||||
buf[ii*2+1] /= 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]);
|
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
|
#define PI 3.141592653589793238462643383279502884197169399375105820974944
|
||||||
#endif
|
#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_prepare(void);
|
||||||
void FFT_fp(int64_t* inp, uint32_t inp_L, int64_t* buf);
|
void FFT_fp(int64_t* inp, uint32_t inp_L, int64_t* buf);
|
||||||
|
|
||||||
|
|||||||
Binary file not shown.
@ -5,7 +5,7 @@
|
|||||||
#include <math.h>
|
#include <math.h>
|
||||||
|
|
||||||
#define DATA_L (1<<16)
|
#define DATA_L (1<<16)
|
||||||
#define FP_acc 1000
|
#define FP_acc (1<<16)
|
||||||
|
|
||||||
#include "FFT_FP_realisation.h"
|
#include "FFT_FP_realisation.h"
|
||||||
|
|
||||||
|
|||||||
BIN
C/FP_math.o
BIN
C/FP_math.o
Binary file not shown.
Reference in New Issue
Block a user