#include <sent/stddefs.h>
#include <sent/htk_param.h>
#include <sent/htk_hmm.h>
#include <sent/mfcc.h>
Go to the source code of this file.
Defines | |
#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 |
Functions | |
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) |
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 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_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) |
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. | |
Variables | |
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 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_State ** | st_index |
Sorted data pointers for mapping from pointer to id. | |
static unsigned int | st_num |
Length of above. |
Julius supports a binary format of HMM definition file. The tool "mkbinhmm" can convert the ascii format HTK HMM definition file to this format. Please note that this binary format is not compatible with the HTK binary format.
Definition in file 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 |
Definition at line 54 of file write_binhmm.c.
Referenced by 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 |
Definition at line 80 of file write_binhmm.c.
static boolean wt_header | ( | FILE * | fp, | |
boolean | emp, | |||
boolean | inv | |||
) | [static] |
Write header string as binary HMM file (ver.
2)
fp | [in] file pointer |
Definition at line 102 of file write_binhmm.c.
Referenced by 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 |
Definition at line 131 of file write_binhmm.c.
Referenced by 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. |
Definition at line 166 of file write_binhmm.c.
Referenced by 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 |
Definition at line 184 of file write_binhmm.c.
Referenced by 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 |
Definition at line 206 of file write_binhmm.c.
Referenced by 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 |
Definition at line 225 of file write_binhmm.c.
Referenced by 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 |
Definition at line 261 of file write_binhmm.c.
Referenced by 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 |
Definition at line 293 of file write_binhmm.c.
Referenced by 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 |
Definition at line 312 of file write_binhmm.c.
Referenced by 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 |
Definition at line 344 of file write_binhmm.c.
Referenced by 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 |
Definition at line 376 of file write_binhmm.c.
Referenced by 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 |
Definition at line 397 of file write_binhmm.c.
Referenced by 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 |
Definition at line 437 of file write_binhmm.c.
Referenced by wt_state(), and wt_tmix().
static void tmix_list_callback | ( | void * | p | ) | [static] |
Traverse callback function to store pointers in tm_index.
p | [in] pointer to the codebook data |
Definition at line 466 of file write_binhmm.c.
Referenced by wt_tmix().
qsort callback function to sort density pointers by their address for indexing.
tm1 | [in] data 1 | |
tm2 | [in] data 2 |
Definition at line 483 of file write_binhmm.c.
Referenced by 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 |
Definition at line 504 of file write_binhmm.c.
Referenced by 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 |
Definition at line 549 of file write_binhmm.c.
Referenced by 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 |
Definition at line 581 of file write_binhmm.c.
Referenced by wt_state().
static boolean wt_state | ( | FILE * | fp, | |
HTK_HMM_INFO * | hmm | |||
) | [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 |
Definition at line 602 of file write_binhmm.c.
Referenced by 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 |
Definition at line 674 of file write_binhmm.c.
Referenced by 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 |
Definition at line 704 of file write_binhmm.c.
Referenced by 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 |
Definition at line 753 of file write_binhmm.c.