SAF
Loading...
Searching...
No Matches
saf_utility_fft.c File Reference

Wrappers for optimised discrete/fast Fourier transform (FFT) routines. More...

#include "saf_utilities.h"
#include "saf_externals.h"

Go to the source code of this file.

Data Structures

struct  saf_stft_data
 Data structure for short-time Fourier transform. More...
 
struct  saf_rfft_data
 Data structure for real-(half)complex FFT transforms. More...
 
struct  saf_fft_data
 Data structure for complex-complex FFT transforms. More...
 

Functions

void getUniformFreqVector (int fftSize, float fs, float *freqVector)
 Calculates the frequencies (in Hz) of uniformly spaced bins, for a given FFT size and sampling rate.
 
void fftconv (float *x, float *h, int x_len, int h_len, int nCH, float *y)
 FFT-based convolution of signal 'x' with filter 'h'.
 
void fftfilt (float *x, float *h, int x_len, int h_len, int nCH, float *y)
 FFT-based convolution for FIR filters.
 
void hilbert (float_complex *x, int x_len, float_complex *y)
 Computes the discrete-time analytic signal via the Hilbert transform [1].
 
void saf_stft_create (void **const phSTFT, int winsize, int hopsize, int nCHin, int nCHout, SAF_STFT_FDDATA_FORMAT FDformat)
 Creates an instance of saf_stft.
 
void saf_stft_destroy (void **const phSTFT)
 Destroys an instance of saf_stft.
 
void saf_stft_forward (void *const hSTFT, float **dataTD, int framesize, float_complex ***dataFD)
 Performs the forward-STFT operation for the current frame.
 
void saf_stft_backward (void *const hSTFT, float_complex ***dataFD, int framesize, float **dataTD)
 Performs the backward-STFT operation for the current frame.
 
void saf_stft_flushBuffers (void *const hSTFT)
 Flushes the internal buffers with zeros.
 
void saf_stft_channelChange (void *const hSTFT, int new_nCHin, int new_nCHout)
 Changes the number of input/output channels.
 
void saf_rfft_create (void **const phFFT, int N)
 Creates an instance of saf_rfft; real<->half-complex (conjugate-symmetric) FFT.
 
void saf_rfft_destroy (void **const phFFT)
 Destroys an instance of saf_rfft.
 
void saf_rfft_forward (void *const hFFT, float *inputTD, float_complex *outputFD)
 Performs the forward-FFT operation; use for real to complex (conjugate symmetric) transformations.
 
void saf_rfft_backward (void *const hFFT, float_complex *inputFD, float *outputTD)
 Performs the backward-FFT operation; use for complex (conjugate symmetric) to real transformations.
 
void saf_fft_create (void **const phFFT, int N)
 Creates an instance of saf_fft; complex<->complex FFT.
 
void saf_fft_destroy (void **const phFFT)
 Destroys an instance of saf_fft.
 
void saf_fft_forward (void *const hFFT, float_complex *inputTD, float_complex *outputFD)
 Performs the forward-FFT operation; use for complex to complex transformations.
 
void saf_fft_backward (void *const hFFT, float_complex *inputFD, float_complex *outputTD)
 Performs the backward-FFT operation; use for complex to complex transformations.
 

Detailed Description

Wrappers for optimised discrete/fast Fourier transform (FFT) routines.

Note
If none of the supported optimised FFT implementations are linked, then saf_fft employs the highly respectable KissFFT (BSD 3-Clause License): https://github.com/mborgerding/kissfft
If using Apple Accelerate's vDSP for the FFT with an unsupported FFT size, then KissFFT is employed instead.
If you would like to use some other FFT implementation, then feel free to add it and submit a pull request :-)

Dependencies

Intel MKL, Intel IPP, Apple Accelerate, FFTW, or KissFFT (included in SAF)

Author
Leo McCormack
Date
06.04.2019
License
ISC

Definition in file saf_utility_fft.c.