50 #include <sphinxbase/prim_type.h> 51 #include <sphinxbase/err.h> 52 #include <sphinxbase/cmd_ln.h> 53 #include <sphinxbase/strfuncs.h> 54 #include <sphinxbase/byteorder.h> 55 #include <sphinxbase/feat.h> 56 #include <sphinxbase/bio.h> 59 #include "cmdln_macro.h" 61 #include "s2_semi_mgau.h" 65 static int32 acmod_process_mfcbuf(
acmod_t *acmod);
70 char const *mdeffn, *tmatfn, *mllrfn, *hmmdir;
73 if ((mdeffn = cmd_ln_str_r(acmod->
config,
"_mdef")) == NULL) {
74 if ((hmmdir = cmd_ln_str_r(acmod->
config,
"-hmm")) == NULL)
75 E_ERROR(
"Acoustic model definition is not specified either " 76 "with -mdef option or with -hmm\n");
78 E_ERROR(
"Folder '%s' does not contain acoustic model " 79 "definition 'mdef'\n", hmmdir);
85 E_ERROR(
"Failed to read acoustic model definition from %s\n", mdeffn);
90 if ((tmatfn = cmd_ln_str_r(acmod->
config,
"_tmat")) == NULL) {
91 E_ERROR(
"No tmat file specified\n");
95 cmd_ln_float32_r(acmod->
config,
"-tmatfloor"),
99 if ((cmd_ln_str_r(acmod->
config,
"_mean") == NULL)
100 || (cmd_ln_str_r(acmod->
config,
"_var") == NULL)
101 || (cmd_ln_str_r(acmod->
config,
"_tmat") == NULL)) {
102 E_ERROR(
"No mean/var/tmat files specified\n");
106 if (cmd_ln_str_r(acmod->
config,
"_senmgau")) {
107 E_INFO(
"Using general multi-stream GMM computation\n");
108 acmod->
mgau = ms_mgau_init(acmod, acmod->
lmath, acmod->
mdef);
109 if (acmod->
mgau == NULL)
113 E_INFO(
"Attempting to use PTM computation module\n");
114 if ((acmod->
mgau = ptm_mgau_init(acmod, acmod->
mdef)) == NULL) {
115 E_INFO(
"Attempting to use semi-continuous computation module\n");
116 if ((acmod->
mgau = s2_semi_mgau_init(acmod)) == NULL) {
117 E_INFO(
"Falling back to general multi-stream GMM computation\n");
118 acmod->
mgau = ms_mgau_init(acmod, acmod->
lmath, acmod->
mdef);
119 if (acmod->
mgau == NULL) {
120 E_ERROR(
"Failed to read acoustic model\n");
128 if ((mllrfn = cmd_ln_str_r(acmod->
config,
"-mllr"))) {
139 acmod_init_feat(
acmod_t *acmod)
142 feat_init(cmd_ln_str_r(acmod->
config,
"-feat"),
143 cmn_type_from_str(cmd_ln_str_r(acmod->
config,
"-cmn")),
144 cmd_ln_boolean_r(acmod->
config,
"-varnorm"),
145 agc_type_from_str(cmd_ln_str_r(acmod->
config,
"-agc")),
146 1, cmd_ln_int32_r(acmod->
config,
"-ceplen"));
147 if (acmod->
fcb == NULL)
150 if (cmd_ln_str_r(acmod->
config,
"_lda")) {
151 E_INFO(
"Reading linear feature transformation from %s\n",
152 cmd_ln_str_r(acmod->
config,
"_lda"));
153 if (feat_read_lda(acmod->
fcb,
154 cmd_ln_str_r(acmod->
config,
"_lda"),
155 cmd_ln_int32_r(acmod->
config,
"-ldadim")) < 0)
159 if (cmd_ln_str_r(acmod->
config,
"-svspec")) {
161 E_INFO(
"Using subvector specification %s\n",
162 cmd_ln_str_r(acmod->
config,
"-svspec"));
163 if ((subvecs = parse_subvecs(cmd_ln_str_r(acmod->
config,
"-svspec"))) == NULL)
165 if ((feat_set_subvecs(acmod->
fcb, subvecs)) < 0)
169 if (cmd_ln_exists_r(acmod->
config,
"-agcthresh")
170 && 0 != strcmp(cmd_ln_str_r(acmod->
config,
"-agc"),
"none")) {
171 agc_set_threshold(acmod->
fcb->agc_struct,
172 cmd_ln_float32_r(acmod->
config,
"-agcthresh"));
175 if (acmod->
fcb->cmn_struct
176 && cmd_ln_exists_r(acmod->
config,
"-cmninit")) {
177 char *c, *cc, *vallist;
180 vallist = ckd_salloc(cmd_ln_str_r(acmod->
config,
"-cmninit"));
183 while (nvals < acmod->fcb->cmn_struct->veclen
184 && (cc = strchr(c,
',')) != NULL) {
186 acmod->
fcb->cmn_struct->cmn_mean[nvals] = FLOAT2MFCC(atof_c(c));
190 if (nvals < acmod->fcb->cmn_struct->veclen && *c !=
'\0') {
191 acmod->
fcb->cmn_struct->cmn_mean[nvals] = FLOAT2MFCC(atof_c(c));
199 acmod_fe_mismatch(
acmod_t *acmod, fe_t *fe)
202 if (cmd_ln_int32_r(acmod->
config,
"-ceplen") != fe_get_output_size(fe)) {
203 E_ERROR(
"Configured feature length %d doesn't match feature " 204 "extraction output size %d\n",
205 cmd_ln_int32_r(acmod->
config,
"-ceplen"),
206 fe_get_output_size(fe));
215 acmod_feat_mismatch(
acmod_t *acmod, feat_t *fcb)
218 if (0 != strcmp(cmd_ln_str_r(acmod->
config,
"-feat"), feat_name(fcb)))
221 if (cmd_ln_int32_r(acmod->
config,
"-ceplen") != feat_cepsize(fcb))
228 acmod_init(cmd_ln_t *config, logmath_t *lmath, fe_t *fe, feat_t *fcb)
232 acmod = ckd_calloc(1,
sizeof(*acmod));
233 acmod->
config = cmd_ln_retain(config);
234 acmod->
lmath = lmath;
239 if (acmod_fe_mismatch(acmod, fe))
246 acmod->
fe = fe_init_auto_r(config);
247 if (acmod->
fe == NULL)
249 if (acmod_fe_mismatch(acmod, acmod->
fe))
253 if (acmod_feat_mismatch(acmod, fcb))
260 if (acmod_init_feat(acmod) < 0)
265 if (acmod_init_am(acmod) < 0)
290 acmod->
compallsen = cmd_ln_boolean_r(config,
"-compallsen");
304 feat_free(acmod->
fcb);
306 cmd_ln_free_r(acmod->
config);
309 ckd_free_2d((
void **)acmod->
mfc_buf);
314 fclose(acmod->
mfcfh);
316 fclose(acmod->
rawfh);
318 fclose(acmod->
senfh);
324 ckd_free(acmod->rawdata);
331 ps_mgau_free(acmod->
mgau);
344 ps_mgau_transform(acmod->
mgau, mllr);
352 char nsenstr[64], logbasestr[64];
354 sprintf(nsenstr,
"%d", bin_mdef_n_sen(acmod->
mdef));
355 sprintf(logbasestr,
"%f", logmath_get_base(acmod->
lmath));
356 return bio_writehdr(logfh,
358 "mdef_file", cmd_ln_str_r(acmod->
config,
"_mdef"),
360 "logbase", logbasestr, NULL);
367 fclose(acmod->
senfh);
368 acmod->
senfh = logfh;
380 fclose(acmod->
mfcfh);
381 acmod->
mfcfh = logfh;
382 fwrite(&rv, 4, 1, acmod->
mfcfh);
390 fclose(acmod->
rawfh);
391 acmod->
rawfh = logfh;
396 acmod_grow_feat_buf(
acmod_t *acmod,
int nfr)
399 E_FATAL(
"Decoder can not process more than %d frames at once, " 417 acmod_grow_feat_buf(acmod, 128);
425 fe_start_utt(acmod->
fe);
435 acmod->rawdata_pos = 0;
451 fe_end_utt(acmod->
fe, acmod->
mfc_buf[inptr], &nfr);
456 nfr = acmod_process_mfcbuf(acmod);
458 feat_update_stats(acmod->
fcb);
463 outlen = (ftell(acmod->
mfcfh) - 4) / 4;
465 if ((rv = fseek(acmod->
mfcfh, 0, SEEK_SET)) == 0) {
466 fwrite(&outlen, 4, 1, acmod->
mfcfh);
468 fclose(acmod->
mfcfh);
472 fclose(acmod->
rawfh);
477 fclose(acmod->
senfh);
486 mfcc_t **cep,
int n_frames)
488 int n = n_frames * feat_cepsize(acmod->
fcb);
490 if (fwrite(cep[0],
sizeof(mfcc_t), n, acmod->
mfcfh) != n) {
491 E_ERROR_SYSTEM(
"Failed to write %d values to file", n);
497 acmod_process_full_cep(
acmod_t *acmod,
505 acmod_log_mfc(acmod, *inout_cep, *inout_n_frames);
511 E_FATAL(
"Batch processing can not process more than %d frames " 512 "at once, requested %d\n",
MAX_N_FRAMES, *inout_n_frames);
515 acmod->
feat_buf = feat_array_alloc(acmod->
fcb, *inout_n_frames);
521 nfr = feat_s2mfc2feat_live(acmod->
fcb, *inout_cep, inout_n_frames,
525 *inout_cep += *inout_n_frames;
532 acmod_process_full_raw(
acmod_t *acmod,
533 int16
const **inout_raw,
534 size_t *inout_n_samps)
540 if (*inout_n_samps + acmod->rawdata_pos < acmod->rawdata_size) {
541 memcpy(acmod->rawdata + acmod->rawdata_pos, *inout_raw, *inout_n_samps *
sizeof(int16));
542 acmod->rawdata_pos += *inout_n_samps;
545 fwrite(*inout_raw,
sizeof(int16), *inout_n_samps, acmod->
rawfh);
547 if (fe_process_frames(acmod->
fe, NULL, inout_n_samps, NULL, &nfr, NULL) < 0)
551 acmod->
mfc_buf = ckd_calloc_2d(nfr + 1, fe_get_output_size(acmod->
fe),
557 fe_start_utt(acmod->
fe);
558 if (fe_process_frames(acmod->
fe, inout_raw, inout_n_samps,
559 acmod->
mfc_buf, &nfr, NULL) < 0)
561 fe_end_utt(acmod->
fe, acmod->
mfc_buf[nfr], &ntail);
565 nfr = acmod_process_full_cep(acmod, &cepptr, &nfr);
574 acmod_process_mfcbuf(
acmod_t *acmod)
583 int saved_state = acmod->
state;
596 acmod->
state = saved_state;
608 int16
const **inout_raw,
609 size_t *inout_n_samps,
614 int16
const *prev_audio_inptr;
618 return acmod_process_full_raw(acmod, inout_raw, inout_n_samps);
622 if (inout_n_samps && *inout_n_samps) {
624 int32 processed_samples;
626 prev_audio_inptr = *inout_raw;
635 if (fe_process_frames(acmod->
fe, inout_raw, inout_n_samps,
636 acmod->
mfc_buf + inptr, &ncep1, &out_frameidx) < 0)
639 if (out_frameidx > 0)
642 processed_samples = *inout_raw - prev_audio_inptr;
643 if (processed_samples + acmod->rawdata_pos < acmod->rawdata_size) {
644 memcpy(acmod->rawdata + acmod->rawdata_pos, prev_audio_inptr, processed_samples *
sizeof(int16));
645 acmod->rawdata_pos += processed_samples;
649 fwrite(prev_audio_inptr,
sizeof(int16),
653 prev_audio_inptr = *inout_raw;
670 assert(inptr + ncep <= acmod->n_mfc_alloc);
671 if (fe_process_frames(acmod->
fe, inout_raw, inout_n_samps,
672 acmod->
mfc_buf + inptr, &ncep, &out_frameidx) < 0)
675 if (out_frameidx > 0)
679 processed_samples = *inout_raw - prev_audio_inptr;
680 if (processed_samples + acmod->rawdata_pos < acmod->rawdata_size) {
681 memcpy(acmod->rawdata + acmod->rawdata_pos, prev_audio_inptr, processed_samples *
sizeof(int16));
682 acmod->rawdata_pos += processed_samples;
685 fwrite(prev_audio_inptr,
sizeof(int16),
686 processed_samples, acmod->
rawfh);
688 prev_audio_inptr = *inout_raw;
695 return acmod_process_mfcbuf(acmod);
704 int32 nfeat, ncep, inptr;
709 return acmod_process_full_cep(acmod, inout_cep, inout_n_frames);
713 acmod_log_mfc(acmod, *inout_cep, *inout_n_frames);
716 orig_n_frames = ncep = nfeat = *inout_n_frames;
720 nfeat += feat_window_size(acmod->
fcb);
722 nfeat -= feat_window_size(acmod->
fcb);
729 acmod_grow_feat_buf(acmod, acmod->
n_feat_alloc + nfeat);
750 *inout_n_frames -= ncep;
760 nfeat = feat_s2mfc2feat_live(acmod->
fcb, *inout_cep,
773 *inout_n_frames -= ncep1;
778 nfeat = feat_s2mfc2feat_live(acmod->
fcb, *inout_cep,
788 *inout_n_frames -= ncep;
793 return orig_n_frames - *inout_n_frames;
818 for (i = 0; i < feat_dimension1(acmod->
fcb); ++i)
820 feat[i], feat_dimension2(acmod->
fcb, i) *
sizeof(**feat));
828 acmod_read_senfh_header(
acmod_t *acmod)
834 if (bio_readhdr(acmod->
insenfh, &name, &val, &swap) < 0)
836 for (i = 0; name[i] != NULL; ++i) {
837 if (!strcmp(name[i],
"n_sen")) {
838 if (atoi(val[i]) != bin_mdef_n_sen(acmod->
mdef)) {
839 E_ERROR(
"Number of senones in senone file (%d) does not " 840 "match mdef (%d)\n", atoi(val[i]),
841 bin_mdef_n_sen(acmod->
mdef));
846 if (!strcmp(name[i],
"logbase")) {
847 if (fabs(atof_c(val[i]) - logmath_get_base(acmod->
lmath)) > 0.001) {
848 E_ERROR(
"Logbase in senone file (%f) does not match acmod " 849 "(%f)\n", atof_c(val[i]),
850 logmath_get_base(acmod->
lmath));
856 bio_hdrarg_free(name, val);
859 bio_hdrarg_free(name, val);
873 return acmod_read_senfh_header(acmod);
881 E_ERROR(
"Circular feature buffer cannot be rewound (output frame %d, " 912 int16
const *senscr, FILE *senfh)
927 n_active2 = n_active;
928 if (fwrite(&n_active2, 2, 1, senfh) != 1)
930 if (n_active == bin_mdef_n_sen(acmod->
mdef)) {
931 if (fwrite(senscr, 2, n_active, senfh) != n_active)
936 if (fwrite(active, 1, n_active, senfh) != n_active)
938 for (i = n = 0; i < n_active; ++i) {
940 if (fwrite(senscr + n, 2, 1, senfh) != 1)
946 E_ERROR_SYSTEM(
"Failed to write frame to senone file");
954 acmod_read_scores_internal(
acmod_t *acmod)
970 if ((rv = fread(&n_active, 2, 1, senfh)) != 1)
988 for (j = n + 1; j < sen; ++j)
991 if ((rv = fread(acmod->
senone_scores + sen, 2, 1, senfh)) != 1)
998 while (n < bin_mdef_n_sen(acmod->
mdef))
1004 if (ferror(senfh)) {
1005 E_ERROR_SYSTEM(
"Failed to read frame from senone file");
1029 if ((rv = acmod_read_scores_internal(acmod)) != 1)
1036 E_DEBUG(1,(
"Frame %d has %d active states\n",
1049 calc_frame_idx(
acmod_t *acmod,
int *inout_frame_idx)
1054 if (inout_frame_idx == NULL)
1056 else if (*inout_frame_idx < 0)
1057 frame_idx = acmod->
output_frame + 1 + *inout_frame_idx;
1059 frame_idx = *inout_frame_idx;
1065 calc_feat_idx(
acmod_t *acmod,
int frame_idx)
1067 int n_backfr, feat_idx;
1070 if (frame_idx < 0 || acmod->output_frame - frame_idx > n_backfr) {
1071 E_ERROR(
"Frame %d outside queue of %d frames, %d alloc (%d > %d), " 1090 int frame_idx, feat_idx;
1093 frame_idx = calc_frame_idx(acmod, inout_frame_idx);
1096 if ((feat_idx = calc_feat_idx(acmod, frame_idx)) < 0)
1099 if (inout_frame_idx)
1100 *inout_frame_idx = frame_idx;
1108 int frame_idx, feat_idx;
1111 frame_idx = calc_frame_idx(acmod, inout_frame_idx);
1117 if (inout_frame_idx)
1118 *inout_frame_idx = frame_idx;
1123 if ((feat_idx = calc_feat_idx(acmod, frame_idx)) < 0)
1132 if (acmod_read_scores_internal(acmod) < 0)
1140 ps_mgau_frame_eval(acmod->
mgau,
1149 if (inout_frame_idx)
1150 *inout_frame_idx = frame_idx;
1160 E_DEBUG(1,(
"Frame %d has %d active states\n", frame_idx,
1174 for (i = 0; i < bin_mdef_n_sen(acmod->
mdef); ++i) {
1177 *out_best_senid = i;
1186 if (*senscr < best) {
1188 *out_best_senid = i;
1205 #define MPX_BITVEC_SET(a,h,i) \ 1206 if (hmm_mpx_ssid(h,i) != BAD_SSID) \ 1207 bitvec_set((a)->senone_active_vec, hmm_mpx_senid(h,i)) 1208 #define NONMPX_BITVEC_SET(a,h,i) \ 1209 bitvec_set((a)->senone_active_vec, \ 1210 hmm_nonmpx_senid(h,i)) 1219 if (hmm_is_mpx(hmm)) {
1220 switch (hmm_n_emit_state(hmm)) {
1222 MPX_BITVEC_SET(acmod, hmm, 4);
1223 MPX_BITVEC_SET(acmod, hmm, 3);
1225 MPX_BITVEC_SET(acmod, hmm, 2);
1226 MPX_BITVEC_SET(acmod, hmm, 1);
1227 MPX_BITVEC_SET(acmod, hmm, 0);
1230 for (i = 0; i < hmm_n_emit_state(hmm); ++i) {
1231 MPX_BITVEC_SET(acmod, hmm, i);
1236 switch (hmm_n_emit_state(hmm)) {
1238 NONMPX_BITVEC_SET(acmod, hmm, 4);
1239 NONMPX_BITVEC_SET(acmod, hmm, 3);
1241 NONMPX_BITVEC_SET(acmod, hmm, 2);
1242 NONMPX_BITVEC_SET(acmod, hmm, 1);
1243 NONMPX_BITVEC_SET(acmod, hmm, 0);
1246 for (i = 0; i < hmm_n_emit_state(hmm); ++i) {
1247 NONMPX_BITVEC_SET(acmod, hmm, i);
1256 int32 w, l, n, b, total_dists, total_words, extra_bits;
1259 total_dists = bin_mdef_n_sen(acmod->
mdef);
1264 total_words = total_dists / BITVEC_BITS;
1265 extra_bits = total_dists % BITVEC_BITS;
1270 for (b = 0; b < BITVEC_BITS; ++b) {
1271 if (*flagptr & (1UL << b)) {
1272 int32 sen = w * BITVEC_BITS + b;
1273 int32 delta = sen - l;
1276 while (delta > 255) {
1286 for (b = 0; b < extra_bits; ++b) {
1287 if (*flagptr & (1UL << b)) {
1288 int32 sen = w * BITVEC_BITS + b;
1289 int32 delta = sen - l;
1292 while (delta > 255) {
1302 E_DEBUG(1, (
"acmod_flags2list: %d active in frame %d\n",
1316 fe_start_stream(acmod->
fe);
1324 acmod->rawdata_size = size;
1325 if (acmod->rawdata_size > 0) {
1326 ckd_free(acmod->rawdata);
1327 acmod->rawdata = ckd_calloc(size,
sizeof(int16));
1335 *buffer = acmod->rawdata;
1338 *size = acmod->rawdata_pos;
(Sphinx 3.0 specific) A module that wraps up the code of gauden and senone because they are closely r...
FILE * insenfh
Input senone score file.
void acmod_get_rawdata(acmod_t *acmod, int16 **buffer, int32 *size)
Retrieves the raw data collected during utterance decoding.
uint8 grow_feat
Whether to grow feat_buf.
ps_mgau_t * mgau
Model parameters.
int acmod_read_scores(acmod_t *acmod)
Read one frame of scores from senone score dump file.
uint8 * senone_active
Array of deltas to active GMMs.
long * framepos
File positions of recent frames in senone file.
Utterance started, no data yet.
int acmod_set_insenfh(acmod_t *acmod, FILE *senfh)
Set up a senone score dump file for input.
int32 acmod_stream_offset(acmod_t *acmod)
Get the offset of the utterance start of the current stream, helpful for stream-wide timing...
int acmod_rewind(acmod_t *acmod)
Rewind the current utterance, allowing it to be rescored.
int16 * senone_scores
GMM scores for current frame.
ps_mllr_t * acmod_update_mllr(acmod_t *acmod, ps_mllr_t *mllr)
Adapt acoustic model using a linear transform.
int acmod_process_cep(acmod_t *acmod, mfcc_t ***inout_cep, int *inout_n_frames, int full_utt)
Feed acoustic feature data into the acoustic model for scoring.
int n_senone_active
Number of active GMMs.
An individual HMM among the HMM search space.
void acmod_set_rawdata_size(acmod_t *acmod, int32 size)
Sets the limit of the raw audio data to store.
void acmod_start_stream(acmod_t *acmod)
Reset the current stream.
logmath_t * lmath
Log-math computation.
fe_t * fe
Acoustic feature computation.
frame_idx_t n_mfc_frame
Number of frames active in mfc_buf.
void acmod_activate_hmm(acmod_t *acmod, hmm_t *hmm)
Activate senones associated with an HMM.
Utterance ended, still buffering.
FILE * rawfh
File for writing raw audio data.
mfcc_t ** mfc_buf
Temporary buffer of acoustic features.
frame_idx_t utt_start_frame
Index of the utterance start in the stream, all timings are relative to that.
void tmat_free(tmat_t *t)
RAH, add code to remove memory allocated by tmat_init.
frame_idx_t n_feat_alloc
Number of frames allocated in feat_buf.
mfcc_t *** feat_buf
Temporary buffer of dynamic features.
tmat_t * tmat_init(char const *tmatfile, logmath_t *lmath, float64 tpfloor, int32 breport)
Initialize transition matrix.
int acmod_set_senfh(acmod_t *acmod, FILE *logfh)
Start logging senone scores to a filehandle.
#define MAX_N_FRAMES
Maximum number of frames in index, should be in sync with above.
int acmod_set_rawfh(acmod_t *acmod, FILE *logfh)
Start logging raw audio to a filehandle.
ps_mllr_t * mllr
Speaker transformation.
Fast phonetically-tied mixture evaluation.
POCKETSPHINX_EXPORT ps_mllr_t * ps_mllr_read(char const *file)
Read a speaker-adaptive linear transform from a file.
uint8 compallsen
Compute all senones?
POCKETSPHINX_EXPORT bin_mdef_t * bin_mdef_read(cmd_ln_t *config, const char *filename)
Read a binary mdef from a file.
int acmod_process_feat(acmod_t *acmod, mfcc_t **feat)
Feed dynamic feature data into the acoustic model for scoring.
int acmod_write_senfh_header(acmod_t *acmod, FILE *logfh)
Write senone dump file header.
cmd_ln_t * config
Configuration.
frame_idx_t output_frame
Index of next frame of dynamic features.
int acmod_write_scores(acmod_t *acmod, int n_active, uint8 const *active, int16 const *senscr, FILE *senfh)
Write a frame of senone scores to a dump file.
tmat_t * tmat
Transition matrices.
int32 acmod_flags2list(acmod_t *acmod)
Build active list from.
POCKETSPHINX_EXPORT int ps_mllr_free(ps_mllr_t *mllr)
Release a pointer to a linear transform.
int acmod_end_utt(acmod_t *acmod)
Mark the end of an utterance.
int acmod_advance(acmod_t *acmod)
Advance the frame index.
uint8 state
State of utterance processing.
int acmod_set_mfcfh(acmod_t *acmod, FILE *logfh)
Start logging MFCCs to a filehandle.
void acmod_free(acmod_t *acmod)
Finalize an acoustic model.
void acmod_clear_active(acmod_t *acmod)
Clear set of active senones.
#define SENSCR_DUMMY
Dummy senone score value for unintentionally active states.
Feature space linear transform structure.
frame_idx_t feat_outidx
Start of active frames in feat_buf.
mfcc_t ** acmod_get_frame(acmod_t *acmod, int *inout_frame_idx)
Get a frame of dynamic feature data.
feat_t * fcb
Dynamic feature computation.
int log_zero
Zero log-probability value.
FILE * senfh
File for writing senone score data.
frame_idx_t mfc_outidx
Start of active frames in mfc_buf.
frame_idx_t n_mfc_alloc
Number of frames allocated in mfc_buf.
int acmod_process_raw(acmod_t *acmod, int16 const **inout_raw, size_t *inout_n_samps, int full_utt)
TODO: Set queue length for utterance processing.
int bin_mdef_free(bin_mdef_t *m)
Release a pointer to a binary mdef.
uint8 insen_swap
Whether to swap input senone score.
int acmod_start_utt(acmod_t *acmod)
Mark the start of an utterance.
int senscr_frame
Frame index for senone_scores.
bin_mdef_t * mdef
Model definition.
int acmod_best_score(acmod_t *acmod, int *out_best_senid)
Get best score and senone index for current frame.
acmod_t * acmod_init(cmd_ln_t *config, logmath_t *lmath, fe_t *fe, feat_t *fcb)
Initialize an acoustic model.
frame_idx_t n_feat_frame
Number of frames active in feat_buf.
Acoustic model structures for PocketSphinx.
FILE * mfcfh
File for writing acoustic feature data.
Acoustic model structure.
int acmod_set_grow(acmod_t *acmod, int grow_feat)
Set memory allocation policy for utterance processing.
int16 const * acmod_score(acmod_t *acmod, int *inout_frame_idx)
Score one frame of data.
int frame_idx
frame counter.
bitvec_t * senone_active_vec
Active GMMs in current frame.