Julius 4.2
データ構造 | マクロ定義 | 列挙型 | 関数
libsent/include/sent/hmm_calc.h

音響尤度計算用ワークエリアとキャッシュ [詳細]

#include <sent/stddefs.h>
#include <sent/htk_hmm.h>
#include <sent/htk_param.h>

ソースコードを見る。

データ構造

struct  MIXCACHE
 A component of per-codebook probability cache while search. [詳細]
struct  HMMWork
 Work area and cache for HMM computation. [詳細]

マクロ定義

#define TMBEAMWIDTH   5.0
 Score beam offset for GPRUNE_SEL_BEAM.

列挙型

enum  {
  GPRUNE_SEL_UNDEF, GPRUNE_SEL_NONE, GPRUNE_SEL_SAFE, GPRUNE_SEL_HEURISTIC,
  GPRUNE_SEL_BEAM, GPRUNE_SEL_USER
}
 Symbols to specify which Gaussian pruning algorithm to use. [詳細]

関数

void make_log_tbl ()
 Generate a value tables of $\log (1+e^x)$.
LOGPROB addlog (LOGPROB x, LOGPROB y)
 Rapid computation of $\log (e^x + e^y)$.
LOGPROB addlog_array (LOGPROB *x, int n)
 Rapid computation of $\log (\sum_{i=1}^N e^{x_i})$.
boolean outprob_init (HMMWork *wrk, HTK_HMM_INFO *hmminfo, HTK_HMM_INFO *gshmm, int gms_num, int gprune_method, int gprune_mixnum)
 Initialize and setup acoustic computation functions.
boolean outprob_prepare (HMMWork *wrk, int framenum)
 Prepare for the next input of given frame length.
void outprob_free (HMMWork *wrk)
 Free all work area for outprob computation.
boolean outprob_cache_init (HMMWork *wrk)
 Initialize the cache data, should be called once on startup.
boolean outprob_cache_prepare (HMMWork *wrk)
 Prepare cache for the next input, by clearing the existing cache.
void outprob_cache_free (HMMWork *wrk)
 Free work area for cache.
LOGPROB outprob_state (HMMWork *wrk, int t, HTK_HMM_State *stateinfo, HTK_Param *param)
 Compute output probability of a state.
void outprob_cd_nbest_init (HMMWork *wrk, int num)
 Initialize work area for outprob_cd_nbest().
void outprob_cd_nbest_free (HMMWork *wrk)
 Free work area for outprob_cd_nbest().
LOGPROB outprob_cd (HMMWork *wrk, int t, CD_State_Set *lset, HTK_Param *param)
 Compute the log output probability of a pseudo state set.
boolean gms_init (HMMWork *wrk)
 Initialize the GMS related functions and data.
boolean gms_prepare (HMMWork *wrk, int framelen)
 Setup GMS parameters for next input.
void gms_free (HMMWork *wrk)
 Free GMS related work areas.
LOGPROB gms_state (HMMWork *wrk)
 Get HMM State probability of current state with Gaussiam Mixture Selection.
void gms_gprune_init (HMMWork *wrk)
 Initialization of GMS HMM likelihood computation.
void gms_gprune_prepare (HMMWork *wrk)
 Prepare GMS HMM computation for the next speech input.
void gms_gprune_free (HMMWork *wrk)
 Free GMS related work area.
void compute_gs_scores (HMMWork *wrk)
 Main function to compute all the GMS HMM states in a frame with the input vectore specified by OP_vec.
LOGPROB calc_mix (HMMWork *wrk)
 Compute the output probability of current state OP_State.
boolean calc_tied_mix_init (HMMWork *wrk)
 Initialize codebook cache area.
boolean calc_tied_mix_prepare (HMMWork *wrk, int framenum)
 Setup codebook cache for the next incoming input.
void calc_tied_mix_free (HMMWork *wrk)
 Free work area for tied-mixture calculation.
LOGPROB calc_tied_mix (HMMWork *wrk)
 Compute the output probability of current state OP_State on tied-mixture model.
LOGPROB calc_compound_mix (HMMWork *wrk)
 Compute the output probability of current state OP_State, regardless of tied-mixture model or state-level mixture PDF.
int cache_push (HMMWork *wrk, int id, LOGPROB score, int len)
 Store a score to the current list of computed Gaussians.
LOGPROB compute_g_base (HMMWork *wrk, HTK_HMM_Dens *binfo)
 Calculate probability of a Gaussian density against input vector on OP_vec.
boolean gprune_none_init (HMMWork *wrk)
 Initialize and setup work area for Gaussian computation.
void gprune_none_free (HMMWork *wrk)
 Free gprune_none related work area.
void gprune_none (HMMWork *wrk, HTK_HMM_Dens **g, int num, int *last_id, int lnum)
 Compute a set of Gaussians with no pruning.
LOGPROB compute_g_safe (HMMWork *wrk, HTK_HMM_Dens *binfo, LOGPROB thres)
 Calculate probability with safe pruning.
boolean gprune_safe_init (HMMWork *wrk)
 Initialize and setup work area for Gaussian pruning by safe algorithm.
void gprune_safe_free (HMMWork *wrk)
 Free gprune_safe related work area.
void gprune_safe (HMMWork *wrk, HTK_HMM_Dens **g, int gnum, int *last_id, int lnum)
 Compute a set of Gaussians with safe pruning.
boolean gprune_heu_init (HMMWork *wrk)
 Initialize and setup work area for Gaussian pruning by heuristic algorithm.
void gprune_heu_free (HMMWork *wrk)
 Free gprune_heu related work area.
void gprune_heu (HMMWork *wrk, HTK_HMM_Dens **g, int gnum, int *last_id, int lnum)
 Compute a set of Gaussians with heuristic pruning.
boolean gprune_beam_init (HMMWork *wrk)
 Initialize and setup work area for Gaussian pruning by beam algorithm.
void gprune_beam_free (HMMWork *wrk)
 Free gprune_beam related work area.
void gprune_beam (HMMWork *wrk, HTK_HMM_Dens **g, int gnum, int *last_id, int lnum)
 Compute a set of Gaussians with beam pruning.

説明

音響尤度計算用ワークエリアとキャッシュ

作者:
Akinobu LEE
日付:
Thu Feb 10 14:54:06 2005
Revision:
1.8

hmm_calc.h で定義されています。


マクロ定義

#define TMBEAMWIDTH   5.0

Score beam offset for GPRUNE_SEL_BEAM.

Larger value may ease pruning error, but processing may become slower. Smaller value can speed up the acoustic computation, but may cause error.

hmm_calc.h53 行で定義されています。

参照元 set_dimthres().


列挙型

anonymous enum

Symbols to specify which Gaussian pruning algorithm to use.

  • GPRUNE_SEL_UNDEF: unspecified by user
  • GPRUNE_SEL_NONE: no pruning
  • GPRUNE_SEL_SAFE: safe pruning
  • GPRUNE_SEL_HEURISTIC: heuristic pruning
  • GPRUNE_SEL_BEAM: beam pruning
  • GPRUNE_SEL_USER: user-defined function

hmm_calc.h44 行で定義されています。


関数

void make_log_tbl ( )

Generate a value tables of $\log (1+e^x)$.

$x$ is from 0 to (- VRANGE), and table size is TBLSIZE.

addlog.c42 行で定義されています。

参照元 outprob_init().

LOGPROB addlog ( LOGPROB  x,
LOGPROB  y 
)

Rapid computation of $\log (e^x + e^y)$.

If value differs more than LOG_ADDMIN, the larger value will be returned as is.

引数:
x[in] log value
y[in] log value
戻り値:
result value.

addlog.c71 行で定義されています。

LOGPROB addlog_array ( LOGPROB a,
int  n 
)

Rapid computation of $\log (\sum_{i=1}^N e^{x_i})$.

引数:
a[in] array of log values
n[in] length of above
戻り値:
the result value.

addlog.c103 行で定義されています。

参照元 calc_compound_mix(), calc_mix(), calc_tied_mix(), と gmm_calc_mix().

boolean outprob_init ( HMMWork wrk,
HTK_HMM_INFO hmminfo,
HTK_HMM_INFO gshmm,
int  gms_num,
int  gprune_method,
int  gprune_mixnum 
)

Initialize and setup acoustic computation functions.

引数:
wrk[i/o] HMM computation work area
hmminfo[in] HMM definition
gshmm[in] GMS HMM definition if exist, or NULL if not
gms_num[in] number of GMS HMM to compute (valid if gshmm != NULL)
gprune_method[in] gaussian pruning method
gprune_mixnum[in] number of pdf to compute at a codebook in gaussian pruning
戻り値:
TRUE on success, FALSE on failure.

select functions

outprob_init.c68 行で定義されています。

参照元 j_final_fusion().

boolean outprob_prepare ( HMMWork wrk,
int  framenum 
)

Prepare for the next input of given frame length.

引数:
wrk[i/o] HMM computation work area
framenum[in] input length in frame.
戻り値:
TRUE on success, FALSE on failure.

outprob_init.c201 行で定義されています。

参照元 get_back_trellis(), j_recognize_stream_core(), RealTimePipeLinePrepare(), と RealTimeResume().

void outprob_free ( HMMWork wrk)

Free all work area for outprob computation.

引数:
wrk[i/o] HMM computation work area

outprob_init.c222 行で定義されています。

参照元 j_process_am_free().

boolean outprob_cache_init ( HMMWork wrk)

Initialize the cache data, should be called once on startup.

引数:
wrk[i/o] HMM computation work area
戻り値:
TRUE on success, FALSE on failure.

outprob.c78 行で定義されています。

参照元 outprob_init().

boolean outprob_cache_prepare ( HMMWork wrk)

Prepare cache for the next input, by clearing the existing cache.

引数:
wrk[i/o] HMM computation work area
戻り値:
TRUE on success, FALSE on failure.

outprob.c96 行で定義されています。

参照元 outprob_prepare().

void outprob_cache_free ( HMMWork wrk)

Free work area for cache.

引数:
wrk[i/o] HMM computation work area

outprob.c158 行で定義されています。

参照元 outprob_free().

LOGPROB outprob_state ( HMMWork wrk,
int  t,
HTK_HMM_State stateinfo,
HTK_Param param 
)

Compute output probability of a state.

Set the needed values to the global variables that begins with "OP_", and call calc_outprob_state(). The calc_outprob_state() is actually a function pointer, and the entity is either calc_tied_mix() for tied-mixture model and calc_mix() for others. (If you use GMS, the entity will be gms_state() instead.)

The state-level cache is also consulted here.

引数:
wrk[i/o] HMM computation work area
t[in] time frame
stateinfo[in] state information to compute the output probability
param[in] input parameter vectors
戻り値:
output log probability.

outprob.c184 行で定義されています。

参照元 next_word(), outprob(), outprob_cd_avg(), outprob_cd_max(), outprob_cd_nbest(), outprob_style(), と start_word().

void outprob_cd_nbest_init ( HMMWork wrk,
int  num 
)

Initialize work area for outprob_cd_nbest().

引数:
wrk[i/o] HMM computation work area
num[in] number of top states to be calculated.

outprob.c222 行で定義されています。

参照元 outprob_init().

void outprob_cd_nbest_free ( HMMWork wrk)

Free work area for outprob_cd_nbest().

引数:
wrk[i/o] HMM computation work area

outprob.c235 行で定義されています。

参照元 outprob_free().

LOGPROB outprob_cd ( HMMWork wrk,
int  t,
CD_State_Set lset,
HTK_Param param 
)

Compute the log output probability of a pseudo state set.

引数:
wrk[i/o] HMM computation work area
t[in] input frame
lset[in] pseudo state set
param[in] input parameter data
戻り値:
the computed log output probability.

outprob.c347 行で定義されています。

参照元 next_word(), outprob(), outprob_style(), と start_word().

boolean gms_init ( HMMWork wrk)

Initialize the GMS related functions and data.

引数:
wrk[i/o] HMM computation work area
戻り値:
TRUE on success, FALSE on failure.

gms.c283 行で定義されています。

参照元 outprob_init().

boolean gms_prepare ( HMMWork wrk,
int  framenum 
)

Setup GMS parameters for next input.

引数:
wrk[i/o] HMM computation work area
framenum[in] length of next input in frames
戻り値:
TRUE on success, FALSE on failure.

gms.c330 行で定義されています。

参照元 outprob_prepare().

void gms_free ( HMMWork wrk)

Free GMS related work areas.

引数:
wrk[i/o] HMM computation work area

gms.c366 行で定義されています。

参照元 outprob_free().

LOGPROB gms_state ( HMMWork wrk)

Get HMM State probability of current state with Gaussiam Mixture Selection.

If the GMS HMM score of the corresponding basephone is below the N-best, the triphone score will not be computed, and the score of the GMS HMM will be returned instead as a fallback score. Else, the precise triphone will be computed and returned.

引数:
wrk[i/o] HMM computation work area
戻り値:
the state output probability score in log10.

gms.c394 行で定義されています。

参照元 outprob_init().

void gms_gprune_init ( HMMWork wrk)

Initialization of GMS HMM likelihood computation.

引数:
wrk[i/o] HMM computation work area

gms_gprune.c43 行で定義されています。

参照元 gms_init().

void gms_gprune_prepare ( HMMWork wrk)

Prepare GMS HMM computation for the next speech input.

引数:
wrk[i/o] HMM computation work area

gms_gprune.c59 行で定義されています。

参照元 gms_prepare().

void gms_gprune_free ( HMMWork wrk)

Free GMS related work area.

引数:
wrk[i/o] HMM computation work area

gms_gprune.c76 行で定義されています。

参照元 gms_free().

void compute_gs_scores ( HMMWork wrk)

Main function to compute all the GMS HMM states in a frame with the input vectore specified by OP_vec.

This function assumes that this will be called for sequencial frame, since it utilizes the result of previous frame for faster pruning.

引数:
wrk[i/o] HMM computation work area

gms_gprune.c238 行で定義されています。

参照元 do_gms().

LOGPROB calc_mix ( HMMWork wrk)

Compute the output probability of current state OP_State.

No codebook-level cache is done.

引数:
wrk[i/o] HMM computation work area
戻り値:
the output probability of the state OP_State in log10

calc_mix.c41 行で定義されています。

参照元 outprob_init().

boolean calc_tied_mix_init ( HMMWork wrk)

Initialize codebook cache area.

引数:
wrk[i/o] HMM computation work area
戻り値:
TRUE on success, FALSE on failure.

calc_tied_mix.c51 行で定義されています。

参照元 outprob_init().

boolean calc_tied_mix_prepare ( HMMWork wrk,
int  framenum 
)

Setup codebook cache for the next incoming input.

引数:
wrk[i/o] HMM computation work area
framenum[in] length of the next input.
戻り値:
TRUE on success, FALSE on failure.

calc_tied_mix.c70 行で定義されています。

参照元 outprob_prepare().

void calc_tied_mix_free ( HMMWork wrk)

Free work area for tied-mixture calculation.

引数:
wrk[i/o] HMM computation work area

calc_tied_mix.c137 行で定義されています。

参照元 outprob_free().

LOGPROB calc_tied_mix ( HMMWork wrk)

Compute the output probability of current state OP_State on tied-mixture model.

This function assumes that the OP_state is assigned to a tied-mixture codebook. Here the output probability of Gaussian mixture component referred by OP_state is consulted to the book level cache, and if not computed yet on that input frame time, it will be computed here.

引数:
wrk[i/o] HMM computation work area
戻り値:
the computed output probability in log10.

calc_tied_mix.c162 行で定義されています。

参照元 outprob_init().

LOGPROB calc_compound_mix ( HMMWork wrk)

Compute the output probability of current state OP_State, regardless of tied-mixture model or state-level mixture PDF.

This function switches calculation function of calc_mix() and calc_tied_mix() based on the mixture PDF information. This will be used on a system which has tied-mixture codebook but some states still has their own mixture PDF.

The initialization functions should be the same as calc_tied_mix(), since calc_mix() has no specific initialization.

引数:
wrk[i/o] HMM computation work area
戻り値:
the computed output probability in log10.

calc_tied_mix.c258 行で定義されています。

参照元 outprob_init().

int cache_push ( HMMWork wrk,
int  id,
LOGPROB  score,
int  len 
)

Store a score to the current list of computed Gaussians.

Store the calculated score of a Gaussian to OP_calced_score, with its corresponding mixture id to OP_calced_id.

The OP_calced_score and OP_calced_id always holds the (OP_gprune_num)-best scores and ids. If the number of stored Gaussian from start has reached OP_gprune_num and the given score is below the bottom, it will be dropped. Else, the new score will be inserted and the bottom will be dropped from the list.

The OP_calced_score will always kept sorted by the scores.

引数:
wrk[i/o] HMM computation work area
id[in] mixture id of the Gaussian to store
score[in] score of the Gaussian to store
len[in] current number of stored scores in OP_calced_score
戻り値:
the resulting number of stored scores in OP_calced_score.

gprune_common.c88 行で定義されています。

参照元 gprune_beam(), gprune_heu(), と gprune_safe().

LOGPROB compute_g_base ( HMMWork wrk,
HTK_HMM_Dens binfo 
)

Calculate probability of a Gaussian density against input vector on OP_vec.

引数:
wrk[i/o] HMM computation work area
binfo[in] a Gaussian density
戻り値:
the output log probability.

gprune_none.c59 行で定義されています。

参照元 compute_gs_scores(), gprune_beam(), gprune_heu(), gprune_none(), と gprune_safe().

boolean gprune_none_init ( HMMWork wrk)

Initialize and setup work area for Gaussian computation.

引数:
wrk[i/o] HMM computation work area
戻り値:
TRUE on success, FALSE on failure.

gprune_none.c92 行で定義されています。

参照元 outprob_init().

void gprune_none_free ( HMMWork wrk)

Free gprune_none related work area.

引数:
wrk[i/o] HMM computation work area

gprune_none.c110 行で定義されています。

参照元 outprob_init().

void gprune_none ( HMMWork wrk,
HTK_HMM_Dens **  g,
int  num,
int *  last_id,
int  lnum 
)

Compute a set of Gaussians with no pruning.

The calculated scores will be stored to OP_calced_score, with its corresponding mixture id to OP_calced_id. The number of calculated mixtures is also stored in OP_calced_num.

This can be called from calc_tied_mix() or calc_mix().

引数:
wrk[i/o] HMM computation work area
g[in] set of Gaussian densities to compute the output probability.
num[in] length of above
last_id[in] ID list of N-best mixture in previous input frame, or NULL if not exist
lnum[in] length of last_id

gprune_none.c133 行で定義されています。

参照元 outprob_init().

LOGPROB compute_g_safe ( HMMWork wrk,
HTK_HMM_Dens binfo,
LOGPROB  thres 
)

Calculate probability with safe pruning.

Calculate probability of a Gaussian toward OP_vec, performing pruning using the scholar threshold.

引数:
wrk[i/o] HMM computation work area
binfo[in] Gaussian density
thres[in] threshold
戻り値:
the output log probability.

gprune_safe.c76 行で定義されています。

参照元 gprune_beam(), gprune_heu(), と gprune_safe().

boolean gprune_safe_init ( HMMWork wrk)

Initialize and setup work area for Gaussian pruning by safe algorithm.

引数:
wrk[i/o] HMM computation work area
戻り値:
TRUE on success, FALSE on failure.

gprune_safe.c107 行で定義されています。

参照元 outprob_init().

void gprune_safe_free ( HMMWork wrk)

Free gprune_safe related work area.

引数:
wrk[i/o] HMM computation work area

gprune_safe.c127 行で定義されています。

参照元 outprob_init().

void gprune_safe ( HMMWork wrk,
HTK_HMM_Dens **  g,
int  gnum,
int *  last_id,
int  lnum 
)

Compute a set of Gaussians with safe pruning.

If the N-best mixtures in the previous frame is specified in last_id, They are first computed to set the initial threshold. After that, the rest of the Gaussians will be computed with the thresholds to drop unpromising Gaussians from computation at early stage of likelihood computation. If the computation of a Gaussian reached to the end, the threshold will be updated to always hold the likelihood of current N-best score.

The calculated scores will be stored to OP_calced_score, with its corresponding mixture id to OP_calced_id. These are done by calling cache_push(). The number of calculated mixtures is also stored in OP_calced_num.

This can be called from calc_tied_mix() or calc_mix().

引数:
wrk[i/o] HMM computation work area
g[in] set of Gaussian densities to compute the output probability
gnum[in] length of above
last_id[in] ID list of N-best mixture in previous input frame, or NULL if not exist
lnum[in] length of last_id

gprune_safe.c160 行で定義されています。

参照元 outprob_init().

boolean gprune_heu_init ( HMMWork wrk)

Initialize and setup work area for Gaussian pruning by heuristic algorithm.

引数:
wrk[i/o] HMM computation work area
戻り値:
TRUE on success, FALSE on failure.

gprune_heu.c237 行で定義されています。

参照元 outprob_init().

void gprune_heu_free ( HMMWork wrk)

Free gprune_heu related work area.

引数:
wrk[i/o] HMM computation work area

gprune_heu.c260 行で定義されています。

参照元 outprob_init().

void gprune_heu ( HMMWork wrk,
HTK_HMM_Dens **  g,
int  gnum,
int *  last_id,
int  lnum 
)

Compute a set of Gaussians with heuristic pruning.

If the N-best mixtures in the previous frame is specified in last_id, They are first computed to get the maximum value for each dimension. After that, the rest of the Gaussians will be computed using the maximum values as heuristics of uncomputed dimensions to drop unpromising Gaussians from computation at early stage of likelihood computation. If the last_id is not specified (typically at the first frame of the input), a safe pruning as same as one in gprune_safe.c will be applied.

The calculated scores will be stored to OP_calced_score, with its corresponding mixture id to OP_calced_id. These are done by calling cache_push(). The number of calculated mixtures is also stored in OP_calced_num.

This can be called from calc_tied_mix() or calc_mix().

引数:
wrk[i/o] HMM computation work area
g[in] set of Gaussian densities to compute the output probability
gnum[in] length of above
last_id[in] ID list of N-best mixture in previous input frame, or NULL if not exist
lnum[in] length of last_id

gprune_heu.c295 行で定義されています。

参照元 outprob_init().

boolean gprune_beam_init ( HMMWork wrk)

Initialize and setup work area for Gaussian pruning by beam algorithm.

引数:
wrk[i/o] HMM computation work area
戻り値:
TRUE on success, FALSE on failure.

gprune_beam.c234 行で定義されています。

参照元 outprob_init().

void gprune_beam_free ( HMMWork wrk)

Free gprune_beam related work area.

引数:
wrk[i/o] HMM computation work area

gprune_beam.c257 行で定義されています。

参照元 outprob_init().

void gprune_beam ( HMMWork wrk,
HTK_HMM_Dens **  g,
int  gnum,
int *  last_id,
int  lnum 
)

Compute a set of Gaussians with beam pruning.

If the N-best mixtures in the previous frame is specified in last_id, They are first computed to set the thresholds for each dimension. After that, the rest of the Gaussians will be computed with those dimension thresholds to drop unpromising Gaussians from computation at early stage of likelihood computation. If the last_id is not specified (typically at the first frame of the input), a safe pruning as same as one in gprune_safe.c will be applied.

The calculated scores will be stored to OP_calced_score, with its corresponding mixture id to OP_calced_id. These are done by calling cache_push(). The number of calculated mixtures is also stored in OP_calced_num.

This can be called from calc_tied_mix() or calc_mix().

引数:
wrk[i/o] HMM computation work area
g[in] set of Gaussian densities to compute the output probability
gnum[in] length of above
last_id[in] ID list of N-best mixture in previous input frame, or NULL if not exist
lnum[in] length of last_id

gprune_beam.c291 行で定義されています。

参照元 outprob_init().