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 * s3types.h -- Types specific to s3 decoder. 39 * 40 * ********************************************** 41 * CMU ARPA Speech Project 42 * 43 * Copyright (c) 1999 Carnegie Mellon University. 44 * ALL RIGHTS RESERVED. 45 * ********************************************** 46 * 47 * HISTORY 48 * $Log: s3types.h,v $ 49 * Revision 1.16 2006/02/22 19:57:57 arthchan2003 50 * Merged from branch SPHINX3_5_2_RCI_IRII_BRANCH: Increase the size of MAX_S3CIPID from 127 to 32767. This will make Chinese Mandarin setup works. 51 * 52 * Revision 1.15.4.1 2005/10/09 19:53:09 arthchan2003 53 * Changed the maximum number of CI PID from 127 to 32767, this will allow us to take care of Chinese syllable, Chinese initial/final and even Cantononese. It might still cause us problem in Turkish. 54 * 55 * Revision 1.15 2005/06/21 20:54:44 arthchan2003 56 * 1, Added $ keyword. 2, make a small change for compilation purpose. 57 * 58 * Revision 1.5 2005/06/16 04:59:09 archan 59 * Sphinx3 to s3.generic, a gentle-refactored version of Dave's change in senone scale. 60 * 61 * Revision 1.4 2005/06/15 21:48:56 archan 62 * Sphinx3 to s3.generic: Changed noinst_HEADERS to pkginclude_HEADERS. This make all the headers to be installed. 63 * 64 * Revision 1.3 2005/03/30 01:22:47 archan 65 * Fixed mistakes in last updates. Add 66 * 67 * 68 * 13-May-1999 M K Ravishankar (rkm@cs.cmu.edu) at Carnegie Mellon University. 69 * Changed typedef source for s3ssid_t from int32 to s3pid_t. 70 * Changed s3senid_t from int16 to int32 (to conform with composite senid 71 * which is int32). 72 * 73 * 04-May-1999 M K Ravishankar (rkm@cs.cmu.edu) at Carnegie Mellon University. 74 * Added senone sequence ID (s3ssid_t). 75 * 76 * 12-Jul-95 M K Ravishankar (rkm@cs.cmu.edu) at Carnegie Mellon University. 77 * Started. 78 */ 79 80 81 #ifndef _S3_S3TYPES_H_ 82 #define _S3_S3TYPES_H_ 83 84 #include <float.h> 85 #include <assert.h> 86 87 #include <prim_type.h> 88 #include <err.h> 89 #include <ckd_alloc.h> 90 #include <sphinx3_export.h> 91 92 /** \file s3types.h 93 * \brief Size definition of semantically units. Common for both s3 and s3.X decoder. 94 */ 95 96 #ifdef __cplusplus 97 extern "C" { 98 #endif 99 #if 0 100 } /* Fool Emacs into not indenting things. */ 101 #endif 102 103 /** 104 * Size definitions for more semantially meaningful units. 105 * Illegal value definitions, limits, and tests for specific types. 106 * NOTE: Types will be either int32 or smaller; only smaller ones may be unsigned (i.e., 107 * no type will be uint32). 108 */ 109 110 typedef int16 s3cipid_t; /** Ci phone id */ 111 #define BAD_S3CIPID ((s3cipid_t) -1) 112 #define NOT_S3CIPID(p) ((p)<0) 113 #define IS_S3CIPID(p) ((p)>=0) 114 #define MAX_S3CIPID 32767 115 116 /*#define MAX_S3CIPID 127*/ 117 118 typedef int32 s3pid_t; /** Phone id (triphone or ciphone) */ 119 #define BAD_S3PID ((s3pid_t) -1) 120 #define NOT_S3PID(p) ((p)<0) 121 #define IS_S3PID(p) ((p)>=0) 122 #define MAX_S3PID ((int32)0x7ffffffe) 123 124 typedef s3pid_t s3ssid_t; /** Senone sequence id (triphone or ciphone) */ 125 #define BAD_S3SSID ((s3ssid_t) -1) 126 #define NOT_S3SSID(p) ((p)<0) 127 #define IS_S3SSID(p) ((p)>=0) 128 #define MAX_S3SSID ((int32)0x7ffffffe) 129 130 typedef int32 s3tmatid_t; /** Transition matrix id; there can be as many as pids */ 131 #define BAD_S3TMATID ((s3tmatid_t) -1) 132 #define NOT_S3TMATID(t) ((t)<0) 133 #define IS_S3TMATID(t) ((t)>=0) 134 #define MAX_S3TMATID ((int32)0x7ffffffe) 135 136 typedef int32 s3wid_t; /** Dictionary word id */ 137 #define BAD_S3WID ((s3wid_t) -1) 138 #define NOT_S3WID(w) ((w)<0) 139 #define IS_S3WID(w) ((w)>=0) 140 #define MAX_S3WID ((int32)0x7ffffffe) 141 142 typedef uint16 s3lmwid_t; /** LM word id (uint16 for conserving space) */ 143 #define BAD_S3LMWID ((s3lmwid_t) 0xffff) 144 #define NOT_S3LMWID(w) ((w)==BAD_S3LMWID) 145 #define IS_S3LMWID(w) ((w)!=BAD_S3LMWID) 146 #define MAX_S3LMWID ((uint32)0xfffe) 147 #define BAD_LMCLASSID (-1) 148 149 typedef uint32 s3lmwid32_t; /** LM word id (uint32 for conserving space) */ 150 #define BAD_S3LMWID32 ((s3lmwid32_t) 0x0fffffff) 151 #define NOT_S3LMWID32(w) ((w)==BAD_S3LMWID32) 152 #define IS_S3LMWID32(w) ((w)!=BAD_S3LMWID32) 153 #define MAX_S3LMWID32 ((uint32)0xfffffffe) 154 155 /* Generic macro that is applicable to both uint16 and uint32 156 Careful with efficiency issue. 157 158 Also, please don't use BAD_S3LATID(l); 159 */ 160 161 #define BAD_LMWID(lm) (lm->is32bits? BAD_S3LMWID32 : BAD_S3LMWID) 162 #define NOT_LMWID(lm,w) (lm->is32bits? NOT_S3LMWID32(w): NOT_S3LMWID(w)) 163 #define IS_LMWID(lm,w) (lm->is32bits? IS_S3LMWID32(w): IS_S3LMWID(w)) 164 #define MAX_LMWID(lm) (lm->is32bits? MAX_S3LMWID32: MAX_S3LMWID) 165 166 typedef int32 s3latid_t; /** Lattice entry id */ 167 #define BAD_S3LATID ((s3latid_t) -1) 168 #define NOT_S3LATID(l) ((l)<0) 169 #define IS_S3LATID(l) ((l)>=0) 170 #define MAX_S3LATID ((int32)0x7ffffffe) 171 172 typedef int16 s3frmid_t; /** Frame id (must be SIGNED integer) */ 173 #define BAD_S3FRMID ((s3frmid_t) -1) 174 #define NOT_S3FRMID(f) ((f)<0) 175 #define IS_S3FRMID(f) ((f)>=0) 176 #define MAX_S3FRMID ((int32)0x7ffe) 177 178 typedef int16 s3senid_t; /** Senone id */ 179 #define BAD_S3SENID ((s3senid_t) -1) 180 #define NOT_S3SENID(s) ((s)<0) 181 #define IS_S3SENID(s) ((s)>=0) 182 #define MAX_S3SENID ((int16)0x7ffe) 183 184 typedef int16 s3mgauid_t; /** Mixture-gaussian codebook id */ 185 #define BAD_S3MGAUID ((s3mgauid_t) -1) 186 #define NOT_S3MGAUID(m) ((m)<0) 187 #define IS_S3MGAUID(m) ((m)>=0) 188 #define MAX_S3MGAUID ((int32)0x00007ffe) 189 190 191 #define S3_LOGPROB_ZERO ((int32) 0xc8000000) /** Integer version of log of zero Approx -infinity!! */ 192 #define S3_LOGPROB_ZERO_F ((float32) -1e30) /** Float version of log of zero Approx -infinity!! */ 193 194 /* RAH, I believe this is unreasonably large and not feasible */ /* Frame = 10msec */ 195 #define S3_MAX_FRAMES 15000 /* Frame = 10msec */ 196 197 #define RENORM_THRESH ((int32) ((S3_LOGPROB_ZERO)>>1)) /** Bestscore getting close to 0 */ 198 199 #define S3_SUCCESS 0 200 #define S3_ERROR -1 201 #define S3_WARNING -2 202 203 /** The maximum # of states for any given acoustic model */ 204 #define MAX_N_STATE 20 205 206 /** The maximum # of attributes associated with any 207 * given acoustic model */ 208 #define MAX_N_ATTRIB 5 209 210 #ifndef TRUE 211 #define TRUE 1 212 #define FALSE 0 /* assume that true is never defined w/o false */ 213 #endif 214 215 /* Timer for elapsed I/O time */ 216 #define IO_ELAPSED 0 217 218 /* Timer for utt processing elapsed time */ 219 #define UTT_ELAPSED 1 220 #define UTT_IO_ELAPSED 2 221 #define UTT_BW_ELAPSED 3 222 223 #define TYING_NON_EMITTING (0xffffffff) 224 #define TYING_NO_ID (0xffffffff) 225 226 #define MAX_VERSION_LEN 128 227 228 #define MEG *1024*1024 229 230 #if 0 231 { /* Stop indent from complaining */ 232 #endif 233 #ifdef __cplusplus 234 } 235 #endif 236 237 #endif 238