PocketSphinx
0.6
Main Page
Data Structures
Files
File List
Globals
tied_mgau_common.h
Go to the documentation of this file.
1
/* -*- c-basic-offset: 4; indent-tabs-mode: nil -*- */
2
/* ====================================================================
3
* Copyright (c) 1999-2010 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
43
#ifndef __TIED_MGAU_COMMON_H__
44
#define __TIED_MGAU_COMMON_H__
45
46
#include <sphinxbase/logmath.h>
47
#include <sphinxbase/fixpoint.h>
48
49
#define MGAU_MIXW_VERSION "1.0"
/* Sphinx-3 file format version for mixw */
50
#define MGAU_PARAM_VERSION "1.0"
/* Sphinx-3 file format version for mean/var */
51
#define NONE -1
52
#define WORST_DIST (int32)(0x80000000)
53
55
#ifdef FIXED_POINT
56
#define GMMSUB(a,b) \
57
(((a)-(b) > a) ? (INT_MIN) : ((a)-(b)))
58
59
#define GMMADD(a,b) \
60
(((a)+(b) < a) ? (INT_MAX) : ((a)+(b)))
61
#else
62
#define GMMSUB(a,b) ((a)-(b))
63
#define GMMADD(a,b) ((a)+(b))
64
#endif
65
66
#ifndef MIN
67
#define MIN(a,b) ((a) < (b) ? (a) : (b))
68
#endif
69
70
71
#if defined(__STDC_VERSION__) && (__STDC_VERSION__ == 199901L)
72
#define LOGMATH_INLINE inline
73
#elif defined(__GNUC__)
74
#define LOGMATH_INLINE static inline
75
#elif defined(_MSC_VER)
76
#define LOGMATH_INLINE __inline
77
#else
78
#define LOGMATH_INLINE static
79
#endif
80
81
/* Allocate 0..159 for negated quantized mixture weights and 0..96 for
82
* negated normalized acoustic scores, so that the combination of the
83
* two (for a single mixture) can never exceed 255. */
84
#define MAX_NEG_MIXW 159
85
#define MAX_NEG_ASCR 96
104
LOGMATH_INLINE int
105
fast_logmath_add
(logmath_t *lmath,
int
mlx,
int
mly)
106
{
107
logadd_t *t = LOGMATH_TABLE(lmath);
108
int
d, r;
109
110
/* d must be positive, obviously. */
111
if
(mlx > mly) {
112
d = (mlx - mly);
113
r = mly;
114
}
115
else
{
116
d = (mly - mlx);
117
r = mlx;
118
}
119
120
return
r - (((uint8 *)t->table)[d]);
121
}
122
123
#endif
/* __TIED_MGAU_COMMON_H__ */
src
libpocketsphinx
tied_mgau_common.h
Generated by
1.8.3.1