#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>
#include <time.h>

#include <fftw3.h>

#include "FST_semi_memo.h"
#include "FST_semi_fly.h"
#include "cospmls.h"
#include "makeweights.h"


/* Constantes */

#define D_PI 6.28318530717958647692
#define T_PI 3.14159265358979

#define AR 0
#define PB 1
#define KH 2

#define CARRE(x) ((x)*(x))
#define CUBE(x) ((x)*(x)*(x))

#define compmult(a,b,c,d,e,f) (e) = ((a)*(c))-((b)*(d)); (f) = ((a)*(d))+((b)*(c))


/* Structures */

typedef struct point4d
{
	double x, y, z;
	double t;
}point4d_t;


/* Variables globales */

point4d_t *liste_sommets;
double *tex;
int nb_sommets;
int B;


/* Fonctions */

void lecture_texture(FILE *file);
void ecriture(FILE *file);

void filtre_AR(double *rcoeffs, double *icoeffs, double *rresult, double *iresult);
void filtre_PB(double *rcoeffs, double *icoeffs, double *rresult, double *iresult, int Ka, int Kb);
void filtre_KH(double *rcoeffs, double *icoeffs, double *rresult, double *iresult, double H);

void convolution(int type);
void convolution_S2Kit(void);
void inv_filtre(void);