SAF
|
A modified version of afSTFTlib. More...
#include "../../modules/saf_utilities/saf_utilities.h"
Go to the source code of this file.
Macros | |
#define | AFSTFT_USE_SAF_UTILITIES |
Remove the "AFSTFT_USE_SAF_UTILITIES" definition, and add the vecTools.h/c and fft4g.h/c to your project, if you want to use the original afSTFT vector code. | |
Enumerations | |
enum | AFSTFT_FDDATA_FORMAT { AFSTFT_BANDS_CH_TIME , AFSTFT_TIME_CH_BANDS } |
Options for how the frequency domain data is permuted when using afSTFT. More... | |
Functions | |
void | afSTFT_create (void **const phSTFT, int nCHin, int nCHout, int hopsize, int lowDelayMode, int hybridmode, AFSTFT_FDDATA_FORMAT format) |
Creates an instance of afSTFT. | |
void | afSTFT_destroy (void **const phSTFT) |
Destroys an instance of afSTFT. | |
void | afSTFT_forward (void *const hSTFT, float **dataTD, int framesize, float_complex ***dataFD) |
Performs forward afSTFT transform. | |
void | afSTFT_forward_knownDimensions (void *const hSTFT, float **dataTD, int framesize, int dataFD_nCH, int dataFD_nHops, float_complex ***dataFD) |
Performs forward afSTFT transform (dataFD dimensions are known) | |
void | afSTFT_forward_flat (void *const hSTFT, float *dataTD, int framesize, float_complex *dataFD) |
Performs forward afSTFT transform (flattened arrays) | |
void | afSTFT_backward (void *const hSTFT, float_complex ***dataFD, int framesize, float **dataTD) |
Performs backward afSTFT transform. | |
void | afSTFT_backward_knownDimensions (void *const hSTFT, float_complex ***dataFD, int framesize, int dataFD_nCH, int dataFD_nHops, float **dataTD) |
Performs backward afSTFT transform (dataFD dimensions are known) | |
void | afSTFT_backward_flat (void *const hSTFT, float_complex *dataFD, int framesize, float *dataTD) |
Performs backward afSTFT transform (flattened arrays) | |
void | afSTFT_channelChange (void *const hSTFT, int new_nCHin, int new_nCHout) |
Re-allocates memory to support a change in the number of input/output channels. | |
void | afSTFT_clearBuffers (void *const hSTFT) |
Flushes time-domain buffers with zeros. | |
int | afSTFT_getNBands (void *const hSTFT) |
Returns number of frequency bands. | |
int | afSTFT_getProcDelay (void *const hSTFT) |
Returns current processing delay, in samples. | |
void | afSTFT_getCentreFreqs (void *const hSTFT, float fs, int nBands, float *freqVector) |
Returns current frequency vector. | |
void | afSTFT_FIRtoFilterbankCoeffs (float *hIR, int N_dirs, int nCH, int ir_len, int hopSize, int LDmode, int hybridmode, float_complex *hFB) |
Converts FIR filters into Filterbank Coefficients by passing them through the afSTFT filterbank. | |
Variables | |
const float | __afSTFT_protoFilter1024 [10240] |
Prototype filter used by afSTFTlib. | |
const float | __afSTFT_protoFilter1024LD [10240] |
Prototype filter used by afSTFTlib (low-delay mode) | |
A modified version of afSTFTlib.
The original afSTFT code (by Juha Vilkamo) can be found here: https://github.com/jvilkamo/afSTFT This version is slightly modified to be more in-line with how the rest of SAF is structured. The files afSTFTlib.h/.c act as the interface to afSTFT, which is then implemented in afSTFT_internal.h/.c.
This version also adds functionality to change the number of channels on the fly, flush the run-time buffers with zeros, return the current frequency vector and the current processing delay. It also incorporates SAF utilities (for the vectorisation and FFT).
The afSTFT design is also described in more detail in [1]
Definition in file afSTFTlib.h.
#define AFSTFT_USE_SAF_UTILITIES |
Remove the "AFSTFT_USE_SAF_UTILITIES" definition, and add the vecTools.h/c and fft4g.h/c to your project, if you want to use the original afSTFT vector code.
Note the vecTools.h/c and fft4g.h/c files, may be found here: https://github.com/jvilkamo/afSTFT
Definition at line 63 of file afSTFTlib.h.
enum AFSTFT_FDDATA_FORMAT |
Options for how the frequency domain data is permuted when using afSTFT.
Enumerator | |
---|---|
AFSTFT_BANDS_CH_TIME | nBands x nChannels x nTimeHops |
AFSTFT_TIME_CH_BANDS | nTimeHops x nChannels x nBands |
Definition at line 79 of file afSTFTlib.h.
void afSTFT_backward | ( | void *const | hSTFT, |
float_complex *** | dataFD, | ||
int | framesize, | ||
float ** | dataTD ) |
Performs backward afSTFT transform.
[in] | hSTFT | afSTFT handle |
[in] | dataFD | Frequency-domain input; AFSTFT_FDDATA_FORMAT |
[in] | framesize | Frame size of time-domain data |
[out] | dataTD | Time-domain output; nCHout x framesize |
Definition at line 347 of file afSTFTlib.c.
void afSTFT_backward_flat | ( | void *const | hSTFT, |
float_complex * | dataFD, | ||
int | framesize, | ||
float * | dataTD ) |
Performs backward afSTFT transform (flattened arrays)
[in] | hSTFT | afSTFT handle |
[in] | dataFD | Frequency-domain input; FLAT: AFSTFT_FDDATA_FORMAT |
[in] | framesize | Frame size of time-domain data |
[out] | dataTD | Time-domain output; FLAT: nCHout x framesize |
Definition at line 433 of file afSTFTlib.c.
void afSTFT_backward_knownDimensions | ( | void *const | hSTFT, |
float_complex *** | dataFD, | ||
int | framesize, | ||
int | dataFD_nCH, | ||
int | dataFD_nHops, | ||
float ** | dataTD ) |
Performs backward afSTFT transform (dataFD dimensions are known)
[in] | hSTFT | afSTFT handle |
[in] | dataFD | Frequency-domain input; AFSTFT_FDDATA_FORMAT |
[in] | framesize | Frame size of time-domain data |
[in] | dataFD_nCH | Number of channels dataFD is allocated (the max) |
[in] | dataFD_nHops | Number of timeslots dataFD is allocated (the max) |
[out] | dataTD | Time-domain output; nCHout x framesize |
Definition at line 390 of file afSTFTlib.c.
void afSTFT_channelChange | ( | void *const | hSTFT, |
int | new_nCHin, | ||
int | new_nCHout ) |
Re-allocates memory to support a change in the number of input/output channels.
[in] | hSTFT | afSTFT handle |
[in] | new_nCHin | New number of input channels |
[in] | new_nCHout | New number of output channels |
Definition at line 476 of file afSTFTlib.c.
void afSTFT_clearBuffers | ( | void *const | hSTFT | ) |
Flushes time-domain buffers with zeros.
Definition at line 518 of file afSTFTlib.c.
void afSTFT_create | ( | void **const | phSTFT, |
int | nCHin, | ||
int | nCHout, | ||
int | hopsize, | ||
int | lowDelayMode, | ||
int | hybridmode, | ||
AFSTFT_FDDATA_FORMAT | format ) |
Creates an instance of afSTFT.
[in] | phSTFT | (&) address of afSTFT handle |
[in] | nCHin | Number of input channels |
[in] | nCHout | Number of output channels |
[in] | hopsize | Hop size, in samples |
[in] | lowDelayMode | 0: disabled, 1: low-delay mode enabled |
[in] | hybridmode | 0: disabled, 1: hybrid-filtering enabled |
[in] | format | Frequency-domain frame format, see AFSTFT_FDDATA_FORMAT enum |
Definition at line 142 of file afSTFTlib.c.
void afSTFT_destroy | ( | void **const | phSTFT | ) |
Destroys an instance of afSTFT.
[in] | phSTFT | (&) address of afSTFT handle |
Definition at line 198 of file afSTFTlib.c.
void afSTFT_FIRtoFilterbankCoeffs | ( | float * | hIR, |
int | N_dirs, | ||
int | nCH, | ||
int | ir_len, | ||
int | hopSize, | ||
int | LDmode, | ||
int | hybridmode, | ||
float_complex * | hFB ) |
Converts FIR filters into Filterbank Coefficients by passing them through the afSTFT filterbank.
[in] | hIR | Time-domain FIR; FLAT: N_dirs x nCH x ir_len |
[in] | N_dirs | Number of FIR sets |
[in] | nCH | Number of channels per FIR set |
[in] | ir_len | Length of the FIR |
[in] | hopSize | Hop size |
[in] | LDmode | 0: disabled, 1:enabled |
[in] | hybridmode | 0: disabled, 1:enabled |
[out] | hFB | The FIRs as Filterbank coefficients; FLAT: N_bands x nCH x N_dirs |
Definition at line 592 of file afSTFTlib.c.
void afSTFT_forward | ( | void *const | hSTFT, |
float ** | dataTD, | ||
int | framesize, | ||
float_complex *** | dataFD ) |
Performs forward afSTFT transform.
[in] | hSTFT | afSTFT handle |
[in] | dataTD | Time-domain input; nCHin x framesize |
[in] | framesize | Frame size of time-domain data |
[out] | dataFD | Frequency-domain output; AFSTFT_FDDATA_FORMAT |
Definition at line 229 of file afSTFTlib.c.
void afSTFT_forward_flat | ( | void *const | hSTFT, |
float * | dataTD, | ||
int | framesize, | ||
float_complex * | dataFD ) |
Performs forward afSTFT transform (flattened arrays)
[in] | hSTFT | afSTFT handle |
[in] | dataTD | Time-domain input; FLAT: nCHin x framesize |
[in] | framesize | Frame size of time-domain data |
[out] | dataFD | Frequency-domain output; FLAT: AFSTFT_FDDATA_FORMAT |
Definition at line 310 of file afSTFTlib.c.
void afSTFT_forward_knownDimensions | ( | void *const | hSTFT, |
float ** | dataTD, | ||
int | framesize, | ||
int | dataFD_nCH, | ||
int | dataFD_nHops, | ||
float_complex *** | dataFD ) |
Performs forward afSTFT transform (dataFD dimensions are known)
[in] | hSTFT | afSTFT handle |
[in] | dataTD | Time-domain input; nCHin x framesize |
[in] | framesize | Frame size of time-domain data |
[in] | dataFD_nCH | Number of channels dataFD is allocated (the max) |
[in] | dataFD_nHops | Number of timeslots dataFD is allocated (the max) |
[out] | dataFD | Frequency-domain output; AFSTFT_FDDATA_FORMAT |
Definition at line 267 of file afSTFTlib.c.
void afSTFT_getCentreFreqs | ( | void *const | hSTFT, |
float | fs, | ||
int | nBands, | ||
float * | freqVector ) |
Returns current frequency vector.
Definition at line 545 of file afSTFTlib.c.
int afSTFT_getNBands | ( | void *const | hSTFT | ) |
Returns number of frequency bands.
Definition at line 527 of file afSTFTlib.c.
int afSTFT_getProcDelay | ( | void *const | hSTFT | ) |
Returns current processing delay, in samples.
If the low-delay mode is enabled, it is instead: analysis delay: 2*hopsize
Definition at line 536 of file afSTFTlib.c.
|
extern |
Prototype filter used by afSTFTlib.
Definition at line 28 of file afSTFT_protoFilter.h.
|
extern |
Prototype filter used by afSTFTlib (low-delay mode)
Definition at line 1494 of file afSTFT_protoFilter.h.