00001 /* -*- c-basic-offset: 4; indent-tabs-mode: nil -*- */ 00002 /* ==================================================================== 00003 * Copyright (c) 1999-2004 Carnegie Mellon University. All rights 00004 * reserved. 00005 * 00006 * Redistribution and use in source and binary forms, with or without 00007 * modification, are permitted provided that the following conditions 00008 * are met: 00009 * 00010 * 1. Redistributions of source code must retain the above copyright 00011 * notice, this list of conditions and the following disclaimer. 00012 * 00013 * 2. Redistributions in binary form must reproduce the above copyright 00014 * notice, this list of conditions and the following disclaimer in 00015 * the documentation and/or other materials provided with the 00016 * distribution. 00017 * 00018 * This work was supported in part by funding from the Defense Advanced 00019 * Research Projects Agency and the National Science Foundation of the 00020 * United States of America, and the CMU Sphinx Speech Consortium. 00021 * 00022 * THIS SOFTWARE IS PROVIDED BY CARNEGIE MELLON UNIVERSITY ``AS IS'' AND 00023 * ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 00024 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 00025 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL CARNEGIE MELLON UNIVERSITY 00026 * NOR ITS EMPLOYEES BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 00027 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 00028 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 00029 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 00030 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 00031 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 00032 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 00033 * 00034 * ==================================================================== 00035 * 00036 */ 00037 /* 00038 * ms_mgau.h -- Essentially a wrapper that wrap up gauden and 00039 * senone. It supports multi-stream. 00040 * 00041 * 00042 * ********************************************** 00043 * CMU ARPA Speech Project 00044 * 00045 * Copyright (c) 1997 Carnegie Mellon University. 00046 * ALL RIGHTS RESERVED. 00047 * ********************************************** 00048 * HISTORY 00049 * $Log$ 00050 * Revision 1.1 2006/04/05 20:27:30 dhdfu 00051 * A Great Reorganzation of header files and executables 00052 * 00053 * Revision 1.3 2006/02/22 16:57:15 arthchan2003 00054 * Fixed minor dox-doc issue 00055 * 00056 * Revision 1.2 2006/02/22 16:56:01 arthchan2003 00057 * Merged from SPHINX3_5_2_RCI_IRII_BRANCH: Added ms_mgau.[ch] into the trunk. It is a wrapper of ms_gauden and ms_senone 00058 * 00059 * Revision 1.1.2.4 2005/09/25 18:55:19 arthchan2003 00060 * Added a flag to turn on and off precomputation. 00061 * 00062 * Revision 1.1.2.3 2005/08/03 18:53:44 dhdfu 00063 * Add memory deallocation functions. Also move all the initialization 00064 * of ms_mgau_model_t into ms_mgau_init (duh!), which entails removing it 00065 * from decode_anytopo and friends. 00066 * 00067 * Revision 1.1.2.2 2005/08/02 21:05:38 arthchan2003 00068 * 1, Added dist and mgau_active as intermediate variable for computation. 2, Added ms_cont_mgau_frame_eval, which is a multi stream version of GMM computation mainly s3.0 family of tools. 3, Fixed dox-doc. 00069 * 00070 * Revision 1.1.2.1 2005/07/20 19:37:09 arthchan2003 00071 * Added a multi-stream cont_mgau (ms_mgau) which is a wrapper of both gauden and senone. Add ms_mgau_init and model_set_mllr. This allow eliminating 600 lines of code in decode_anytopo/align/allphone. 00072 * 00073 * 00074 * 00075 */ 00076 00096 #ifndef _LIBFBS_MS_CONT_MGAU_H_ 00097 #define _LIBFBS_MS_CONT_MGAU_H_ 00098 00099 #include <prim_type.h> 00100 #include <cmd_ln.h> 00101 #include <logmath.h> 00102 #include <s3types.h> 00103 #include <ms_gauden.h> 00104 #include <ms_senone.h> 00105 #include <interp.h> 00106 #include <feat.h> 00107 #include <mdef.h> 00108 #include <ascr.h> 00109 00110 #ifdef __cplusplus 00111 extern "C" { 00112 #endif 00113 #if 0 00114 /* Fool Emacs. */ 00115 } 00116 #endif 00117 00118 /* Lists of senones sharing each mixture Gaussian codebook */ 00119 /* \struct mgau2sen_t 00120 \brief a mapping from gaussian to senone 00121 */ 00122 typedef struct mgau2sen_s { 00123 s3senid_t sen; 00124 struct mgau2sen_s *next; 00125 } mgau2sen_t; 00126 00131 typedef struct { 00132 gauden_t* g; 00133 senone_t* s; 00134 mgau2sen_t **mgau2sen; 00135 interp_t* i; 00136 int32 topn; 00139 gauden_dist_t ***dist; 00140 int8 *mgau_active; 00141 00142 } ms_mgau_model_t; 00143 00144 #define ms_mgau_gauden(msg) (msg->g) 00145 #define ms_mgau_senone(msg) (msg->s) 00146 #define ms_mgau_interp(msg) (msg->i) 00147 #define ms_mgau_mgau2sen(msg) (msg->mgau2sen) 00148 #define ms_mgau_topn(msg) (msg->topn) 00149 00150 ms_mgau_model_t* ms_mgau_init (const char *meanfile, 00151 const char *varfile, 00152 float64 varfloor, 00153 const char *mixwfile, 00154 float64 mixwfloor, 00155 int32 precomp, 00156 const char* senmgau, 00158 const char* lambdafile, 00159 int32 topn, 00160 logmath_t *logmath 00161 ); 00162 00164 void ms_mgau_free(ms_mgau_model_t *g 00165 ); 00166 00167 S3DECODER_EXPORT 00168 int32 ms_cont_mgau_frame_eval (ascr_t *ascr, 00169 ms_mgau_model_t *msg, 00170 mdef_t *mdef, 00171 float32** feat 00172 ); 00173 00174 00175 S3DECODER_EXPORT 00176 int32 model_set_mllr(ms_mgau_model_t* msg, 00177 const char *mllrfile, 00178 const char *cb2mllrfile, 00179 feat_t* fcb, 00180 mdef_t *mdef, 00181 cmd_ln_t *config 00182 ); 00183 00184 #ifdef __cplusplus 00185 } 00186 #endif 00187 00188 00189 #endif /* _LIBFBS_MS_CONT_MGAU_H_*/ 00190