Data Structures | Typedefs | Enumerations | Functions
Le Roux's Modifications of the Griffin-Lim Algorithm

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)
 

Detailed Description

Algorithm Description

The implementation follows papers [3] [4].

Algorithm Acceleration

[5]

Typedef Documentation

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

Parameters
[in]userdataUser defined data
[in,out]cSet of coefficients to by updated, size M2 x N x W
[in]LSignal length
[in]WNumber of signal channels
[in]aTime hop factor
[in]MNumber of frequency channels

Versions

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);

Returns
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

Parameters
[in]pDGTREAL analysis-synthesis plan
[in]userdataUser defined data
[in,out]cSet of coefficients at the end of iteration, size M2 x N x W
[in]LSignal length
[in]WNumber of signal channels
[in]aTime hop factor
[in]MNumber of frequency channels
[in]alphaAcceleration parameter
[in]iterCurrent iteration

Versions

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);

Returns
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
See also
dgtreal_execute_proj dgtreal_execute_ana dgtreal_execute_syn

Function Documentation

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

Parameters
[in]cinitInitial set of coefficients, size M2 x N x W
[in]gAnalysis window, size gl x 1
[in]LSignal length
[in]glWindow length
[in]WNumber of signal channels
[in]aTime hop factor
[in]MNumber of frequency channels
[in]iterNumber of iterations
[out]cCoefficients with reconstructed phase, size M2 x N x W

Versions

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[]);

Returns
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

Parameters
[in]pLEGLA plan

Versions

phaseret_legla_done_d(phaseret_legla_plan_d** p);

phaseret_legla_done_s(phaseret_legla_plan_s** p);

Returns
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

Parameters
[in]pLEGLA plan
[in]iterNumber of iterations

Versions

phaseret_legla_execute_d(phaseret_legla_plan_d* p, ltfat_int iter);

phaseret_legla_execute_s(phaseret_legla_plan_s* p, ltfat_int iter);

Returns
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

Parameters
[in]pLEGLA plan
[in]cinitInitial coefficient array, size M2 x N x W
[in]iterNumber of iterations
[in]cCoefficients with reconstructed phase, size M2 x N x W

Versions

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[]);

Returns
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

Parameters
[in]cinitInitial set of coefficients, size M2 x N x W or NULL
[in]gAnalysis window, size gl x 1
[in]LSignal length
[in]glWindow length
[in]WNumber of signal channels
[in]aTime hop factor
[in]MNumber of frequency channels
[in]alphaAcceleration parameter
[in]paramsOptional parameters
[out]cCoefficients with reconstructed phase, size M2 x N x W, cannot be NULL

Versions

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);

Returns
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

Parameters
[in]pLEGLA plan
[in]callbackCallback function
[in]userdataUser defined data

Versions

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);

Returns
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

Parameters
[in]pLEGLA plan
[in]callbackCallback function
[in]userdataUser defined data

Versions

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);

Returns
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

Warning
The structure must be freed using phaseret_legla_params_free()
Returns
Allocated struct (or NULL if the memory allocation failed)
See also
phaseret_legla_params_free
int phaseret_legla_params_free ( phaseret_legla_params *  params)

Destroy struct

Returns
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

Note
There is no need to free the returned struct.
Returns
Struct (or NULL if params was NULL)
See also
phaseret_dgtreal_params_set_phaseconv phaseret_dgtreal_params_set_fftwflags
phaseret_dgtreal_params_set_hint
int phaseret_legla_params_set_kernelsize ( phaseret_legla_params *  params,
phaseret_size  ksize 
)

Set kernel size

Returns
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

Returns
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

Returns
Status code Description
LTFATERR_SUCESS No error occured
LTFATERR_NULLPOINTER params was NULL