/* Definition of the state information data type */ /* */ struct stateInfo { int stateNo; /* state number */ int numDur; /* number of allowed durations for each state */ float *mean; /* mean vector for this state */ float *slope; /* slope vector */ float *var; /* variance vector */ float *logVar; /* logarithm of the variance vector */ float *durP; /* vector of duration probabilities */ float *logDurP; /* log duration probability vector */ float *rMean; /* accumulator for mean in intermediate layer */ float *rSlope; /* accumulator for slope in intermediate layer */ float *rVar; /* accumulator for variance in acoustic layer */ int *rFreq; /* accumulator for duration probability estimation */ int rSkip; /* accumulator for skipped durations */ float *rDurP; /* accumulator for duration probability estimation */ int occ; /* state occupancy counter */ float slopeOcc; /* occupancy counter for the slope */ }; /* C module to recover the state identities */ /* */ struct stateInfo **RecoverStateIds(struct syntax syn, int *stateSeq, int numVecs) { int t; struct stateInfo **stateId; /*---------------------------------------------------------------------*/ /* The previous fuction, RecoverStateSeq, recovers the indices of the */ /* optimal state sequence, as an array of ints, relative to the syntax.*/ /* This function's purpose is to convert the sequence of ints into a */ /* sequence of pointers to model states. */ /*---------------------------------------------------------------------*/ /* Allocate memory for state identity sequence */ if ((stateId = (struct stateInfo **) calloc(numVecs, sizeof(struct stateInfo *))) == NULL) { printf("\n!>\tError in RecoverStateIds():"); printf(" allocating state sequence (out of memory)!\n"); return(NULL); } /* Recover the state identity sequence */ for (t=0; t