SphinxBase
0.6
Main Page
Related Pages
Data Structures
Files
File List
Globals
logmath.h
Go to the documentation of this file.
1
/* -*- c-basic-offset: 4; indent-tabs-mode: nil -*- */
2
/* ====================================================================
3
* Copyright (c) 2007 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
*/
72
#ifndef __LOGMATH_H__
73
#define __LOGMATH_H__
74
75
#include <sphinxbase/sphinxbase_export.h>
76
#include <
sphinxbase/prim_type.h
>
77
#include <
sphinxbase/cmd_ln.h
>
78
79
80
#ifdef __cplusplus
81
extern
"C"
{
82
#endif
83
#if 0
84
/* Fool Emacs. */
85
}
86
#endif
87
93
typedef
struct
logadd_s
logadd_t
;
94
struct
logadd_s
{
96
void
*
table
;
98
uint32
table_size
;
100
uint8
width
;
102
int8
shift
;
103
};
104
108
typedef
struct
logmath_s
logmath_t
;
109
113
#define LOGMATH_TABLE(lm) ((logadd_t *)lm)
114
122
SPHINXBASE_EXPORT
123
logmath_t
*
logmath_init
(float64 base,
int
shift,
int
use_table);
124
128
SPHINXBASE_EXPORT
129
logmath_t
*
logmath_read
(
const
char
*filename);
130
134
SPHINXBASE_EXPORT
135
int32
logmath_write
(
logmath_t
*lmath,
const
char
*filename);
136
140
SPHINXBASE_EXPORT
141
int32
logmath_get_table_shape
(
logmath_t
*lmath, uint32 *out_size,
142
uint32 *out_width, uint32 *out_shift);
143
147
SPHINXBASE_EXPORT
148
float64
logmath_get_base
(
logmath_t
*lmath);
149
153
SPHINXBASE_EXPORT
154
int
logmath_get_zero
(
logmath_t
*lmath);
155
159
SPHINXBASE_EXPORT
160
int
logmath_get_width
(
logmath_t
*lmath);
161
165
SPHINXBASE_EXPORT
166
int
logmath_get_shift
(
logmath_t
*lmath);
167
173
SPHINXBASE_EXPORT
174
logmath_t
*
logmath_retain
(
logmath_t
*lmath);
175
181
SPHINXBASE_EXPORT
182
int
logmath_free
(
logmath_t
*lmath);
183
187
SPHINXBASE_EXPORT
188
int
logmath_add_exact
(
logmath_t
*lmath,
int
logb_p,
int
logb_q);
189
193
SPHINXBASE_EXPORT
194
int
logmath_add
(
logmath_t
*lmath,
int
logb_p,
int
logb_q);
195
199
SPHINXBASE_EXPORT
200
int
logmath_log
(
logmath_t
*lmath, float64 p);
201
205
SPHINXBASE_EXPORT
206
float64
logmath_exp
(
logmath_t
*lmath,
int
logb_p);
207
211
SPHINXBASE_EXPORT
212
int
logmath_ln_to_log
(
logmath_t
*lmath, float64 log_p);
213
217
SPHINXBASE_EXPORT
218
float64
logmath_log_to_ln
(
logmath_t
*lmath,
int
logb_p);
219
223
SPHINXBASE_EXPORT
224
int
logmath_log10_to_log
(
logmath_t
*lmath, float64 log_p);
225
229
SPHINXBASE_EXPORT
230
float64
logmath_log_to_log10
(
logmath_t
*lmath,
int
logb_p);
231
232
#ifdef __cplusplus
233
}
234
#endif
235
236
237
#endif
/* __LOGMATH_H__ */
include
sphinxbase
logmath.h
Generated on Sun Jun 30 2013 20:14:36 for SphinxBase by
1.8.4