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 /* SphinxBase headers. */ 00100 #include <cmd_ln.h> 00101 #include <logmath.h> 00102 #include <feat.h> 00103 00104 /* Local headers. */ 00105 #include "ms_gauden.h" 00106 #include "ms_senone.h" 00107 00108 00109 /* Lists of senones sharing each mixture Gaussian codebook */ 00110 /* \struct mgau2sen_t 00111 \brief a mapping from gaussian to senone 00112 */ 00113 typedef struct mgau2sen_s { 00114 int16 sen; 00115 struct mgau2sen_s *next; 00116 } mgau2sen_t; 00117 00122 typedef struct { 00123 gauden_t* g; 00124 senone_t* s; 00125 mgau2sen_t **mgau2sen; 00126 int topn; 00129 gauden_dist_t ***dist; 00130 uint8 *mgau_active; 00131 00132 } ms_mgau_model_t; 00133 00134 #define ms_mgau_gauden(msg) (msg->g) 00135 #define ms_mgau_senone(msg) (msg->s) 00136 #define ms_mgau_mgau2sen(msg) (msg->mgau2sen) 00137 #define ms_mgau_topn(msg) (msg->topn) 00138 00139 ms_mgau_model_t* ms_mgau_init(cmd_ln_t *config, logmath_t *lmath); 00140 00142 void ms_mgau_free(ms_mgau_model_t *g 00143 ); 00144 00145 int32 ms_cont_mgau_frame_eval(ms_mgau_model_t * msg, 00146 int16 *senscr, 00147 int32 *senone_active, 00148 int32 n_senone_active, 00149 mfcc_t ** feat, 00150 int32 frame, 00151 int32 compallsen, 00152 int32 *out_bestidx); 00153 00154 #endif /* _LIBFBS_MS_CONT_MGAU_H_*/ 00155