ms_gauden.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  * gauden.h -- gaussian density module.
39  *
40  * **********************************************
41  * CMU ARPA Speech Project
42  *
43  * Copyright (c) 1996 Carnegie Mellon University.
44  * ALL RIGHTS RESERVED.
45  * **********************************************
46  *
47  * HISTORY
48  * $Log$
49  * Revision 1.1 2006/04/05 20:27:30 dhdfu
50  * A Great Reorganzation of header files and executables
51  *
52  * Revision 1.8 2006/02/22 17:09:55 arthchan2003
53  * Merged from SPHINX3_5_2_RCI_IRII_BRANCH: 1, Followed Dave's change, keep active to be uint8 instead int8 in gauden_dist_norm.\n 2, Introdued gauden_dump and gauden_dump_ind. This allows debugging of ms_gauden routine. \n 3, Introduced gauden_free, this fixed some minor memory leaks. \n 4, gauden_init accept an argument precompute to specify whether the distance is pre-computed or not.\n 5, Added license. \n 6, Fixed dox-doc.
54  *
55  *
56  *
57  * Revision 1.6.4.6 2006/01/16 19:45:59 arthchan2003
58  * Change the gaussian density dumping routine to a function.
59  *
60  * Revision 1.6.4.5 2005/10/09 19:51:05 arthchan2003
61  * Followed Dave's changed in the trunk.
62  *
63  * Revision 1.7 2005/10/05 00:31:14 dhdfu
64  * Make int8 be explicitly signed (signedness of 'char' is
65  * architecture-dependent). Then make a bunch of things use uint8 where
66  * signedness is unimportant, because on the architecture where 'char' is
67  * unsigned, it is that way for a reason (signed chars are slower).
68  *
69  * Revision 1.6.4.4 2005/09/25 18:54:20 arthchan2003
70  * Added a flag to turn on and off precomputation.
71  *
72  * Revision 1.6.4.3 2005/08/03 18:53:44 dhdfu
73  * Add memory deallocation functions. Also move all the initialization
74  * of ms_mgau_model_t into ms_mgau_init (duh!), which entails removing it
75  * from decode_anytopo and friends.
76  *
77  * Revision 1.6.4.2 2005/07/20 19:39:01 arthchan2003
78  * Added licences in ms_* series of code.
79  *
80  * Revision 1.6.4.1 2005/07/05 05:47:59 arthchan2003
81  * Fixed dox-doc. struct level of documentation are included.
82  *
83  * Revision 1.6 2005/06/21 18:55:09 arthchan2003
84  * 1, Add comments to describe this modules, 2, Fixed doxygen documentation. 3, Added $ keyword.
85  *
86  * Revision 1.4 2005/06/13 04:02:55 archan
87  * Fixed most doxygen-style documentation under libs3decoder.
88  *
89  * Revision 1.3 2005/03/30 01:22:47 archan
90  * Fixed mistakes in last updates. Add
91  *
92  *
93  * 26-Sep-96 M K Ravishankar (rkm@cs.cmu.edu) at Carnegie Mellon University.
94  * Added gauden_mean_reload() for application of MLLR.
95  *
96  * 20-Jan-96 M K Ravishankar (rkm@cs.cmu.edu) at Carnegie Mellon University.
97  * Added active argument to gauden_dist_norm and gauden_dist_norm_global,
98  * and made the latter a static function.
99  *
100  * 06-Nov-95 M K Ravishankar (rkm@cs.cmu.edu) at Carnegie Mellon University.
101  * Initial version created.
102  * Very liberally borrowed/adapted from Eric's S3 trainer implementation.
103  */
104 
105 
106 #ifndef _LIBFBS_GAUDEN_H_
107 #define _LIBFBS_GAUDEN_H_
108 
121 #include <s3types.h>
122 #include <logmath.h>
123 #include "vector.h"
124 
125 #ifdef __cplusplus
126 extern "C" {
127 #endif
128 #if 0
129 } /* Fool Emacs into not indenting things. */
130 #endif
131 
136 typedef struct {
137  logmath_t *logmath;
140  float32 ***det;
142  int32 n_mgau;
143  int32 n_feat;
144  int32 n_density;
145  int32 *featlen;
146 } gauden_t;
147 
152 typedef struct {
153  int32 id;
154  int32 dist;
157 } gauden_dist_t;
158 
159 
166 gauden_t *
167 gauden_init (const char *meanfile,
168  const char *varfile,
169  float32 varfloor,
170  int32 precompute,
171  logmath_t *logmath
172  );
173 
175 void gauden_free(gauden_t *g);
182 int32 gauden_mean_reload (gauden_t *g,
183  const char *meanfile
184  );
185 
192 int32
193 gauden_dist (gauden_t *g,
194  s3mgauid_t mgau,
196  int32 n_top,
197  vector_t *obs,
198  gauden_dist_t **out_dist
203  );
204 
205 
214 int32
216  int32 n_top,
217  gauden_dist_t ***dist,
220  uint8 *active
222  );
223 
224 
228 void gauden_dump (const gauden_t *g
229  );
230 
234 void gauden_dump_ind (const gauden_t *g,
235  int senidx
236  );
237 
238 #if 0
239 { /* Stop indent from complaining */
240 #endif
241 #ifdef __cplusplus
242 }
243 #endif
244 
245 #endif /* GAUDEN_H */
void gauden_dump(const gauden_t *g)
float32 * vector_t
Definition: vector.h:79
int32 gauden_dist_norm(gauden_t *g, int32 n_top, gauden_dist_t ***dist, uint8 *active)
int32 n_density
Definition: ms_gauden.h:144
void gauden_free(gauden_t *g)
int32 id
Definition: ms_gauden.h:153
int32 gauden_mean_reload(gauden_t *g, const char *meanfile)
Structure to store distance (density) values for a given input observation wrt density values in some...
Definition: ms_gauden.h:152
int32 dist
Definition: ms_gauden.h:154
gauden_t * gauden_init(const char *meanfile, const char *varfile, float32 varfloor, int32 precompute, logmath_t *logmath)
int16 s3mgauid_t
Definition: s3types.h:184
int32 * featlen
Definition: ms_gauden.h:145
Size definition of semantically units. Common for both s3 and s3.X decoder.
int32 n_mgau
Definition: ms_gauden.h:142
logmath_t * logmath
Definition: ms_gauden.h:137
vector_t *** mean
Definition: ms_gauden.h:138
int32 n_feat
Definition: ms_gauden.h:143
operation on Vector
int32 gauden_dist(gauden_t *g, s3mgauid_t mgau, int32 n_top, vector_t *obs, gauden_dist_t **out_dist)
void gauden_dump_ind(const gauden_t *g, int senidx)
Multivariate gaussian mixture density parameters.
Definition: ms_gauden.h:136
vector_t *** var
Definition: ms_gauden.h:139
float32 *** det
Definition: ms_gauden.h:140