1/*---------------------------------------------------------------------------*
2 *  all_defs.h  *
3 *                                                                           *
4 *  Copyright 2007, 2008 Nuance Communciations, Inc.                               *
5 *                                                                           *
6 *  Licensed under the Apache License, Version 2.0 (the 'License');          *
7 *  you may not use this file except in compliance with the License.         *
8 *                                                                           *
9 *  You may obtain a copy of the License at                                  *
10 *      http://www.apache.org/licenses/LICENSE-2.0                           *
11 *                                                                           *
12 *  Unless required by applicable law or agreed to in writing, software      *
13 *  distributed under the License is distributed on an 'AS IS' BASIS,        *
14 *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. *
15 *  See the License for the specific language governing permissions and      *
16 *  limitations under the License.                                           *
17 *                                                                           *
18 *---------------------------------------------------------------------------*/
19
20
21#ifndef _h_all_defs_
22#define _h_all_defs_
23
24#include "ptypes.h"
25#include "setting.h"
26
27#define USE_CONFIDENCE_SCORER 1
28
29/* constants */
30/* Model constants */
31#define MAX_LABEL       40      /* Maximum permitted label length */
32#define MAX_STRING      1024    /* Maximum permitted string length */
33#define MAX_FILE_NAME 256     /* Maximum permitted filename length */
34#define ALLOC_BLOCK     100
35#define MAX_STREAM      32      /* max no. of streams in prog, not file */
36#define MAX_DIMEN 64
37#define MAX_PELS        128
38
39/* Likelihood calculations */
40#define ADD_LOG_LIMIT    8
41#define SCORE_ADJUST     4
42#define SIGMA_BIAS       4
43#define MUL_SCALE        6.4F
44#define WT_SCALE         6.4F /* log weights */
45#define WT_ADJUST  2 /* in bits, for exp table lookup */
46#define WEIGHT_SHIFT  10
47#define WEIGHT_SCALE  (0x01 << WEIGHT_SHIFT) /* absolute weights */
48#define MAX_WTS   400 /* Needs to be tuned, dependent on some scales */
49#define IMELDA_SCALE     14 /* Applicable only for grand variance */
50#define EIGEN            1      /* for full covariance probability calc. */
51#define EUCLID_SHIFT     14 /* Scaling for FIXED_POINT in shifts */
52
53/* MLLR and Baum-Welch */
54/*dahan20070525
55#define MEAN_SCALE 20 // MLLR coefficients
56#define MEAN_OFFSET 128 // MLLR coefficients
57#define MAX_MLLR_TRANSFORMS 50
58#define EPSILON         0.001F
59#define MAX_OCCUPANCY   1000
60#define ITEM_WEIGHT     1       // item weighting for covariance calc.
61// otherwise gamma weighted
62#define GAMMA_SIGNI     0.0001  // minimum occupancy accumulates
63*/
64
65/* state duration constants */
66#define DUR_BIAS        0       /* duration penalty bias, changed elsewhere */
67#define NEWTON_FACTOR   10.0F   /* for converting duration to penalties */
68#define DEFAULT_UNIT_PER_FRAME 1
69#define FRAME_RATE_IN_MS 10
70#define UTB_MEAN        127.5F  /* mean of parameters in utb file */
71
72/* utterence constants */
73#define NORM_IN_IMELDA     0 /* Do channel normalization in IMELDA space */
74#define MAX_CEP_DIM     12
75#define MAX_CHAN_DIM     36
76#define MAX_FILTER_NUM     32 /* spectrum filter read as frontend pars  (centre freq, spread)*/
77#define NEW_UTB      1 /* support for latest (version 5) UTB files */
78/* with this set to zero supports version 3 files */
79
80
81/* phonemes and contexts */
82#define MAX_PHONEMES     128
83#define MAX_PHONE_STATES 6
84
85#define True  ESR_TRUE /*  Boolean constants */
86#define False  ESR_FALSE
87
88#define LITTLE          0       /* endian types */
89#define BIG             1
90/*  Configuration options
91    useful arithmetic functions and constants */
92#ifndef MAX
93#define MAX(X,Y)        ((X) > (Y) ? (X) : (Y))
94#endif
95#ifndef MIN
96#define MIN(X,Y)        ((X) < (Y) ? (X) : (Y))
97#endif
98#ifndef RANGE
99#define RANGE(X,Y,Z)        ((X) < (Y) ? (Y) : (X) > (Z) ? (Z) : (X))
100#endif
101#define SQR(X)          ((X) * (X))
102#define MAKEBYTE(X)     ((X) > 255 ? 255: ((X) < 0 ? 0 : (X)))
103#define ROUNDOFF(X) ((int)((X) >= 0 ? ((X) + 0.5) : ((X) - 0.5)))
104
105#ifndef M_PI
106#define M_PI            3.14159265358979323846
107#endif /* M_PI */
108
109#define MAX_LOG  1000000                 /* Check this value against types */
110#define FIXED_MAX 32767
111
112
113#define D_SHORT         1L            /* Frame data types */
114#define D_LONG          2L
115#define D_FLOAT         3L
116#define D_PTR           4L
117#define D_CHAR          5L
118#define D_UCHAR         6L
119#define D_USHORT        7L
120#define D_INT           8L
121#define D_UINT          9L
122#define D_ULONG        10L
123#define D_DOUBLE       11L
124
125#define USE_SYSTEM_MEMMOVE  1  /* memmove redefinitions, do not change */
126
127#endif
128