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 <sphinx_config.h>
00076 #include <prim_type.h>
00077 #include <cmd_ln.h>
00078
00079
00080 #ifdef __cplusplus
00081 extern "C" {
00082 #endif
00083 #if 0
00084
00085 }
00086 #endif
00087
00093 typedef struct logadd_s logadd_t;
00094 struct logadd_s {
00096 void *table;
00098 uint32 table_size;
00100 uint8 width;
00102 int8 shift;
00103 };
00104
00108 typedef struct logmath_s logmath_t;
00109
00113 #define LOGMATH_TABLE(lm) ((logadd_t *)lm)
00114
00122 SPHINXBASE_EXPORT
00123 logmath_t *logmath_init(float64 base, int shift, int use_table);
00124
00128 SPHINXBASE_EXPORT
00129 logmath_t *logmath_read(const char *filename);
00130
00134 SPHINXBASE_EXPORT
00135 int32 logmath_write(logmath_t *lmath, const char *filename);
00136
00140 SPHINXBASE_EXPORT
00141 int32 logmath_get_table_shape(logmath_t *lmath, uint32 *out_size,
00142 uint32 *out_width, uint32 *out_shift);
00143
00147 SPHINXBASE_EXPORT
00148 float64 logmath_get_base(logmath_t *lmath);
00149
00153 SPHINXBASE_EXPORT
00154 int logmath_get_zero(logmath_t *lmath);
00155
00159 SPHINXBASE_EXPORT
00160 int logmath_get_width(logmath_t *lmath);
00161
00165 SPHINXBASE_EXPORT
00166 int logmath_get_shift(logmath_t *lmath);
00167
00173 SPHINXBASE_EXPORT
00174 logmath_t *logmath_retain(logmath_t *lmath);
00175
00181 SPHINXBASE_EXPORT
00182 int logmath_free(logmath_t *lmath);
00183
00187 SPHINXBASE_EXPORT
00188 int logmath_add_exact(logmath_t *lmath, int logb_p, int logb_q);
00189
00193 SPHINXBASE_EXPORT
00194 int logmath_add(logmath_t *lmath, int logb_p, int logb_q);
00195
00199 SPHINXBASE_EXPORT
00200 int logmath_log(logmath_t *lmath, float64 p);
00201
00205 SPHINXBASE_EXPORT
00206 float64 logmath_exp(logmath_t *lmath, int logb_p);
00207
00211 SPHINXBASE_EXPORT
00212 int logmath_ln_to_log(logmath_t *lmath, float64 log_p);
00213
00217 SPHINXBASE_EXPORT
00218 float64 logmath_log_to_ln(logmath_t *lmath, int logb_p);
00219
00223 SPHINXBASE_EXPORT
00224 int logmath_log10_to_log(logmath_t *lmath, float64 log_p);
00225
00229 SPHINXBASE_EXPORT
00230 float64 logmath_log_to_log10(logmath_t *lmath, int logb_p);
00231
00232 #ifdef __cplusplus
00233 }
00234 #endif
00235
00236
00237 #endif