added fast(er) list to be included (just in header) + small bug fix
[my-code/api.git] / fourier / fourier.h
index 5a8ddb3..57ef187 100644 (file)
@@ -4,17 +4,19 @@
 #define FOURIER_H
 
 /* includes */
+#define _GNU_SOURCE
 #include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+#include <math.h>
 
 /* defines */
 #define F_SUCCESS 1
 #define F_ERROR -1
-#define F_DIM_ERROR -2
-#define F_DLEN_ERROR -3
-#define F_MALLOC_ERROR -4
-#define F_SET_DLEN_ERROR -5
-
-#define MAX_DIM 3
+#define F_NOT_SUPPORTED -2
+#define F_DIM_FAILURE -3
+#define F_ALLOC_FAIL -4
+#define F_FFT_IMPOSSIBLE -5
 
 /* fourier specific variables */
 typedef struct s_complex {
@@ -25,9 +27,27 @@ typedef struct s_complex {
 typedef struct s_fourier {
   int outfd;
   unsigned char type;
+#define DFT (1<<0)
+#define FFT (1<<1)
+#define FWD (1<<2)
+#define BWD (1<<3)
+#define MAX_DIM 3
   int dim;
-  t_complex *data[MAX_DIM];
+  t_complex *data;
+  t_complex *ftdata;
+  t_complex **revdata;
   int data_len[MAX_DIM];
+  int log2len[MAX_DIM];
 } t_fourier;
 
+/* function prototypes */
+int fourier_init(t_fourier *fourier,int outfd);
+int fourier_alloc_data(t_fourier *fourier);
+int fourier_dft_1d(t_fourier *fourier);
+int fourier_dft_2d(t_fourier *fourier);
+int fourier_dft_3d(t_fourier *fourier);
+int fourier_fft_1d_init(t_fourier *fourier);
+int fourier_fft_1d(t_fourier *fourier);
+int fourier_shutdown(t_fourier *fourier);
+
 #endif