📄 recog.h
字号:
int bpmax; ///< Maximum length of @a buffer int bp; ///< Current point to store the next data int current_len; ///< Current length of stored samples SP16 *cbuf; ///< Buffer for flushing cycle buffer just after detecting trigger boolean down_sample; ///< TRUE if perform down sampling from 48kHz to 16kHz SP16 *buffer48; ///< Another temporary buffer to hold 48kHz inputs int io_rate; ///< frequency rate (should be 3 always for 48/16 conversion boolean is_valid_data; ///< TRUE if we are now triggered int nc; ///< count of current tail silence segments boolean end_of_stream; ///< TRUE if we have reached the end of stream boolean need_init; ///< if TRUE, initialize buffer on startup DS_BUFFER *ds; ///< Filter buffer for 48-to-16 conversion boolean rehash; ///< TRUE is want rehash at rewinding on decoder-based VAD boolean input_side_segment; ///< TRUE if segmentation requested by ad_read unsigned int total_captured_len; unsigned int last_trigger_sample;} ADIn;/** * Recognition result output structure. You may want to use with model data * to get fully detailed results. * */typedef struct __Output__ { /** * 1: recognition in progress * 0: recognition succeeded (at least one candidate has been found) * -1: search failed, no candidate has been found * -2: input rejected by short input * -3: input rejected by GMM * */ int status; int num_frame; ///< Number of frames of the recognized part int length_msec; ///< Length of the recognized part Sentence *sent; ///< List of (N-best) recognition result sentences int sentnum; ///< Number of sentences WordGraph *wg1; ///< List of word graph generated on 1st pass int wg1_num; ///< Num of words in the wg1 WordGraph *wg; ///< List of word graph CN_CLUSTER *confnet; ///< List of confusion network clusters Sentence pass1; ///< Recognition result on the 1st pass} Output; /**********************************************************************//**********************************************************************//**********************************************************************//** * instance for a parameter vector computation * */typedef struct __mfcc_calc__ { /** * Unique id * */ short id; /** * Parameter setting (entity in JCONF_AM) * */ Value *para; /** * TRUE if the para came from "-htkconf" * */ boolean htk_loaded; /** * TRUE if the para came from binhmm embedded header * */ boolean hmm_loaded; /** * Check input parameter type with header of the hmmdefs * (-notypecheck to unset) */ boolean paramtype_check_flag; /** * Parameter extraction work area * */ MFCCWork *wrk; /** * Parameter vector sequence to be recognized * */ HTK_Param *param; /** * Rest parameter for next segment for short-pause segmentation */ HTK_Param *rest_param; /** * Work area and setting for cepstral mean normalization * */ struct { /** * CMN: load initial cepstral mean from file at startup (-cmnload) */ char *load_filename; /** * CMN: update cepstral mean while recognition * (-cmnnoupdate to unset) */ boolean update; /** * CMN: save cepstral mean to file at end of every recognition (-cmnsave) */ char *save_filename; /** * CMN: MAP weight for initial cepstral mean on (-cmnmapweight) */ float map_weight; /** * TRUE if CMN parameter loaded from file at boot up */ boolean loaded; /** * realtime CMN work area * */ CMNWork *wrk; } cmn; /** * Work area for front-end processing * */ struct { /** * Estimated noise spectrum */ float *ssbuf; /** * Length of @a ssbuf */ int sslen; /** * Alpha coefficient for spectral subtraction * */ float ss_alpha; /** * Flooring coefficient for spectral subtraction * */ float ss_floor; /** * SS: compute noise spectrum from head silence on file input (-sscalc) */ boolean sscalc; /** * With "-sscalc", specify noise length at input head in msec (-sscalclen) */ int sscalc_len; /** * Load noise spectrum data from file (-ssload), that was made by "mkss". */ char *ssload_filename; /** * Parameter extraction work area for spectral subtraction * */ MFCCWork *mfccwrk_ss; } frontend; /** * work area for energy normalization on real time processing * */ ENERGYWork ewrk; /** * delta MFCC cycle buffer * */ DeltaBuf *db; /** * accel MFCC cycle buffer * */ DeltaBuf *ab; /** * working buffer holding current computing mfcc vector * */ VECT *tmpmfcc; /** * FALSE indicates that the current frame (f) is not valid and should * not be used for recognition * */ boolean valid; /** * Current frame * */ int f; /** * Processed frame length when segmented * */ int last_time; /** * Re-start frame if segmenetd * */ int sparea_start; /** * TRUE if a parent instance has decided segmented * */ boolean segmented; /** * TRUE if an input functionhas decided segmented * */ boolean segmented_by_input; /** * id of an plugin module if MFCC should be obtained via plugin * */ int plugin_source; /** * Function entry points for plugin input * */ struct { /// Pointer to function for device initialization (call once on startup) boolean (*fv_standby)(); /// Pointer to function to open audio stream for capturing boolean (*fv_begin)(); /// Pointer to function to read samples int (*fv_read)(VECT *, int); /// Pointer to function to close audio stream capturing boolean (*fv_end)(); /// Pointer to function to begin / restart recording boolean (*fv_resume)(); /// Pointer to function to pause recording boolean (*fv_pause)(); /// Pointer to function to terminate current recording immediately boolean (*fv_terminate)(); } func;#ifdef POWER_REJECT float avg_power;#endif /** * pointer to next * */ struct __mfcc_calc__ *next;} MFCCCalc;/** * instance for an AM. * */typedef struct __process_am__ { /** * Configuration parameters * */ JCONF_AM *config; /** * Corresponding input parameter vector instance * */ MFCCCalc *mfcc; /** * Main phoneme HMM */ HTK_HMM_INFO *hmminfo; /** * HMM for Gaussian Selection */ HTK_HMM_INFO *hmm_gs; /** * Work area and outprob cache for HMM output probability computation */ HMMWork hmmwrk; /** * pointer to next * */ struct __process_am__ *next; } PROCESS_AM;/** * instance for a LM. * */typedef struct __process_lm__ { /** * Configuration parameters * */ JCONF_LM *config; /** * Corresponding AM * */ PROCESS_AM *am; /** * the LM type of this Model holder: will be set from Jconf used for loading * */ int lmtype; /** * the LM variation type of this Model holder: will be set from * Jconf used for loading * */ int lmvar; /** * Main Word dictionary for all LM types */ WORD_INFO *winfo; /** * Main N-gram language model (do not use with grammars) */ NGRAM_INFO *ngram; /** * List of all loaded grammars (do not use with ngram) */ MULTIGRAM *grammars; /** * Current maximum value of assigned grammar ID. * A new grammar ID will be assigned to each new grammar. * */ int gram_maxid; /** * Global DFA for recognition. This will be generated from @a grammars, * concatinating each DFA into one. */ DFA_INFO *dfa; /** * TRUE if modified in multigram_update() * */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -