PocketSphinx  0.6
src/libpocketsphinx/s3types.h
Go to the documentation of this file.
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  * s3types.h -- Types specific to s3 decoder.
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: s3types.h,v $
00049  * Revision 1.16  2006/02/22 19:57:57  arthchan2003
00050  * 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.
00051  *
00052  * Revision 1.15.4.1  2005/10/09 19:53:09  arthchan2003
00053  * 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.
00054  *
00055  * Revision 1.15  2005/06/21 20:54:44  arthchan2003
00056  * 1, Added $ keyword. 2, make a small change for compilation purpose.
00057  *
00058  * Revision 1.5  2005/06/16 04:59:09  archan
00059  * Sphinx3 to s3.generic, a gentle-refactored version of Dave's change in senone scale.
00060  *
00061  * Revision 1.4  2005/06/15 21:48:56  archan
00062  * Sphinx3 to s3.generic: Changed noinst_HEADERS to pkginclude_HEADERS.  This make all the headers to be installed.
00063  *
00064  * Revision 1.3  2005/03/30 01:22:47  archan
00065  * Fixed mistakes in last updates. Add
00066  *
00067  * 
00068  * 13-May-1999  M K Ravishankar (rkm@cs.cmu.edu) at Carnegie Mellon University.
00069  *              Changed typedef source for s3ssid_t from int32 to s3pid_t.
00070  *              Changed s3senid_t from int16 to int32 (to conform with composite senid
00071  *              which is int32).
00072  * 
00073  * 04-May-1999  M K Ravishankar (rkm@cs.cmu.edu) at Carnegie Mellon University.
00074  *              Added senone sequence ID (s3ssid_t).
00075  * 
00076  * 12-Jul-95    M K Ravishankar (rkm@cs.cmu.edu) at Carnegie Mellon University.
00077  *              Started.
00078  */
00079 
00080 
00081 #ifndef _S3_S3TYPES_H_
00082 #define _S3_S3TYPES_H_
00083 
00084 #include <float.h>
00085 #include <assert.h>
00086 
00087 #include <sphinxbase/prim_type.h>
00088 #include <sphinxbase/err.h>
00089 #include <sphinxbase/ckd_alloc.h>
00090 
00095 #ifdef __cplusplus
00096 extern "C" {
00097 #endif
00098 #if 0
00099 } /* Fool Emacs into not indenting things. */
00100 #endif
00101 
00109 typedef int16           s3cipid_t;      
00110 #define BAD_S3CIPID     ((s3cipid_t) -1)
00111 #define NOT_S3CIPID(p)  ((p)<0)
00112 #define IS_S3CIPID(p)   ((p)>=0)
00113 #define MAX_S3CIPID     32767
00114 
00115 /*#define MAX_S3CIPID   127*/
00116 
00117 typedef int32           s3pid_t;        
00118 #define BAD_S3PID       ((s3pid_t) -1)
00119 #define NOT_S3PID(p)    ((p)<0)
00120 #define IS_S3PID(p)     ((p)>=0)
00121 #define MAX_S3PID       ((int32)0x7ffffffe)
00122 
00123 typedef uint16          s3ssid_t;       
00124 #define BAD_S3SSID      ((s3ssid_t) 0xffff)
00125 #define NOT_S3SSID(p)   ((p) == BAD_S3SSID)
00126 #define IS_S3SSID(p)    ((p) != BAD_S3SSID)
00127 #define MAX_S3SSID      ((s3ssid_t)0xfffe)
00128 
00129 typedef int32           s3tmatid_t;     
00130 #define BAD_S3TMATID    ((s3tmatid_t) -1)
00131 #define NOT_S3TMATID(t) ((t)<0)
00132 #define IS_S3TMATID(t)  ((t)>=0)
00133 #define MAX_S3TMATID    ((int32)0x7ffffffe)
00134 
00135 typedef int32           s3wid_t;        
00136 #define BAD_S3WID       ((s3wid_t) -1)
00137 #define NOT_S3WID(w)    ((w)<0)
00138 #define IS_S3WID(w)     ((w)>=0)
00139 #define MAX_S3WID       ((int32)0x7ffffffe)
00140 
00141 typedef uint16          s3lmwid_t;      
00142 #define BAD_S3LMWID     ((s3lmwid_t) 0xffff)
00143 #define NOT_S3LMWID(w)  ((w)==BAD_S3LMWID)
00144 #define IS_S3LMWID(w)   ((w)!=BAD_S3LMWID)
00145 #define MAX_S3LMWID     ((uint32)0xfffe)
00146 #define BAD_LMCLASSID   (-1)
00147 
00148 typedef uint32          s3lmwid32_t;    
00149 #define BAD_S3LMWID32   ((s3lmwid32_t) 0x0fffffff)
00150 #define NOT_S3LMWID32(w)  ((w)==BAD_S3LMWID32)
00151 #define IS_S3LMWID32(w) ((w)!=BAD_S3LMWID32)
00152 #define MAX_S3LMWID32   ((uint32)0xfffffffe)
00153 
00154 /* Generic macro that is applicable to both uint16 and uint32
00155    Careful with efficiency issue. 
00156 
00157    Also, please don't use BAD_S3LATID(l);
00158 */
00159 
00160 #define BAD_LMWID(lm)      (lm->is32bits? BAD_S3LMWID32 : BAD_S3LMWID)
00161 #define NOT_LMWID(lm,w)    (lm->is32bits? NOT_S3LMWID32(w): NOT_S3LMWID(w))
00162 #define IS_LMWID(lm,w)     (lm->is32bits? IS_S3LMWID32(w): IS_S3LMWID(w))
00163 #define MAX_LMWID(lm)      (lm->is32bits? MAX_S3LMWID32: MAX_S3LMWID)
00164 
00165 typedef int32           s3latid_t;      
00166 #define BAD_S3LATID     ((s3latid_t) -1)
00167 #define NOT_S3LATID(l)  ((l)<0)
00168 #define IS_S3LATID(l)   ((l)>=0)
00169 #define MAX_S3LATID     ((int32)0x7ffffffe)
00170 
00171 typedef int16           s3frmid_t;      
00172 #define BAD_S3FRMID     ((s3frmid_t) -1)
00173 #define NOT_S3FRMID(f)  ((f)<0)
00174 #define IS_S3FRMID(f)   ((f)>=0)
00175 #define MAX_S3FRMID     ((int32)0x7ffe)
00176 
00177 typedef uint16          s3senid_t;      
00178 #define BAD_S3SENID     ((s3senid_t) 0xffff)
00179 #define NOT_S3SENID(s)  ((s) == BAD_S3SENID)
00180 #define IS_S3SENID(s)   ((s) != BAD_S3SENID)
00181 #define MAX_S3SENID     ((int16)0x7ffe)
00182 
00183 typedef int16           s3mgauid_t;     
00184 #define BAD_S3MGAUID    ((s3mgauid_t) -1)
00185 #define NOT_S3MGAUID(m) ((m)<0)
00186 #define IS_S3MGAUID(m)  ((m)>=0)
00187 #define MAX_S3MGAUID    ((int32)0x00007ffe)
00188 
00189 
00190 #define S3_LOGPROB_ZERO         ((int32) 0xc8000000)    
00191 #define S3_LOGPROB_ZERO_F       ((float32) -1e30)       
00193 /* RAH, I believe this is unreasonably large and not feasible */ /* Frame = 10msec */
00194 #define S3_MAX_FRAMES           15000   /* Frame = 10msec */  
00195 
00196 #define RENORM_THRESH     ((int32) ((S3_LOGPROB_ZERO)>>1))       
00198 #define S3_SUCCESS      0
00199 #define S3_ERROR        -1
00200 #define S3_WARNING      -2
00201 
00203 #define MAX_N_STATE     20
00204 
00207 #define MAX_N_ATTRIB    5
00208 
00209 #ifndef TRUE
00210 #define TRUE  1
00211 #define FALSE 0 /* assume that true is never defined w/o false */
00212 #endif
00213 
00214 /* Timer for elapsed I/O time */
00215 #define IO_ELAPSED      0
00216 
00217 /* Timer for utt processing elapsed time */
00218 #define UTT_ELAPSED     1
00219 #define UTT_IO_ELAPSED  2
00220 #define UTT_BW_ELAPSED  3
00221 
00222 #define TYING_NON_EMITTING      (0xffffffff)
00223 #define TYING_NO_ID             (0xffffffff)
00224 
00225 #define MAX_VERSION_LEN 128
00226 
00227 #define MEG *1024*1024
00228 
00229 #if 0
00230 { /* Stop indent from complaining */
00231 #endif
00232 #ifdef __cplusplus
00233 }
00234 #endif
00235 
00236 #endif