ms_mgau.h
Go to the documentation of this file.
1 /* -*- c-basic-offset: 4; indent-tabs-mode: nil -*- */
2 /* ====================================================================
3  * Copyright (c) 1999-2004 Carnegie Mellon University. All rights
4  * reserved.
5  *
6  * Redistribution and use in source and binary forms, with or without
7  * modification, are permitted provided that the following conditions
8  * are met:
9  *
10  * 1. Redistributions of source code must retain the above copyright
11  * notice, this list of conditions and the following disclaimer.
12  *
13  * 2. Redistributions in binary form must reproduce the above copyright
14  * notice, this list of conditions and the following disclaimer in
15  * the documentation and/or other materials provided with the
16  * distribution.
17  *
18  * This work was supported in part by funding from the Defense Advanced
19  * Research Projects Agency and the National Science Foundation of the
20  * United States of America, and the CMU Sphinx Speech Consortium.
21  *
22  * THIS SOFTWARE IS PROVIDED BY CARNEGIE MELLON UNIVERSITY ``AS IS'' AND
23  * ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
24  * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
25  * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL CARNEGIE MELLON UNIVERSITY
26  * NOR ITS EMPLOYEES BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
27  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
28  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
29  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
30  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
31  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
32  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33  *
34  * ====================================================================
35  *
36  */
37 /*
38  * ms_mgau.h -- Essentially a wrapper that wrap up gauden and
39  * senone. It supports multi-stream.
40  *
41  *
42  * **********************************************
43  * CMU ARPA Speech Project
44  *
45  * Copyright (c) 1997 Carnegie Mellon University.
46  * ALL RIGHTS RESERVED.
47  * **********************************************
48  * HISTORY
49  * $Log$
50  * Revision 1.1 2006/04/05 20:27:30 dhdfu
51  * A Great Reorganzation of header files and executables
52  *
53  * Revision 1.3 2006/02/22 16:57:15 arthchan2003
54  * Fixed minor dox-doc issue
55  *
56  * Revision 1.2 2006/02/22 16:56:01 arthchan2003
57  * 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
58  *
59  * Revision 1.1.2.4 2005/09/25 18:55:19 arthchan2003
60  * Added a flag to turn on and off precomputation.
61  *
62  * Revision 1.1.2.3 2005/08/03 18:53:44 dhdfu
63  * Add memory deallocation functions. Also move all the initialization
64  * of ms_mgau_model_t into ms_mgau_init (duh!), which entails removing it
65  * from decode_anytopo and friends.
66  *
67  * Revision 1.1.2.2 2005/08/02 21:05:38 arthchan2003
68  * 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.
69  *
70  * Revision 1.1.2.1 2005/07/20 19:37:09 arthchan2003
71  * 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.
72  *
73  *
74  *
75  */
76 
96 #ifndef _LIBFBS_MS_CONT_MGAU_H_
97 #define _LIBFBS_MS_CONT_MGAU_H_
98 
99 #include <prim_type.h>
100 #include <cmd_ln.h>
101 #include <logmath.h>
102 #include <s3types.h>
103 #include <ms_gauden.h>
104 #include <ms_senone.h>
105 #include <interp.h>
106 #include <feat.h>
107 #include <mdef.h>
108 #include <ascr.h>
109 
110 #ifdef __cplusplus
111 extern "C" {
112 #endif
113 #if 0
114 /* Fool Emacs. */
115 }
116 #endif
117 
118 /* Lists of senones sharing each mixture Gaussian codebook */
119 /* \struct mgau2sen_t
120  \brief a mapping from gaussian to senone
121 */
122 typedef struct mgau2sen_s {
124  struct mgau2sen_s *next;
125 } mgau2sen_t;
126 
131 typedef struct {
136  int32 topn;
140  int8 *mgau_active;
141 
142 } ms_mgau_model_t;
143 
144 #define ms_mgau_gauden(msg) (msg->g)
145 #define ms_mgau_senone(msg) (msg->s)
146 #define ms_mgau_interp(msg) (msg->i)
147 #define ms_mgau_mgau2sen(msg) (msg->mgau2sen)
148 #define ms_mgau_topn(msg) (msg->topn)
149 
150 ms_mgau_model_t* ms_mgau_init (const char *meanfile,
151  const char *varfile,
152  float64 varfloor,
153  const char *mixwfile,
154  float64 mixwfloor,
155  int32 precomp,
156  const char* senmgau,
158  const char* lambdafile,
159  int32 topn,
160  logmath_t *logmath
161  );
162 
165  );
166 
168 int32 ms_cont_mgau_frame_eval (ascr_t *ascr,
169  ms_mgau_model_t *msg,
170  mdef_t *mdef,
171  float32** feat
172  );
173 
174 
176 int32 model_set_mllr(ms_mgau_model_t* msg,
177  const char *mllrfile,
178  const char *cb2mllrfile,
179  feat_t* fcb,
180  mdef_t *mdef,
181  cmd_ln_t *config
182  );
183 
184 #ifdef __cplusplus
185 }
186 #endif
187 
188 
189 #endif /* _LIBFBS_MS_CONT_MGAU_H_*/
190