summaryrefslogtreecommitdiff
path: root/fft.h
blob: 29005426f008827d9d8e8d96b975d876702fd2a1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#include <math.h>
#include "complex.h"

#ifndef FALSE
#define FALSE (0)
#endif

#ifndef TRUE
#define TRUE (1)
#endif

static inline double
rad_to_degree (double theta)
{
    return theta * (360.0 / (2 * M_PI));
}

void
fft (complex_t *buffer, int n);

void
ifft (complex_t *buffer, int n);

/* Fourier transform an n x n array */
void
fft_2d (complex_t *buffer, int n);

void
ifft_2d (complex_t *buffer, int n);

/* Shifts the zero component to the center of the array */
void
shift (complex_t *buffer, int n);

void
shift_2d (complex_t *buffer, int n);

void
fft_shift_2d (complex_t *buffer, int n);

void
ifft_shift_2d (complex_t *buffer, int n);

void
show_image (const char *name, complex_t *image, int n);