summaryrefslogtreecommitdiffstats
path: root/flow/fft.c
blob: 15c821f695e8b29f16b96fd45e779e82c419502c (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
#include "gsl/gslfft.h"
#include "fft.h"

void arts_fft_float (
    unsigned  NumSamples,
    int       InverseTransform,
    float    *RealIn,
    float    *ImagIn,
    float    *RealOut,
    float    *ImagOut )
{
	double *ri_in = g_newa(double, NumSamples*4);
	double *ri_out = ri_in + NumSamples*2;
	unsigned int i;

	for(i = 0; i < NumSamples; i++)
	{
		ri_in[2*i] = RealIn[i];
		ri_in[2*i+1] = (ImagIn?ImagIn[i]:0.0);
	}

	if(InverseTransform == 0)
		gsl_power2_fftac (NumSamples, ri_in, ri_out);
	else
		gsl_power2_fftsc (NumSamples, ri_in, ri_out);

	for(i = 0; i < NumSamples; i++)
	{
		RealOut[i] = ri_out[2*i];
		ImagOut[i] = ri_out[2*i+1];
	}
}