Main Page | Modules | Data Structures | Directories | File List | Data Fields | Globals | Related Pages

read_binhmm.c File Reference

Read a binary HMM definition file. More...

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

Include dependency graph for read_binhmm.c:

Go to the source code of this file.

Functions

static void rdn (FILE *fp, void *buf, size_t unitbyte, int unitnum)
static char * rdn_str (FILE *fp)
static boolean rd_header (FILE *fp)
static void rd_opt (FILE *fp, HTK_HMM_Options *opt)
static void rd_type (FILE *fp, HTK_HMM_INFO *hmm)
static void rd_trans (FILE *fp, HTK_HMM_INFO *hmm)
 Read a sequence of transition matrix data for tr_num.
static void rd_var (FILE *fp, HTK_HMM_INFO *hmm)
 Read a sequence of variance vector for vr_num.
static void rd_dens (FILE *fp, HTK_HMM_INFO *hmm)
 Read a sequence of mixture densities for dens_num.
static void rd_tmix (FILE *fp, HTK_HMM_INFO *hmm)
 Read a sequence of mixture codebook for tm_num.
static void rd_state (FILE *fp, HTK_HMM_INFO *hmm)
 Read a sequence of state data for st_num.
static void rd_data (FILE *fp, HTK_HMM_INFO *hmm)
 Read a sequence of HMM models.
boolean read_binhmm (FILE *fp, HTK_HMM_INFO *hmm)

Variables

static char buf [MAXLINELEN]
 Local work are for text handling.
static char * binhmm_header = BINHMM_HEADER
 Header string.
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 GCODEBOOK ** tm_index
 Map codebook id to its pointer.
static unsigned int tm_num
 Length of above.
static HTK_HMM_State ** st_index
 Map state id to its pointer.
static unsigned int st_num
 Length of above.


Detailed Description

Read a binary HMM definition file.

Author:
Akinobu LEE
Date:
Wed Feb 16 05:23:59 2005
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.

Revision
1.2

Definition in file read_binhmm.c.


Function Documentation

static void rdn FILE *  fp,
void *  buf,
size_t  unitbyte,
int  unitnum
[static]
 

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

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

Definition at line 48 of file read_binhmm.c.

Referenced by check_header(), ngram_read_bin(), rd_data(), rd_dens(), rd_opt(), rd_state(), rd_tmix(), rd_trans(), rd_type(), and rd_var().

static char* rdn_str FILE *  fp  )  [static]
 

Read a string till NULL.

Parameters:
fp [in] file pointer
Returns:
pointer to a newly allocated buffer that contains the read string.

Definition at line 73 of file read_binhmm.c.

Referenced by rd_data(), rd_dens(), rd_header(), rd_state(), rd_tmix(), rd_trans(), and rd_var().

static boolean rd_header FILE *  fp  )  [static]
 

Read header string of binary HMM file.

Parameters:
fp [in] file pointer
Returns:
TRUE if a correct header was read, FALSE if header string does not match the current version.

Definition at line 104 of file read_binhmm.c.

Referenced by read_binhmm().

static void rd_opt FILE *  fp,
HTK_HMM_Options opt
[static]
 

Read HMM option specifications.

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

Definition at line 126 of file read_binhmm.c.

Referenced by read_binhmm().

static void rd_type FILE *  fp,
HTK_HMM_INFO hmm
[static]
 

Read HMM type of mixture tying.

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

Definition at line 143 of file read_binhmm.c.

Referenced by read_binhmm().

static void 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.).

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

Definition at line 165 of file read_binhmm.c.

Referenced by read_binhmm().

static void 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.).

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

Definition at line 211 of file read_binhmm.c.

Referenced by read_binhmm().

static void 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.).

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

Definition at line 252 of file read_binhmm.c.

Referenced by read_binhmm().

static void 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.).

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

Definition at line 298 of file read_binhmm.c.

Referenced by read_binhmm().

static void rd_state FILE *  fp,
HTK_HMM_INFO hmm
[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.).

Parameters:
fp [in] file pointer
hmm [out] HMM definition structure to hold the read states.

Definition at line 351 of file read_binhmm.c.

Referenced by read_binhmm().

static void 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.

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

Definition at line 408 of file read_binhmm.c.

Referenced by read_binhmm().

boolean read_binhmm FILE *  fp,
HTK_HMM_INFO hmm
 

Top function to read a binary HMM file from fp.

Parameters:
fp [in] file pointer
hmm [out] HMM definition structure to hold the read models.
Returns:
TRUE on success, FALSE on failure.

Definition at line 454 of file read_binhmm.c.

Referenced by init_hmminfo().


Generated on Tue Mar 28 16:03:15 2006 for Julius by  doxygen 1.4.2