RENEWLab  1.1.0
RENEW project
fft.h
Go to the documentation of this file.
1 /* Copyright (C) 2015 Hans-Kristian Arntzen <maister@archlinux.us>
2  *
3  * Permission is hereby granted, free of charge,
4  * to any person obtaining a copy of this software and associated documentation files (the "Software"),
5  * to deal in the Software without restriction, including without limitation the rights to
6  * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software,
7  * and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
8  *
9  * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
10  *
11  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
12  * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
13  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
14  * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
15  * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
16  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
17  */
18 
19 #ifndef MUFFT_H__
20 #define MUFFT_H__
21 
22 #ifdef __cplusplus
23 extern "C" {
24 #endif
25 
26 #include <stddef.h>
27 
29 
30 #if __STDC_VERSION__ >= 199901L
31 #define MUFFT_RESTRICT restrict
33 #else
34 #define MUFFT_RESTRICT
36 #endif
37 
41 
43 #define MUFFT_FORWARD (-1)
44 #define MUFFT_INVERSE (1)
46 
49 
51 #define MUFFT_FLAG_CPU_ANY (0)
52 #define MUFFT_FLAG_CPU_NO_SIMD ((1 << 16) - 1)
54 #define MUFFT_FLAG_CPU_NO_AVX (1 << 0)
56 #define MUFFT_FLAG_CPU_NO_SSE3 (1 << 1)
58 #define MUFFT_FLAG_CPU_NO_SSE (1 << 2)
60 #define MUFFT_FLAG_FULL_R2C (1 << 16)
62 #define MUFFT_FLAG_ZERO_PAD_UPPER_HALF (1 << 17)
65 
75 
78 
85 mufft_plan_1d* mufft_create_plan_1d_c2c(unsigned N, int direction,
86  unsigned flags);
87 
99 mufft_plan_1d* mufft_create_plan_1d_r2c(unsigned N, unsigned flags);
100 
111 mufft_plan_1d* mufft_create_plan_1d_c2r(unsigned N, unsigned flags);
112 
117 void mufft_execute_plan_1d(mufft_plan_1d* plan, void* MUFFT_RESTRICT output,
118  const void* MUFFT_RESTRICT input);
119 
124 
127 
130 
132 #define MUFFT_CONV_METHOD_FLAG_MONO_MONO 0
133 
138 #define MUFFT_CONV_METHOD_FLAG_STEREO_MONO 1
139 
141 #define MUFFT_CONV_METHOD_FLAG_ZERO_PAD_UPPER_HALF_FIRST (1 << 2)
142 
144 #define MUFFT_CONV_METHOD_FLAG_ZERO_PAD_UPPER_HALF_SECOND (1 << 3)
145 
148 #define MUFFT_CONV_BLOCK_FIRST 0
149 
151 #define MUFFT_CONV_BLOCK_SECOND 1
152 
155 
169 mufft_plan_conv* mufft_create_plan_conv(unsigned N, unsigned flags,
170  unsigned method);
171 
181 void mufft_execute_conv_input(mufft_plan_conv* plan, unsigned block,
182  void* output, const void* input);
183 
189 
198 void mufft_execute_conv_output(mufft_plan_conv* plan, void* output,
199  const void* input_first,
200  const void* input_second);
201 
204 
206 typedef void (*mufft_convolve_func)(void* output, const void* a, const void* b,
207  float normalization, unsigned samples);
208 
214 
224 
227 
237 mufft_plan_2d* mufft_create_plan_2d_c2c(unsigned Nx, unsigned Ny, int direction,
238  unsigned flags);
239 
255 mufft_plan_2d* mufft_create_plan_2d_r2c(unsigned Nx, unsigned Ny,
256  unsigned flags);
257 
273 mufft_plan_2d* mufft_create_plan_2d_c2r(unsigned Nx, unsigned Ny,
274  unsigned flags);
275 
280 void mufft_execute_plan_2d(mufft_plan_2d* plan, void* MUFFT_RESTRICT output,
281  const void* MUFFT_RESTRICT input);
282 
287 
290 
295 void* mufft_alloc(size_t size);
296 
302 void* mufft_calloc(size_t size);
303 
306 void mufft_free(void* ptr);
308 
312 
313 #ifdef __cplusplus
314 }
315 #endif
316 
317 #endif
mufft_execute_plan_2d
void mufft_execute_plan_2d(mufft_plan_2d *plan, void *output, const void *input)
Executes a 2D FFT plan.
N
Modulation order N
Definition: mod_demod.m:14
mufft_plan_conv
struct mufft_plan_conv mufft_plan_conv
Opaque type representing a plan to convolve data.
Definition: fft.h:154
mufft_create_plan_conv
mufft_plan_conv * mufft_create_plan_conv(unsigned N, unsigned flags, unsigned method)
Create a plan to convolve zero-padded input data of length N with zero-padded input data of length N.
mufft_execute_conv_output
void mufft_execute_conv_output(mufft_plan_conv *plan, void *output, const void *input_first, const void *input_second)
Multiply together FFTs of the two input arrays obtained from mufft_execute_conv_input and perform a n...
mufft_create_plan_2d_c2r
mufft_plan_2d * mufft_create_plan_2d_c2r(unsigned Nx, unsigned Ny, unsigned flags)
Create a plan for a 2D complex-to-real inverse FFT.
a
a
Definition: iris_py.m:254
mufft_create_plan_2d_c2c
mufft_plan_2d * mufft_create_plan_2d_c2c(unsigned Nx, unsigned Ny, int direction, unsigned flags)
Create a plan for a 2D complex-to-complex inverse or forward FFT.
mufft_get_convolve_func
mufft_convolve_func mufft_get_convolve_func(unsigned flags)
Gets a function pointer which implements complex multiplication (convolution in frequency domain).
mufft_calloc
void * mufft_calloc(size_t size)
Allocate zeroed out aligned storage suitable for muFFT. Same as calloc(), but aligned....
mufft_plan_2d
struct mufft_plan_2d mufft_plan_2d
Opaque type representing a 2D FFT.
Definition: fft.h:226
mufft_free_plan_1d
void mufft_free_plan_1d(mufft_plan_1d *plan)
Free a previously allocated 1D FFT plan.
mufft_convolve_func
void(* mufft_convolve_func)(void *output, const void *a, const void *b, float normalization, unsigned samples)
Vector complex multiply routine signature.
Definition: fft.h:206
mufft_create_plan_2d_r2c
mufft_plan_2d * mufft_create_plan_2d_r2c(unsigned Nx, unsigned Ny, unsigned flags)
Create a plan for a 2D real-to-complex forward FFT.
mufft_create_plan_1d_r2c
mufft_plan_1d * mufft_create_plan_1d_r2c(unsigned N, unsigned flags)
Create a plan for real-to-complex forward transform.
mufft_free_plan_2d
void mufft_free_plan_2d(mufft_plan_2d *plan)
Free a previously allocated 2D FFT plan.
mufft_create_plan_1d_c2r
mufft_plan_1d * mufft_create_plan_1d_c2r(unsigned N, unsigned flags)
Create a plan for complex-to-real inverse transform.
samples
end Rx payload processing Extract the payload samples(integral number of OFDM symbols following preamble) payload_vec
mufft_alloc
void * mufft_alloc(size_t size)
Allocate aligned storage suitable for muFFT. Must be freed with mufft_free.
mufft_execute_conv_input
void mufft_execute_conv_input(mufft_plan_conv *plan, unsigned block, void *output, const void *input)
Applies forward FFT of either first or second input block.
mufft_plan_1d
struct mufft_plan_1d mufft_plan_1d
Opaque type representing a 1D FFT.
Definition: fft.h:77
mufft_execute_plan_1d
void mufft_execute_plan_1d(mufft_plan_1d *plan, void *output, const void *input)
Executes a 1D FFT plan.
mufft_free_plan_conv
void mufft_free_plan_conv(mufft_plan_conv *plan)
Free a previously allocated convolution plan obtained from mufft_create_plan_conv.
mufft_create_plan_1d_c2c
mufft_plan_1d * mufft_create_plan_1d_c2c(unsigned N, int direction, unsigned flags)
Create a plan for a 1D complex-to-complex inverse or forward FFT.
mufft_free
void mufft_free(void *ptr)
Free previously allocated storage obtained from mufft_alloc or mufft_calloc.
mufft_conv_get_transformed_block_size
size_t mufft_conv_get_transformed_block_size(mufft_plan_conv *plan)
Queries the buffer size for intermediate FFT blocks.
MUFFT_RESTRICT
#define MUFFT_RESTRICT
Portable variant of C99 restrict keyword.
Definition: fft.h:35