RENEWLab  1.1.0
RENEW project
2D real and complex FFT
Collaboration diagram for 2D real and complex FFT:

Typedefs

typedef struct mufft_plan_2d mufft_plan_2d
 Opaque type representing a 2D FFT. More...
 

Functions

mufft_plan_2dmufft_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. More...
 
mufft_plan_2dmufft_create_plan_2d_r2c (unsigned Nx, unsigned Ny, unsigned flags)
 Create a plan for a 2D real-to-complex forward FFT. More...
 
mufft_plan_2dmufft_create_plan_2d_c2r (unsigned Nx, unsigned Ny, unsigned flags)
 Create a plan for a 2D complex-to-real inverse FFT. More...
 
void mufft_execute_plan_2d (mufft_plan_2d *plan, void *output, const void *input)
 Executes a 2D FFT plan. More...
 
void mufft_free_plan_2d (mufft_plan_2d *plan)
 Free a previously allocated 2D FFT plan. More...
 

Detailed Description

The FFT performed by these functions are not normalized. A forward transform followed by an inverse transform will scale the output by the transform size (Nx * Ny). The FFTs implemented take input in regular order, no permutation step is required. Similarly, the output of the FFT is in regular order, without any permutation. If input is laid out as (x[0], x[1], x[2], x[3], ..., x[N - 1]) the FFT transform will output (X[0], X[1], X[2], X[3], ..., X[N - 1]) as expected.

Typedef Documentation

◆ mufft_plan_2d

typedef struct mufft_plan_2d mufft_plan_2d

Opaque type representing a 2D FFT.

Function Documentation

◆ 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.

The input and output data to the 2D transform is represented as a row-major array.

Parameters
NxThe transform size in X dimension (number of columns). Must be power-of-two and at least 2.
NyThe transform size in Y dimension (number of rows). Must be power-of-two and at least 2.
directionForward (MUFFT_FORWARD) or inverse (MUFFT_INVERSE) transform.
flagsFlags for the planning. See Planning options.
Returns
A 2D transform plan, or NULL if an error occured.

◆ 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.

The input and output data to the 2D transform is represented as a row-major array.

Note that even if only N / 2 + 1 complex samples are required for a complex-to-real transform, the input array of the transform is still expected to contain N columns of padded complex data. This is to help SIMD optimization since N / 2 + 1 is odd and would require unaligned memory accesses to work properly. The output array needs a minimum size of 2 * Nx * Ny * sizeof(float) and not the expected Nx * Ny * sizeof(float). muFFT uses the output buffer as a scratch buffer during the FFT computation. The end result however, will only require Nx * Ny * sizeof(float) size.

Parameters
NxThe transform size in X dimension (number of columns). Must be power-of-two and at least 4.
NyThe transform size in Y dimension (number of rows). Must be power-of-two and at least 2.
flagsFlags for the planning. See Planning options.
Returns
A 2D transform plan, or NULL if an error occured.

◆ 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.

The input and output data to the 2D transform is represented as a row-major array.

Note that even if only N / 2 + 1 complex samples are required for a real-to-complex transform, the output array of the transform is still expected to contain N columns of complex data. This is to help SIMD optimization since N / 2 + 1 is odd and would require unaligned memory accesses to work properly. The vertical transform will only transform the first N / 2 + D columns, where D is some convenient value which aligns well to the SIMD instruction set used. The full N complex samples can be processed vertically as well if MUFFT_FLAG_FULL_R2C is used.

Parameters
NxThe transform size in X dimension (number of columns). Must be power-of-two and at least 4.
NyThe transform size in Y dimension (number of rows). Must be power-of-two and at least 2.
flagsFlags for the planning. See Planning options. If MUFFT_FLAG_FULL_R2C flag is added, the transform will output the full N complex frequency samples, instead of the minimum N / 2 + 1 samples.
Returns
A 2D transform plan, or NULL if an error occured.

◆ mufft_execute_plan_2d()

void mufft_execute_plan_2d ( mufft_plan_2d plan,
void *  output,
const void *  input 
)

Executes a 2D FFT plan.

Parameters
planPreviously allocated 2D FFT plan.
outputOutput of the transform. The data must be aligned. See Memory allocation.
inputInput to the transform. The data must be aligned. See Memory allocation.

◆ mufft_free_plan_2d()

void mufft_free_plan_2d ( mufft_plan_2d plan)

Free a previously allocated 2D FFT plan.

Parameters
planA plan. May be NULL in which case nothing happens.