Functions | |
int | pghi (const LTFAT_REAL s[], double gamma, ltfat_int L, ltfat_int W, ltfat_int a, ltfat_int M, LTFAT_COMPLEX c[]) |
int | pghi_withmask (const LTFAT_COMPLEX cin[], const int mask[], double gamma, ltfat_int L, ltfat_int W, ltfat_int a, ltfat_int M, LTFAT_COMPLEX c[]) |
int | pghi_init (double gamma, ltfat_int L, ltfat_int W, ltfat_int a, ltfat_int M, double tol1, double tol2, pghi_plan **p) |
int | pghi_execute (pghi_plan *p, const LTFAT_REAL s[], LTFAT_COMPLEX c[]) |
int | pghi_execute_withmask (pghi_plan *p, const LTFAT_COMPLEX cin[], const int mask[], LTFAT_REAL buffer[], LTFAT_COMPLEX c[]) |
int | pghi_done (pghi_plan **p) |
The implementation follows paper [7].
Please note that the gollowing relation holds between \(\lambda\) used in the paper and \(\gamma\) used in this implementation
\[ \gamma = \lambda L, \]
where \(L\) is the transform length.
int pghi | ( | const LTFAT_REAL | s[], |
double | gamma, | ||
ltfat_int | L, | ||
ltfat_int | W, | ||
ltfat_int | a, | ||
ltfat_int | M, | ||
LTFAT_COMPLEX | c[] | ||
) |
Reconstruct complex coefficients from the magnitude using PGHI algorithm
M2 = M/2 + 1, N = L/a
[in] | s | Target magnitude, size M2 x N x W |
[in] | gamma | Window specific constant |
[in] | L | Signal length |
[in] | W | Number of channels |
[in] | a | Hop factor |
[in] | M | Number of frequency channels (FFT length) |
[out] | c | Reconstructed coefficients, size M2 x N x W |
phaseret_pghi_d(const double s[], double gamma, ltfat_int L, ltfat_int W, ltfat_int a, ltfat_int M, ltfat_complex_d c[]);
phaseret_pghi_s(const double s[], double gamma, ltfat_int L, ltfat_int W, ltfat_int a, ltfat_int M, ltfat_complex_s c[]);
Status code | Description |
---|---|
LTFATERR_SUCCESS | Indicates no error |
LTFATERR_NULLPOINTER | Indicates that at least one of the following was NULL: c, s |
LTFATERR_NOTPOSARG | At least one of the followig was not positive: L, W, a |
LTFATERR_BADARG | gamma was not positive or it was NAN. |
LTFATERR_NOMEM | Indicates that heap allocation failed |
int pghi_done | ( | pghi_plan ** | p | ) |
Destroy PGHI plan
[in] | p | PGHI plan |
phaseret_pghi_done_d(phaseret_pghi_plan_d** p);
phaseret_pghi_done_s(phaseret_pghi_plan_s** p);
Status code | Description |
---|---|
LTFATERR_SUCCESS | Indicates no error |
LTFATERR_NULLPOINTER | p was NULL |
int pghi_execute | ( | pghi_plan * | p, |
const LTFAT_REAL | s[], | ||
LTFAT_COMPLEX | c[] | ||
) |
Execute PGHI plan
M2 = M/2 + 1, N = L/a
[in] | p | PGHI plan |
[in] | s | Target magnitude of coefficients, size M2 x N X W |
[out] | c | Output coefficients with reconstructed phase, size M2 x N X W |
phaseret_pghi_execute_d(phaseret_pghi_plan_d* p, const double s[], ltfat_complex_d c[]);
phaseret_pghi_execute_s(phaseret_pghi_plan_s* p, const float s[], ltfat_complex_s c[]);
Status code | Description |
---|---|
LTFATERR_SUCCESS | Indicates no error |
LTFATERR_NULLPOINTER | Indicates that at least one of the following was NULL: p, c, s |
int pghi_execute_withmask | ( | pghi_plan * | p, |
const LTFAT_COMPLEX | cin[], | ||
const int | mask[], | ||
LTFAT_REAL | buffer[], | ||
LTFAT_COMPLEX | c[] | ||
) |
Execute PGHI plan with respect to mask
M2 = M/2 + 1, N = L/a
Nonzero values in mask represent known coefficient in
[in] | p | PGHI plan |
[in] | cin | Coefficients with initial phase, size M2 x N X W |
[in] | mask | Mask used to select coefficients with known phase, size M2 x N X W |
[in] | buffer | Work buffer, size M2 x N. Internal heap allocation occurs if it is NULL |
[out] | cout | Output coefficients with reconstructed phase, size M2 x N X W |
phaseret_pghi_execute_withmask_d(phaseret_pghi_plan_d* p, const ltfat_complex_d cin[], const int mask[], double buffer[], ltfat_complex_d c[]);
phaseret_pghi_execute_withmask_s(phaseret_pghi_plan_s* p, const ltfat_complex_s cin[], const int mask[], double buffer[], ltfat_complex_s c[]);
Status code | Description |
---|---|
LTFATERR_SUCCESS | Indicates no error |
LTFATERR_NULLPOINTER | Indicates that at least one of the following was NULL: p, cin, mask, cout |
LTFATERR_NOMEM | Indicates that heap allocation failed |
int pghi_init | ( | double | gamma, |
ltfat_int | L, | ||
ltfat_int | W, | ||
ltfat_int | a, | ||
ltfat_int | M, | ||
double | tol1, | ||
double | tol2, | ||
pghi_plan ** | p | ||
) |
Initialize PGHI plan
M2 = M/2 + 1, N = L/a
[in] | gamma | Window specific constant |
[in] | L | Signal length |
[in] | W | Number of channels |
[in] | a | Hop factor |
[in] | M | Number of frequency channels (FFT length) |
[in] | tol1 | Relative tolerance for the first pass, must be in range [0-1] |
[in] | tol2 | Relative tolernace for the second pass, must be in range [0-1] and lower or equal to tol1. If tol2 is NAN or it is equal to tol1, only the first pass will be done. |
[out] | p | PGHI plan |
phaseret_pghi_init_d(double gamma, ltfat_int L, ltfat_int W, ltfat_int a, ltfat_int M, double tol1, double tol2, phaseret_pghi_plan_d** p);
phaseret_pghi_init_s(double gamma, ltfat_int L, ltfat_int W, ltfat_int a, ltfat_int M, double tol1, double tol2, phaseret_pghi_plan_s** p);
Status code | Description |
---|---|
LTFATERR_SUCCESS | Indicates no error |
LTFATERR_NULLPOINTER | p was NULL. |
LTFATERR_NOTPOSARG | At least one of the followig was not positive: L, W, a |
LTFATERR_BADARG | gamma was not positive |
LTFATERR_NOTINRANGE | tol1 and tol2 were not in range [0-1] or tol1 < tol2 |
LTFATERR_NOMEM | Indicates that heap allocation failed |
int pghi_withmask | ( | const LTFAT_COMPLEX | cin[], |
const int | mask[], | ||
double | gamma, | ||
ltfat_int | L, | ||
ltfat_int | W, | ||
ltfat_int | a, | ||
ltfat_int | M, | ||
LTFAT_COMPLEX | c[] | ||
) |
Reconstruct complex coefficients from the magnitude using PGHI algorithm ... using some known coefficients.
M2 = M/2 + 1, N = L/a
[in] | cin | Coefficients with initial phase, size M2 x N X W |
[in] | mask | Mask used to select coefficients with known phase, size M2 x N X W |
[in] | gamma | Window specific constant |
[in] | L | Signal length |
[in] | W | Number of signal channels |
[in] | a | Hop factor |
[in] | M | Number of frequency channels (FFT length) |
[out] | c | Reconstructed coefficients, size M2 x N x W |
phaseret_pghi_withmask_d(const ltfat_complex_d s[], const int mask[], double gamma, ltfat_int L, ltfat_int W, ltfat_int a, ltfat_int M, ltfat_complex_d c[]);
phaseret_pghi_withmask_s(const ltfat_complex_s s[], const int mask[], double gamma, ltfat_int L, ltfat_int W, ltfat_int a, ltfat_int M, ltfat_complex_s c[]);
Status code | Description |
---|---|
LTFATERR_SUCCESS | Indicates no error |
LTFATERR_NULLPOINTER | Indicates that at least one of the following was NULL: cin, c, mask |
LTFATERR_NOTPOSARG | At least one of the followig was not positive: L, W, a |
LTFATERR_BADARG | gamma was not positive or it was NAN. |
LTFATERR_NOMEM | Indicates that heap allocation failed |