Data Structures | |
| struct | phaseret_size |
Typedefs | |
| typedef int | legla_callback_cmod(void *userdata, LTFAT_COMPLEX c[], ltfat_int L, ltfat_int W, ltfat_int a, ltfat_int M) |
| typedef int | legla_callback_status(dgtreal_plan *p, void *userdata, LTFAT_COMPLEX c[], ltfat_int L, ltfat_int W, ltfat_int a, ltfat_int M, double *alpha, ltfat_int iter) |
Enumerations | |
| enum | leglaupdate_mod { MOD_STEPWISE = (1 << 0), MOD_FRAMEWISE = (1 << 1), MOD_COEFFICIENTWISE = (1 << 2), MOD_COEFFICIENTWISE_SORTED = (1 << 3), MOD_MODIFIEDUPDATE = (1 << 4) } |
Functions | |
| phaseret_legla_params * | phaseret_legla_params_allocdef () |
| int | phaseret_legla_params_set_relthr (phaseret_legla_params *params, double relthr) |
| int | phaseret_legla_params_set_kernelsize (phaseret_legla_params *params, phaseret_size ksize) |
| int | phaseret_legla_params_set_leglaflags (phaseret_legla_params *params, unsigned leglaflags) |
| phaseret_dgtreal_params * | phaseret_legla_params_get_dgtreal_params (phaseret_legla_params *params) |
| int | phaseret_legla_params_free (phaseret_legla_params *params) |
| int | legla (const LTFAT_COMPLEX cinit[], const LTFAT_REAL g[], ltfat_int L, ltfat_int gl, ltfat_int W, ltfat_int a, ltfat_int M, ltfat_int iter, LTFAT_COMPLEX c[]) |
| int | legla_init (const LTFAT_COMPLEX cinit[], const LTFAT_REAL g[], ltfat_int L, ltfat_int gl, ltfat_int W, ltfat_int a, ltfat_int M, const double alpha, LTFAT_COMPLEX c[], phaseret_legla_params *params, legla_plan **p) |
| int | legla_execute (legla_plan *p, ltfat_int iter) |
| int | legla_execute_newarray (legla_plan *p, const LTFAT_COMPLEX cinit[], ltfat_int iter, LTFAT_COMPLEX c[]) |
| int | legla_done (legla_plan **p) |
| int | legla_set_status_callback (legla_plan *p, legla_callback_status *callback, void *userdata) |
| int | legla_set_cmod_callback (legla_plan *p, legla_callback_cmod *callback, void *userdata) |
The implementation follows papers [3] [4].
| typedef int legla_callback_cmod(void *userdata, LTFAT_COMPLEX c[], ltfat_int L, ltfat_int W, ltfat_int a, ltfat_int M) |
Function prototype for coefficient modification callback
M2 = M/2 + 1, N = L/a
| [in] | userdata | User defined data |
| [in,out] | c | Set of coefficients to by updated, size M2 x N x W |
| [in] | L | Signal length |
| [in] | W | Number of signal channels |
| [in] | a | Time hop factor |
| [in] | M | Number of frequency channels |
phaseret_legla_callback_cmod_d(void* userdata, ltfat_complex_d c[], ltfat_int L, ltfat_int W, ltfat_int a, ltfat_int M);
phaseret_legla_callback_cmod_s(void* userdata, ltfat_complex_s c[], ltfat_int L, ltfat_int W, ltfat_int a, ltfat_int M);
| Status code | Meaning |
|---|---|
| 0 | Signalizes that callback exited without error |
| <0 | Callback exited with error |
| typedef int legla_callback_status(dgtreal_plan *p, void *userdata, LTFAT_COMPLEX c[], ltfat_int L, ltfat_int W, ltfat_int a, ltfat_int M, double *alpha, ltfat_int iter) |
Function prototype for status callback
The callback is executed at the end of each iteration.
M2 = M/2 + 1, N = L/a
| [in] | p | DGTREAL analysis-synthesis plan |
| [in] | userdata | User defined data |
| [in,out] | c | Set of coefficients at the end of iteration, size M2 x N x W |
| [in] | L | Signal length |
| [in] | W | Number of signal channels |
| [in] | a | Time hop factor |
| [in] | M | Number of frequency channels |
| [in] | alpha | Acceleration parameter |
| [in] | iter | Current iteration |
phaseret_legla_callback_status_d(phaseret_dgtreal_plan_d* p, void* userdata, ltfat_complex_d c[], ltfat_int L, ltfat_int W, ltfat_int a, ltfat_int M, double* alpha, ltfat_int iter);
phaseret_legla_callback_status_s(phaseret_dgtreal_plan_s* p, void* userdata, ltfat_complex_s c[], ltfat_int L, ltfat_int W, ltfat_int a, ltfat_int M, double* alpha, ltfat_int iter);
| Status code | Meaning |
|---|---|
| 0 | Signalizes that callback exited without error |
| >0 | Signalizes that callback exited without error but terminate the algorithm prematurely |
| <0 | Callback exited with error |
| int legla | ( | const LTFAT_COMPLEX | cinit[], |
| const LTFAT_REAL | g[], | ||
| ltfat_int | L, | ||
| ltfat_int | gl, | ||
| ltfat_int | W, | ||
| ltfat_int | a, | ||
| ltfat_int | M, | ||
| ltfat_int | iter, | ||
| LTFAT_COMPLEX | c[] | ||
| ) |
Le Roux's Griffin-Lim algorithm
M2 = M/2 + 1, N = L/a
| [in] | cinit | Initial set of coefficients, size M2 x N x W |
| [in] | g | Analysis window, size gl x 1 |
| [in] | L | Signal length |
| [in] | gl | Window length |
| [in] | W | Number of signal channels |
| [in] | a | Time hop factor |
| [in] | M | Number of frequency channels |
| [in] | iter | Number of iterations |
| [out] | c | Coefficients with reconstructed phase, size M2 x N x W |
phaseret_legla_d(const ltfat_complex_d cinit[], const double g[], ltfat_int L, ltfat_int gl, ltfat_int W, ltfat_int a, ltfat_int M, ltfat_int iter, ltfat_complex_d c[]);
phaseret_legla_s(const ltfat_complex_s cinit[], const float g[], ltfat_int L, ltfat_int gl, ltfat_int W, ltfat_int a, ltfat_int M, ltfat_int iter, ltfat_complex_s c[]);
| Status code | Description |
|---|---|
| LTFATERR_SUCCESS | No error occurred |
| LTFATERR_NULLPOINTER | cinit or g or cout was NULL |
| LTFATERR_NOTPOSARG | iter must be positive |
| LTFATERR_NOMEM | Memory allocation error occurred |
| int legla_done | ( | legla_plan ** | p | ) |
Delete LEGLA plan
| [in] | p | LEGLA plan |
phaseret_legla_done_d(phaseret_legla_plan_d** p);
phaseret_legla_done_s(phaseret_legla_plan_s** p);
| Status code | Description |
|---|---|
| LTFATERR_SUCCESS | No error occurred |
| LTFATERR_NULLPOINTER | p or *p was NULL |
| int legla_execute | ( | legla_plan * | p, |
| ltfat_int | iter | ||
| ) |
Execute LEGLA plan
| [in] | p | LEGLA plan |
| [in] | iter | Number of iterations |
phaseret_legla_execute_d(phaseret_legla_plan_d* p, ltfat_int iter);
phaseret_legla_execute_s(phaseret_legla_plan_s* p, ltfat_int iter);
| Status code | Description |
|---|---|
| LTFATERR_SUCCESS | No error occurred |
| LTFATERR_NULLPOINTER | p or p->cinit was NULL. |
| LTFATERR_NOTPOSARG | iter must be positive |
| LTFATERR_BADARG | alpha set in the status callback must be nonnegative |
| LTFATERR_NOMEM | Memory allocation failed |
| any | Status code from any of the callbacks |
| int legla_execute_newarray | ( | legla_plan * | p, |
| const LTFAT_COMPLEX | cinit[], | ||
| ltfat_int | iter, | ||
| LTFAT_COMPLEX | c[] | ||
| ) |
Execute LEGLA plan on new arrays
M2 = M/2 + 1, N = L/a
| [in] | p | LEGLA plan |
| [in] | cinit | Initial coefficient array, size M2 x N x W |
| [in] | iter | Number of iterations |
| [in] | c | Coefficients with reconstructed phase, size M2 x N x W |
phaseret_legla_execute_newarray_d(phaseret_legla_plan_d* p, const ltfat_complex_d cinit[], ltfat_int iter, ltfat_complex_d c[]);
phaseret_legla_execute_newarray_s(phaseret_legla_plan_s* p, const ltfat_complex_s cinit[], ltfat_int iter, ltfat_complex_s c[]);
| Status code | Description |
|---|---|
| LTFATERR_SUCCESS | No error occurred |
| LTFATERR_NULLPOINTER | p or cinit or c was NULL. |
| LTFATERR_NOTPOSARG | iter must be positive |
| LTFATERR_BADARG | alpha set in the status callback must be nonnegative |
| LTFATERR_NOMEM | Memory allocation failed |
| any | Status code from any of the callbacks |
| int legla_init | ( | const LTFAT_COMPLEX | cinit[], |
| const LTFAT_REAL | g[], | ||
| ltfat_int | L, | ||
| ltfat_int | gl, | ||
| ltfat_int | W, | ||
| ltfat_int | a, | ||
| ltfat_int | M, | ||
| const double | alpha, | ||
| LTFAT_COMPLEX | c[], | ||
| phaseret_legla_params * | params, | ||
| legla_plan ** | p | ||
| ) |
Le Roux's Griffin-Lim algorithm struct initialization
M2 = M/2 + 1, N = L/a
The function can work inplace i.e. cinit == c
| [in] | cinit | Initial set of coefficients, size M2 x N x W or NULL |
| [in] | g | Analysis window, size gl x 1 |
| [in] | L | Signal length |
| [in] | gl | Window length |
| [in] | W | Number of signal channels |
| [in] | a | Time hop factor |
| [in] | M | Number of frequency channels |
| [in] | alpha | Acceleration parameter |
| [in] | params | Optional parameters |
| [out] | c | Coefficients with reconstructed phase, size M2 x N x W, cannot be NULL |
phaseret_legla_init_d(const ltfat_complex_d cinit[], const double g[], ltfat_int L, ltfat_int gl, ltfat_int W, ltfat_int a, ltfat_int M, double alpha, ltfat_complex_d c[], phaseret_legla_params* params, phaseret_legla_plan_d** p);
phaseret_legla_init_s(const ltfat_complex_s cinit[], const double g[], ltfat_int L, ltfat_int gl, ltfat_int W, ltfat_int a, ltfat_int M, double alpha, ltfat_complex_s c[], phaseret_legla_params* params, phaseret_legla_plan_s** p);
| Status code | Description |
|---|---|
| LTFATERR_SUCCESS | No error occurred |
| LTFATERR_NULLPOINTER | g or c or pout was NULL |
| LTFATERR_BADARG | alpha must be greater or equal to 0.0 |
| LTFATERR_NOTINRAGE | params->relthr must be in range [0-1] |
| LTFATERR_BADSIZE | Invalid kernel size: params->ksize |
| LTFATERR_CANNOTHAPPEN | params was not inilialized with phaseret_legla_params_defaults |
| LTFATERR_NOMEM | Memory allocation error occurred |
| int legla_set_cmod_callback | ( | legla_plan * | p, |
| legla_callback_cmod * | callback, | ||
| void * | userdata | ||
| ) |
Register coefficient modification callback
| [in] | p | LEGLA plan |
| [in] | callback | Callback function |
| [in] | userdata | User defined data |
phaseret_legla_set_cmod_callback_d(phaseret_legla_plan_d* p, phaseret_legla_callback_cmod_d* callback, void* userdata);
phaseret_legla_set_cmod_callback_s(phaseret_legla_plan_s* p, phaseret_legla_callback_cmod_s* callback, void* userdata);
| Status code | Description |
|---|---|
| LTFATERR_SUCCESS | No error occurred |
| LTFATERR_NULLPOINTER | p or callback was NULL |
| int legla_set_status_callback | ( | legla_plan * | p, |
| legla_callback_status * | callback, | ||
| void * | userdata | ||
| ) |
Register status callback
| [in] | p | LEGLA plan |
| [in] | callback | Callback function |
| [in] | userdata | User defined data |
phaseret_legla_set_status_callback_d(phaseret_legla_plan_d* p, phaseret_legla_callback_status_d* callback, void* userdata);
phaseret_legla_set_status_callback_s(phaseret_legla_plan_s* p, phaseret_legla_callback_status_s* callback, void* userdata);
| Status code | Description |
|---|---|
| LTFATERR_SUCCESS | No error occurred |
| LTFATERR_NULLPOINTER | p or callback was NULL |
| phaseret_legla_params* phaseret_legla_params_allocdef | ( | ) |
Allocate legla_params struct and initialize to default values
| int phaseret_legla_params_free | ( | phaseret_legla_params * | params | ) |
Destroy struct
| Status code | Description |
|---|---|
| LTFATERR_SUCESS | No error occured |
| LTFATERR_NULLPOINTER | params was NULL |
| phaseret_dgtreal_params* phaseret_legla_params_get_dgtreal_params | ( | phaseret_legla_params * | params | ) |
Get dgtreal_params struct
| int phaseret_legla_params_set_kernelsize | ( | phaseret_legla_params * | params, |
| phaseret_size | ksize | ||
| ) |
Set kernel size
| Status code | Description |
|---|---|
| LTFATERR_SUCESS | No error occured |
| LTFATERR_NULLPOINTER | params was NULL |
| int phaseret_legla_params_set_leglaflags | ( | phaseret_legla_params * | params, |
| unsigned | leglaflags | ||
| ) |
Set legla flags
| Status code | Description |
|---|---|
| LTFATERR_SUCESS | No error occured |
| LTFATERR_NULLPOINTER | params was NULL |
| int phaseret_legla_params_set_relthr | ( | phaseret_legla_params * | params, |
| double | relthr | ||
| ) |
Set relative threshold
| Status code | Description |
|---|---|
| LTFATERR_SUCESS | No error occured |
| LTFATERR_NULLPOINTER | params was NULL |