sumom****@users*****
sumom****@users*****
2008年 7月 20日 (日) 01:51:35 JST
Index: julius4/libsent/src/phmm/calc_mix.c diff -u julius4/libsent/src/phmm/calc_mix.c:1.3 julius4/libsent/src/phmm/calc_mix.c:1.4 --- julius4/libsent/src/phmm/calc_mix.c:1.3 Mon Jul 7 14:50:12 2008 +++ julius4/libsent/src/phmm/calc_mix.c Sun Jul 20 01:51:35 2008 @@ -12,7 +12,7 @@ * @author Akinobu LEE * @date Thu Feb 17 14:18:52 2005 * - * $Revision: 1.3 $ + * $Revision: 1.4 $ * */ /* @@ -60,7 +60,7 @@ /* computed Gaussians will be set in: score ... OP_calced_score[0..OP_calced_num] id ... OP_calced_id[0..OP_calced_num] */ - (*(wrk->compute_gaussset))(wrk, wrk->OP_state->pdf[s]->b, wrk->OP_state->pdf[s]->mix_num, NULL); + (*(wrk->compute_gaussset))(wrk, wrk->OP_state->pdf[s]->b, wrk->OP_state->pdf[s]->mix_num, NULL, 0); /* add weights */ id = wrk->OP_calced_id; w = wrk->OP_state->pdf[s]->bweight; Index: julius4/libsent/src/phmm/calc_tied_mix.c diff -u julius4/libsent/src/phmm/calc_tied_mix.c:1.4 julius4/libsent/src/phmm/calc_tied_mix.c:1.5 --- julius4/libsent/src/phmm/calc_tied_mix.c:1.4 Mon Jul 7 14:50:12 2008 +++ julius4/libsent/src/phmm/calc_tied_mix.c Sun Jul 20 01:51:35 2008 @@ -22,7 +22,7 @@ * @author Akinobu LEE * @date Thu Feb 17 14:22:44 2005 * - * $Revision: 1.4 $ + * $Revision: 1.5 $ * */ /* @@ -167,6 +167,7 @@ MIXCACHE *ttcache; short ttcachenum; MIXCACHE *last_ttcache; + short last_ttcachenum; PROB *weight; PROB stream_weight; int s; @@ -201,15 +202,16 @@ id ... OP_calced_id[0..OP_calced_num] */ if (wrk->OP_time >= 1) { last_ttcache = wrk->mixture_cache[wrk->OP_time-1][book->id]; - if (last_ttcache[0].score != LOG_ZERO) { - for(i=0;i<wrk->OP_gprune_num;i++) wrk->tmix_last_id[i] = last_ttcache[i].id; + last_ttcachenum = wrk->mixture_cache_num[wrk->OP_time-1][book->id]; + if (last_ttcachenum > 0) { + for(i=0;i<last_ttcachenum;i++) wrk->tmix_last_id[i] = last_ttcache[i].id; /* tell last calced best */ - (*(wrk->compute_gaussset))(wrk, book->d, book->num, wrk->tmix_last_id); + (*(wrk->compute_gaussset))(wrk, book->d, book->num, wrk->tmix_last_id, last_ttcachenum); } else { - (*(wrk->compute_gaussset))(wrk, book->d, book->num, NULL); + (*(wrk->compute_gaussset))(wrk, book->d, book->num, NULL, 0); } } else { - (*(wrk->compute_gaussset))(wrk, book->d, book->num, NULL); + (*(wrk->compute_gaussset))(wrk, book->d, book->num, NULL, 0); } /* store to cache */ wrk->mixture_cache_num[wrk->OP_time][book->id] = wrk->OP_calced_num; @@ -262,6 +264,7 @@ MIXCACHE *ttcache; short ttcachenum; MIXCACHE *last_ttcache; + short last_ttcachenum; PROB *weight; PROB stream_weight; int s; @@ -299,15 +302,16 @@ id ... OP_calced_id[0..OP_calced_num] */ if (wrk->OP_time >= 1) { last_ttcache = wrk->mixture_cache[wrk->OP_time-1][book->id]; - if (last_ttcache[0].score != LOG_ZERO) { - for(i=0;i<wrk->OP_gprune_num;i++) wrk->tmix_last_id[i] = last_ttcache[i].id; + last_ttcachenum = wrk->mixture_cache_num[wrk->OP_time-1][book->id]; + if (last_ttcachenum > 0) { + for(i=0;i<last_ttcachenum;i++) wrk->tmix_last_id[i] = last_ttcache[i].id; /* tell last calced best */ - (*(wrk->compute_gaussset))(wrk, book->d, book->num, wrk->tmix_last_id); + (*(wrk->compute_gaussset))(wrk, book->d, book->num, wrk->tmix_last_id, last_ttcachenum); } else { - (*(wrk->compute_gaussset))(wrk, book->d, book->num, NULL); + (*(wrk->compute_gaussset))(wrk, book->d, book->num, NULL, 0); } } else { - (*(wrk->compute_gaussset))(wrk, book->d, book->num, NULL); + (*(wrk->compute_gaussset))(wrk, book->d, book->num, NULL, 0); } /* store to cache */ wrk->mixture_cache_num[wrk->OP_time][book->id] = wrk->OP_calced_num; @@ -323,7 +327,7 @@ } } else { /* normal state */ - (*(wrk->compute_gaussset))(wrk, m->b, m->mix_num, NULL); + (*(wrk->compute_gaussset))(wrk, m->b, m->mix_num, NULL, 0); /* add weights */ for(i=0;i<wrk->OP_calced_num;i++) { wrk->OP_calced_score[i] += weight[wrk->OP_calced_id[i]]; Index: julius4/libsent/src/phmm/gprune_beam.c diff -u julius4/libsent/src/phmm/gprune_beam.c:1.3 julius4/libsent/src/phmm/gprune_beam.c:1.4 --- julius4/libsent/src/phmm/gprune_beam.c:1.3 Mon Jul 7 14:50:12 2008 +++ julius4/libsent/src/phmm/gprune_beam.c Sun Jul 20 01:51:35 2008 @@ -40,7 +40,7 @@ * @author Akinobu LEE * @date Thu Feb 17 03:27:53 2005 * - * $Revision: 1.3 $ + * $Revision: 1.4 $ * */ /* @@ -285,9 +285,10 @@ * @param gnum [in] length of above * @param last_id [in] ID list of N-best mixture in previous input frame, * or NULL if not exist + * @param lnum [in] length of last_id */ void -gprune_beam(HMMWork *wrk, HTK_HMM_Dens **g, int gnum, int *last_id) +gprune_beam(HMMWork *wrk, HTK_HMM_Dens **g, int gnum, int *last_id, int lnum) { int i, j, num = 0; LOGPROB score, thres; @@ -296,7 +297,7 @@ /* 1. clear dimthres */ clear_dimthres(wrk); /* 2. calculate first $OP_gprune_num and set initial thresholds */ - for (j=0; j<wrk->OP_gprune_num; j++) { + for (j=0; j<lnum; j++) { i = last_id[j]; #ifdef TEST2 if (!g[i]) { Index: julius4/libsent/src/phmm/gprune_heu.c diff -u julius4/libsent/src/phmm/gprune_heu.c:1.3 julius4/libsent/src/phmm/gprune_heu.c:1.4 --- julius4/libsent/src/phmm/gprune_heu.c:1.3 Mon Jul 7 14:50:12 2008 +++ julius4/libsent/src/phmm/gprune_heu.c Sun Jul 20 01:51:35 2008 @@ -38,7 +38,7 @@ * @author Akinobu LEE * @date Thu Feb 17 05:44:52 2005 * - * $Revision: 1.3 $ + * $Revision: 1.4 $ * */ /* @@ -289,9 +289,10 @@ * @param gnum [in] length of above * @param last_id [in] ID list of N-best mixture in previous input frame, * or NULL if not exist + * @param lnum [in] length of last_id */ void -gprune_heu(HMMWork *wrk, HTK_HMM_Dens **g, int gnum, int *last_id) +gprune_heu(HMMWork *wrk, HTK_HMM_Dens **g, int gnum, int *last_id, int lnum) { int i, j, num = 0; LOGPROB score, thres; @@ -300,7 +301,7 @@ /* 1. clear backmax */ init_backmax(wrk); /* 2. calculate first $OP_gprune_num with setting max for each dimension */ - for (j=0; j<wrk->OP_gprune_num; j++) { + for (j=0; j<lnum; j++) { i = last_id[j]; score = compute_g_heu_updating(wrk, g[i]); num = cache_push(wrk, i, score, num); Index: julius4/libsent/src/phmm/gprune_none.c diff -u julius4/libsent/src/phmm/gprune_none.c:1.3 julius4/libsent/src/phmm/gprune_none.c:1.4 --- julius4/libsent/src/phmm/gprune_none.c:1.3 Mon Jul 7 14:50:12 2008 +++ julius4/libsent/src/phmm/gprune_none.c Sun Jul 20 01:51:35 2008 @@ -30,7 +30,7 @@ * @author Akinobu LEE * @date Thu Feb 17 05:09:46 2005 * - * $Revision: 1.3 $ + * $Revision: 1.4 $ * */ /* @@ -127,9 +127,10 @@ * @param num [in] length of above * @param last_id [in] ID list of N-best mixture in previous input frame, * or NULL if not exist + * @param lnum [in] length of last_id */ void -gprune_none(HMMWork *wrk, HTK_HMM_Dens **g, int num, int *last_id) +gprune_none(HMMWork *wrk, HTK_HMM_Dens **g, int num, int *last_id, int lnum) { int i; HTK_HMM_Dens *dens; Index: julius4/libsent/src/phmm/gprune_safe.c diff -u julius4/libsent/src/phmm/gprune_safe.c:1.3 julius4/libsent/src/phmm/gprune_safe.c:1.4 --- julius4/libsent/src/phmm/gprune_safe.c:1.3 Mon Jul 7 14:50:12 2008 +++ julius4/libsent/src/phmm/gprune_safe.c Sun Jul 20 01:51:35 2008 @@ -39,7 +39,7 @@ * @author Akinobu LEE * @date Thu Feb 17 05:28:12 2005 * - * $Revision: 1.3 $ + * $Revision: 1.4 $ * */ /* @@ -52,7 +52,7 @@ /* gprune_safe.c --- calculate probability of Gaussian densities */ /* with Gaussian pruning (safe) */ -/* $Id: gprune_safe.c,v 1.3 2008/07/07 05:50:12 sumomo Exp $ */ +/* $Id: gprune_safe.c,v 1.4 2008/07/19 16:51:35 sumomo Exp $ */ #include <sent/stddefs.h> #include <sent/htk_hmm.h> @@ -154,16 +154,17 @@ * @param gnum [in] length of above * @param last_id [in] ID list of N-best mixture in previous input frame, * or NULL if not exist + * @param lnum [in] length of last_id */ void -gprune_safe(HMMWork *wrk, HTK_HMM_Dens **g, int gnum, int *last_id) +gprune_safe(HMMWork *wrk, HTK_HMM_Dens **g, int gnum, int *last_id, int lnum) { int i, j, num = 0; LOGPROB score, thres; if (last_id != NULL) { /* compute them first to form threshold */ /* 1. calculate first $OP_gprune_num and set initial threshold */ - for (j=0; j<wrk->OP_gprune_num; j++) { + for (j=0; j<lnum; j++) { i = last_id[j]; score = compute_g_base(wrk, g[i]); num = cache_push(wrk, i, score, num);