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

HMM 定義をバイナリ形式のファイルへ書き出す [詳細]

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

ソースコードを見る。

マクロ定義

#define wrt(A, B, C, D)   if (wrtfunc(A,B,C,D) == FALSE) return FALSE
#define wrt_str(A, B)   if (wrt_strfunc(A,B) == FALSE) return FALSE

関数

static boolean wrtfunc (FILE *fp, void *buf, size_t unitbyte, size_t unitnum)
 Binary write function with byte swap (assume file is BIG ENDIAN)
static boolean wrt_strfunc (FILE *fp, char *str)
 Write a string, teminating at NULL.
static boolean wt_header (FILE *fp, boolean emp, boolean inv, boolean mpdfmacro)
 Write header string as binary HMM file (ver.
static boolean wt_para (FILE *fp, Value *para)
 Write acoustic analysis configration parameters into header of binary HMM.
static boolean wt_opt (FILE *fp, HTK_HMM_Options *opt)
 Write HMM option specifications.
static boolean wt_type (FILE *fp, HTK_HMM_INFO *hmm)
 Write HMM type of mixture tying.
static int qsort_tr_index (HTK_HMM_Trans **t1, HTK_HMM_Trans **t2)
 qsort callback function to sort transition pointers by their address for indexing.
static boolean wt_trans (FILE *fp, HTK_HMM_INFO *hmm)
 Write all transition matrix data.
static unsigned int search_trid (HTK_HMM_Trans *t)
 Binary search function to convert transition matrix pointer to a scholar ID.
static int qsort_vr_index (HTK_HMM_Var **v1, HTK_HMM_Var **v2)
 qsort callback function to sort variance pointers by their address for indexing.
static boolean wt_var (FILE *fp, HTK_HMM_INFO *hmm)
 Write all variance data.
static unsigned int search_vid (HTK_HMM_Var *v)
 Binary search function to convert variance pointer to a scholar ID.
static int qsort_dens_index (HTK_HMM_Dens **d1, HTK_HMM_Dens **d2)
 qsort callback function to sort density pointers by their address for indexing.
static boolean wt_dens (FILE *fp, HTK_HMM_INFO *hmm)
 Write all mixture density data.
static unsigned int search_did (HTK_HMM_Dens *d)
 Binary search function to convert density pointer to a scholar ID.
static int qsort_streamweight_index (HTK_HMM_StreamWeight **d1, HTK_HMM_StreamWeight **d2)
 qsort callback function to sort stream weight pointers by their address for indexing.
static boolean wt_streamweight (FILE *fp, HTK_HMM_INFO *hmm)
 Write all stream weight data.
static unsigned int search_swid (HTK_HMM_StreamWeight *sw)
 Binary search function to convert stream weight pointer to a scholar ID.
static void tmix_list_callback (void *p)
 Traverse callback function to store pointers in tm_index.
static int qsort_tm_index (GCODEBOOK **tm1, GCODEBOOK **tm2)
 qsort callback function to sort density pointers by their address for indexing.
static boolean wt_tmix (FILE *fp, HTK_HMM_INFO *hmm)
 Write all codebook data.
static unsigned int search_tmid (GCODEBOOK *tm)
 Binary search function to convert codebook pointer to a scholar ID.
static int qsort_mpdf_index (HTK_HMM_PDF **d1, HTK_HMM_PDF **d2)
 qsort callback function to sort mixture PDF pointers by their address for indexing.
static boolean wt_pdf_sub (FILE *fp, HTK_HMM_INFO *hmm, HTK_HMM_PDF *m)
 Write a mixture PDF.
static boolean wt_mpdf (FILE *fp, HTK_HMM_INFO *hmm)
 Write all mixture pdf data.
static unsigned int search_mpdfid (HTK_HMM_PDF *m)
 Binary search function to convert mixture pdf pointer to a scholar ID.
static int qsort_st_index (HTK_HMM_State **s1, HTK_HMM_State **s2)
 qsort callback function to sort state pointers by their address for indexing.
static boolean wt_state (FILE *fp, HTK_HMM_INFO *hmm, boolean mpdf_macro)
 Write all state data.
static unsigned int search_stid (HTK_HMM_State *s)
 Binary search function to convert state pointer to a scholar ID.
static boolean wt_data (FILE *fp, HTK_HMM_INFO *hmm)
 Write all model data.
boolean write_binhmm (FILE *fp, HTK_HMM_INFO *hmm, Value *para)
 Top function to write HMM definition data to a binary file.

変数

static char * binhmm_header_v2 = BINHMM_HEADER_V2
 Header string for V2.
static HTK_HMM_Trans ** tr_index
 Sorted data pointers for mapping from pointer to id.
static unsigned int tr_num
 Length of above.
static HTK_HMM_Var ** vr_index
 Sorted data pointers for mapping from pointer to id.
static unsigned int vr_num
 Length of above.
static HTK_HMM_Dens ** dens_index
 Sorted data pointers for mapping from pointer to id.
static unsigned int dens_num
 Length of above.
static HTK_HMM_StreamWeight ** streamweight_index
 Sorted data pointers for mapping from pointer to id.
static unsigned int streamweight_num
 Length of above.
static GCODEBOOK ** tm_index
 Sorted data pointers for mapping from pointer to id.
static unsigned int tm_num
 Length of above.
static unsigned int tm_idx
 Current index.
static HTK_HMM_PDF ** mpdf_index
 Sorted data pointers for mapping from pointer to id.
static unsigned int mpdf_num
 Length of above.
static HTK_HMM_State ** st_index
 Sorted data pointers for mapping from pointer to id.
static unsigned int st_num
 Length of above.

説明

HMM 定義をバイナリ形式のファイルへ書き出す

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

作者:
Akinobu LEE
日付:
Wed Feb 16 06:03:36 2005
Revision:
1.5

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


関数

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

Binary write function with byte swap (assume file is BIG ENDIAN)

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

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

参照元 wrt_strfunc().

static boolean wrt_strfunc ( FILE *  fp,
char *  str 
) [static]

Write a string, teminating at NULL.

引数:
fp[in] file pointer
str[in] string to write

write_binhmm.c83 行で定義されています。

static boolean wt_header ( FILE *  fp,
boolean  emp,
boolean  inv,
boolean  mpdfmacro 
) [static]

Write header string as binary HMM file (ver.

2)

引数:
fp[in] file pointer
emp[in] TRUE if parameter embedded
inv[in] TRUE if variances are inversed
mpdfmacro[in] TRUE if some mixture pdfs are defined as macro

write_binhmm.c108 行で定義されています。

参照元 write_binhmm().

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

Write acoustic analysis configration parameters into header of binary HMM.

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

write_binhmm.c142 行で定義されています。

参照元 write_binhmm().

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

Write HMM option specifications.

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

write_binhmm.c178 行で定義されています。

参照元 write_binhmm().

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

Write HMM type of mixture tying.

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

write_binhmm.c196 行で定義されています。

参照元 write_binhmm().

static int qsort_tr_index ( HTK_HMM_Trans **  t1,
HTK_HMM_Trans **  t2 
) [static]

qsort callback function to sort transition pointers by their address for indexing.

引数:
t1[in] data 1
t2[in] data 2
戻り値:
value required for qsort.

write_binhmm.c218 行で定義されています。

参照元 wt_trans().

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

Write all transition matrix data.

The pointers of all transition matrixes are first gathered, sorted by the address. Then the transition matrix data are written by the sorted order. The index will be used later to convert any pointer reference to a transition matrix into scholar id.

引数:
fp[in] file pointer
hmm[in] writing HMM definition data

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

参照元 write_binhmm().

static unsigned int search_trid ( HTK_HMM_Trans t) [static]

Binary search function to convert transition matrix pointer to a scholar ID.

引数:
t[in] pointer to a transition matrix
戻り値:
the corresponding scholar ID.

write_binhmm.c273 行で定義されています。

参照元 wt_data().

static int qsort_vr_index ( HTK_HMM_Var **  v1,
HTK_HMM_Var **  v2 
) [static]

qsort callback function to sort variance pointers by their address for indexing.

引数:
v1[in] data 1
v2[in] data 2
戻り値:
value required for qsort.

write_binhmm.c305 行で定義されています。

参照元 wt_var().

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

Write all variance data.

The pointers of all variance vectors are first gathered, sorted by the address. Then the variance vectors are written by the sorted order. The index will be used later to convert any pointer reference to a variance vector into scholar id.

引数:
fp[in] file pointer
hmm[in] writing HMM definition data

write_binhmm.c324 行で定義されています。

参照元 write_binhmm().

static unsigned int search_vid ( HTK_HMM_Var v) [static]

Binary search function to convert variance pointer to a scholar ID.

引数:
v[in] pointer to a variance data
戻り値:
the corresponding scholar ID.

write_binhmm.c356 行で定義されています。

参照元 wt_dens().

static int qsort_dens_index ( HTK_HMM_Dens **  d1,
HTK_HMM_Dens **  d2 
) [static]

qsort callback function to sort density pointers by their address for indexing.

引数:
d1[in] data 1
d2[in] data 2
戻り値:
value required for qsort.

write_binhmm.c388 行で定義されています。

参照元 wt_dens().

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

Write all mixture density data.

The pointers of all mixture densities are first gathered, sorted by the address. Then the densities are written by the sorted order. The pointers to the lower structure (variance etc.) in the data are written in a corresponding scholar id. The pointer index of this data will be used later to convert any pointer reference to a density data into scholar id.

引数:
fp[in] file pointer
hmm[in] writing HMM definition data

write_binhmm.c409 行で定義されています。

参照元 write_binhmm().

static unsigned int search_did ( HTK_HMM_Dens d) [static]

Binary search function to convert density pointer to a scholar ID.

引数:
d[in] pointer to a mixture density
戻り値:
the corresponding scholar ID.

write_binhmm.c449 行で定義されています。

参照元 wt_pdf_sub(), と wt_tmix().

static int qsort_streamweight_index ( HTK_HMM_StreamWeight **  d1,
HTK_HMM_StreamWeight **  d2 
) [static]

qsort callback function to sort stream weight pointers by their address for indexing.

引数:
d1[in] data 1
d2[in] data 2
戻り値:
value required for qsort.

write_binhmm.c480 行で定義されています。

参照元 wt_streamweight().

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

Write all stream weight data.

The pointers of all stream weights are first gathered, sorted by the address. Then the stream weights are written by the sorted order. The pointers to the lower structure (variance etc.) in the data are written in a corresponding scholar id. The pointer index of this data will be used later to convert any pointer reference to a data into scholar id.

引数:
fp[in] file pointer
hmm[in] writing HMM definition data

write_binhmm.c501 行で定義されています。

参照元 write_binhmm().

static unsigned int search_swid ( HTK_HMM_StreamWeight sw) [static]

Binary search function to convert stream weight pointer to a scholar ID.

引数:
d[in] pointer to a mixture density
戻り値:
the corresponding scholar ID.

write_binhmm.c533 行で定義されています。

参照元 wt_state().

static void tmix_list_callback ( void *  p) [static]

Traverse callback function to store pointers in tm_index.

引数:
p[in] pointer to the codebook data

write_binhmm.c562 行で定義されています。

参照元 wt_tmix().

static int qsort_tm_index ( GCODEBOOK **  tm1,
GCODEBOOK **  tm2 
) [static]

qsort callback function to sort density pointers by their address for indexing.

引数:
tm1[in] data 1
tm2[in] data 2
戻り値:
value required for qsort.

write_binhmm.c579 行で定義されています。

参照元 wt_tmix().

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

Write all codebook data.

The pointers of all codebook densities are first gathered, sorted by the address. Then the densities are written by the sorted order. The pointers to the lower structure (mixture etc.) in the data are written by the corresponding scholar id. The pointer index of this data will be used later to convert any pointer reference to a codebook into scholar id.

引数:
fp[in] file pointer
hmm[in] writing HMM definition data

write_binhmm.c600 行で定義されています。

参照元 write_binhmm().

static unsigned int search_tmid ( GCODEBOOK tm) [static]

Binary search function to convert codebook pointer to a scholar ID.

引数:
tm[in] pointer to a codebook
戻り値:
the corresponding scholar ID.

write_binhmm.c645 行で定義されています。

参照元 wt_pdf_sub().

static int qsort_mpdf_index ( HTK_HMM_PDF **  d1,
HTK_HMM_PDF **  d2 
) [static]

qsort callback function to sort mixture PDF pointers by their address for indexing.

引数:
d1[in] data 1
d2[in] data 2
戻り値:
value required for qsort.

write_binhmm.c677 行で定義されています。

参照元 wt_mpdf().

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

Write a mixture PDF.

引数:
fp[in] file pointer
hmm[in] writing HMM definition data
m[out] mixture PDF to be written
戻り値:
TRUE on success, FALSE on error.

write_binhmm.c695 行で定義されています。

参照元 wt_mpdf(), と wt_state().

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

Write all mixture pdf data.

The pointers of all mixture pdfs are first gathered, sorted by the address. Then the mixture pdfs are written by the sorted order. The pointers to the lower structure (variance etc.) in the data are written in a corresponding scholar id. The pointer index of this data will be used later to convert any pointer reference to a data into scholar id.

引数:
fp[in] file pointer
hmm[in] writing HMM definition data

write_binhmm.c759 行で定義されています。

参照元 write_binhmm().

static unsigned int search_mpdfid ( HTK_HMM_PDF m) [static]

Binary search function to convert mixture pdf pointer to a scholar ID.

引数:
m[in] pointer to a mixture pdf
戻り値:
the corresponding scholar ID.

write_binhmm.c792 行で定義されています。

参照元 wt_state().

static int qsort_st_index ( HTK_HMM_State **  s1,
HTK_HMM_State **  s2 
) [static]

qsort callback function to sort state pointers by their address for indexing.

引数:
s1[in] data 1
s2[in] data 2
戻り値:
value required for qsort.

write_binhmm.c824 行で定義されています。

参照元 wt_state().

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

Write all state data.

The pointers of all states are first gathered, sorted by the address. Then the state informations are written by the sorted order. The pointers to the lower structure (mixture etc.) in the data are written in a corresponding scholar id. The pointer index of this data will be used later to convert any pointer reference to a state data into scholar id.

引数:
fp[in] file pointer
hmm[in] writing HMM definition data
mpdf_macro[in] TRUE if mixture PDFs are already read as separated definitions

write_binhmm.c846 行で定義されています。

参照元 write_binhmm().

static unsigned int search_stid ( HTK_HMM_State s) [static]

Binary search function to convert state pointer to a scholar ID.

引数:
s[in] pointer to a state
戻り値:
the corresponding scholar ID.

write_binhmm.c913 行で定義されています。

参照元 wt_data().

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

Write all model data.

The data of all models are written. The order is not important at this top level, since there are no reference to this data. The pointers to the lower structure (states, transitions, etc.) in the data are written by the corresponding scholar id.

引数:
fp[in] file pointer
hmm[in] writing HMM definition data

write_binhmm.c943 行で定義されています。

参照元 write_binhmm().

boolean write_binhmm ( FILE *  fp,
HTK_HMM_INFO hmm,
Value para 
)

Top function to write HMM definition data to a binary file.

引数:
fp[in] file pointer
hmm[in] HMM definition structure to be written
para[in] acoustic analysis parameter, or NULL if not available
戻り値:
TRUE on success, FALSE on failure.

write_binhmm.c992 行で定義されています。