spLib
Loading...
Searching...
No Matches
<sp/fft.h>: FFT

Data Structures

class  spFFTRec
 A class to handle FFT execution. More...
 

Macros

#define spFFTSpeed   spComputeSpeed
 
#define SP_FFT_HIGHEST_PRECISION   SP_HIGHEST_PRECISION
 
#define SP_FFT_HIGH_DOUBLE_PRECISION   SP_HIGH_DOUBLE_PRECISION
 
#define SP_FFT_DOUBLE_PRECISION   SP_DOUBLE_PRECISION
 
#define SP_FFT_LOW_DOUBLE_PRECISION   SP_LOW_DOUBLE_PRECISION
 
#define SP_FFT_HIGH_FLOAT_PRECISION   SP_HIGH_FLOAT_PRECISION
 
#define SP_FFT_FLOAT_PRECISION   SP_FLOAT_PRECISION
 
#define SP_FFT_LOW_FLOAT_PRECISION   SP_LOW_FLOAT_PRECISION
 
#define SP_FFT_32BIT_PRECISION   SP_32BIT_PRECISION
 
#define SP_FFT_24BIT_PRECISION   SP_24BIT_PRECISION
 
#define SP_FFT_16BIT_PRECISION   SP_16BIT_PRECISION
 
#define SP_FFT_IGNORE_PRECISION   SP_IGNORE_PRECISION
 
#define SP_FFT_UNKNOWN_PRECISION   SP_UNKNOWN_PRECISION
 
#define SP_FFT_DEFAULT_PRECISION   SP_FFT_FLOAT_PRECISION
 
#define SP_FFT_SPEED_EXTREMELY_FAST   SP_COMPUTE_SPEED_EXTREMELY_FAST
 
#define SP_FFT_SPEED_VERY_FAST   SP_COMPUTE_SPEED_VERY_FAST
 
#define SP_FFT_SPEED_FASTER   SP_COMPUTE_SPEED_FASTER
 
#define SP_FFT_SPEED_FAST   SP_COMPUTE_SPEED_FAST
 
#define SP_FFT_SPEED_NORMAL   SP_COMPUTE_SPEED_NORMAL
 
#define SP_FFT_SPEED_SLOW   SP_COMPUTE_SPEED_SLOW
 
#define SP_FFT_SPEED_SLOWER   SP_COMPUTE_SPEED_SLOWER
 
#define SP_FFT_SPEED_VERY_SLOW   SP_COMPUTE_SPEED_VERY_SLOW
 
#define SP_FFT_SPEED_EXTREMELY_SLOW   SP_COMPUTE_SPEED_EXTREMELY_SLOW
 
#define SP_FFT_SPEED_UNKNOWN   SP_COMPUTE_SPEED_UNKNOWN
 

Typedefs

typedef struct _spFFTRec * spFFTRec
 

FFT Execution (<sp/fft.h>)

int spfftf (float *xRe, float *xIm, long fftl, int inv)
 
int spfft (double *xRe, double *xIm, long fftl, int inv)
 
int sprfftf (float *data, long fftl, int inv)
 
int sprfft (double *data, long fftl, int inv)
 

Data Shift for FFT (<sp/fft.h>)

void datashifts (short *data, long length, long shift)
 
void datashiftl (long *data, long length, long shift)
 
void datashiftf (float *data, long length, long shift)
 
void datashift (double *data, long length, long shift)
 
void ridatashifts (short *real, short *imag, long length, long shift)
 
void ridatashiftl (long *real, long *imag, long length, long shift)
 
void ridatashiftf (float *real, float *imag, long length, long shift)
 
void ridatashift (double *real, double *imag, long length, long shift)
 
void circshifts (short *data, long length, long shift)
 
void circshiftl (long *data, long length, long shift)
 
void circshiftf (float *data, long length, long shift)
 
void circshift (double *data, long length, long shift)
 
void ricircshifts (short *real, short *imag, long length, long shift)
 
void ricircshiftl (long *real, long *imag, long length, long shift)
 
void ricircshiftf (float *real, float *imag, long length, long shift)
 
void ricircshift (double *real, double *imag, long length, long shift)
 
void fftturnf (float *xRe, float *xIm, long fftl)
 
void fftturn (double *xRe, double *xIm, long fftl)
 
void fftshiftf (float *xRe, float *xIm, long fftl)
 
void fftshift (double *xRe, double *xIm, long fftl)
 

FFT Execution with FFT Plugin (<sp/fft.h>)

int spGetNumFFTPlugin (void)
 
char * xspSearchFFTPluginFile (int *index)
 
spBool spSetDefaultFFTPlugin (const char *name)
 
spBool spIsFFTPlugin (spPlugin *plugin)
 
spPluginspLoadFFTPlugin (const char *name)
 
spBool spFreeFFTPlugin (spPlugin *plugin)
 
spFFTSpeed spGetFFTSpeed (spFFTPrecision precision)
 
spFFTRec spInitBatchedFFTByPlugin (spPlugin *plugin, long order, long batch, spFFTPrecision precision)
 
spFFTRec spInitBatchedFFT (long order, long batch, spFFTPrecision precision)
 
spFFTRec spInitFFTByPlugin (spPlugin *plugin, long order, spFFTPrecision precision)
 
spFFTRec spInitFFT (long order, spFFTPrecision precision)
 
spBool spFreeFFT (spFFTRec fftrec)
 
spBool spResetFFTOrder (spFFTRec fftrec, long order)
 
long spGetFFTOrder (spFFTRec fftrec)
 
long spGetFFTLength (spFFTRec fftrec)
 
long spGetFFTBatch (spFFTRec fftrec)
 
spBool spExecFFTF (spFFTRec fftrec, float *real, float *imag, int inv)
 
spBool spExecFFT (spFFTRec fftrec, double *real, double *imag, int inv)
 
spBool spExecRealFFTF (spFFTRec fftrec, float *data, int inv)
 
spBool spExecRealFFT (spFFTRec fftrec, double *data, int inv)
 
spBool spExecFFTPowerF (spFFTRec fftrec, float *data, float exponent)
 
spBool spExecFFTPower (spFFTRec fftrec, double *data, double exponent)
 

Detailed Description

#include <sp/fft.h>

Macro Definition Documentation

◆ spFFTSpeed

#define spFFTSpeed   spComputeSpeed

Indicates speed of FFT computation.

◆ SP_FFT_HIGHEST_PRECISION

#define SP_FFT_HIGHEST_PRECISION   SP_HIGHEST_PRECISION

Highest precision.

◆ SP_FFT_HIGH_DOUBLE_PRECISION

#define SP_FFT_HIGH_DOUBLE_PRECISION   SP_HIGH_DOUBLE_PRECISION

Double type precision higher than normal double type.

◆ SP_FFT_DOUBLE_PRECISION

#define SP_FFT_DOUBLE_PRECISION   SP_DOUBLE_PRECISION

double type precision.

Examples
lpctest.c.

◆ SP_FFT_LOW_DOUBLE_PRECISION

#define SP_FFT_LOW_DOUBLE_PRECISION   SP_LOW_DOUBLE_PRECISION

double type precision lower than normal double type

◆ SP_FFT_HIGH_FLOAT_PRECISION

#define SP_FFT_HIGH_FLOAT_PRECISION   SP_HIGH_FLOAT_PRECISION

float type precision higher than normal double type.

◆ SP_FFT_FLOAT_PRECISION

#define SP_FFT_FLOAT_PRECISION   SP_FLOAT_PRECISION

float type precision.

◆ SP_FFT_LOW_FLOAT_PRECISION

#define SP_FFT_LOW_FLOAT_PRECISION   SP_LOW_FLOAT_PRECISION

float type precision lower than normal float type

◆ SP_FFT_32BIT_PRECISION

#define SP_FFT_32BIT_PRECISION   SP_32BIT_PRECISION

32-bit integer precision.

◆ SP_FFT_24BIT_PRECISION

#define SP_FFT_24BIT_PRECISION   SP_24BIT_PRECISION

24-bit integer precision.

◆ SP_FFT_16BIT_PRECISION

#define SP_FFT_16BIT_PRECISION   SP_16BIT_PRECISION

16-bit integer precision.

◆ SP_FFT_IGNORE_PRECISION

#define SP_FFT_IGNORE_PRECISION   SP_IGNORE_PRECISION

Indicates that precision is ignored.

◆ SP_FFT_UNKNOWN_PRECISION

#define SP_FFT_UNKNOWN_PRECISION   SP_UNKNOWN_PRECISION

Unknown precision.

◆ SP_FFT_DEFAULT_PRECISION

#define SP_FFT_DEFAULT_PRECISION   SP_FFT_FLOAT_PRECISION

Default precision.

Examples
fftvec.c, simple_fft.c, and simple_rfft.c.

◆ SP_FFT_SPEED_EXTREMELY_FAST

#define SP_FFT_SPEED_EXTREMELY_FAST   SP_COMPUTE_SPEED_EXTREMELY_FAST

Extremely fast speed.

◆ SP_FFT_SPEED_VERY_FAST

#define SP_FFT_SPEED_VERY_FAST   SP_COMPUTE_SPEED_VERY_FAST

Very fast speed.

◆ SP_FFT_SPEED_FASTER

#define SP_FFT_SPEED_FASTER   SP_COMPUTE_SPEED_FASTER

Faster speed.

◆ SP_FFT_SPEED_FAST

#define SP_FFT_SPEED_FAST   SP_COMPUTE_SPEED_FAST

Fast speed.

◆ SP_FFT_SPEED_NORMAL

#define SP_FFT_SPEED_NORMAL   SP_COMPUTE_SPEED_NORMAL

Normal speed.

◆ SP_FFT_SPEED_SLOW

#define SP_FFT_SPEED_SLOW   SP_COMPUTE_SPEED_SLOW

Slow speed.

◆ SP_FFT_SPEED_SLOWER

#define SP_FFT_SPEED_SLOWER   SP_COMPUTE_SPEED_SLOWER

Slower speed.

◆ SP_FFT_SPEED_VERY_SLOW

#define SP_FFT_SPEED_VERY_SLOW   SP_COMPUTE_SPEED_VERY_SLOW

Very slow speed.

◆ SP_FFT_SPEED_EXTREMELY_SLOW

#define SP_FFT_SPEED_EXTREMELY_SLOW   SP_COMPUTE_SPEED_EXTREMELY_SLOW

Extremely slow speed.

◆ SP_FFT_SPEED_UNKNOWN

#define SP_FFT_SPEED_UNKNOWN   SP_COMPUTE_SPEED_UNKNOWN

Unknown speed.

Typedef Documentation

◆ spFFTRec

typedef struct _spFFTRec* spFFTRec

Definition of spFFTRec.

Function Documentation

◆ spfftf()

int spfftf ( float * xRe,
float * xIm,
long fftl,
int inv )
extern

Executes FFT of input data.

Parameters
[in]xReThe real part buffer of the data. The size of this buffer must be larger than fftl .
[in]xImThe imaginary part buffer of the data. The size of this buffer must be larger than fftl .
[in]fftlThe number of FFT points.
[in]invNonzero value enables execution of the inverse FFT.
Return values
SP_SUCCESSSuccess
SP_FAILUREFailure

◆ spfft()

int spfft ( double * xRe,
double * xIm,
long fftl,
int inv )
extern

Executes FFT of input data.

Parameters
[in]xReThe real part buffer of the data. The size of this buffer must be larger than fftl .
[in]xImThe imaginary part buffer of the data. The size of this buffer must be larger than fftl .
[in]fftlThe number of FFT points.
[in]invNonzero value enables execution of the inverse FFT.
Return values
SP_SUCCESSSuccess
SP_FAILUREFailure
Examples
simple_fft.c.

◆ sprfftf()

int sprfftf ( float * data,
long fftl,
int inv )
extern

Executes FFT of input real data.

Parameters
[in]dataThe buffer of the data. The size of this buffer must be larger than fftl . After FFT execution, data holds data[0]=Re(X[0]), data[1]=Re(X[fftl/2]), data[2*n]=Re(X[n]), and data[2*n+1]=Im(X[n]) (n > 0, n < fftl/2), where X[n] is the complex spectrum. In other words, even elements except the index 0 and odd elements except the index 1 hold the real part and the imaginary part of the complex spectrum, respectively.
[in]fftlThe number of FFT points.
[in]invNonzero value enables execution of the inverse FFT.
Return values
SP_SUCCESSSuccess
SP_FAILUREFailure

◆ sprfft()

int sprfft ( double * data,
long fftl,
int inv )
extern

Executes FFT of input real data.

Parameters
[in]dataThe buffer of the data. The size of this buffer must be larger than fftl . After FFT execution, data holds data[0]=Re(X[0]), data[1]=Re(X[fftl/2]), data[2*n]=Re(X[n]), and data[2*n+1]=Im(X[n]) (n > 0, n < fftl/2), where X[n] is the complex spectrum. In other words, even elements except the index 0 and odd elements except the index 1 hold the real part and the imaginary part of the complex spectrum, respectively.
[in]fftlThe number of FFT points.
[in]invNonzero value enables execution of the inverse FFT.
Return values
SP_SUCCESSSuccess
SP_FAILUREFailure
Examples
simple_rfft.c.

◆ datashifts()

void datashifts ( short * data,
long length,
long shift )
extern

Shifts input data. The pushed out data by shifting is discarded.

Parameters
[in]dataThe buffer containing input data. The input data is replaced with shifted data.
[in]lengthThe size of data .
[in]shiftThe shift length. Positive and negative values indicate shift to left and right respectively.

◆ datashiftl()

void datashiftl ( long * data,
long length,
long shift )
extern

Shifts input data. The pushed out data by shifting is discarded.

Parameters
[in]dataThe buffer containing input data. The input data is replaced with shifted data.
[in]lengthThe size of data .
[in]shiftThe shift length. Positive and negative values indicate shift to left and right respectively.

◆ datashiftf()

void datashiftf ( float * data,
long length,
long shift )
extern

Shifts input data. The pushed out data by shifting is discarded.

Parameters
[in]dataThe buffer containing input data. The input data is replaced with shifted data.
[in]lengthThe size of data .
[in]shiftThe shift length. Positive and negative values indicate shift to left and right respectively.

◆ datashift()

void datashift ( double * data,
long length,
long shift )
extern

Shifts input data. The pushed out data by shifting is discarded.

Parameters
[in]dataThe buffer containing input data. The input data is replaced with shifted data.
[in]lengthThe size of data .
[in]shiftThe shift length. Positive and negative values indicate shift to left and right respectively.

◆ ridatashifts()

void ridatashifts ( short * real,
short * imag,
long length,
long shift )
extern

Shifts input complex data. The pushed out data by shifting is discarded.

Parameters
[in]realThe buffer containing input real data. The input data is replaced with shifted data.
[in]imagThe buffer containing input imaginary data. The input data is replaced with shifted data.
[in]lengthThe size of input data.
[in]shiftThe shift length. Positive and negative values indicate shift to left and right respectively.

◆ ridatashiftl()

void ridatashiftl ( long * real,
long * imag,
long length,
long shift )
extern

Shifts input complex data. The pushed out data by shifting is discarded.

Parameters
[in]realThe buffer containing input real data. The input data is replaced with shifted data.
[in]imagThe buffer containing input imaginary data. The input data is replaced with shifted data.
[in]lengthThe size of input data.
[in]shiftThe shift length. Positive and negative values indicate shift to left and right respectively.

◆ ridatashiftf()

void ridatashiftf ( float * real,
float * imag,
long length,
long shift )
extern

Shifts input complex data. The pushed out data by shifting is discarded.

Parameters
[in]realThe buffer containing input real data. The input data is replaced with shifted data.
[in]imagThe buffer containing input imaginary data. The input data is replaced with shifted data.
[in]lengthThe size of input data.
[in]shiftThe shift length. Positive and negative values indicate shift to left and right respectively.

◆ ridatashift()

void ridatashift ( double * real,
double * imag,
long length,
long shift )
extern

Shifts input complex data. The pushed out data by shifting is discarded.

Parameters
[in]realThe buffer containing input real data. The input data is replaced with shifted data.
[in]imagThe buffer containing input imaginary data. The input data is replaced with shifted data.
[in]lengthThe size of input data.
[in]shiftThe shift length. Positive and negative values indicate shift to left and right respectively.

◆ circshifts()

void circshifts ( short * data,
long length,
long shift )
extern

Circular-shifts input data.

Parameters
[in]dataThe buffer containing input data. The input data is replaced with shifted data.
[in]lengthThe size of input data.
[in]shiftThe shift length. Positive and negative values indicate shift to left and right respectively.

◆ circshiftl()

void circshiftl ( long * data,
long length,
long shift )
extern

Circular-shifts input data.

Parameters
[in]dataThe buffer containing input data. The input data is replaced with shifted data.
[in]lengthThe size of input data.
[in]shiftThe shift length. Positive and negative values indicate shift to left and right respectively.

◆ circshiftf()

void circshiftf ( float * data,
long length,
long shift )
extern

Circular-shifts input data.

Parameters
[in]dataThe buffer containing input data. The input data is replaced with shifted data.
[in]lengthThe size of input data.
[in]shiftThe shift length. Positive and negative values indicate shift to left and right respectively.

◆ circshift()

void circshift ( double * data,
long length,
long shift )
extern

Circular-shifts input data.

Parameters
[in]dataThe buffer containing input data. The input data is replaced with shifted data.
[in]lengthThe size of input data.
[in]shiftThe shift length. Positive and negative values indicate shift to left and right respectively.

◆ ricircshifts()

void ricircshifts ( short * real,
short * imag,
long length,
long shift )
extern

Circular-shifts input complex data.

Parameters
[in]realThe buffer containing input real data. The input data is replaced with shifted data.
[in]imagThe buffer containing input imaginary data. The input data is replaced with shifted data.
[in]lengthThe size of input data.
[in]shiftThe shift length. Positive and negative values indicate shift to left and right respectively.

◆ ricircshiftl()

void ricircshiftl ( long * real,
long * imag,
long length,
long shift )
extern

Circular-shifts input complex data.

Parameters
[in]realThe buffer containing input real data. The input data is replaced with shifted data.
[in]imagThe buffer containing input imaginary data. The input data is replaced with shifted data.
[in]lengthThe size of input data.
[in]shiftThe shift length. Positive and negative values indicate shift to left and right respectively.

◆ ricircshiftf()

void ricircshiftf ( float * real,
float * imag,
long length,
long shift )
extern

Circular-shifts input complex data.

Parameters
[in]realThe buffer containing input real data. The input data is replaced with shifted data.
[in]imagThe buffer containing input imaginary data. The input data is replaced with shifted data.
[in]lengthThe size of input data.
[in]shiftThe shift length. Positive and negative values indicate shift to left and right respectively.

◆ ricircshift()

void ricircshift ( double * real,
double * imag,
long length,
long shift )
extern

Circular-shifts input complex data.

Parameters
[in]realThe buffer containing input real data. The input data is replaced with shifted data.
[in]imagThe buffer containing input imaginary data. The input data is replaced with shifted data.
[in]lengthThe size of input data.
[in]shiftThe shift length. Positive and negative values indicate shift to left and right respectively.

◆ fftturnf()

void fftturnf ( float * xRe,
float * xIm,
long fftl )
extern

Makes the real part of the spectrum reflection symmetric and the imaginary part rotational symmetric with respect to the index fftl/2. The right half data is not used for computation.

Parameters
[in]xReThe buffer of the real part of input data. The right half data is overwritten.
[in]xImThe buffer of the imaginary part of input data. The right half data is overwritten. If you don't use the immaginary part, NULL can be specified.
[in]fftlThe number of FFT points. The buffer size must be larger than this value.

◆ fftturn()

void fftturn ( double * xRe,
double * xIm,
long fftl )
extern

Makes the real part of the spectrum reflection symmetric and the imaginary part rotational symmetric with respect to the index fftl/2. The right half data is not used for computation.

Parameters
[in]xReThe buffer of the real part of input data. The right half data is overwritten.
[in]xImThe buffer of the imaginary part of input data. The right half data is overwritten. If you don't use the immaginary part, NULL can be specified.
[in]fftlThe number of FFT points. The buffer size must be larger than this value.

◆ fftshiftf()

void fftshiftf ( float * xRe,
float * xIm,
long fftl )
extern

Circular-shifts input data so that the index fftl/2 of the buffer moves to the index 0 .

Parameters
[in]xReThe buffer of the real part of input data. The input data is replaced with shifted data.
[in]xImThe buffer of the imaginary part of input data. The input data is replaced with shifted data.
[in]fftlThe number of FFT points. The buffer size must be larger than this value.

◆ fftshift()

void fftshift ( double * xRe,
double * xIm,
long fftl )
extern

Circular-shifts input data so that the index fftl/2 of the buffer moves to the index 0 .

Parameters
[in]xReThe buffer of the real part of input data. The input data is replaced with shifted data.
[in]xImThe buffer of the imaginary part of input data. The input data is replaced with shifted data.
[in]fftlThe number of FFT points. The buffer size must be larger than this value.

◆ spGetNumFFTPlugin()

int spGetNumFFTPlugin ( void )
extern

Gets the number of FFT plugins available.

Returns
The number of FFT plugins available.

◆ xspSearchFFTPluginFile()

char * xspSearchFFTPluginFile ( int * index)
extern

Finds the name of an FFT plugin registered.

Parameters
[in]indexThe address of a variable which holds the index to find. The index of the first call must be 0. After the function call, the value of the variable will be the index of the FFT plugin obtained.
Returns
A null-terminated string indicating the file name of the FFT plugin. You have to deallocate the memory by calling xspFree() . NULL will be returned if error occurs or no plugin is found anymore.

◆ spSetDefaultFFTPlugin()

spBool spSetDefaultFFTPlugin ( const char * name)
extern

Sets the specified FFT plugin default.

Parameters
[in]nameA null-terminated string of the name of an FFT plugin.
Return values
SP_TRUESuccess
SP_FALSEFailure

◆ spIsFFTPlugin()

spBool spIsFFTPlugin ( spPlugin * plugin)
extern

Checks if the plugin is an FFT plugin.

Parameters
[in]pluginspPlugin type pointer to check.
Return values
SP_TRUESuccess
SP_FALSEFailure

◆ spLoadFFTPlugin()

spPlugin * spLoadFFTPlugin ( const char * name)
extern

Loads an FFT plugin.

Parameters
[in]nameThe name of the FFT plugin.
Returns
The loaded FFT plugin if successful or NULL if failure.
Examples
simple_fft.c, and simple_rfft.c.

◆ spFreeFFTPlugin()

spBool spFreeFFTPlugin ( spPlugin * plugin)
extern

Unloads the FFT plugin.

Parameters
[in]pluginThe loaded FFT plugin obtained by spLoadFFTPlugin() .
Return values
SP_TRUESuccess
SP_FALSEFailure

◆ spGetFFTSpeed()

spFFTSpeed spGetFFTSpeed ( spFFTPrecision precision)
extern

Gets speed of the default FFT engine. This function doesn't get speed of the plugin-based FFT engine if the plugin-based FFT is set to default.

Parameters
[in]precisionThe precision of the FFT engine to get speed in spFFTPrecision type.
Returns
The speed of the FFT engine in spFFTSpeed type.

◆ spInitBatchedFFTByPlugin()

spFFTRec spInitBatchedFFTByPlugin ( spPlugin * plugin,
long order,
long batch,
spFFTPrecision precision )
extern

Initializes resources for plugin-based FFT inside spFFTRec. The return value can be used for FFT-related functions such as spExecFFT() and spExecRealFFT() . The difference from spInitFFTByPlugin() is that a single FFT call executes multiple FFTs of the batch count in parallel. The buffer for spExecFFT() or spExecRealFFT() contains a series of vectors of the batch count.

Parameters
[in]pluginThe FFT plugin used as FFT engine.
[in]orderThe order (the power of 2) of FFT points. For example, 8 for the FFT points of 256.
[in]batchThe batch count.
[in]precisionThe precision of FFT engine such as SP_FFT_DEFAULT_PRECISION , SP_FFT_DOUBLE_PRECISION , SP_FFT_FLOAT_PRECISION and so on. Normally, SP_FFT_DEFAULT_PRECISION is recommended. Higher precision can make FFT execution slow on some environments.
Returns
The memory-allocated spFFTRec type variable including resources for FFT execution if successful or NULL if failure. You have to call spFreeFFT() to free the resources.

◆ spInitBatchedFFT()

spFFTRec spInitBatchedFFT ( long order,
long batch,
spFFTPrecision precision )
extern

Initializes resources for FFT inside spFFTRec. The return value can be used for FFT-related functions such as spExecFFT() and spExecRealFFT() . The difference from spInitFFT() is that a single FFT call executes multiple FFTs of the batch count in parallel. The buffer for spExecFFT() or spExecRealFFT() contains a series of vectors of the batch count.

Parameters
[in]orderThe order (the power of 2) of FFT points. For example, 8 for the FFT points of 256.
[in]batchThe batch count.
[in]precisionThe precision of FFT engine such as SP_FFT_DEFAULT_PRECISION , SP_FFT_DOUBLE_PRECISION , SP_FFT_FLOAT_PRECISION and so on. Normally, SP_FFT_DEFAULT_PRECISION is recommended. Higher precision can make FFT execution slow on some environments.
Returns
The memory-allocated spFFTRec type variable including resources for FFT execution if successful or NULL if failure. You have to call spFreeFFT() to free the resources.

◆ spInitFFTByPlugin()

spFFTRec spInitFFTByPlugin ( spPlugin * plugin,
long order,
spFFTPrecision precision )
extern

Initializes resources for plugin-based FFT inside spFFTRec. The return value can be used for FFT-related functions such as spExecFFT() and spExecRealFFT() .

Parameters
[in]pluginThe FFT plugin used as FFT engine.
[in]orderThe order (the power of 2) of FFT points. For example, 8 for the FFT points of 256.
[in]precisionThe precision of FFT engine such as SP_FFT_DEFAULT_PRECISION , SP_FFT_DOUBLE_PRECISION , SP_FFT_FLOAT_PRECISION and so on. Normally, SP_FFT_DEFAULT_PRECISION is recommended. Higher precision can make FFT execution slow on some environments.
Returns
The memory-allocated spFFTRec type variable including resources for FFT execution if successful or NULL if failure. You have to call spFreeFFT() to free the resources.
Examples
simple_fft.c, and simple_rfft.c.

◆ spInitFFT()

spFFTRec spInitFFT ( long order,
spFFTPrecision precision )
extern

Initializes resources for FFT inside spFFTRec. The return value can be used for FFT-related functions such as spExecFFT() and spExecRealFFT() .

Parameters
[in]orderThe order (the power of 2) of FFT points. For example, 8 for the FFT points of 256.
[in]precisionThe precision of FFT engine such as SP_FFT_DEFAULT_PRECISION , SP_FFT_DOUBLE_PRECISION , SP_FFT_FLOAT_PRECISION and so on. Normally, SP_FFT_DEFAULT_PRECISION is recommended. Higher precision can make FFT execution slow on some environments.
Returns
The memory-allocated spFFTRec type variable including resources for FFT execution if successful or NULL if failure. You have to call spFreeFFT() to free the resources.
Examples
fftvec.c, and lpctest.c.

◆ spFreeFFT()

spBool spFreeFFT ( spFFTRec fftrec)
extern

Frees the resources inside spFFTRec for FFT execution.

Parameters
[in]fftrecspFFTRec type variable obtained by spInitFFT() or similar functions.
Return values
SP_TRUESuccess
SP_FALSEFailure
Examples
fftvec.c, lpctest.c, simple_fft.c, and simple_rfft.c.

◆ spResetFFTOrder()

spBool spResetFFTOrder ( spFFTRec fftrec,
long order )
extern

Resets the order of FFT. The buffer length must be larger than the length of 2 to the order-th power.

Parameters
[in]fftrecspFFTRec type variable obtained by spInitFFT() or similar functions.
[in]orderThe order (the power of 2) of FFT points. For example, 8 for the FFT points of 256.
Return values
SP_TRUESuccess
SP_FALSEFailure

◆ spGetFFTOrder()

long spGetFFTOrder ( spFFTRec fftrec)
extern

Gets the order (the power of 2) of FFT points.

Parameters
[in]fftrecspFFTRec type variable obtained by spInitFFT() or similar functions.
Returns
The order of FFT points.

◆ spGetFFTLength()

long spGetFFTLength ( spFFTRec fftrec)
extern

Gets the number of FFT points.

Parameters
[in]fftrecspFFTRec type variable obtained by spInitFFT() or similar functions.
Returns
The number of FFT points.
Examples
fftvec.c, lpctest.c, simple_fft.c, and simple_rfft.c.

◆ spGetFFTBatch()

long spGetFFTBatch ( spFFTRec fftrec)
extern

Gets the batch size.

Parameters
[in]fftrecspFFTRec type variable obtained by spInitBatchedFFT() or spInitBatchedFFTByPlugin() .
Returns
The batch size.

◆ spExecFFTF()

spBool spExecFFTF ( spFFTRec fftrec,
float * real,
float * imag,
int inv )
extern

Executes FFT of input data with an FFT plugin.

Parameters
[in]fftrecspFFTRec type variable obtained by spInitFFT() or similar functions.
[in]realThe real part buffer of the data. The size of this buffer must be larger than the number of FFT points.
[in]imagThe imaginary part buffer of the data. The size of this buffer must be larger than the number of FFT points.
[in]invNonzero value enables execution of the inverse FFT.
Return values
SP_TRUESuccess
SP_FALSEFailure

◆ spExecFFT()

spBool spExecFFT ( spFFTRec fftrec,
double * real,
double * imag,
int inv )
extern

Executes FFT of input data with an FFT plugin.

Parameters
[in]fftrecspFFTRec type variable obtained by spInitFFT() or similar functions.
[in]realThe real part buffer of the data. The size of this buffer must be larger than the number of FFT points.
[in]imagThe imaginary part buffer of the data. The size of this buffer must be larger than the number of FFT points.
[in]invNonzero value enables execution of the inverse FFT.
Return values
SP_TRUESuccess
SP_FALSEFailure
Examples
simple_fft.c.

◆ spExecRealFFTF()

spBool spExecRealFFTF ( spFFTRec fftrec,
float * data,
int inv )
extern

Executes FFT of input real data with an FFT plugin.

Parameters
[in]fftrecspFFTRec type variable obtained by spInitFFT() or similar functions.
[in]dataThe buffer of the data. The size of this buffer must be larger than the number of FFT points. After FFT execution, data holds data[0]=Re(X[0]), data[1]=Re(X[fftl/2]), data[2*n]=Re(X[n]), and data[2*n+1]=Im(X[n]) (n > 0, n < fftl/2), where X[n] is the complex spectrum. In other words, even elements except the index 0 and odd elements except the index 1 hold the real part and the imaginary part of the complex spectrum, respectively.
[in]invNonzero value enables execution of the inverse FFT.
Return values
SP_TRUESuccess
SP_FALSEFailure

◆ spExecRealFFT()

spBool spExecRealFFT ( spFFTRec fftrec,
double * data,
int inv )
extern

Executes FFT of input real data with an FFT plugin.

Parameters
[in]fftrecspFFTRec type variable obtained by spInitFFT() or similar functions.
[in]dataThe buffer of the data. The size of this buffer must be larger than the number of FFT points. After FFT execution, data holds data[0]=Re(X[0]), data[1]=Re(X[fftl/2]), data[2*n]=Re(X[n]), and data[2*n+1]=Im(X[n]) (n > 0, n < fftl/2), where X[n] is the complex spectrum. In other words, even elements except the index 0 and odd elements except the index 1 hold the real part and the imaginary part of the complex spectrum, respectively.
[in]invNonzero value enables execution of the inverse FFT.
Return values
SP_TRUESuccess
SP_FALSEFailure
Examples
simple_rfft.c.

◆ spExecFFTPowerF()

spBool spExecFFTPowerF ( spFFTRec fftrec,
float * data,
float exponent )
extern

Calculates a power spectrum of input data with an FFT plugin.

Parameters
[in]fftrecspFFTRec type variable obtained by spInitFFT() or similar functions.
[in]dataThe buffer containing input data. The size of this buffer must be larger than the number of FFT points. After the function call, the buffer is replaced by the power spectrum calculated.
[in]exponentThe exponent value to a power spectrum. For example, 1.0 and 0.5 correspond to the power spectrum and the amplitude spectrum, respectively.
Return values
SP_TRUESuccess
SP_FALSEFailure

◆ spExecFFTPower()

spBool spExecFFTPower ( spFFTRec fftrec,
double * data,
double exponent )
extern

Calculates a power spectrum of input data with an FFT plugin.

Parameters
[in]fftrecspFFTRec type variable obtained by spInitFFT() or similar functions.
[in]dataThe buffer containing input data. The size of this buffer must be larger than the number of FFT points. After the function call, the buffer is replaced by the power spectrum calculated.
[in]exponentThe exponent value to a power spectrum. For example, 1.0 and 0.5 correspond to the power spectrum and the amplitude spectrum, respectively.
Return values
SP_TRUESuccess
SP_FALSEFailure