Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00072 #ifndef __LOGMATH_H__
00073 #define __LOGMATH_H__
00074
00075 #include <sphinxbase_export.h>
00076 #include <sphinx_config.h>
00077 #include <prim_type.h>
00078 #include <cmd_ln.h>
00079
00080
00081 #ifdef __cplusplus
00082 extern "C" {
00083 #endif
00084 #if 0
00085
00086 }
00087 #endif
00088
00094 typedef struct logadd_s logadd_t;
00095 struct logadd_s {
00097 void *table;
00099 uint32 table_size;
00101 uint8 width;
00103 int8 shift;
00104 };
00105
00109 typedef struct logmath_s logmath_t;
00110
00114 #define LOGMATH_TABLE(lm) ((logadd_t *)lm)
00115
00123 SPHINXBASE_EXPORT
00124 logmath_t *logmath_init(float64 base, int shift, int use_table);
00125
00129 SPHINXBASE_EXPORT
00130 logmath_t *logmath_read(const char *filename);
00131
00135 SPHINXBASE_EXPORT
00136 int32 logmath_write(logmath_t *lmath, const char *filename);
00137
00141 SPHINXBASE_EXPORT
00142 int32 logmath_get_table_shape(logmath_t *lmath, uint32 *out_size,
00143 uint32 *out_width, uint32 *out_shift);
00144
00148 SPHINXBASE_EXPORT
00149 float64 logmath_get_base(logmath_t *lmath);
00150
00154 SPHINXBASE_EXPORT
00155 int logmath_get_zero(logmath_t *lmath);
00156
00160 SPHINXBASE_EXPORT
00161 int logmath_get_width(logmath_t *lmath);
00162
00166 SPHINXBASE_EXPORT
00167 int logmath_get_shift(logmath_t *lmath);
00168
00174 SPHINXBASE_EXPORT
00175 logmath_t *logmath_retain(logmath_t *lmath);
00176
00182 SPHINXBASE_EXPORT
00183 int logmath_free(logmath_t *lmath);
00184
00188 SPHINXBASE_EXPORT
00189 int logmath_add_exact(logmath_t *lmath, int logb_p, int logb_q);
00190
00194 SPHINXBASE_EXPORT
00195 int logmath_add(logmath_t *lmath, int logb_p, int logb_q);
00196
00200 SPHINXBASE_EXPORT
00201 int logmath_log(logmath_t *lmath, float64 p);
00202
00206 SPHINXBASE_EXPORT
00207 float64 logmath_exp(logmath_t *lmath, int logb_p);
00208
00212 SPHINXBASE_EXPORT
00213 int logmath_ln_to_log(logmath_t *lmath, float64 log_p);
00214
00218 SPHINXBASE_EXPORT
00219 float64 logmath_log_to_ln(logmath_t *lmath, int logb_p);
00220
00224 SPHINXBASE_EXPORT
00225 int logmath_log10_to_log(logmath_t *lmath, float64 log_p);
00226
00230 SPHINXBASE_EXPORT
00231 float64 logmath_log_to_log10(logmath_t *lmath, int logb_p);
00232
00233 #ifdef __cplusplus
00234 }
00235 #endif
00236
00237
00238 #endif