PandA-2024.02
fft.c
Go to the documentation of this file.
1 #include "fft.h"
2 
3 void fft(double real[FFT_SIZE], double img[FFT_SIZE], double real_twid[FFT_SIZE/2], double img_twid[FFT_SIZE/2]){
4  int even, odd, span, log, rootindex;
5  double temp;
6  log = 0;
7 
8  outer:for(span=FFT_SIZE>>1; span; span>>=1, log++){
9  inner:for(odd=span; odd<FFT_SIZE; odd++){
10  odd |= span;
11  even = odd ^ span;
12 
13  temp = real[even] + real[odd];
14  real[odd] = real[even] - real[odd];
15  real[even] = temp;
16 
17  temp = img[even] + img[odd];
18  img[odd] = img[even] - img[odd];
19  img[even] = temp;
20 
21  rootindex = (even<<log) & (FFT_SIZE - 1);
22  if(rootindex){
23  temp = real_twid[rootindex] * real[odd] -
24  img_twid[rootindex] * img[odd];
25  img[odd] = real_twid[rootindex]*img[odd] +
26  img_twid[rootindex]*real[odd];
27  real[odd] = temp;
28  }
29  }
30  }
31 }
#define FFT_SIZE
Definition: fft.h:5
volatile unsigned char img[WIDTH][HEIGHT]
Definition: mandelbrot.c:20
void fft(double real[FFT_SIZE], double img[FFT_SIZE], double real_twid[FFT_SIZE/2], double img_twid[FFT_SIZE/2])
Definition: fft.c:3

Generated on Mon Feb 12 2024 13:02:49 for PandA-2024.02 by doxygen 1.8.13