void InitPStream(PStream * pst) { void InitDWin(PStream *); double *dcalloc(int, int); double **ddcalloc(int, int, int, int); double ***dddcalloc(int, int, int, int, int, int); int half, full; int i, m; InitDWin(pst); half = pst->range * 2; full = pst->range * 4 + 1; pst->vSize = (pst->order + 1) * pst->dw.num; pst->sm.length = LENGTH; while (pst->sm.length < pst->range + pst->dw.maxw[WRIGHT]) pst->sm.length *= 2; pst->mean = dcalloc(pst->vSize * 2, 0); pst->ivar = pst->mean + pst->vSize; pst->sm.mseq = ddcalloc(pst->sm.length, pst->vSize, 0, 0); pst->sm.ivseq = ddcalloc(pst->sm.length, pst->vSize, 0, 0); pst->sm.c = ddcalloc(pst->sm.length, pst->order + 1, 0, 0); pst->sm.P = dddcalloc(full, pst->sm.length, pst->order + 1, half, 0, 0); pst->sm.pi = ddcalloc(pst->range + pst->dw.maxw[WRIGHT] + 1, pst->order + 1, pst->range, 0); pst->sm.k = ddcalloc(pst->range + pst->dw.maxw[WRIGHT] + 1, pst->order + 1, pst->range, 0); for (i = 0; i < pst->sm.length; i++) for (m = 0; m < pst->vSize; m++) pst->sm.ivseq[i][m] = 0.0; for (i = 0; i < pst->sm.length; i++) for (m = 0; m <= pst->order; m++) pst->sm.P[0][i][m] = INFTY; pst->sm.t = pst->range - 1; pst->sm.mask = pst->sm.length - 1; return; }
static void InitPStreamChol(PStreamChol *pst, const float *dynwin, int fsize, int order, int T) { // order of cepstrum pst->order = order; // windows for dynamic feature InitDWin(pst, dynwin, fsize); // dimension of observed vector pst->vSize = (pst->order + 1) * pst->dw.num; // odim = dim * (1--3) // memory allocation pst->T = T; // number of frames pst->width = pst->dw.maxw[WRIGHT] * 2 + 1; // width of R pst->mseq = ddcalloc(T, pst->vSize, 0, 0); // [T][odim] pst->ivseq = ddcalloc(T, pst->vSize, 0, 0); // [T][odim] pst->R = ddcalloc(T, pst->width, 0, 0); // [T][width] pst->r = dcalloc(T, 0); // [T] pst->g = dcalloc(T, 0); // [T] pst->c = ddcalloc(T, pst->order + 1, 0, 0); // [T][dim] return; }