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 * gauden.h -- gaussian density module. 00039 * 00040 * ********************************************** 00041 * CMU ARPA Speech Project 00042 * 00043 * Copyright (c) 1996 Carnegie Mellon University. 00044 * ALL RIGHTS RESERVED. 00045 * ********************************************** 00046 * 00047 * HISTORY 00048 * $Log$ 00049 * Revision 1.1 2006/04/05 20:27:30 dhdfu 00050 * A Great Reorganzation of header files and executables 00051 * 00052 * Revision 1.8 2006/02/22 17:09:55 arthchan2003 00053 * 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. 00054 * 00055 * 00056 * 00057 * Revision 1.6.4.6 2006/01/16 19:45:59 arthchan2003 00058 * Change the gaussian density dumping routine to a function. 00059 * 00060 * Revision 1.6.4.5 2005/10/09 19:51:05 arthchan2003 00061 * Followed Dave's changed in the trunk. 00062 * 00063 * Revision 1.7 2005/10/05 00:31:14 dhdfu 00064 * Make int8 be explicitly signed (signedness of 'char' is 00065 * architecture-dependent). Then make a bunch of things use uint8 where 00066 * signedness is unimportant, because on the architecture where 'char' is 00067 * unsigned, it is that way for a reason (signed chars are slower). 00068 * 00069 * Revision 1.6.4.4 2005/09/25 18:54:20 arthchan2003 00070 * Added a flag to turn on and off precomputation. 00071 * 00072 * Revision 1.6.4.3 2005/08/03 18:53:44 dhdfu 00073 * Add memory deallocation functions. Also move all the initialization 00074 * of ms_mgau_model_t into ms_mgau_init (duh!), which entails removing it 00075 * from decode_anytopo and friends. 00076 * 00077 * Revision 1.6.4.2 2005/07/20 19:39:01 arthchan2003 00078 * Added licences in ms_* series of code. 00079 * 00080 * Revision 1.6.4.1 2005/07/05 05:47:59 arthchan2003 00081 * Fixed dox-doc. struct level of documentation are included. 00082 * 00083 * Revision 1.6 2005/06/21 18:55:09 arthchan2003 00084 * 1, Add comments to describe this modules, 2, Fixed doxygen documentation. 3, Added $ keyword. 00085 * 00086 * Revision 1.4 2005/06/13 04:02:55 archan 00087 * Fixed most doxygen-style documentation under libs3decoder. 00088 * 00089 * Revision 1.3 2005/03/30 01:22:47 archan 00090 * Fixed mistakes in last updates. Add 00091 * 00092 * 00093 * 26-Sep-96 M K Ravishankar (rkm@cs.cmu.edu) at Carnegie Mellon University. 00094 * Added gauden_mean_reload() for application of MLLR. 00095 * 00096 * 20-Jan-96 M K Ravishankar (rkm@cs.cmu.edu) at Carnegie Mellon University. 00097 * Added active argument to gauden_dist_norm and gauden_dist_norm_global, 00098 * and made the latter a static function. 00099 * 00100 * 06-Nov-95 M K Ravishankar (rkm@cs.cmu.edu) at Carnegie Mellon University. 00101 * Initial version created. 00102 * Very liberally borrowed/adapted from Eric's S3 trainer implementation. 00103 */ 00104 00105 00106 #ifndef _LIBFBS_GAUDEN_H_ 00107 #define _LIBFBS_GAUDEN_H_ 00108 00121 #include <s3types.h> 00122 #include <logmath.h> 00123 #include "vector.h" 00124 00125 #ifdef __cplusplus 00126 extern "C" { 00127 #endif 00128 #if 0 00129 } /* Fool Emacs into not indenting things. */ 00130 #endif 00131 00136 typedef struct { 00137 logmath_t *logmath; 00138 vector_t ***mean; 00139 vector_t ***var; 00140 float32 ***det; 00142 int32 n_mgau; 00143 int32 n_feat; 00144 int32 n_density; 00145 int32 *featlen; 00146 } gauden_t; 00147 00152 typedef struct { 00153 int32 id; 00154 int32 dist; 00157 } gauden_dist_t; 00158 00159 00166 gauden_t * 00167 gauden_init (const char *meanfile, 00168 const char *varfile, 00169 float32 varfloor, 00170 int32 precompute, 00171 logmath_t *logmath 00172 ); 00173 00175 void gauden_free(gauden_t *g); 00182 int32 gauden_mean_reload (gauden_t *g, 00183 const char *meanfile 00184 ); 00185 00192 int32 00193 gauden_dist (gauden_t *g, 00194 s3mgauid_t mgau, 00196 int32 n_top, 00197 vector_t *obs, 00198 gauden_dist_t **out_dist 00203 ); 00204 00205 00214 int32 00215 gauden_dist_norm (gauden_t *g, 00216 int32 n_top, 00217 gauden_dist_t ***dist, 00220 uint8 *active 00222 ); 00223 00224 00228 void gauden_dump (const gauden_t *g 00229 ); 00230 00234 void gauden_dump_ind (const gauden_t *g, 00235 int senidx 00236 ); 00237 00238 #if 0 00239 { /* Stop indent from complaining */ 00240 #endif 00241 #ifdef __cplusplus 00242 } 00243 #endif 00244 00245 #endif /* GAUDEN_H */