Typedefs | Functions
Griffin-Lim Algorithm

Typedefs

typedef int gla_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)
 
typedef int gla_callback_cmod(void *userdata, LTFAT_COMPLEX c[], ltfat_int L, ltfat_int W, ltfat_int a, ltfat_int M)
 
typedef int gla_callback_fmod(void *userdata, LTFAT_REAL f[], ltfat_int L, ltfat_int W, ltfat_int a, ltfat_int M)
 

Functions

int gla (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 gla_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_dgtreal_params *params, gla_plan **p)
 
int gla_execute (gla_plan *p, ltfat_int iter)
 
int gla_execute_newarray (gla_plan *p, const LTFAT_COMPLEX cinit[], ltfat_int iter, LTFAT_COMPLEX c[])
 
int gla_done (gla_plan **p)
 
int gla_set_status_callback (gla_plan *p, gla_callback_status *callback, void *userdata)
 
int gla_set_cmod_callback (gla_plan *p, gla_callback_cmod *callback, void *userdata)
 
int gla_set_fmod_callback (gla_plan *p, gla_callback_fmod *callback, void *userdata)
 

Detailed Description

Algorithm Description

The implementation follows papers [2] [5]

Typedef Documentation

typedef int gla_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_gla_callback_cmod_d(void* userdata, ltfat_complex_d c[], ltfat_int L, ltfat_int W, ltfat_int a, ltfat_int M);

phaseret_gla_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 gla_callback_fmod(void *userdata, LTFAT_REAL f[], ltfat_int L, ltfat_int W, ltfat_int a, ltfat_int M)

Function prototype for signal modification callback

Parameters
[in]userdataUser defined data
[in,out]fTime-domain signal to be updated, size L x W
[in]LSignal length
[in]WNumber of signal channels
[in]aTime hop factor
[in]MNumber of frequency channels

Versions

phaseret_gla_callback_fmod_d(void* userdata, double f[], ltfat_int L, ltfat_int W, ltfat_int a, ltfat_int M);

phaseret_gla_callback_fmod_s(void* userdata, float f[], 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 gla_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_gla_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_gla_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 gla ( 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[] 
)

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]coutCoefficients with reconstructed phase, size M2 x N x W

Versions

phaseret_gla_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_gla_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_BADSIZE Signal length L is less or equal to 0.
LTFATERR_NOTPOSARG At least one of W, a, M, gl was less or equal to zero.
LTFATERR_BADTRALEN L is not divisible by both a and M.
LTFATERR_NOTAFRAME System does not form a frame
LTFATERR_INITFAILED The FFTW plan creation failed
LTFATERR_NOTSUPPORTED This is a non-painless system but its support was not compiled
LTFATERR_NOMEM Memory allocation error occurred
int gla_done ( gla_plan **  p)

Destroy Griffin-Lim algorithm plan

Parameters
[in]pGriffin-lim algorithm plan

Versions

phaseret_gla_done_d(phaseret_gla_plan_d** p);

phaseret_gla_done_s(phaseret_gla_plan_s** p);

Returns
Status code Description
LTFATERR_SUCCESS No error occurred
LTFATERR_NULLPOINTER p or *p was NULL
int gla_execute ( gla_plan *  p,
ltfat_int  iter 
)

Execute Griffin-Lim algorithm plan

M2 = M/2 + 1, N = L/a

Parameters
[in]pGriffin-lim algorithm plan [in] iter Number of iterations

Versions

phaseret_gla_execute_d(phaseret_gla_plan_d* p, ltfat_int iter);

phaseret_gla_execute_s(phaseret_gla_plan_s* p, ltfat_int iter);

Returns
Status code Description
LTFATERR_SUCCESS No error occurred
LTFATERR_NULLPOINTER p was NULL or the plan was created with cinit or cout being NULL
LTFATERR_NOTPOSARG iter was not positive
LTFATERR_BADARG alpha was set to a negative number in the status callback
LTFATERR_NOMEM Memory allocation error occurred
any Error code from some of the callbacks
int gla_execute_newarray ( gla_plan *  p,
const LTFAT_COMPLEX  cinit[],
ltfat_int  iter,
LTFAT_COMPLEX  c[] 
)

Execute Griffin-Lim algorithm plan on a new array

M2 = M/2 + 1, N = L/a

Parameters
[in]pGriffin-lim algorithm plan
[in]cinitInitial set of coefficients, size M2 x N x W [in] iter Number of iterations
[in]coutCoefficients with reconstructed phase, size M2 x N x W

Versions

phaseret_gla_execute_newarray_d(phaseret_gla_plan_d* p, const ltfat_complex_d cinit[], ltfat_int iter, ltfat_complex_d c[]);

phaseret_gla_execute_newarray_s(phaseret_gla_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 cout was NULL
LTFATERR_NOTPOSARG iter was not positive
LTFATERR_BADARG alpha was set to a negative number in the status callback
LTFATERR_NOMEM Memory allocation error occurred
any Error code from some of the callbacks
int gla_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_dgtreal_params *  params,
gla_plan **  p 
)

Initialize Griffin-Lim algorithm plan

M2 = M/2 + 1, N = L/a

Note
cinit can be NULL if the plan is intended to be used wit the _newarray execute function. Similarly, c can also be NULL only if FFTW_ESTIMATE is passed in flags (the FFTW planning routine does not touch the array). On the other hand, the content of c might get overwritten if other FFTW planning flags are used.
In-place mode i.e. cinit == c is allowed.
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 constant
[in]cArray for holding coefficients with reconstructed phase, size M2 x N x W or NULL if flags == FFTW_ESTIMATE
[in]hintDGT algorithm hint
[in]flagsFFTW planning flag
[out]pGLA Plan

Versions

phaseret_gla_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_dgtreal_hint hint, unsigned flags, phaseret_gla_plan_d** p);

phaseret_gla_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_dgtreal_hint hint, unsigned flags, phaseret_gla_plan_s** p);

Returns
Status code Description
LTFATERR_SUCCESS No error occurred
LTFATERR_NULLPOINTER cinit or g or or p was NULL or c was NULL and flags != FFTW_ESTIMATE
LTFATERR_BADSIZE Signal length L is less or equal to 0.
LTFATERR_NOTPOSARG At least one of W, a, M, gl was less or equal to zero.
LTFATERR_BADTRALEN L is not divisible by both a and M.
LTFATERR_NOTAFRAME System does not form a frame
LTFATERR_INITFAILED The FFTW plan creation failed
LTFATERR_NOTSUPPORTED This is a non-painless system but its support was not compiled
LTFATERR_BADARG alpha was set to a negative number
LTFATERR_CANNOTHAPPEN hint does not have a valid value from phaseret_dgtreal_hint or ptype is not valid value from ltfat_phaseconvention enum
LTFATERR_NOMEM Memory allocation error occurred
int gla_set_cmod_callback ( gla_plan *  p,
gla_callback_cmod callback,
void *  userdata 
)

Register coefficient modification callback

Parameters
[in]pGriffin-lim algorithm plan
[in]callbackCallback function
[in]userdataUser defined data

Versions

phaseret_gla_set_cmod_callback_d(phaseret_gla_plan_d* p, phaseret_gla_callback_cmod_d* callback, void* userdata);

phaseret_gla_set_cmod_callback_s(phaseret_gla_plan_s* p, phaseret_gla_callback_cmod_s* callback, void* userdata);

Returns
Status code Description
LTFATERR_SUCCESS No error occurred
LTFATERR_NULLPOINTER p or callback was NULL
int gla_set_fmod_callback ( gla_plan *  p,
gla_callback_fmod callback,
void *  userdata 
)

Register signal modification callback

Parameters
[in]pGriffin-lim algorithm plan
[in]callbackCallback function
[in]userdataUser defined data

Versions

phaseret_set_fmod_callback_d(phaseret_gla_plan_d* p, phaseret_gla_callback_fmod_d* callback, void* userdata);

phaseret_set_fmod_callback_s(phaseret_gla_plan_s* p, phaseret_gla_callback_fmod_s* callback, void* userdata);

Returns
Status code Description
LTFATERR_SUCCESS No error occurred
LTFATERR_NULLPOINTER p or callback was NULL
int gla_set_status_callback ( gla_plan *  p,
gla_callback_status callback,
void *  userdata 
)

Register status callback

Parameters
[in]pGriffin-lim algorithm plan
[in]callbackCallback function
[in]userdataUser defined data

Versions

phaseret_gla_set_status_callback_d(phaseret_gla_plan_d* p, phaseret_gla_callback_status_d* callback, void* userdata);

phaseret_gla_set_status_callback_s(phaseret_gla_plan_s* p, phaseret_gla_callback_status_s* callback, void* userdata);

Returns
Status code Description
LTFATERR_SUCCESS No error occurred
LTFATERR_NULLPOINTER p or callback was NULL