\doxysection{cmn.\+c}
\label{cmn_8c_source}\index{src/libsphinxbase/feat/cmn.c@{src/libsphinxbase/feat/cmn.c}}

\begin{DoxyCode}{0}
\DoxyCodeLine{00001\ \textcolor{comment}{/*\ -\/*-\/\ c-\/basic-\/offset:\ 4;\ indent-\/tabs-\/mode:\ nil\ -\/*-\/\ */}}
\DoxyCodeLine{00002\ \textcolor{comment}{/*\ ====================================================================}}
\DoxyCodeLine{00003\ \textcolor{comment}{\ *\ Copyright\ (c)\ 1999-\/2004\ Carnegie\ Mellon\ University.\ \ All\ rights}}
\DoxyCodeLine{00004\ \textcolor{comment}{\ *\ reserved.}}
\DoxyCodeLine{00005\ \textcolor{comment}{\ *}}
\DoxyCodeLine{00006\ \textcolor{comment}{\ *\ Redistribution\ and\ use\ in\ source\ and\ binary\ forms,\ with\ or\ without}}
\DoxyCodeLine{00007\ \textcolor{comment}{\ *\ modification,\ are\ permitted\ provided\ that\ the\ following\ conditions}}
\DoxyCodeLine{00008\ \textcolor{comment}{\ *\ are\ met:}}
\DoxyCodeLine{00009\ \textcolor{comment}{\ *}}
\DoxyCodeLine{00010\ \textcolor{comment}{\ *\ 1.\ Redistributions\ of\ source\ code\ must\ retain\ the\ above\ copyright}}
\DoxyCodeLine{00011\ \textcolor{comment}{\ *\ \ \ \ notice,\ this\ list\ of\ conditions\ and\ the\ following\ disclaimer.\ }}
\DoxyCodeLine{00012\ \textcolor{comment}{\ *}}
\DoxyCodeLine{00013\ \textcolor{comment}{\ *\ 2.\ Redistributions\ in\ binary\ form\ must\ reproduce\ the\ above\ copyright}}
\DoxyCodeLine{00014\ \textcolor{comment}{\ *\ \ \ \ notice,\ this\ list\ of\ conditions\ and\ the\ following\ disclaimer\ in}}
\DoxyCodeLine{00015\ \textcolor{comment}{\ *\ \ \ \ the\ documentation\ and/or\ other\ materials\ provided\ with\ the}}
\DoxyCodeLine{00016\ \textcolor{comment}{\ *\ \ \ \ distribution.}}
\DoxyCodeLine{00017\ \textcolor{comment}{\ *}}
\DoxyCodeLine{00018\ \textcolor{comment}{\ *\ This\ work\ was\ supported\ in\ part\ by\ funding\ from\ the\ Defense\ Advanced\ }}
\DoxyCodeLine{00019\ \textcolor{comment}{\ *\ Research\ Projects\ Agency\ and\ the\ National\ Science\ Foundation\ of\ the\ }}
\DoxyCodeLine{00020\ \textcolor{comment}{\ *\ United\ States\ of\ America,\ and\ the\ CMU\ Sphinx\ Speech\ Consortium.}}
\DoxyCodeLine{00021\ \textcolor{comment}{\ *}}
\DoxyCodeLine{00022\ \textcolor{comment}{\ *\ THIS\ SOFTWARE\ IS\ PROVIDED\ BY\ CARNEGIE\ MELLON\ UNIVERSITY\ \`{}\`{}AS\ IS''\ AND\ }}
\DoxyCodeLine{00023\ \textcolor{comment}{\ *\ ANY\ EXPRESSED\ OR\ IMPLIED\ WARRANTIES,\ INCLUDING,\ BUT\ NOT\ LIMITED\ TO,\ }}
\DoxyCodeLine{00024\ \textcolor{comment}{\ *\ THE\ IMPLIED\ WARRANTIES\ OF\ MERCHANTABILITY\ AND\ FITNESS\ FOR\ A\ PARTICULAR}}
\DoxyCodeLine{00025\ \textcolor{comment}{\ *\ PURPOSE\ ARE\ DISCLAIMED.\ \ IN\ NO\ EVENT\ SHALL\ CARNEGIE\ MELLON\ UNIVERSITY}}
\DoxyCodeLine{00026\ \textcolor{comment}{\ *\ NOR\ ITS\ EMPLOYEES\ BE\ LIABLE\ FOR\ ANY\ DIRECT,\ INDIRECT,\ INCIDENTAL,}}
\DoxyCodeLine{00027\ \textcolor{comment}{\ *\ SPECIAL,\ EXEMPLARY,\ OR\ CONSEQUENTIAL\ DAMAGES\ (INCLUDING,\ BUT\ NOT\ }}
\DoxyCodeLine{00028\ \textcolor{comment}{\ *\ LIMITED\ TO,\ PROCUREMENT\ OF\ SUBSTITUTE\ GOODS\ OR\ SERVICES;\ LOSS\ OF\ USE,\ }}
\DoxyCodeLine{00029\ \textcolor{comment}{\ *\ DATA,\ OR\ PROFITS;\ OR\ BUSINESS\ INTERRUPTION)\ HOWEVER\ CAUSED\ AND\ ON\ ANY\ }}
\DoxyCodeLine{00030\ \textcolor{comment}{\ *\ THEORY\ OF\ LIABILITY,\ WHETHER\ IN\ CONTRACT,\ STRICT\ LIABILITY,\ OR\ TORT\ }}
\DoxyCodeLine{00031\ \textcolor{comment}{\ *\ (INCLUDING\ NEGLIGENCE\ OR\ OTHERWISE)\ ARISING\ IN\ ANY\ WAY\ OUT\ OF\ THE\ USE\ }}
\DoxyCodeLine{00032\ \textcolor{comment}{\ *\ OF\ THIS\ SOFTWARE,\ EVEN\ IF\ ADVISED\ OF\ THE\ POSSIBILITY\ OF\ SUCH\ DAMAGE.}}
\DoxyCodeLine{00033\ \textcolor{comment}{\ *}}
\DoxyCodeLine{00034\ \textcolor{comment}{\ *\ ====================================================================}}
\DoxyCodeLine{00035\ \textcolor{comment}{\ *}}
\DoxyCodeLine{00036\ \textcolor{comment}{\ */}}
\DoxyCodeLine{00037\ \textcolor{comment}{/*}}
\DoxyCodeLine{00038\ \textcolor{comment}{\ *\ cmn.c\ -\/-\/\ Various\ forms\ of\ cepstral\ mean\ normalization}}
\DoxyCodeLine{00039\ \textcolor{comment}{\ *}}
\DoxyCodeLine{00040\ \textcolor{comment}{\ *\ **********************************************}}
\DoxyCodeLine{00041\ \textcolor{comment}{\ *\ CMU\ ARPA\ Speech\ Project}}
\DoxyCodeLine{00042\ \textcolor{comment}{\ *}}
\DoxyCodeLine{00043\ \textcolor{comment}{\ *\ Copyright\ (c)\ 1996\ Carnegie\ Mellon\ University.}}
\DoxyCodeLine{00044\ \textcolor{comment}{\ *\ ALL\ RIGHTS\ RESERVED.}}
\DoxyCodeLine{00045\ \textcolor{comment}{\ *\ **********************************************}}
\DoxyCodeLine{00046\ \textcolor{comment}{\ *\ }}
\DoxyCodeLine{00047\ \textcolor{comment}{\ *\ HISTORY}}
\DoxyCodeLine{00048\ \textcolor{comment}{\ *\ \$Log\$}}
\DoxyCodeLine{00049\ \textcolor{comment}{\ *\ Revision\ 1.14\ \ 2006/02/24\ \ 15:57:47\ \ egouvea}}
\DoxyCodeLine{00050\ \textcolor{comment}{\ *\ Removed\ cmn\ =\ NULL\ from\ the\ cmn\_free(),\ since\ it's\ pointless\ (my\ bad!).}}
\DoxyCodeLine{00051\ \textcolor{comment}{\ *\ }}
\DoxyCodeLine{00052\ \textcolor{comment}{\ *\ Removed\ cmn\_prior,\ which\ was\ surrounded\ by\ \#if\ 0/\#endif,\ since\ the}}
\DoxyCodeLine{00053\ \textcolor{comment}{\ *\ function\ is\ already\ in\ cmn\_prior.c}}
\DoxyCodeLine{00054\ \textcolor{comment}{\ *\ }}
\DoxyCodeLine{00055\ \textcolor{comment}{\ *\ Revision\ 1.13\ \ 2006/02/23\ 03:47:49\ \ arthchan2003}}
\DoxyCodeLine{00056\ \textcolor{comment}{\ *\ Used\ Evandro's\ changes.\ Resolved\ conflicts.}}
\DoxyCodeLine{00057\ \textcolor{comment}{\ *}}
\DoxyCodeLine{00058\ \textcolor{comment}{\ *}}
\DoxyCodeLine{00059\ \textcolor{comment}{\ *\ Revision\ 1.12\ \ 2006/02/23\ 00:48:23\ \ egouvea}}
\DoxyCodeLine{00060\ \textcolor{comment}{\ *\ Replaced\ loops\ resetting\ vectors\ with\ the\ more\ efficient\ memset()}}
\DoxyCodeLine{00061\ \textcolor{comment}{\ *}}
\DoxyCodeLine{00062\ \textcolor{comment}{\ *\ Revision\ 1.11\ \ 2006/02/22\ 23:43:55\ \ arthchan2003}}
\DoxyCodeLine{00063\ \textcolor{comment}{\ *\ Merged\ from\ the\ branch\ SPHINX3\_5\_2\_RCI\_IRII\_BRANCH:\ Put\ data\ structure\ into\ the\ cmn\_t\ structure.}}
\DoxyCodeLine{00064\ \textcolor{comment}{\ *}}
\DoxyCodeLine{00065\ \textcolor{comment}{\ *\ Revision\ 1.10.4.2\ \ 2005/10/17\ 04:45:57\ \ arthchan2003}}
\DoxyCodeLine{00066\ \textcolor{comment}{\ *\ Free\ stuffs\ in\ cmn\ and\ feat\ corectly.}}
\DoxyCodeLine{00067\ \textcolor{comment}{\ *}}
\DoxyCodeLine{00068\ \textcolor{comment}{\ *\ Revision\ 1.10.4.1\ \ 2005/07/05\ 06:25:08\ \ arthchan2003}}
\DoxyCodeLine{00069\ \textcolor{comment}{\ *\ Fixed\ dox-\/doc.}}
\DoxyCodeLine{00070\ \textcolor{comment}{\ *}}
\DoxyCodeLine{00071\ \textcolor{comment}{\ *\ Revision\ 1.10\ \ 2005/06/21\ 19:28:00\ \ arthchan2003}}
\DoxyCodeLine{00072\ \textcolor{comment}{\ *\ 1,\ Fixed\ doxygen\ documentation.\ 2,\ Added\ \$\ keyword.}}
\DoxyCodeLine{00073\ \textcolor{comment}{\ *}}
\DoxyCodeLine{00074\ \textcolor{comment}{\ *\ Revision\ 1.3\ \ 2005/03/30\ 01:22:46\ \ archan}}
\DoxyCodeLine{00075\ \textcolor{comment}{\ *\ Fixed\ mistakes\ in\ last\ updates.\ Add}}
\DoxyCodeLine{00076\ \textcolor{comment}{\ *}}
\DoxyCodeLine{00077\ \textcolor{comment}{\ *\ }}
\DoxyCodeLine{00078\ \textcolor{comment}{\ *\ 20.Apr.2001\ \ RAH\ (rhoughton@mediasite.com,\ ricky.houghton@cs.cmu.edu)}}
\DoxyCodeLine{00079\ \textcolor{comment}{\ *\ \ \ \ \ \ \ \ \ \ \ \ \ \ Added\ cmn\_free()\ and\ moved\ *mean\ and\ *var\ out\ global\ space\ and\ named\ them\ cmn\_mean\ and\ cmn\_var}}
\DoxyCodeLine{00080\ \textcolor{comment}{\ *\ }}
\DoxyCodeLine{00081\ \textcolor{comment}{\ *\ 28-\/Apr-\/1999\ \ M\ K\ Ravishankar\ (rkm@cs.cmu.edu)\ at\ Carnegie\ Mellon\ University}}
\DoxyCodeLine{00082\ \textcolor{comment}{\ *\ \ \ \ \ \ \ \ \ \ \ \ \ \ Changed\ the\ name\ norm\_mean()\ to\ cmn().}}
\DoxyCodeLine{00083\ \textcolor{comment}{\ *\ }}
\DoxyCodeLine{00084\ \textcolor{comment}{\ *\ 19-\/Jun-\/1996\ \ M\ K\ Ravishankar\ (rkm@cs.cmu.edu)\ at\ Carnegie\ Mellon\ University}}
\DoxyCodeLine{00085\ \textcolor{comment}{\ *\ \ \ \ \ \ \ \ \ \ \ \ \ \ Changed\ to\ compute\ CMN\ over\ ALL\ dimensions\ of\ cep\ instead\ of\ 1..12.}}
\DoxyCodeLine{00086\ \textcolor{comment}{\ *\ }}
\DoxyCodeLine{00087\ \textcolor{comment}{\ *\ 04-\/Nov-\/1995\ \ M\ K\ Ravishankar\ (rkm@cs.cmu.edu)\ at\ Carnegie\ Mellon\ University}}
\DoxyCodeLine{00088\ \textcolor{comment}{\ *\ \ \ \ \ \ \ \ \ \ \ \ \ \ Created.}}
\DoxyCodeLine{00089\ \textcolor{comment}{\ */}}
\DoxyCodeLine{00090\ }
\DoxyCodeLine{00091\ }
\DoxyCodeLine{00092\ \textcolor{preprocessor}{\#include\ <stdio.h>}}
\DoxyCodeLine{00093\ \textcolor{preprocessor}{\#include\ <stdlib.h>}}
\DoxyCodeLine{00094\ \textcolor{preprocessor}{\#include\ <string.h>}}
\DoxyCodeLine{00095\ \textcolor{preprocessor}{\#include\ <assert.h>}}
\DoxyCodeLine{00096\ \textcolor{preprocessor}{\#include\ <math.h>}}
\DoxyCodeLine{00097\ \textcolor{preprocessor}{\#ifdef\ HAVE\_CONFIG\_H}}
\DoxyCodeLine{00098\ \textcolor{preprocessor}{\#include\ <config.h>}}
\DoxyCodeLine{00099\ \textcolor{preprocessor}{\#endif}}
\DoxyCodeLine{00100\ }
\DoxyCodeLine{00101\ \textcolor{preprocessor}{\#ifdef\ \_MSC\_VER}}
\DoxyCodeLine{00102\ \textcolor{preprocessor}{\#pragma\ warning\ (disable:\ 4244)}}
\DoxyCodeLine{00103\ \textcolor{preprocessor}{\#endif}}
\DoxyCodeLine{00104\ }
\DoxyCodeLine{00105\ \textcolor{preprocessor}{\#include\ "{}sphinxbase/ckd\_alloc.h"{}}}
\DoxyCodeLine{00106\ \textcolor{preprocessor}{\#include\ "{}sphinxbase/err.h"{}}}
\DoxyCodeLine{00107\ \textcolor{preprocessor}{\#include\ "{}sphinxbase/cmn.h"{}}}
\DoxyCodeLine{00108\ }
\DoxyCodeLine{00109\ \textcolor{comment}{/*\ NOTE!\ \ These\ must\ match\ the\ enum\ in\ cmn.h\ */}}
\DoxyCodeLine{00110\ \textcolor{keyword}{const}\ \textcolor{keywordtype}{char}\ *cmn\_type\_str[]\ =\ \{}
\DoxyCodeLine{00111\ \ \ \ \ \textcolor{stringliteral}{"{}none"{}},}
\DoxyCodeLine{00112\ \ \ \ \ \textcolor{stringliteral}{"{}current"{}},}
\DoxyCodeLine{00113\ \ \ \ \ \textcolor{stringliteral}{"{}prior"{}}}
\DoxyCodeLine{00114\ \};}
\DoxyCodeLine{00115\ \textcolor{keyword}{static}\ \textcolor{keyword}{const}\ \textcolor{keywordtype}{int}\ n\_cmn\_type\_str\ =\ \textcolor{keyword}{sizeof}(cmn\_type\_str)/\textcolor{keyword}{sizeof}(cmn\_type\_str[0]);}
\DoxyCodeLine{00116\ }
\DoxyCodeLine{00117\ cmn\_type\_t}
\DoxyCodeLine{00118\ cmn\_type\_from\_str(\textcolor{keyword}{const}\ \textcolor{keywordtype}{char}\ *str)}
\DoxyCodeLine{00119\ \{}
\DoxyCodeLine{00120\ \ \ \ \ \textcolor{keywordtype}{int}\ i;}
\DoxyCodeLine{00121\ }
\DoxyCodeLine{00122\ \ \ \ \ \textcolor{keywordflow}{for}\ (i\ =\ 0;\ i\ <\ n\_cmn\_type\_str;\ ++i)\ \{}
\DoxyCodeLine{00123\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{if}\ (0\ ==\ strcmp(str,\ cmn\_type\_str[i]))}
\DoxyCodeLine{00124\ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{return}\ (cmn\_type\_t)i;}
\DoxyCodeLine{00125\ \ \ \ \ \}}
\DoxyCodeLine{00126\ \ \ \ \ E\_FATAL(\textcolor{stringliteral}{"{}Unknown\ CMN\ type\ '\%s'\(\backslash\)n"{}},\ str);}
\DoxyCodeLine{00127\ \ \ \ \ \textcolor{keywordflow}{return}\ CMN\_NONE;}
\DoxyCodeLine{00128\ \}}
\DoxyCodeLine{00129\ }
\DoxyCodeLine{00130\ cmn\_t\ *}
\DoxyCodeLine{00131\ cmn\_init(int32\ veclen)}
\DoxyCodeLine{00132\ \{}
\DoxyCodeLine{00133\ \ \ \ \ cmn\_t\ *cmn;}
\DoxyCodeLine{00134\ \ \ \ \ cmn\ =\ (cmn\_t\ *)\ ckd\_calloc(1,\ \textcolor{keyword}{sizeof}(cmn\_t));}
\DoxyCodeLine{00135\ \ \ \ \ cmn-\/>veclen\ =\ veclen;}
\DoxyCodeLine{00136\ \ \ \ \ cmn-\/>cmn\_mean\ =\ (mfcc\_t\ *)\ ckd\_calloc(veclen,\ \textcolor{keyword}{sizeof}(mfcc\_t));}
\DoxyCodeLine{00137\ \ \ \ \ cmn-\/>cmn\_var\ =\ (mfcc\_t\ *)\ ckd\_calloc(veclen,\ \textcolor{keyword}{sizeof}(mfcc\_t));}
\DoxyCodeLine{00138\ \ \ \ \ cmn-\/>sum\ =\ (mfcc\_t\ *)\ ckd\_calloc(veclen,\ \textcolor{keyword}{sizeof}(mfcc\_t));}
\DoxyCodeLine{00139\ \ \ \ \ \textcolor{comment}{/*\ A\ front-\/end\ dependent\ magic\ number\ */}}
\DoxyCodeLine{00140\ \ \ \ \ cmn-\/>cmn\_mean[0]\ =\ FLOAT2MFCC(12.0);}
\DoxyCodeLine{00141\ \ \ \ \ cmn-\/>nframe\ =\ 0;}
\DoxyCodeLine{00142\ \ \ \ \ E\_INFO(\textcolor{stringliteral}{"{}mean[0]=\ \%.2f,\ mean[1..\%d]=\ 0.0\(\backslash\)n"{}},}
\DoxyCodeLine{00143\ \ \ \ \ \ \ \ \ \ \ \ MFCC2FLOAT(cmn-\/>cmn\_mean[0]),\ veclen\ -\/\ 1);}
\DoxyCodeLine{00144\ }
\DoxyCodeLine{00145\ \ \ \ \ \textcolor{keywordflow}{return}\ cmn;}
\DoxyCodeLine{00146\ \}}
\DoxyCodeLine{00147\ }
\DoxyCodeLine{00148\ }
\DoxyCodeLine{00149\ \textcolor{keywordtype}{void}}
\DoxyCodeLine{00150\ cmn(cmn\_t\ *cmn,\ mfcc\_t\ **\ mfc,\ int32\ varnorm,\ int32\ n\_frame)}
\DoxyCodeLine{00151\ \{}
\DoxyCodeLine{00152\ \ \ \ \ mfcc\_t\ *mfcp;}
\DoxyCodeLine{00153\ \ \ \ \ mfcc\_t\ t;}
\DoxyCodeLine{00154\ \ \ \ \ int32\ i,\ f;}
\DoxyCodeLine{00155\ }
\DoxyCodeLine{00156\ \ \ \ \ assert(mfc\ !=\ NULL);}
\DoxyCodeLine{00157\ }
\DoxyCodeLine{00158\ \ \ \ \ \textcolor{keywordflow}{if}\ (n\_frame\ <=\ 0)}
\DoxyCodeLine{00159\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{return};}
\DoxyCodeLine{00160\ }
\DoxyCodeLine{00161\ \ \ \ \ \textcolor{comment}{/*\ If\ cmn-\/>cmn\_mean\ wasn't\ NULL,\ we\ need\ to\ zero\ the\ contents\ */}}
\DoxyCodeLine{00162\ \ \ \ \ memset(cmn-\/>cmn\_mean,\ 0,\ cmn-\/>veclen\ *\ \textcolor{keyword}{sizeof}(mfcc\_t));}
\DoxyCodeLine{00163\ }
\DoxyCodeLine{00164\ \ \ \ \ \textcolor{comment}{/*\ Find\ mean\ cep\ vector\ for\ this\ utterance\ */}}
\DoxyCodeLine{00165\ \ \ \ \ \textcolor{keywordflow}{for}\ (f\ =\ 0;\ f\ <\ n\_frame;\ f++)\ \{}
\DoxyCodeLine{00166\ \ \ \ \ \ \ \ \ mfcp\ =\ mfc[f];}
\DoxyCodeLine{00167\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{for}\ (i\ =\ 0;\ i\ <\ cmn-\/>veclen;\ i++)\ \{}
\DoxyCodeLine{00168\ \ \ \ \ \ \ \ \ \ \ \ \ cmn-\/>cmn\_mean[i]\ +=\ mfcp[i];}
\DoxyCodeLine{00169\ \ \ \ \ \ \ \ \ \}}
\DoxyCodeLine{00170\ \ \ \ \ \}}
\DoxyCodeLine{00171\ }
\DoxyCodeLine{00172\ \ \ \ \ \textcolor{keywordflow}{for}\ (i\ =\ 0;\ i\ <\ cmn-\/>veclen;\ i++)}
\DoxyCodeLine{00173\ \ \ \ \ \ \ \ \ cmn-\/>cmn\_mean[i]\ /=\ n\_frame;}
\DoxyCodeLine{00174\ }
\DoxyCodeLine{00175\ \ \ \ \ E\_INFO(\textcolor{stringliteral}{"{}CMN:\ "{}});}
\DoxyCodeLine{00176\ \ \ \ \ \textcolor{keywordflow}{for}\ (i\ =\ 0;\ i\ <\ cmn-\/>veclen;\ i++)}
\DoxyCodeLine{00177\ \ \ \ \ \ \ \ \ E\_INFOCONT(\textcolor{stringliteral}{"{}\%5.2f\ "{}},\ MFCC2FLOAT(cmn-\/>cmn\_mean[i]));}
\DoxyCodeLine{00178\ \ \ \ \ E\_INFOCONT(\textcolor{stringliteral}{"{}\(\backslash\)n"{}});}
\DoxyCodeLine{00179\ \ \ \ \ \textcolor{keywordflow}{if}\ (!varnorm)\ \{}
\DoxyCodeLine{00180\ \ \ \ \ \ \ \ \ \textcolor{comment}{/*\ Subtract\ mean\ from\ each\ cep\ vector\ */}}
\DoxyCodeLine{00181\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{for}\ (f\ =\ 0;\ f\ <\ n\_frame;\ f++)\ \{}
\DoxyCodeLine{00182\ \ \ \ \ \ \ \ \ \ \ \ \ mfcp\ =\ mfc[f];}
\DoxyCodeLine{00183\ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{for}\ (i\ =\ 0;\ i\ <\ cmn-\/>veclen;\ i++)}
\DoxyCodeLine{00184\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ mfcp[i]\ -\/=\ cmn-\/>cmn\_mean[i];}
\DoxyCodeLine{00185\ \ \ \ \ \ \ \ \ \}}
\DoxyCodeLine{00186\ \ \ \ \ \}}
\DoxyCodeLine{00187\ \ \ \ \ \textcolor{keywordflow}{else}\ \{}
\DoxyCodeLine{00188\ \ \ \ \ \ \ \ \ \textcolor{comment}{/*\ Scale\ cep\ vectors\ to\ have\ unit\ variance\ along\ each\ dimension,\ and\ subtract\ means\ */}}
\DoxyCodeLine{00189\ \ \ \ \ \ \ \ \ \textcolor{comment}{/*\ If\ cmn-\/>cmn\_var\ wasn't\ NULL,\ we\ need\ to\ zero\ the\ contents\ */}}
\DoxyCodeLine{00190\ \ \ \ \ \ \ \ \ memset(cmn-\/>cmn\_var,\ 0,\ cmn-\/>veclen\ *\ \textcolor{keyword}{sizeof}(mfcc\_t));}
\DoxyCodeLine{00191\ }
\DoxyCodeLine{00192\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{for}\ (f\ =\ 0;\ f\ <\ n\_frame;\ f++)\ \{}
\DoxyCodeLine{00193\ \ \ \ \ \ \ \ \ \ \ \ \ mfcp\ =\ mfc[f];}
\DoxyCodeLine{00194\ }
\DoxyCodeLine{00195\ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{for}\ (i\ =\ 0;\ i\ <\ cmn-\/>veclen;\ i++)\ \{}
\DoxyCodeLine{00196\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ t\ =\ mfcp[i]\ -\/\ cmn-\/>cmn\_mean[i];}
\DoxyCodeLine{00197\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ cmn-\/>cmn\_var[i]\ +=\ MFCCMUL(t,\ t);}
\DoxyCodeLine{00198\ \ \ \ \ \ \ \ \ \ \ \ \ \}}
\DoxyCodeLine{00199\ \ \ \ \ \ \ \ \ \}}
\DoxyCodeLine{00200\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{for}\ (i\ =\ 0;\ i\ <\ cmn-\/>veclen;\ i++)}
\DoxyCodeLine{00201\ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{comment}{/*\ Inverse\ Std.\ Dev,\ RAH\ added\ type\ case\ from\ sqrt\ */}}
\DoxyCodeLine{00202\ \ \ \ \ \ \ \ \ \ \ \ \ cmn-\/>cmn\_var[i]\ =\ FLOAT2MFCC(sqrt((float64)n\_frame\ /\ MFCC2FLOAT(cmn-\/>cmn\_var[i])));}
\DoxyCodeLine{00203\ }
\DoxyCodeLine{00204\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{for}\ (f\ =\ 0;\ f\ <\ n\_frame;\ f++)\ \{}
\DoxyCodeLine{00205\ \ \ \ \ \ \ \ \ \ \ \ \ mfcp\ =\ mfc[f];}
\DoxyCodeLine{00206\ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{for}\ (i\ =\ 0;\ i\ <\ cmn-\/>veclen;\ i++)}
\DoxyCodeLine{00207\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ mfcp[i]\ =\ MFCCMUL((mfcp[i]\ -\/\ cmn-\/>cmn\_mean[i]),\ cmn-\/>cmn\_var[i]);}
\DoxyCodeLine{00208\ \ \ \ \ \ \ \ \ \}}
\DoxyCodeLine{00209\ \ \ \ \ \}}
\DoxyCodeLine{00210\ \}}
\DoxyCodeLine{00211\ }
\DoxyCodeLine{00212\ \textcolor{comment}{/*\ }}
\DoxyCodeLine{00213\ \textcolor{comment}{\ *\ RAH,\ free\ previously\ allocated\ memory}}
\DoxyCodeLine{00214\ \textcolor{comment}{\ */}}
\DoxyCodeLine{00215\ \textcolor{keywordtype}{void}}
\DoxyCodeLine{00216\ cmn\_free(cmn\_t\ *\ cmn)}
\DoxyCodeLine{00217\ \{}
\DoxyCodeLine{00218\ \ \ \ \ \textcolor{keywordflow}{if}\ (cmn\ !=\ NULL)\ \{}
\DoxyCodeLine{00219\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{if}\ (cmn-\/>cmn\_var)}
\DoxyCodeLine{00220\ \ \ \ \ \ \ \ \ \ \ \ \ ckd\_free((\textcolor{keywordtype}{void}\ *)\ cmn-\/>cmn\_var);}
\DoxyCodeLine{00221\ }
\DoxyCodeLine{00222\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{if}\ (cmn-\/>cmn\_mean)}
\DoxyCodeLine{00223\ \ \ \ \ \ \ \ \ \ \ \ \ ckd\_free((\textcolor{keywordtype}{void}\ *)\ cmn-\/>cmn\_mean);}
\DoxyCodeLine{00224\ }
\DoxyCodeLine{00225\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{if}\ (cmn-\/>sum)}
\DoxyCodeLine{00226\ \ \ \ \ \ \ \ \ \ \ \ \ ckd\_free((\textcolor{keywordtype}{void}\ *)\ cmn-\/>sum);}
\DoxyCodeLine{00227\ }
\DoxyCodeLine{00228\ \ \ \ \ \ \ \ \ ckd\_free((\textcolor{keywordtype}{void}\ *)\ cmn);}
\DoxyCodeLine{00229\ \ \ \ \ \}}
\DoxyCodeLine{00230\ \}}

\end{DoxyCode}
