comparison fft/nayukic/fft.h @ 33:bbf5d4e825eb

Hack in an alternative float-only version (no faster)
author Chris Cannam
date Mon, 09 Nov 2015 12:22:00 +0000
parents ebc87a62321d
children
comparison
equal deleted inserted replaced
32:ebc87a62321d 33:bbf5d4e825eb
41 * The vector's length must be a power of 2. Uses the Cooley-Tukey decimation-in-time radix-2 algorithm. 41 * The vector's length must be a power of 2. Uses the Cooley-Tukey decimation-in-time radix-2 algorithm.
42 * Returns 1 (true) if successful, 0 (false) otherwise (n is not a power of 2, or out of memory). 42 * Returns 1 (true) if successful, 0 (false) otherwise (n is not a power of 2, or out of memory).
43 */ 43 */
44 int transform_radix2(double real[], double imag[], size_t n); 44 int transform_radix2(double real[], double imag[], size_t n);
45 45
46 /* Test versions with precalculated structures -- this API is
47 absolutely not for production use! */
46 typedef struct { 48 typedef struct {
47 double *cos; 49 double *cos;
48 double *sin; 50 double *sin;
49 int levels; 51 int levels;
50 } tables; 52 } tables;
51 53
52 tables *precalc(size_t n); 54 tables *precalc(size_t n);
53 void dispose(tables *); 55 void dispose(tables *);
54 void transform_radix2_precalc(double real[], double imag[], int n, tables *tables); 56 void transform_radix2_precalc(double real[], double imag[], int n, tables *tables);
57
58 typedef struct {
59 float *cos;
60 float *sin;
61 int levels;
62 } tables_f;
63
64 tables_f *precalc_f(size_t n);
65 void dispose_f(tables_f *);
66 void transform_radix2_precalc_f(float real[], float imag[], int n, tables_f *tables);
55 67
56 /* 68 /*
57 * Computes the discrete Fourier transform (DFT) of the given complex vector, storing the result back into the vector. 69 * Computes the discrete Fourier transform (DFT) of the given complex vector, storing the result back into the vector.
58 * The vector can have any length. This requires the convolution function, which in turn requires the radix-2 FFT function. 70 * The vector can have any length. This requires the convolution function, which in turn requires the radix-2 FFT function.
59 * Uses Bluestein's chirp z-transform algorithm. Returns 1 (true) if successful, 0 (false) otherwise (out of memory). 71 * Uses Bluestein's chirp z-transform algorithm. Returns 1 (true) if successful, 0 (false) otherwise (out of memory).