00001 00018 /* 00019 * Copyright (c) 1991-2007 Kawahara Lab., Kyoto University 00020 * Copyright (c) 2000-2005 Shikano Lab., Nara Institute of Science and Technology 00021 * Copyright (c) 2005-2007 Julius project team, Nagoya Institute of Technology 00022 * All rights reserved 00023 */ 00024 00025 #include <sent/stddefs.h> 00026 #include <sent/htk_defs.h> 00027 #include <sent/htk_hmm.h> 00028 #include <sent/htk_param.h> 00029 00037 boolean 00038 check_hmm_options(HTK_HMM_INFO *hmm) 00039 { 00040 boolean ret_flag = TRUE; 00041 00042 if (hmm->opt.stream_info.num > 1) { 00043 jlog("Error: check_hmmtype: Input stream must be single\n"); 00044 ret_flag = FALSE; 00045 } 00046 if (hmm->opt.dur_type != D_NULL) { 00047 jlog("Error: check_hmmtype: Duration types other than NULLD are not supported.\n"); 00048 ret_flag = FALSE; 00049 } 00050 if (hmm->opt.cov_type != C_DIAG_C) { 00051 jlog("Error: check_hmmtype: Covariance matrix type must be DIAGC, others not supported.\n"); 00052 ret_flag = FALSE; 00053 } 00054 00055 return(ret_flag); 00056 } 00057 00066 boolean 00067 check_param_coherence(HTK_HMM_INFO *hmm, HTK_Param *pinfo) 00068 { 00069 boolean ret_flag; 00070 00071 ret_flag = TRUE; 00072 00073 /* HMM type check */ 00074 if (hmm->opt.param_type 00075 != (pinfo->header.samptype & ~(F_COMPRESS | F_CHECKSUM))) { 00076 /* 00077 * jlog("Error: check_hmmtype: incompatible parameter type\n"); 00078 * jlog("Error: check_hmmtype: HMM trained by %s\n", param_code2str(buf, hmm->opt.param_type, FALSE)); 00079 * jlog("Error: check_hmmtype: input parameter is %s\n", param_code2str(buf, pinfo->header.samptype, FALSE)); 00080 */ 00081 ret_flag = FALSE; 00082 } 00083 00084 /* vector length check */ 00085 if (hmm->opt.vec_size != pinfo->veclen) { 00086 /* 00087 * jlog("Error: check_hmmtype: vector length differ.\n"); 00088 * jlog("Error: check_hmmtype: HMM=%d, param=%d\n", hmm->opt.vec_size, pinfo->veclen); 00089 */ 00090 ret_flag = FALSE; 00091 } 00092 00093 return(ret_flag); 00094 } 00095 00104 boolean 00105 check_param_basetype(HTK_HMM_INFO *hmm, HTK_Param *pinfo) 00106 { 00107 if ((hmm->opt.param_type & F_BASEMASK) 00108 != (pinfo->header.samptype & F_BASEMASK)) { 00109 return FALSE; 00110 } else { 00111 return TRUE; 00112 } 00113 }