-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfft.h
44 lines (31 loc) · 1.36 KB
/
fft.h
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
#pragma once
#include <complex.h>
#include <stdlib.h>
#include <stdio.h>
#include <inttypes.h>
#include <string.h>
#include <math.h>
#define FFT_BUFFER_SIZE (1 << 10)
#define FFT_OUT_FILE "fft_left.dat"
#define PI 3.14159265358979323846
/* basic print macros */
#define puti(i) printf("%ld\n", i)
#define putd(i) printf("%lf\n", i)
#define putcf(i) printf("%f + %f i \n", crealf(i), cimagf(i))
#define fft_coefd(i) cexp(-2*PI*I*i)
#define fft_coeff(i) cexpf(-2*PI*I*i)
/* return non zero size of array */
size_t size(char *__arr, size_t __size);
/* return maximum value in array */
double max(double *__arr, size_t __size);
/* convert bytes to integer (little endian) */
unsigned long btoi(char *__src, long __size);
/* convert signed integers to double complex */
void *itodc(double complex *__dest, int *__src, size_t __size, uint16_t __bitsPerSample);
/* basic O(n2) DFT from unsigned int to complex */
void dft_uint_complex(int *__src, double complex *__dest, size_t __size, uint8_t __bitsPerSample);
void dft_complex_complex(double complex *__src, double complex *__dest, size_t __size);
/* DFT from unsigned int data to logarthmic double precision floating point magnitudes */
void dft_uint_double(int *__src, double *__dest, size_t __size, uint8_t __bitsPerSample);
/* radix 2 FFT from unsigned int to complex */
void fft_cooley(double complex *__src, const size_t __size);