SphinxBase 0.6
|
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 * cmn.h -- Various forms of cepstral mean normalization 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.13 2006/02/23 03:48:27 arthchan2003 00053 * Resolved conflict in cmn.h 00054 * 00055 * 00056 * Revision 1.12 2006/02/22 23:43:55 arthchan2003 00057 * Merged from the branch SPHINX3_5_2_RCI_IRII_BRANCH: Put data structure into the cmn_t structure. 00058 * 00059 * Revision 1.11.4.2 2005/10/17 04:45:57 arthchan2003 00060 * Free stuffs in cmn and feat corectly. 00061 * 00062 * Revision 1.11.4.1 2005/07/05 06:25:08 arthchan2003 00063 * Fixed dox-doc. 00064 * 00065 * Revision 1.11 2005/06/21 19:28:00 arthchan2003 00066 * 1, Fixed doxygen documentation. 2, Added $ keyword. 00067 * 00068 * Revision 1.4 2005/06/13 04:02:56 archan 00069 * Fixed most doxygen-style documentation under libs3decoder. 00070 * 00071 * Revision 1.3 2005/03/30 01:22:46 archan 00072 * Fixed mistakes in last updates. Add 00073 * 00074 * 00075 * 20.Apr.2001 RAH (rhoughton@mediasite.com, ricky.houghton@cs.cmu.edu) 00076 * Added cmn_free() and moved *mean and *var out global space and named them cmn_mean and cmn_var 00077 * 00078 * 28-Apr-1999 M K Ravishankar (rkm@cs.cmu.edu) at Carnegie Mellon University 00079 * Copied from previous version. 00080 */ 00081 00082 00083 #ifndef _S3_CMN_H_ 00084 #define _S3_CMN_H_ 00085 00086 /* Win32/WinCE DLL gunk */ 00087 #include <sphinxbase/sphinxbase_export.h> 00088 #include <sphinxbase/prim_type.h> 00089 #include <sphinxbase/fe.h> 00090 00091 #ifdef __cplusplus 00092 extern "C" { 00093 #endif 00094 #if 0 00095 /* Fool Emacs. */ 00096 } 00097 #endif 00098 00110 typedef enum cmn_type_e { 00111 CMN_NONE = 0, 00112 CMN_CURRENT, 00113 CMN_PRIOR 00114 } cmn_type_t; 00115 00117 SPHINXBASE_EXPORT 00118 extern const char *cmn_type_str[]; 00119 00121 SPHINXBASE_EXPORT 00122 cmn_type_t cmn_type_from_str(const char *str); 00123 00128 typedef struct { 00129 mfcc_t *cmn_mean; 00130 mfcc_t *cmn_var; 00131 mfcc_t *sum; 00132 int32 nframe; 00133 int32 veclen; 00134 } cmn_t; 00135 00136 SPHINXBASE_EXPORT 00137 cmn_t* cmn_init(int32 veclen); 00138 00142 SPHINXBASE_EXPORT 00143 void cmn (cmn_t *cmn, 00144 mfcc_t **mfc, 00145 int32 varnorm, 00148 int32 n_frame 00149 ); 00150 00151 #define CMN_WIN_HWM 800 /* #frames after which window shifted */ 00152 #define CMN_WIN 500 00153 00157 SPHINXBASE_EXPORT 00158 void cmn_prior(cmn_t *cmn, 00160 mfcc_t **incep, 00161 int32 varnorm, 00162 int32 nfr 00163 ); 00164 00168 SPHINXBASE_EXPORT 00169 void cmn_prior_update(cmn_t *cmn); 00170 00174 SPHINXBASE_EXPORT 00175 void cmn_prior_set(cmn_t *cmn, mfcc_t const *vec); 00176 00180 SPHINXBASE_EXPORT 00181 void cmn_prior_get(cmn_t *cmn, mfcc_t *vec); 00182 00183 /* RAH, free previously allocated memory */ 00184 SPHINXBASE_EXPORT 00185 void cmn_free (cmn_t *cmn); 00186 00187 #ifdef __cplusplus 00188 } 00189 #endif 00190 00191 #endif