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