Julius 4.2
マクロ定義 | 関数 | 変数
libsent/src/hmminfo/read_binhmm.c

バイナリ形式の HMM 定義ファイルを読み込む [詳細]

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

ソースコードを見る。

マクロ定義

#define rdn(A, B, C, D)   if (rdnfunc(A,B,C,D) == FALSE) return FALSE
#define rdn_str(A, B, C)   if ((C = rdn_strfunc(A,B)) == NULL) return FALSE

関数

static boolean rdnfunc (FILE *fp, void *buf, size_t unitbyte, int unitnum)
 Binary read function with byte swaping (assume file is BIG ENDIAN)
static char * rdn_strfunc (FILE *fp, HTK_HMM_INFO *hmm)
 Read a string till NULL.
static boolean rd_para (FILE *fp, Value *para)
 Read acoustic analysis configration parameters from header of binary HMM.
static boolean rd_header (FILE *fp, HTK_HMM_INFO *hmm, Value *para, boolean *mpdf_macro_ret)
 Read header string of binary HMM file.
static boolean rd_opt (FILE *fp, HTK_HMM_Options *opt)
 Read HMM option specifications.
static boolean rd_type (FILE *fp, HTK_HMM_INFO *hmm)
 Read HMM type of mixture tying.
static boolean rd_trans (FILE *fp, HTK_HMM_INFO *hmm)
 Read a sequence of transition matrix data for tr_num.
static boolean rd_var (FILE *fp, HTK_HMM_INFO *hmm)
 Read a sequence of variance vector for vr_num.
static boolean rd_dens (FILE *fp, HTK_HMM_INFO *hmm)
 Read a sequence of mixture densities for dens_num.
static boolean rd_streamweight (FILE *fp, HTK_HMM_INFO *hmm)
 Read a sequence of stream weights for streamweight_num.
static boolean rd_tmix (FILE *fp, HTK_HMM_INFO *hmm)
 Read a sequence of mixture codebook for tm_num.
static boolean rd_pdf_sub (FILE *fp, HTK_HMM_INFO *hmm, HTK_HMM_PDF *m)
 Read a mixture PDF.
static boolean rd_mpdf (FILE *fp, HTK_HMM_INFO *hmm)
 Read a sequence of mixture pdf for mpdf_num.
static boolean rd_state (FILE *fp, HTK_HMM_INFO *hmm, boolean mpdf_macro)
 Read a sequence of state data for st_num.
static boolean rd_data (FILE *fp, HTK_HMM_INFO *hmm)
 Read a sequence of HMM models.
boolean read_binhmm (FILE *fp, HTK_HMM_INFO *hmm, boolean gzfile_p, Value *para)
 Top function to read a binary HMM file from fp.

変数

static boolean gzfile
 TRUE when opened by fopen_readfile.
static char buf [MAXLINELEN]
 Local work are for text handling.
static char nostr = '\0'
static char * binhmm_header = BINHMM_HEADER
 Header string.
static char * binhmm_header_v2 = BINHMM_HEADER_V2
 Header string for V2.
static HTK_HMM_Trans ** tr_index
 Map transition matrix id to its pointer.
static unsigned int tr_num
 Length of above.
static HTK_HMM_Var ** vr_index
 Map variance id to its pointer.
static unsigned int vr_num
 Length of above.
static HTK_HMM_Dens ** dens_index
 Map density id to its pointer.
static unsigned int dens_num
 Length of above.
static HTK_HMM_StreamWeight ** streamweight_index
 Map stream weights id to its pointer.
static unsigned int streamweight_num
 Length of above.
static GCODEBOOK ** tm_index
 Map codebook id to its pointer.
static unsigned int tm_num
 Length of above.
static HTK_HMM_PDF ** mpdf_index
 Map mixture pdf id to its pointer.
static unsigned int mpdf_num
 Length of above.
static HTK_HMM_State ** st_index
 Map state id to its pointer.
static unsigned int st_num
 Length of above.

説明

バイナリ形式の HMM 定義ファイルを読み込む

Julius は独自のバイナリ形式の HMM 定義ファイルをサポートしています. HTKのアスキー形式の HMM 定義ファイルからバイナリ形式への変換は, 附属のツール mkbinhmm で行ないます.このバイナリ形式は,HTK の バイナリ形式とは非互換ですので注意して下さい.

作者:
Akinobu LEE
日付:
Wed Feb 16 05:23:59 2005
Revision:
1.7

read_binhmm.c で定義されています。


関数

static boolean rdnfunc ( FILE *  fp,
void *  buf,
size_t  unitbyte,
int  unitnum 
) [static]

Binary read function with byte swaping (assume file is BIG ENDIAN)

引数:
fp[in] file pointer
buf[out] read data
unitbyte[in] size of a unit in bytes
unitnum[in] number of unit to be read

read_binhmm.c54 行で定義されています。

static char* rdn_strfunc ( FILE *  fp,
HTK_HMM_INFO hmm 
) [static]

Read a string till NULL.

引数:
fp[in] file pointer
hmm[out] pointer to HMM definition data to store the values.
戻り値:
pointer to a newly allocated buffer that contains the read string.

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

static boolean rd_para ( FILE *  fp,
Value para 
) [static]

Read acoustic analysis configration parameters from header of binary HMM.

引数:
fp[in] file pointer
para[out] acoustic analysis configration parameters

read_binhmm.c125 行で定義されています。

参照元 rd_header().

static boolean rd_header ( FILE *  fp,
HTK_HMM_INFO hmm,
Value para,
boolean mpdf_macro_ret 
) [static]

Read header string of binary HMM file.

引数:
fp[in] file pointer
hmm[out] pointer to HMM definition data to store the values.
para[out] store embedded acoustic parameters if any (V2)
mpdf_macro_ret[out] will be set to TRUE if the file contains mixture pdf macro defined by "~p"
戻り値:
TRUE if a correct header was read, FALSE if header string does not match the current version.

read_binhmm.c181 行で定義されています。

参照元 read_binhmm().

static boolean rd_opt ( FILE *  fp,
HTK_HMM_Options opt 
) [static]

Read HMM option specifications.

引数:
fp[in] file pointer
opt[out] pointer to the HMM option structure to hold the read values.

read_binhmm.c249 行で定義されています。

参照元 read_binhmm().

static boolean rd_type ( FILE *  fp,
HTK_HMM_INFO hmm 
) [static]

Read HMM type of mixture tying.

引数:
fp[in] file pointer
hmm[out] pointer to HMM definition data to store the values.

read_binhmm.c268 行で定義されています。

参照元 read_binhmm().

static boolean rd_trans ( FILE *  fp,
HTK_HMM_INFO hmm 
) [static]

Read a sequence of transition matrix data for tr_num.

The transition matrixes are stored into hmm, and their pointers are also stored in tr_index for later data mapping operation from upper structure (state etc.).

引数:
fp[in] file pointer
hmm[out] HMM definition structure to hold the read transitions.

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

参照元 read_binhmm().

static boolean rd_var ( FILE *  fp,
HTK_HMM_INFO hmm 
) [static]

Read a sequence of variance vector for vr_num.

The variance vectors are stored into hmm, and their pointers are also stored in vr_index for later data mapping operation from upper structure (density etc.).

引数:
fp[in] file pointer
hmm[out] HMM definition structure to hold the read variance.

read_binhmm.c340 行で定義されています。

参照元 read_binhmm().

static boolean rd_dens ( FILE *  fp,
HTK_HMM_INFO hmm 
) [static]

Read a sequence of mixture densities for dens_num.

The mixture densities are stored into hmm, and their references to lower structure (variance etc.) are recovered from the id-to-pointer index. Their pointers are also stored in dens_index for later data mapping operation from upper structure (state etc.).

引数:
fp[in] file pointer
hmm[out] HMM definition structure to hold the read densities.

read_binhmm.c384 行で定義されています。

参照元 read_binhmm().

static boolean rd_streamweight ( FILE *  fp,
HTK_HMM_INFO hmm 
) [static]

Read a sequence of stream weights for streamweight_num.

The stream weights are stored into hmm, and their references to lower structure (variance etc.) are recovered from the id-to-pointer index. Their pointers are also stored in dens_index for later data mapping operation from upper structure (state etc.).

引数:
fp[in] file pointer
hmm[out] HMM definition structure to hold the read stream weights.

read_binhmm.c433 行で定義されています。

参照元 read_binhmm().

static boolean rd_tmix ( FILE *  fp,
HTK_HMM_INFO hmm 
) [static]

Read a sequence of mixture codebook for tm_num.

The mixture codebook data are stored into hmm, and their references to lower structure (mixtures etc.) are recovered from the id-to-pointer index. Their pointers are also stored in tm_index for later data mapping operation from upper structure (state etc.).

引数:
fp[in] file pointer
hmm[out] HMM definition structure to hold the read codebooks.

read_binhmm.c477 行で定義されています。

参照元 read_binhmm().

static boolean rd_pdf_sub ( FILE *  fp,
HTK_HMM_INFO hmm,
HTK_HMM_PDF m 
) [static]

Read a mixture PDF.

引数:
fp[in] file pointer
hmm[out] HMM definition structure to hold the read codebooks.
m[out] pointer where to store the input mixture PDF.
戻り値:
TRUE on success, FALSE on error.

read_binhmm.c532 行で定義されています。

参照元 rd_mpdf(), と rd_state().

static boolean rd_mpdf ( FILE *  fp,
HTK_HMM_INFO hmm 
) [static]

Read a sequence of mixture pdf for mpdf_num.

The mixture pdfs are stored into hmm, and their references to lower structure (variance etc.) are recovered from the id-to-pointer index. Their pointers are also stored in mpdf_index for later data mapping operation from upper structure (state etc.).

引数:
fp[in] file pointer
hmm[out] HMM definition structure to hold the read data.

read_binhmm.c576 行で定義されています。

参照元 read_binhmm().

static boolean rd_state ( FILE *  fp,
HTK_HMM_INFO hmm,
boolean  mpdf_macro 
) [static]

Read a sequence of state data for st_num.

The state data are stored into hmm, and their references to lower structure (mixture, codebook, etc.) are recovered from the id-to-pointer index. Their pointers are also stored in st_index for later data mapping operation from upper structure (models etc.).

引数:
fp[in] file pointer
hmm[out] HMM definition structure to hold the read states.
mpdf_macro[in] TRUE if mixture pdfs are already read separatedly, or FALSE if they are all defined in-line

read_binhmm.c621 行で定義されています。

参照元 read_binhmm().

static boolean rd_data ( FILE *  fp,
HTK_HMM_INFO hmm 
) [static]

Read a sequence of HMM models.

The models are stored into hmm. Their references to lower structures (state, transition, etc.) are stored in schalar ID, and are recovered from the previously built id-to-pointer index. when reading the sub structures.

引数:
fp[in] file pointer
hmm[out] HMM definition structure to hold the read models.

read_binhmm.c694 行で定義されています。

参照元 read_binhmm().

boolean read_binhmm ( FILE *  fp,
HTK_HMM_INFO hmm,
boolean  gzfile_p,
Value para 
)

Top function to read a binary HMM file from fp.

引数:
fp[in] file pointer
hmm[out] HMM definition structure to hold the read models.
gzfile_p[in] TRUE if the file pointer points to a gzip file
para[out] store acoustic parameters if embedded in binhmm (V2)
戻り値:
TRUE on success, FALSE on failure.

read_binhmm.c745 行で定義されています。

参照元 init_hmminfo().