102 #pragma warning (disable: 4244)
122 for (i = 0; i < n_cmn_type_str; ++i) {
126 E_FATAL(
"Unknown CMN type '%s'\n", str);
131 cmn_init(int32 veclen)
140 cmn->
cmn_mean[0] = FLOAT2MFCC(12.0);
142 E_INFO(
"mean[0]= %.2f, mean[1..%d]= 0.0\n",
143 MFCC2FLOAT(cmn->
cmn_mean[0]), veclen - 1);
150 cmn(
cmn_t *cmn, mfcc_t ** mfc, int32 varnorm, int32 n_frame)
166 for (f = 0, n_pos_frame = 0; f < n_frame; f++) {
173 for (i = 0; i < cmn->
veclen; i++) {
180 for (i = 0; i < cmn->
veclen; i++)
184 for (i = 0; i < cmn->
veclen; i++)
189 for (f = 0; f < n_frame; f++) {
191 for (i = 0; i < cmn->
veclen; i++)
200 for (f = 0; f < n_frame; f++) {
203 for (i = 0; i < cmn->
veclen; i++) {
205 cmn->
cmn_var[i] += MFCCMUL(t, t);
208 for (i = 0; i < cmn->
veclen; i++)
210 cmn->
cmn_var[i] = FLOAT2MFCC(sqrt((float64)n_frame / MFCC2FLOAT(cmn->
cmn_var[i])));
212 for (f = 0; f < n_frame; f++) {
214 for (i = 0; i < cmn->
veclen; i++)
224 cmn_free(
cmn_t * cmn)
#define E_INFO(...)
Print logging information to standard error stream.
#define ckd_calloc(n, sz)
Macros to simplify the use of above functions.
Sphinx's memory allocation/deallocation routines.
Apply Cepstral Mean Normalization (CMN) to the set of input mfc frames.
#define E_INFOCONT(...)
Continue printing the information to standard error stream.
SPHINXBASE_EXPORT void ckd_free(void *ptr)
Test and free a 1-D array.
SPHINXBASE_EXPORT void cmn(cmn_t *cmn, mfcc_t **mfc, int32 varnorm, int32 n_frame)
CMN for the whole sentence.
Implementation of logging routines.
SPHINXBASE_EXPORT cmn_type_t cmn_type_from_str(const char *str)
Convert string representation (from command-line) to cmn_type_t.
wrapper of operation of the cepstral mean normalization.
enum cmn_type_e cmn_type_t
Types of cepstral mean normalization to apply to the features.
SPHINXBASE_EXPORT const char * cmn_type_str[]
String representations of cmn_type_t values.
#define E_FATAL(...)
Exit with non-zero status after error message.
mfcc_t * cmn_mean
Temporary variable: current means.
mfcc_t * cmn_var
Temporary variables: stored the cmn variance.
mfcc_t * sum
The sum of the cmn frames.
int32 veclen
Length of cepstral vector.
int32 nframe
Number of frames.