File: fft.c

package info (click to toggle)
arts 1.5.9-2
  • links: PTS, VCS
  • area: main
  • in suites: lenny
  • size: 8,436 kB
  • ctags: 9,848
  • sloc: ansic: 44,670; cpp: 33,776; sh: 10,486; perl: 3,470; makefile: 372; yacc: 347; lex: 160
file content (32 lines) | stat: -rw-r--r-- 656 bytes parent folder | download | duplicates (5)
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];
	}
}