now printf is disabled if twiddles arrays are external. Now while used for emdedded there is no prfintf garbage in compiled code.

This commit is contained in:
2025-10-09 15:38:10 +03:00
parent 86f488e456
commit 5e36a64acb
2 changed files with 10 additions and 2 deletions

View File

@ -6,8 +6,11 @@
#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_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;
@ -19,7 +22,9 @@ void fft_twiddle_gen(int64_t* tw_re, int64_t* tw_im){
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
}
}
@ -90,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
}
}