Sound Open Firmware
Loading...
Searching...
No Matches
fft.h File Reference

Fast Fourier Transform (FFT) and Inverse FFT (IFFT) interfaces. More...

Include dependency graph for fft.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  fft_plan
 
struct  fft_multi_plan
 

Macros

#define FFT_GENERIC
 
#define FFT_SIZE_MIN   1
 
#define FFT_SIZE_MAX   1024
 
#define FFT_MULTI_COUNT_MAX   3
 

Functions

struct fft_plan * mod_fft_plan_new (struct processing_module *mod, void *inb, void *outb, uint32_t size, int bits)
 Allocate and initialize an FFT execution plan.
 
void fft_execute_16 (struct fft_plan *plan, bool ifft)
 Execute a 16-bit complex FFT or IFFT according to an initialized plan.
 
void fft_execute_32 (struct fft_plan *plan, bool ifft)
 Execute a 32-bit complex FFT or IFFT according to an initialized plan.
 
void mod_fft_plan_free (struct processing_module *mod, struct fft_plan *plan)
 Free an allocated FFT execution plan and its internal buffers.
 
struct fft_multi_plan * mod_fft_multi_plan_new (struct processing_module *mod, void *inb, void *outb, uint32_t size, int bits)
 mod_fft_multi_plan_new() - Prepare FFT for 2^N size and some other FFT sizes
 
void fft_multi_execute_32 (struct fft_multi_plan *plan, bool ifft)
 fft_multi_execute_32() - Calculate Fast Fourier Transform (FFT) for 2^size and other
 
void mod_fft_multi_plan_free (struct processing_module *mod, struct fft_multi_plan *plan)
 mod_fft_multi_plan_free() - Free the FFT plan
 
void dft3_32 (struct icomplex32 *input, struct icomplex32 *output)
 dft3_32() - Discrete Fourier Transform (DFT) for size 3.
 

Detailed Description

Fast Fourier Transform (FFT) and Inverse FFT (IFFT) interfaces.

Macro Definition Documentation

◆ FFT_GENERIC

#define FFT_GENERIC

◆ FFT_MULTI_COUNT_MAX

#define FFT_MULTI_COUNT_MAX   3

◆ FFT_SIZE_MAX

#define FFT_SIZE_MAX   1024

◆ FFT_SIZE_MIN

#define FFT_SIZE_MIN   1

Function Documentation

◆ dft3_32()

void dft3_32 ( struct icomplex32 *  input,
struct icomplex32 *  output 
)

dft3_32() - Discrete Fourier Transform (DFT) for size 3.

Parameters
inputPointer to complex values input array, Q1.31.
outputPointer to complex values output array, Q1.31, scaled down by 1/3.

This function is useful for calculating some non power of two FFTs. E.g. the FFT for size 1536 is done with three 512 size FFTs and one 3 size DFT.

◆ fft_execute_16()

void fft_execute_16 ( struct fft_plan *  plan,
bool  ifft 
)

Execute a 16-bit complex FFT or IFFT according to an initialized plan.

Parameters
planPointer to the initialized 16-bit FFT plan.
ifftTrue for Inverse Fast Fourier Transform, false for forward FFT.

◆ fft_execute_32()

void fft_execute_32 ( struct fft_plan *  plan,
bool  ifft 
)

Execute a 32-bit complex FFT or IFFT according to an initialized plan.

Parameters
planPointer to the initialized 32-bit FFT plan.
ifftTrue for Inverse Fast Fourier Transform, false for forward FFT.

◆ fft_multi_execute_32()

void fft_multi_execute_32 ( struct fft_multi_plan *  plan,
bool  ifft 
)

fft_multi_execute_32() - Calculate Fast Fourier Transform (FFT) for 2^size and other

Parameters
planPointer to FFT plan created with mod_fft_multi_plan_new()
ifftValue 0 calculates FFT, value 1 calculates IFFT

This function calculates the FFT with the buffers defined with mod_fft_multi_plan_new().

◆ mod_fft_multi_plan_free()

void mod_fft_multi_plan_free ( struct processing_module *  mod,
struct fft_multi_plan *  plan 
)

mod_fft_multi_plan_free() - Free the FFT plan

Parameters
modPointer to module
planPointe to FFT plan

This function frees the allocations done internally by the function mod_fft_multi_plan_new(). The input and output buffers need to be freed separately.

◆ mod_fft_multi_plan_new()

struct fft_multi_plan * mod_fft_multi_plan_new ( struct processing_module *  mod,
void *  inb,
void *  outb,
uint32_t  size,
int  bits 
)

mod_fft_multi_plan_new() - Prepare FFT for 2^N size and some other FFT sizes

Parameters
modPointer to module
inbBuffer to use for complex input data
outbBuffer to use for complex output data
sizeSize of FFT as number of bins
bitsWorld length of FFT. Currently only 32 is supported.
Returns
Pointer to allocated FFT plan

This function does the preparations to calculate FFT. If the size is power of two the operation is similar to mod_fft_plan_new(). Some other FFT sizes like 1536 is supported by allocated multiple FFT plans and by wrapping all needed for similar usage as power of two size FFT.

◆ mod_fft_plan_free()

void mod_fft_plan_free ( struct processing_module *  mod,
struct fft_plan *  plan 
)

Free an allocated FFT execution plan and its internal buffers.

Parameters
modProcessing module that owns the plan.
planPointer to the FFT plan to free.

◆ mod_fft_plan_new()

struct fft_plan * mod_fft_plan_new ( struct processing_module *  mod,
void *  inb,
void *  outb,
uint32_t  size,
int  bits 
)

Allocate and initialize an FFT execution plan.

Parameters
modProcessing module requesting the plan (for memory allocation).
inbPointer to input buffer for complex data.
outbPointer to output buffer for complex results.
sizeFFT transform size in number of complex bins.
bitsSample word length in bits (16 or 32).
Returns
Pointer to allocated struct fft_plan, or NULL on failure.