Exemple #1
0
int
acmod_free(acmod_t *acmod)
{
    if (acmod == NULL)
        return 0;
    if (--acmod->refcount > 0)
        return acmod->refcount;

    ckd_free(acmod->senone_scores);
    ckd_free(acmod->senone_active_vec);
    ckd_free(acmod->senone_active);

    if (acmod->mdef)
        bin_mdef_free(acmod->mdef);
    if (acmod->tmat)
        tmat_free(acmod->tmat);
    if (acmod->mgau)
        ps_mgau_free(acmod->mgau);

    featbuf_free(acmod->fb);
    feat_array_free(acmod->feat_buf);
    logmath_free(acmod->lmath);
    cmd_ln_free_r(acmod->config);
    ckd_free(acmod);
    return 0;
}
Exemple #2
0
void
acmod_free(acmod_t *acmod)
{
    if (acmod == NULL)
        return;

    feat_free(acmod->fcb);
    fe_free(acmod->fe);
    cmd_ln_free_r(acmod->config);

    if (acmod->mfc_buf)
        ckd_free_2d((void **)acmod->mfc_buf);
    if (acmod->feat_buf)
        feat_array_free(acmod->feat_buf);

    if (acmod->mfcfh)
        fclose(acmod->mfcfh);
    if (acmod->rawfh)
        fclose(acmod->rawfh);
    if (acmod->senfh)
        fclose(acmod->senfh);

    ckd_free(acmod->framepos);
    ckd_free(acmod->senone_scores);
    ckd_free(acmod->senone_active_vec);
    ckd_free(acmod->senone_active);
    ckd_free(acmod->rawdata);

    if (acmod->mdef)
        bin_mdef_free(acmod->mdef);
    if (acmod->tmat)
        tmat_free(acmod->tmat);
    if (acmod->mgau)
        ps_mgau_free(acmod->mgau);
    if (acmod->mllr)
        ps_mllr_free(acmod->mllr);

    ckd_free(acmod);
}
Exemple #3
0
/* RAH, April 26th, 2001, opened file tmat_test.out and added tmat_free(t) call, there are no memory leaks here */
main (int32 argc, char *argv[])
{
    tmat_t *t;
    float64 flr;
    FILE *fp;
    
    if (argc < 3)
	E_FATAL("Usage: %s tmat floor\n", argv[0]);
    if (sscanf (argv[2], "%lf", &flr) != 1)
	E_FATAL("Usage: %s tmat floor\n", argv[0]);

    fp = fopen ("tmat_test.out","wt");
    if (! fp) {
      fprintf (stderr,"Unable to topen tmat_test.out for writing\n");
      exit (-1);
    }

    logs3_init ((float64) 1.0001);
    
    t = tmat_init (argv[1], flr);

    tmat_dump (t,fp);
    tmat_free (t);
}
Exemple #4
0
int
main(int argc, char *argv[])
{
	dict_t *dict;
	dict2pid_t *d2p;
	bin_mdef_t *mdef;
	glextree_t *tree;
	hmm_context_t *ctx;
	logmath_t *lmath;
	tmat_t *tmat;
	int i;

	TEST_ASSERT(mdef = bin_mdef_read(NULL, MODELDIR "/hmm/en_US/hub4wsj_sc_8k/mdef"));
	TEST_ASSERT(dict = dict_init(cmd_ln_init(NULL, NULL, FALSE,
						 "-dict", DATADIR "/turtle.dic",
						 "-dictcase", "no", NULL),
				       mdef));
	TEST_ASSERT(d2p = dict2pid_build(mdef, dict));
	lmath = logmath_init(1.0001, 0, TRUE);
	tmat = tmat_init(MODELDIR "/hmm/en_US/hub4wsj_sc_8k/transition_matrices",
			 lmath, 1e-5, TRUE);
	ctx = hmm_context_init(bin_mdef_n_emit_state(mdef), tmat->tp, NULL, mdef->sseq);
	TEST_ASSERT(tree = glextree_build(ctx, dict, d2p, NULL, NULL));

	/* Check that a path exists for all dictionary words. */
	for (i = 0; i < dict_size(dict); ++i)
		TEST_ASSERT(glextree_has_word(tree, i));

	dict_free(dict);
	dict2pid_free(d2p);
	bin_mdef_free(mdef);
	tmat_free(tmat);
	hmm_context_free(ctx);
	glextree_free(tree);
	return 0;
}