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 * subvq.h 00039 * 00040 * ********************************************** 00041 * CMU ARPA Speech Project 00042 * 00043 * Copyright (c) 1999 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.14 2006/02/22 17:43:32 arthchan2003 00053 * Merged from SPHINX3_5_2_RCI_IRII_BRANCH: 00054 * 1, vector_gautbl_free is not appropiate to be used in this case because it will free a certain piece of memory twice. 00055 * 2, Fixed dox-doc. 00056 * 00057 * Revision 1.13.4.1 2005/07/05 05:47:59 arthchan2003 00058 * Fixed dox-doc. struct level of documentation are included. 00059 * 00060 * Revision 1.13 2005/06/21 19:01:33 arthchan2003 00061 * Added $ keyword. 00062 * 00063 * Revision 1.3 2005/03/30 01:22:47 archan 00064 * Fixed mistakes in last updates. Add 00065 * 00066 * 00067 * 20.Apr.2001 RAH (rhoughton@mediasite.com, ricky.houghton@cs.cmu.edu) 00068 * Updated subvq_free () to free more allocated memory 00069 * 00070 * 15-Dec-1999 M K Ravishankar (rkm@cs.cmu.edu) at Carnegie Mellon University 00071 * Moved subvq_t.{frm_sen_eval,frm_gau_eval} to cont_mgau.h. 00072 * 00073 * 14-Dec-1999 M K Ravishankar (rkm@cs.cmu.edu) at Carnegie Mellon University 00074 * Added subvq_t.{frm_sen_eval,frm_gau_eval}. Changed subvq_frame_eval to 00075 * return the normalization factor. 00076 * 00077 * 06-Dec-1999 M K Ravishankar (rkm@cs.cmu.edu) at Carnegie Mellon University 00078 * Added subvq_subvec_eval_logs3(). 00079 * 00080 * 14-Oct-1999 M K Ravishankar (rkm@cs.cmu.edu) at Carnegie Mellon University 00081 * Changed ci_active flags input to sen_active in subvq_frame_eval(). 00082 * 00083 * 20-Jul-1999 M K Ravishankar (rkm@cs.cmu.edu) at Carnegie Mellon University 00084 * Added subvq_gautbl_eval_logs3(). 00085 * 00086 * 12-Mar-1999 M K Ravishankar (rkm@cs.cmu.edu) at Carnegie Mellon University 00087 * Started. 00088 */ 00089 00090 00091 #ifndef _S3_SUBVQ_H_ 00092 #define _S3_SUBVQ_H_ 00093 00094 #include <cmd_ln.h> 00095 #include <logmath.h> 00096 00097 #include "s3types.h" 00098 #include "cont_mgau.h" 00099 #include "vector.h" 00100 00104 #ifdef __cplusplus 00105 extern "C" { 00106 #endif 00107 #if 0 00108 } /* Fool Emacs into not indenting things. */ 00109 #endif 00110 00114 typedef struct { 00115 arraysize_t origsize; 00117 int32 n_sv; 00118 int32 vqsize; 00119 int32 **featdim; 00120 vector_gautbl_t *gautbl; 00121 int32 ***map; 00126 /* Working space used during evaluation. */ 00127 float32 *subvec; 00128 int32 **vqdist; 00130 int32 *gauscore; 00131 int32 *mgau_sl; 00133 /* ARCHAN, 1111, 04, move the static global variables to the structure again. */ 00134 /* RAH, 5.8.01, VQ_EVAL determines how many vectors are used to 00135 * compute the shortlist, for now this value is only relevant when n_sv =3. 00136 * Setting it to 1 means that only the CEP values are estimated, 2 means that 00137 * CEP and delta values are estimated, 3 means all three are estimated. 00138 * Note, we must adjust the beam widths as we muck around with these. 00139 */ 00140 00141 int32 VQ_EVAL; 00142 } subvq_t; 00143 00144 00167 subvq_t *subvq_init (const char *file, 00168 float64 varfloor, 00169 int32 max_sv, 00171 mgau_model_t *g, 00175 cmd_ln_t *config, 00176 logmath_t *logmath 00177 ); 00178 00179 00180 00182 void subvq_free (subvq_t *vq 00183 ); 00184 00185 00193 int32 subvq_frame_eval (subvq_t *vq, 00194 mgau_model_t *g, 00195 int32 beam, 00197 float32 *feat, 00198 int32 *sen_active, 00200 int32 *senscr 00201 ); 00202 00207 void subvq_gautbl_eval_logs3 (subvq_t *vq, 00208 float32 *feat, 00211 logmath_t *logmath 00212 ); 00213 00219 void subvq_subvec_eval_logs3 (subvq_t *vq, 00220 float32 *feat, 00227 int32 sv, 00230 logmath_t *logmath 00231 ); 00232 00233 /* 00234 * Based on previously computed subvq scores (Mahalanobis distances), determine the active 00235 * components in the given mixture (using the vq->map). 00236 * @return Number of candidates in the returned shortlist. 00237 */ 00238 int32 subvq_mgau_shortlist (subvq_t *vq, 00239 int32 m, 00240 int32 n, 00241 int32 beam 00242 ); 00243 00244 00250 int32 subvq_mgau_eval (mgau_model_t *g, 00251 subvq_t *vq, 00252 int32 m, 00253 int32 n, 00254 int32 *active 00255 ); 00256 00257 #if 0 00258 { /* Stop indent from complaining */ 00259 #endif 00260 #ifdef __cplusplus 00261 } 00262 #endif 00263 00264 #endif