PandA-2024.02
fft_test.c
Go to the documentation of this file.
1 #include "fft.h"
2 
3 int main(){
4  double data_x[size];
5  double data_y[size];
6  double img[size];
7  double real[size];
8  int i;
9 
10  //set up twiddles...
11  double twoPI = 6.28318530717959;
12  double typed;
13  int n, N;
14  N = size;
15 
16  //Pre-calc twiddles
17  for(n=0; n<(N>>1); n++){
18  typed = (double)(twoPI*n/N);
19  real[n] = cos(typed);
20  img[n] = (-1.0)*sin(typed);
21  }
22 
23  //Init data
24  for(i=0; i < size; i++) {
25  data_x[i] = (double)(i);
26  data_y[i] = (double)(i);
27  }
28 
29  /*
30  printf("Input:\n");
31  for(i=0; i < size; i++) {
32  printf("%f : %f\n", data_x[i], data_y[i]);
33  }
34 
35  printf("fft:\n");
36  */
37 
38  fft(data_x, data_y, real, img);
39 
40  printf("Output:\n");
41 
42 
43  for(i=0; i < size; i++) {
44  printf("%.2f : %.2f\n", data_x[i], data_y[i]);
45  }
46 
47  return 0;
48 }
volatile unsigned char img[WIDTH][HEIGHT]
Definition: mandelbrot.c:20
int main()
Definition: fft_test.c:3
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
#define N
Definition: dfdiv.c:60
#define twoPI
Definition: fft.h:6

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