SphinxBase 5prealpha
cmn.h File Reference

Apply Cepstral Mean Normalization (CMN) to the set of input mfc frames. More...

#include <sphinxbase/sphinxbase_export.h>
#include <sphinxbase/prim_type.h>
#include <sphinxbase/fe.h>

Go to the source code of this file.

Data Structures

struct  cmn_t
 wrapper of operation of the cepstral mean normalization. More...
 

Macros

#define CMN_WIN_HWM   800 /* #frames after which window shifted */
 
#define CMN_WIN   500
 

Typedefs

typedef enum cmn_type_e cmn_type_t
 Types of cepstral mean normalization to apply to the features.
 

Enumerations

enum  cmn_type_e { CMN_NONE = 0 , CMN_BATCH , CMN_LIVE }
 Types of cepstral mean normalization to apply to the features. More...
 

Functions

SPHINXBASE_EXPORT cmn_type_t cmn_type_from_str (const char *str)
 Convert string representation (from command-line) to cmn_type_t.
 
SPHINXBASE_EXPORT cmn_tcmn_init (int32 veclen)
 
SPHINXBASE_EXPORT void cmn (cmn_t *cmn, mfcc_t **mfc, int32 varnorm, int32 n_frame)
 CMN for the whole sentence.
 
SPHINXBASE_EXPORT void cmn_live (cmn_t *cmn, mfcc_t **incep, int32 varnorm, int32 nfr)
 CMN for one block of data, using live mean.
 
SPHINXBASE_EXPORT void cmn_live_update (cmn_t *cmn)
 Update live mean based on observed data.
 
SPHINXBASE_EXPORT void cmn_live_set (cmn_t *cmn, mfcc_t const *vec)
 Set the live mean.
 
SPHINXBASE_EXPORT void cmn_live_get (cmn_t *cmn, mfcc_t *vec)
 Get the live mean.
 
SPHINXBASE_EXPORT void cmn_free (cmn_t *cmn)
 

Variables

SPHINXBASE_EXPORT const char * cmn_type_str []
 String representations of cmn_type_t values.
 

Detailed Description

Apply Cepstral Mean Normalization (CMN) to the set of input mfc frames.

By subtractingthe mean of the input from each frame. C0 is also included in this process. This function operates on an entire utterance at a time. Hence, the entire utterance must be available beforehand (batchmode).

Definition in file cmn.h.

Macro Definition Documentation

◆ CMN_WIN

#define CMN_WIN   500

Definition at line 152 of file cmn.h.

◆ CMN_WIN_HWM

#define CMN_WIN_HWM   800 /* #frames after which window shifted */

Definition at line 151 of file cmn.h.

Enumeration Type Documentation

◆ cmn_type_e

enum cmn_type_e

Types of cepstral mean normalization to apply to the features.

Definition at line 110 of file cmn.h.

Function Documentation

◆ cmn()

SPHINXBASE_EXPORT void cmn ( cmn_t cmn,
mfcc_t **  mfc,
int32  varnorm,
int32  n_frame 
)

CMN for the whole sentence.

Parameters
cmnIn/Out: cmn normalization, which contains the cmn_mean and cmn_var)
mfcIn/Out: mfc[f] = mfc vector in frame f
varnormIn: if not FALSE, variance normalize the input vectors to have unit variance (along each dimension independently); Irrelevant if no cmn is performed
n_frameIn: Number of frames of mfc vectors

Definition at line 100 of file cmn.c.

References cmn(), E_INFO, and E_INFOCONT.

Referenced by cmn(), cmn_live(), cmn_live_get(), cmn_live_set(), cmn_live_update(), and feat_init().

◆ cmn_free()

SPHINXBASE_EXPORT void cmn_free ( cmn_t cmn)

Definition at line 174 of file cmn.c.

◆ cmn_init()

SPHINXBASE_EXPORT cmn_t * cmn_init ( int32  veclen)

Definition at line 85 of file cmn.c.

◆ cmn_live()

SPHINXBASE_EXPORT void cmn_live ( cmn_t cmn,
mfcc_t **  incep,
int32  varnorm,
int32  nfr 
)

CMN for one block of data, using live mean.

Parameters
cmnIn/Out: cmn normalization, which contains the cmn_mean and cmn_var)
incepIn/Out: mfc[f] = mfc vector in frame f
varnormThis flag should always be 0 for live
nfrNumber of incoming frames

Definition at line 145 of file cmn_live.c.

References cmn(), cmn_live(), and E_FATAL.

Referenced by cmn_live().

◆ cmn_live_get()

SPHINXBASE_EXPORT void cmn_live_get ( cmn_t cmn,
mfcc_t *  vec 
)

Get the live mean.

Definition at line 73 of file cmn_live.c.

References cmn(), and cmn_live_get().

Referenced by cmn_live_get().

◆ cmn_live_set()

SPHINXBASE_EXPORT void cmn_live_set ( cmn_t cmn,
mfcc_t const *  vec 
)

Set the live mean.

Definition at line 51 of file cmn_live.c.

References cmn(), cmn_live_set(), E_INFO, and E_INFOCONT.

Referenced by cmn_live_set().

◆ cmn_live_update()

SPHINXBASE_EXPORT void cmn_live_update ( cmn_t cmn)

Update live mean based on observed data.

Definition at line 112 of file cmn_live.c.

References cmn(), cmn_live_update(), E_INFO, and E_INFOCONT.

Referenced by cmn_live_update(), and feat_update_stats().

◆ cmn_type_from_str()

SPHINXBASE_EXPORT cmn_type_t cmn_type_from_str ( const char *  str)

Convert string representation (from command-line) to cmn_type_t.

Definition at line 72 of file cmn.c.

References cmn_type_from_str(), cmn_type_str, and E_FATAL.

Referenced by cmn_type_from_str().

Variable Documentation

◆ cmn_type_str

SPHINXBASE_EXPORT const char* cmn_type_str[]
extern

String representations of cmn_type_t values.

Definition at line 59 of file cmn.c.

Referenced by cmn_type_from_str(), and feat_init().