76 ms_cont_mgau_frame_eval,
77 ms_mgau_mllr_transform,
99 if ((g = msg->
g =
gauden_init(cmd_ln_str_r(config,
"_mean"),
100 cmd_ln_str_r(config,
"_var"),
101 cmd_ln_float32_r(config,
"-varfloor"),
103 E_ERROR(
"Failed to read means and variances\n");
108 if (g->
n_feat != feat_dimension1(acmod->
fcb)) {
109 E_ERROR(
"Number of streams does not match: %d != %d\n",
113 for (i = 0; i < g->
n_feat; ++i) {
114 if (g->
featlen[i] != feat_dimension2(acmod->
fcb, i)) {
115 E_ERROR(
"Dimension of stream %d does not match: %d != %d\n", i,
116 g->
featlen[i], feat_dimension2(acmod->
fcb, i));
122 cmd_ln_str_r(config,
"_mixw"),
123 cmd_ln_str_r(config,
"_senmgau"),
124 cmd_ln_float32_r(config,
"-mixwfloor"),
127 s->
aw = cmd_ln_int32_r(config,
"-aw");
131 E_FATAL(
"#Feature mismatch: gauden= %d, senone= %d\n", g->
n_feat,
134 E_FATAL(
"#Densities mismatch: gauden= %d, senone= %d\n",
137 E_FATAL(
"Senones need more codebooks (%d) than present (%d)\n",
140 E_ERROR(
"Senones use fewer codebooks (%d) than present (%d)\n",
143 msg->
topn = cmd_ln_int32_r(config,
"-topn");
144 E_INFO(
"The value of topn: %d\n", msg->
topn);
147 (
"-topn argument (%d) invalid or > #density codewords (%d); set to latter\n",
155 msg->mgau_active = ckd_calloc(g->
n_mgau,
sizeof(int8));
158 mg->
vt = &ms_mgau_funcs;
161 ms_mgau_free(ps_mgau_base(msg));
177 ckd_free_3d((
void *) msg->dist);
178 if (msg->mgau_active)
179 ckd_free(msg->mgau_active);
195 uint8 *senone_active,
196 int32 n_senone_active,
208 topn = ms_mgau_topn(msg);
209 g = ms_mgau_gauden(msg);
210 sen = ms_mgau_senone(msg);
215 for (gid = 0; gid < g->
n_mgau; gid++)
218 best = (int32) 0x7fffffff;
219 for (s = 0; s < sen->
n_sen; s++) {
221 if (best > senscr[s]) {
227 for (s = 0; s < sen->
n_sen; s++) {
228 int32 bs = senscr[s] - best;
239 for (gid = 0; gid < g->
n_mgau; gid++)
240 msg->mgau_active[gid] = 0;
243 for (i = 0; i < n_senone_active; i++) {
245 int32 s = senone_active[i] + n;
246 msg->mgau_active[sen->
mgau[s]] = 1;
251 for (gid = 0; gid < g->
n_mgau; gid++) {
252 if (msg->mgau_active[gid])
256 best = (int32) 0x7fffffff;
258 for (i = 0; i < n_senone_active; i++) {
259 int32 s = senone_active[i] + n;
261 if (best > senscr[s]) {
269 for (i = 0; i < n_senone_active; i++) {
270 int32 s = senone_active[i] + n;
271 int32 bs = senscr[s] - best;
(Sphinx 3.0 specific) A module that wraps up the code of gauden and senone because they are closely r...
int32 n_density
Number gaussian densities in each codebook-feature stream.
void gauden_free(gauden_t *g)
Release memory allocated by gauden_init.
int32 aw
Inverse acoustic weight.
Structure to store distance (density) values for a given input observation wrt density values in some...
int32 gauden_mllr_transform(gauden_t *s, ps_mllr_t *mllr, cmd_ln_t *config)
Transform Gaussians according to an MLLR matrix (or, eventually, more).
gauden_t * gauden_init(char const *meanfile, char const *varfile, float32 varfloor, logmath_t *lmath)
Read mixture gaussian codebooks from the given files.
uint32 n_sen
Number senones in this set.
gauden_t * g
The codebook.
uint32 * mgau
senone-id -> mgau-id mapping for senones in this set
8-bit senone PDF structure.
uint32 n_feat
Number feature streams.
cmd_ln_t * config
Configuration.
int32 * featlen
feature length for each feature
int topn
Top-n gaussian will be computed.
int32 senone_eval(senone_t *s, int id, gauden_dist_t **dist, int n_top)
Evaluate the score for the given senone wrt to the given top N gaussian codewords.
int32 n_mgau
Number codebooks.
Feature space linear transform structure.
feat_t * fcb
Dynamic feature computation.
void senone_free(senone_t *s)
Release memory allocated by senone_init.
int32 n_feat
Number feature streams in each codebook.
uint32 n_cw
Number codewords per codebook,stream.
uint32 n_gauden
Number gaussian density codebooks referred to by senones.
ps_mgaufuncs_t * vt
vtable of mgau functions.
Multivariate gaussian mixture density parameters.
int32 gauden_dist(gauden_t *g, int mgau, int n_top, mfcc_t **obs, gauden_dist_t **out_dist)
Compute gaussian density values for the given input observation vector wrt the specified mixture gaus...
senone_t * senone_init(gauden_t *g, char const *mixwfile, char const *mgau_mapfile, float32 mixwfloor, logmath_t *lmath, bin_mdef_t *mdef)
Load a set of senones (mixing weights and mixture gaussian codebook mappings) from the given files...
Acoustic model structure.