PocketSphinx
5.0.0
A small speech recognizer

Fast integer logarithmic addition operations. More...
Go to the source code of this file.
Macros  
#define  LOGMATH_TABLE(lm) ((logadd_t *)lm) 
Typedefs  
typedef struct logadd_s  logadd_t 
typedef struct logmath_s  logmath_t 
Fast integer logarithmic addition operations.
Because doxygen is Bad Software, the actual documentation can only exist in logmath_t. Sorry about that.
In evaluating HMM models, probability values are often kept in log domain, to avoid overflow. To enable these logprob values to be held in int32 variables without significant loss of precision, a logbase of (1+epsilon) (where epsilon < 0.01 or so) is used. This module maintains this logbase (B).
However, maintaining probabilities in log domain creates a problem when adding two probability values. This problem can be solved by table lookup. Note that:
So:
The first entry in logadd_table is simply \( log_b(2.0) \), for the case where \( y = x \) and thus \( z = log_b(2x) = log_b(2) + x \). The last entry is zero, where \( log_b(x+y) = x = y \) due to loss of precision.
Since this table can be quite large particularly for small logbases, an option is provided to compress it by dropping the least significant bits of the table.