\doxysection{feat.\+c}
\label{feat_8c_source}\index{src/libsphinxbase/feat/feat.c@{src/libsphinxbase/feat/feat.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}{\ *\ feat.c\ -\/-\/\ Feature\ vector\ description\ and\ cepstra-\/>feature\ computation.}}
\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.22\ \ 2006/02/23\ \ 03:59:40\ \ arthchan2003}}
\DoxyCodeLine{00050\ \textcolor{comment}{\ *\ Merged\ from\ branch\ SPHINX3\_5\_2\_RCI\_IRII\_BRANCH:\ a,\ Free\ buffers\ correctly.\ b,\ Fixed\ dox-\/doc.}}
\DoxyCodeLine{00051\ \textcolor{comment}{\ *\ }}
\DoxyCodeLine{00052\ \textcolor{comment}{\ *\ Revision\ 1.21.4.3\ \ 2005/10/17\ 04:45:57\ \ arthchan2003}}
\DoxyCodeLine{00053\ \textcolor{comment}{\ *\ Free\ stuffs\ in\ cmn\ and\ feat\ corectly.}}
\DoxyCodeLine{00054\ \textcolor{comment}{\ *}}
\DoxyCodeLine{00055\ \textcolor{comment}{\ *\ Revision\ 1.21.4.2\ \ 2005/09/26\ 02:19:57\ \ arthchan2003}}
\DoxyCodeLine{00056\ \textcolor{comment}{\ *\ Add\ message\ to\ show\ the\ directory\ which\ the\ feature\ is\ searched\ for.}}
\DoxyCodeLine{00057\ \textcolor{comment}{\ *}}
\DoxyCodeLine{00058\ \textcolor{comment}{\ *\ Revision\ 1.21.4.1\ \ 2005/07/03\ 22:55:50\ \ arthchan2003}}
\DoxyCodeLine{00059\ \textcolor{comment}{\ *\ More\ correct\ deallocation\ in\ feat.c.\ The\ cmn\ deallocation\ is\ still\ not\ correct\ at\ this\ point.}}
\DoxyCodeLine{00060\ \textcolor{comment}{\ *}}
\DoxyCodeLine{00061\ \textcolor{comment}{\ *\ Revision\ 1.21\ \ 2005/06/22\ 03:29:35\ \ arthchan2003}}
\DoxyCodeLine{00062\ \textcolor{comment}{\ *\ Makefile.am\ s\ \ for\ all\ subdirectory\ of\ libs3decoder/}}
\DoxyCodeLine{00063\ \textcolor{comment}{\ *}}
\DoxyCodeLine{00064\ \textcolor{comment}{\ *\ Revision\ 1.4\ \ 2005/04/21\ 23:50:26\ \ archan}}
\DoxyCodeLine{00065\ \textcolor{comment}{\ *\ Some\ more\ refactoring\ on\ the\ how\ reporting\ of\ structures\ inside\ kbcore\_t\ is\ done,\ it\ is\ now\ 50\%\ nice.\ Also\ added\ class-\/based\ LM\ test\ case\ into\ test-\/decode.sh.in.\ \ At\ this\ moment,\ everything\ in\ search\ mode\ 5\ is\ already\ done.\ \ It\ is\ time\ to\ test\ the\ idea\ whether\ the\ search\ can\ really\ be\ used.}}
\DoxyCodeLine{00066\ \textcolor{comment}{\ *}}
\DoxyCodeLine{00067\ \textcolor{comment}{\ *\ Revision\ 1.3\ \ 2005/03/30\ 01:22:46\ \ archan}}
\DoxyCodeLine{00068\ \textcolor{comment}{\ *\ Fixed\ mistakes\ in\ last\ updates.\ Add}}
\DoxyCodeLine{00069\ \textcolor{comment}{\ *}}
\DoxyCodeLine{00070\ \textcolor{comment}{\ *\ }}
\DoxyCodeLine{00071\ \textcolor{comment}{\ *\ 20.Apr.2001\ \ RAH\ (rhoughton@mediasite.com,\ ricky.houghton@cs.cmu.edu)}}
\DoxyCodeLine{00072\ \textcolor{comment}{\ *\ \ \ \ \ \ \ \ \ \ \ \ \ \ Adding\ feat\_free()\ to\ free\ allocated\ memory}}
\DoxyCodeLine{00073\ \textcolor{comment}{\ *}}
\DoxyCodeLine{00074\ \textcolor{comment}{\ *\ 02-\/Jan-\/2001\ \ Rita\ Singh\ (rsingh@cs.cmu.edu)\ at\ Carnegie\ Mellon\ University}}
\DoxyCodeLine{00075\ \textcolor{comment}{\ *\ \ \ \ \ \ \ \ \ \ \ \ \ \ Modified\ feat\_s2mfc2feat\_block()\ to\ handle\ empty\ buffers\ at}}
\DoxyCodeLine{00076\ \textcolor{comment}{\ *\ \ \ \ \ \ \ \ \ \ \ \ \ \ the\ end\ of\ an\ utterance}}
\DoxyCodeLine{00077\ \textcolor{comment}{\ *}}
\DoxyCodeLine{00078\ \textcolor{comment}{\ *\ 30-\/Dec-\/2000\ \ Rita\ Singh\ (rsingh@cs.cmu.edu)\ at\ Carnegie\ Mellon\ University}}
\DoxyCodeLine{00079\ \textcolor{comment}{\ *\ \ \ \ \ \ \ \ \ \ \ \ \ \ Added\ feat\_s2mfc2feat\_block()\ to\ allow\ feature\ computation}}
\DoxyCodeLine{00080\ \textcolor{comment}{\ *\ \ \ \ \ \ \ \ \ \ \ \ \ \ from\ sequences\ of\ blocks\ of\ cepstral\ vectors}}
\DoxyCodeLine{00081\ \textcolor{comment}{\ *}}
\DoxyCodeLine{00082\ \textcolor{comment}{\ *\ 12-\/Jun-\/98\ \ \ \ M\ K\ Ravishankar\ (rkm@cs.cmu.edu)\ at\ Carnegie\ Mellon\ University}}
\DoxyCodeLine{00083\ \textcolor{comment}{\ *\ \ \ \ \ \ \ \ \ \ \ \ \ \ Major\ changes\ to\ accommodate\ arbitrary\ feature\ input\ types.\ \ Added}}
\DoxyCodeLine{00084\ \textcolor{comment}{\ *\ \ \ \ \ \ \ \ \ \ \ \ \ \ feat\_read(),\ moved\ various\ cep2feat\ functions\ from\ other\ files\ into}}
\DoxyCodeLine{00085\ \textcolor{comment}{\ *\ \ \ \ \ \ \ \ \ \ \ \ \ \ this\ one.\ \ Also,\ made\ this\ module\ object-\/oriented\ with\ the\ feat\_t\ type.}}
\DoxyCodeLine{00086\ \textcolor{comment}{\ *\ \ \ \ \ \ \ \ \ \ \ \ \ \ Changed\ definition\ of\ s2mfc\_read\ to\ let\ the\ caller\ manage\ MFC\ buffers.}}
\DoxyCodeLine{00087\ \textcolor{comment}{\ *\ }}
\DoxyCodeLine{00088\ \textcolor{comment}{\ *\ 03-\/Oct-\/96\ \ \ \ M\ K\ Ravishankar\ (rkm@cs.cmu.edu)\ at\ Carnegie\ Mellon\ University}}
\DoxyCodeLine{00089\ \textcolor{comment}{\ *\ \ \ \ \ \ \ \ \ \ \ \ \ \ Added\ unistd.h\ include.}}
\DoxyCodeLine{00090\ \textcolor{comment}{\ *\ }}
\DoxyCodeLine{00091\ \textcolor{comment}{\ *\ 02-\/Oct-\/96\ \ \ \ M\ K\ Ravishankar\ (rkm@cs.cmu.edu)\ at\ Carnegie\ Mellon\ University}}
\DoxyCodeLine{00092\ \textcolor{comment}{\ *\ \ \ \ \ \ \ \ \ \ \ \ \ \ Added\ check\ for\ sf\ argument\ to\ s2mfc\_read\ being\ within\ file\ size.}}
\DoxyCodeLine{00093\ \textcolor{comment}{\ *\ }}
\DoxyCodeLine{00094\ \textcolor{comment}{\ *\ 18-\/Sep-\/96\ \ \ \ M\ K\ Ravishankar\ (rkm@cs.cmu.edu)\ at\ Carnegie\ Mellon\ University}}
\DoxyCodeLine{00095\ \textcolor{comment}{\ *\ \ \ \ \ \ \ \ \ \ \ \ \ \ Added\ sf,\ ef\ parameters\ to\ s2mfc\_read().}}
\DoxyCodeLine{00096\ \textcolor{comment}{\ *\ }}
\DoxyCodeLine{00097\ \textcolor{comment}{\ *\ 10-\/Jan-\/96\ \ \ \ M\ K\ Ravishankar\ (rkm@cs.cmu.edu)\ at\ Carnegie\ Mellon\ University}}
\DoxyCodeLine{00098\ \textcolor{comment}{\ *\ \ \ \ \ \ \ \ \ \ \ \ \ \ Added\ feat\_cepsize().}}
\DoxyCodeLine{00099\ \textcolor{comment}{\ *\ \ \ \ \ \ \ \ \ \ \ \ \ \ Added\ different\ feature-\/handling\ (s2\_4x,\ s3\_1x39\ at\ this\ point).}}
\DoxyCodeLine{00100\ \textcolor{comment}{\ *\ \ \ \ \ \ \ \ \ \ \ \ \ \ Moved\ feature-\/dependent\ functions\ to\ feature-\/dependent\ files.}}
\DoxyCodeLine{00101\ \textcolor{comment}{\ *\ }}
\DoxyCodeLine{00102\ \textcolor{comment}{\ *\ 09-\/Jan-\/96\ \ \ \ M\ K\ Ravishankar\ (rkm@cs.cmu.edu)\ at\ Carnegie\ Mellon\ University}}
\DoxyCodeLine{00103\ \textcolor{comment}{\ *\ \ \ \ \ \ \ \ \ \ \ \ \ \ Moved\ constant\ declarations\ from\ feat.h\ into\ here.}}
\DoxyCodeLine{00104\ \textcolor{comment}{\ *\ }}
\DoxyCodeLine{00105\ \textcolor{comment}{\ *\ 04-\/Nov-\/95\ \ \ \ M\ K\ Ravishankar\ (rkm@cs.cmu.edu)\ at\ Carnegie\ Mellon\ University}}
\DoxyCodeLine{00106\ \textcolor{comment}{\ *\ \ \ \ \ \ \ \ \ \ \ \ \ \ Created.}}
\DoxyCodeLine{00107\ \textcolor{comment}{\ */}}
\DoxyCodeLine{00108\ }
\DoxyCodeLine{00109\ }
\DoxyCodeLine{00110\ \textcolor{comment}{/*}}
\DoxyCodeLine{00111\ \textcolor{comment}{\ *\ This\ module\ encapsulates\ different\ feature\ streams\ used\ by\ the\ Sphinx\ group.\ \ New}}
\DoxyCodeLine{00112\ \textcolor{comment}{\ *\ stream\ types\ can\ be\ added\ by\ augmenting\ feat\_init()\ and\ providing\ an\ accompanying}}
\DoxyCodeLine{00113\ \textcolor{comment}{\ *\ compute\_feat\ function.\ \ It\ also\ provides\ a\ "{}generic"{}\ feature\ vector\ definition\ for}}
\DoxyCodeLine{00114\ \textcolor{comment}{\ *\ handling\ "{}arbitrary"{}\ speech\ input\ feature\ types\ (see\ the\ last\ section\ in\ feat\_init()).}}
\DoxyCodeLine{00115\ \textcolor{comment}{\ *\ In\ this\ case\ the\ speech\ input\ data\ should\ already\ be\ feature\ vectors;\ no\ computation,}}
\DoxyCodeLine{00116\ \textcolor{comment}{\ *\ such\ as\ MFC-\/>feature\ conversion,\ is\ available\ or\ needed.}}
\DoxyCodeLine{00117\ \textcolor{comment}{\ */}}
\DoxyCodeLine{00118\ }
\DoxyCodeLine{00119\ \textcolor{preprocessor}{\#include\ <assert.h>}}
\DoxyCodeLine{00120\ \textcolor{preprocessor}{\#include\ <string.h>}}
\DoxyCodeLine{00121\ \textcolor{preprocessor}{\#ifdef\ HAVE\_CONFIG\_H}}
\DoxyCodeLine{00122\ \textcolor{preprocessor}{\#include\ <config.h>}}
\DoxyCodeLine{00123\ \textcolor{preprocessor}{\#endif}}
\DoxyCodeLine{00124\ }
\DoxyCodeLine{00125\ \textcolor{preprocessor}{\#ifdef\ \_MSC\_VER}}
\DoxyCodeLine{00126\ \textcolor{preprocessor}{\#pragma\ warning\ (disable:\ 4244\ 4996)}}
\DoxyCodeLine{00127\ \textcolor{preprocessor}{\#endif}}
\DoxyCodeLine{00128\ }
\DoxyCodeLine{00129\ \textcolor{preprocessor}{\#include\ "{}sphinxbase/fe.h"{}}}
\DoxyCodeLine{00130\ \textcolor{preprocessor}{\#include\ "{}sphinxbase/feat.h"{}}}
\DoxyCodeLine{00131\ \textcolor{preprocessor}{\#include\ "{}sphinxbase/bio.h"{}}}
\DoxyCodeLine{00132\ \textcolor{preprocessor}{\#include\ "{}sphinxbase/pio.h"{}}}
\DoxyCodeLine{00133\ \textcolor{preprocessor}{\#include\ "{}sphinxbase/cmn.h"{}}}
\DoxyCodeLine{00134\ \textcolor{preprocessor}{\#include\ "{}sphinxbase/agc.h"{}}}
\DoxyCodeLine{00135\ \textcolor{preprocessor}{\#include\ "{}sphinxbase/err.h"{}}}
\DoxyCodeLine{00136\ \textcolor{preprocessor}{\#include\ "{}sphinxbase/ckd\_alloc.h"{}}}
\DoxyCodeLine{00137\ \textcolor{preprocessor}{\#include\ "{}sphinxbase/prim\_type.h"{}}}
\DoxyCodeLine{00138\ \textcolor{preprocessor}{\#include\ "{}sphinxbase/glist.h"{}}}
\DoxyCodeLine{00139\ }
\DoxyCodeLine{00140\ \textcolor{preprocessor}{\#define\ FEAT\_VERSION\ \ \ \ "{}1.0"{}}}
\DoxyCodeLine{00141\ \textcolor{preprocessor}{\#define\ FEAT\_DCEP\_WIN\ \ \ \ \ \ \ \ \ \ \ 2}}
\DoxyCodeLine{00142\ }
\DoxyCodeLine{00143\ \textcolor{preprocessor}{\#ifdef\ DUMP\_FEATURES}}
\DoxyCodeLine{00144\ \textcolor{keyword}{static}\ \textcolor{keywordtype}{void}}
\DoxyCodeLine{00145\ cep\_dump\_dbg(feat\_t\ *fcb,\ mfcc\_t\ **mfc,\ int32\ nfr,\ \textcolor{keyword}{const}\ \textcolor{keywordtype}{char}\ *text)}
\DoxyCodeLine{00146\ \{}
\DoxyCodeLine{00147\ \ \ \ \ int32\ i,\ j;}
\DoxyCodeLine{00148\ }
\DoxyCodeLine{00149\ \ \ \ \ E\_INFO(\textcolor{stringliteral}{"{}\%s\(\backslash\)n"{}},\ text);}
\DoxyCodeLine{00150\ \ \ \ \ \textcolor{keywordflow}{for}\ (i\ =\ 0;\ i\ <\ nfr;\ i++)\ \{}
\DoxyCodeLine{00151\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{for}\ (j\ =\ 0;\ j\ <\ fcb-\/>cepsize;\ j++)\ \{}
\DoxyCodeLine{00152\ \ \ \ \ \ \ \ \ \ \ \ \ fprintf(stderr,\ \textcolor{stringliteral}{"{}\%f\ "{}},\ MFCC2FLOAT(mfc[i][j]));}
\DoxyCodeLine{00153\ \ \ \ \ \ \ \ \ \}}
\DoxyCodeLine{00154\ \ \ \ \ \ \ \ \ fprintf(stderr,\ \textcolor{stringliteral}{"{}\(\backslash\)n"{}});}
\DoxyCodeLine{00155\ \ \ \ \ \}}
\DoxyCodeLine{00156\ \}}
\DoxyCodeLine{00157\ \textcolor{keyword}{static}\ \textcolor{keywordtype}{void}}
\DoxyCodeLine{00158\ feat\_print\_dbg(feat\_t\ *fcb,\ mfcc\_t\ ***feat,\ int32\ nfr,\ \textcolor{keyword}{const}\ \textcolor{keywordtype}{char}\ *text)}
\DoxyCodeLine{00159\ \{}
\DoxyCodeLine{00160\ \ \ \ \ E\_INFO(\textcolor{stringliteral}{"{}\%s\(\backslash\)n"{}},\ text);}
\DoxyCodeLine{00161\ \ \ \ \ feat\_print(fcb,\ feat,\ nfr,\ stderr);}
\DoxyCodeLine{00162\ \}}
\DoxyCodeLine{00163\ \textcolor{preprocessor}{\#else\ }\textcolor{comment}{/*\ !DUMP\_FEATURES\ */}\textcolor{preprocessor}{}}
\DoxyCodeLine{00164\ \textcolor{preprocessor}{\#define\ cep\_dump\_dbg(fcb,mfc,nfr,text)}}
\DoxyCodeLine{00165\ \textcolor{preprocessor}{\#define\ feat\_print\_dbg(fcb,mfc,nfr,text)}}
\DoxyCodeLine{00166\ \textcolor{preprocessor}{\#endif}}
\DoxyCodeLine{00167\ }
\DoxyCodeLine{00168\ int32\ **}
\DoxyCodeLine{00169\ parse\_subvecs(\textcolor{keywordtype}{char}\ \textcolor{keyword}{const}\ *str)}
\DoxyCodeLine{00170\ \{}
\DoxyCodeLine{00171\ \ \ \ \ \textcolor{keywordtype}{char}\ \textcolor{keyword}{const}\ *strp;}
\DoxyCodeLine{00172\ \ \ \ \ int32\ n,\ n2,\ l;}
\DoxyCodeLine{00173\ \ \ \ \ glist\_t\ dimlist;\ \ \ \ \ \ \ \ \ \ \ \ \textcolor{comment}{/*\ List\ of\ dimensions\ in\ one\ subvector\ */}}
\DoxyCodeLine{00174\ \ \ \ \ glist\_t\ veclist;\ \ \ \ \ \ \ \ \ \ \ \ \textcolor{comment}{/*\ List\ of\ dimlists\ (subvectors)\ */}}
\DoxyCodeLine{00175\ \ \ \ \ int32\ **subvec;}
\DoxyCodeLine{00176\ \ \ \ \ gnode\_t\ *gn,\ *gn2;}
\DoxyCodeLine{00177\ }
\DoxyCodeLine{00178\ \ \ \ \ veclist\ =\ NULL;}
\DoxyCodeLine{00179\ }
\DoxyCodeLine{00180\ \ \ \ \ strp\ =\ str;}
\DoxyCodeLine{00181\ \ \ \ \ \textcolor{keywordflow}{for}\ (;;)\ \{}
\DoxyCodeLine{00182\ \ \ \ \ \ \ \ \ dimlist\ =\ NULL;}
\DoxyCodeLine{00183\ }
\DoxyCodeLine{00184\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{for}\ (;;)\ \{}
\DoxyCodeLine{00185\ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{if}\ (sscanf(strp,\ \textcolor{stringliteral}{"{}\%d\%n"{}},\ \&n,\ \&l)\ !=\ 1)}
\DoxyCodeLine{00186\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ E\_FATAL(\textcolor{stringliteral}{"{}'\%s':\ Couldn't\ read\ int32\ @pos\ \%d\(\backslash\)n"{}},\ str,}
\DoxyCodeLine{00187\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ strp\ -\/\ str);}
\DoxyCodeLine{00188\ \ \ \ \ \ \ \ \ \ \ \ \ strp\ +=\ l;}
\DoxyCodeLine{00189\ }
\DoxyCodeLine{00190\ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{if}\ (*strp\ ==\ \textcolor{charliteral}{'-\/'})\ \{}
\DoxyCodeLine{00191\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ strp++;}
\DoxyCodeLine{00192\ }
\DoxyCodeLine{00193\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{if}\ (sscanf(strp,\ \textcolor{stringliteral}{"{}\%d\%n"{}},\ \&n2,\ \&l)\ !=\ 1)}
\DoxyCodeLine{00194\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ E\_FATAL(\textcolor{stringliteral}{"{}'\%s':\ Couldn't\ read\ int32\ @pos\ \%d\(\backslash\)n"{}},\ str,}
\DoxyCodeLine{00195\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ strp\ -\/\ str);}
\DoxyCodeLine{00196\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ strp\ +=\ l;}
\DoxyCodeLine{00197\ \ \ \ \ \ \ \ \ \ \ \ \ \}}
\DoxyCodeLine{00198\ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{else}}
\DoxyCodeLine{00199\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ n2\ =\ n;}
\DoxyCodeLine{00200\ }
\DoxyCodeLine{00201\ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{if}\ ((n\ <\ 0)\ ||\ (n\ >\ n2))}
\DoxyCodeLine{00202\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ E\_FATAL(\textcolor{stringliteral}{"{}'\%s':\ Bad\ subrange\ spec\ ending\ @pos\ \%d\(\backslash\)n"{}},\ str,}
\DoxyCodeLine{00203\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ strp\ -\/\ str);}
\DoxyCodeLine{00204\ }
\DoxyCodeLine{00205\ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{for}\ (;\ n\ <=\ n2;\ n++)\ \{}
\DoxyCodeLine{00206\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ gnode\_t\ *gn;}
\DoxyCodeLine{00207\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{for}\ (gn\ =\ dimlist;\ gn;\ gn\ =\ gnode\_next(gn))}
\DoxyCodeLine{00208\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{if}\ (gnode\_int32(gn)\ ==\ n)}
\DoxyCodeLine{00209\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{break};}
\DoxyCodeLine{00210\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{if}\ (gn\ !=\ NULL)}
\DoxyCodeLine{00211\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ E\_FATAL(\textcolor{stringliteral}{"{}'\%s':\ Duplicate\ dimension\ ending\ @pos\ \%d\(\backslash\)n"{}},}
\DoxyCodeLine{00212\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ str,\ strp\ -\/\ str);}
\DoxyCodeLine{00213\ }
\DoxyCodeLine{00214\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ dimlist\ =\ glist\_add\_int32(dimlist,\ n);}
\DoxyCodeLine{00215\ \ \ \ \ \ \ \ \ \ \ \ \ \}}
\DoxyCodeLine{00216\ }
\DoxyCodeLine{00217\ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{if}\ ((*strp\ ==\ \textcolor{charliteral}{'\(\backslash\)0'})\ ||\ (*strp\ ==\ \textcolor{charliteral}{'/'}))}
\DoxyCodeLine{00218\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{break};}
\DoxyCodeLine{00219\ }
\DoxyCodeLine{00220\ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{if}\ (*strp\ !=\ \textcolor{charliteral}{','})}
\DoxyCodeLine{00221\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ E\_FATAL(\textcolor{stringliteral}{"{}'\%s':\ Bad\ delimiter\ @pos\ \%d\(\backslash\)n"{}},\ str,\ strp\ -\/\ str);}
\DoxyCodeLine{00222\ }
\DoxyCodeLine{00223\ \ \ \ \ \ \ \ \ \ \ \ \ strp++;}
\DoxyCodeLine{00224\ \ \ \ \ \ \ \ \ \}}
\DoxyCodeLine{00225\ }
\DoxyCodeLine{00226\ \ \ \ \ \ \ \ \ veclist\ =\ glist\_add\_ptr(veclist,\ (\textcolor{keywordtype}{void}\ *)\ dimlist);}
\DoxyCodeLine{00227\ }
\DoxyCodeLine{00228\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{if}\ (*strp\ ==\ \textcolor{charliteral}{'\(\backslash\)0'})}
\DoxyCodeLine{00229\ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{break};}
\DoxyCodeLine{00230\ }
\DoxyCodeLine{00231\ \ \ \ \ \ \ \ \ assert(*strp\ ==\ \textcolor{charliteral}{'/'});}
\DoxyCodeLine{00232\ \ \ \ \ \ \ \ \ strp++;}
\DoxyCodeLine{00233\ \ \ \ \ \}}
\DoxyCodeLine{00234\ }
\DoxyCodeLine{00235\ \ \ \ \ \textcolor{comment}{/*\ Convert\ the\ glists\ to\ arrays;\ remember\ the\ glists\ are\ in\ reverse\ order\ of\ the\ input!\ */}}
\DoxyCodeLine{00236\ \ \ \ \ n\ =\ glist\_count(veclist);\ \ \ \textcolor{comment}{/*\ \#Subvectors\ */}}
\DoxyCodeLine{00237\ \ \ \ \ subvec\ =\ (int32\ **)\ ckd\_calloc(n\ +\ 1,\ \textcolor{keyword}{sizeof}(int32\ *));\ \ \ \ \ \textcolor{comment}{/*\ +1\ for\ sentinel\ */}}
\DoxyCodeLine{00238\ \ \ \ \ subvec[n]\ =\ NULL;\ \ \ \ \ \ \ \ \ \ \ \textcolor{comment}{/*\ sentinel\ */}}
\DoxyCodeLine{00239\ }
\DoxyCodeLine{00240\ \ \ \ \ \textcolor{keywordflow}{for}\ (-\/-\/n,\ gn\ =\ veclist;\ (n\ >=\ 0)\ \&\&\ gn;\ gn\ =\ gnode\_next(gn),\ -\/-\/n)\ \{}
\DoxyCodeLine{00241\ \ \ \ \ \ \ \ \ gn2\ =\ (glist\_t)\ gnode\_ptr(gn);}
\DoxyCodeLine{00242\ }
\DoxyCodeLine{00243\ \ \ \ \ \ \ \ \ n2\ =\ glist\_count(gn2);\ \ \textcolor{comment}{/*\ Length\ of\ this\ subvector\ */}}
\DoxyCodeLine{00244\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{if}\ (n2\ <=\ 0)}
\DoxyCodeLine{00245\ \ \ \ \ \ \ \ \ \ \ \ \ E\_FATAL(\textcolor{stringliteral}{"{}'\%s':\ 0-\/length\ subvector\(\backslash\)n"{}},\ str);}
\DoxyCodeLine{00246\ }
\DoxyCodeLine{00247\ \ \ \ \ \ \ \ \ subvec[n]\ =\ (int32\ *)\ ckd\_calloc(n2\ +\ 1,\ \textcolor{keyword}{sizeof}(int32));\ \ \ \ \ \ \ \ \textcolor{comment}{/*\ +1\ for\ sentinel\ */}}
\DoxyCodeLine{00248\ \ \ \ \ \ \ \ \ subvec[n][n2]\ =\ -\/1;\ \ \ \ \ \textcolor{comment}{/*\ sentinel\ */}}
\DoxyCodeLine{00249\ }
\DoxyCodeLine{00250\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{for}\ (-\/-\/n2;\ (n2\ >=\ 0)\ \&\&\ gn2;\ gn2\ =\ gnode\_next(gn2),\ -\/-\/n2)}
\DoxyCodeLine{00251\ \ \ \ \ \ \ \ \ \ \ \ \ subvec[n][n2]\ =\ gnode\_int32(gn2);}
\DoxyCodeLine{00252\ \ \ \ \ \ \ \ \ assert((n2\ <\ 0)\ \&\&\ (!gn2));}
\DoxyCodeLine{00253\ \ \ \ \ \}}
\DoxyCodeLine{00254\ \ \ \ \ assert((n\ <\ 0)\ \&\&\ (!gn));}
\DoxyCodeLine{00255\ }
\DoxyCodeLine{00256\ \ \ \ \ \textcolor{comment}{/*\ Free\ the\ glists\ */}}
\DoxyCodeLine{00257\ \ \ \ \ \textcolor{keywordflow}{for}\ (gn\ =\ veclist;\ gn;\ gn\ =\ gnode\_next(gn))\ \{}
\DoxyCodeLine{00258\ \ \ \ \ \ \ \ \ gn2\ =\ (glist\_t)\ gnode\_ptr(gn);}
\DoxyCodeLine{00259\ \ \ \ \ \ \ \ \ glist\_free(gn2);}
\DoxyCodeLine{00260\ \ \ \ \ \}}
\DoxyCodeLine{00261\ \ \ \ \ glist\_free(veclist);}
\DoxyCodeLine{00262\ }
\DoxyCodeLine{00263\ \ \ \ \ \textcolor{keywordflow}{return}\ subvec;}
\DoxyCodeLine{00264\ \}}
\DoxyCodeLine{00265\ }
\DoxyCodeLine{00266\ \textcolor{keywordtype}{void}}
\DoxyCodeLine{00267\ subvecs\_free(int32\ **subvecs)}
\DoxyCodeLine{00268\ \{}
\DoxyCodeLine{00269\ \ \ \ \ int32\ **sv;}
\DoxyCodeLine{00270\ }
\DoxyCodeLine{00271\ \ \ \ \ \textcolor{keywordflow}{for}\ (sv\ =\ subvecs;\ sv\ \&\&\ *sv;\ ++sv)}
\DoxyCodeLine{00272\ \ \ \ \ \ \ \ \ ckd\_free(*sv);}
\DoxyCodeLine{00273\ \ \ \ \ ckd\_free(subvecs);}
\DoxyCodeLine{00274\ \}}
\DoxyCodeLine{00275\ }
\DoxyCodeLine{00276\ \textcolor{keywordtype}{int}}
\DoxyCodeLine{00277\ feat\_set\_subvecs(feat\_t\ *fcb,\ int32\ **subvecs)}
\DoxyCodeLine{00278\ \{}
\DoxyCodeLine{00279\ \ \ \ \ int32\ **sv;}
\DoxyCodeLine{00280\ \ \ \ \ int32\ n\_sv,\ n\_dim,\ i;}
\DoxyCodeLine{00281\ }
\DoxyCodeLine{00282\ \ \ \ \ \textcolor{keywordflow}{if}\ (subvecs\ ==\ NULL)\ \{}
\DoxyCodeLine{00283\ \ \ \ \ \ \ \ \ subvecs\_free(fcb-\/>subvecs);}
\DoxyCodeLine{00284\ \ \ \ \ \ \ \ \ ckd\_free(fcb-\/>sv\_buf);}
\DoxyCodeLine{00285\ \ \ \ \ \ \ \ \ ckd\_free(fcb-\/>sv\_len);}
\DoxyCodeLine{00286\ \ \ \ \ \ \ \ \ fcb-\/>n\_sv\ =\ 0;}
\DoxyCodeLine{00287\ \ \ \ \ \ \ \ \ fcb-\/>subvecs\ =\ NULL;}
\DoxyCodeLine{00288\ \ \ \ \ \ \ \ \ fcb-\/>sv\_len\ =\ NULL;}
\DoxyCodeLine{00289\ \ \ \ \ \ \ \ \ fcb-\/>sv\_buf\ =\ NULL;}
\DoxyCodeLine{00290\ \ \ \ \ \ \ \ \ fcb-\/>sv\_dim\ =\ 0;}
\DoxyCodeLine{00291\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{return}\ 0;}
\DoxyCodeLine{00292\ \ \ \ \ \}}
\DoxyCodeLine{00293\ }
\DoxyCodeLine{00294\ \ \ \ \ \textcolor{keywordflow}{if}\ (fcb-\/>n\_stream\ !=\ 1)\ \{}
\DoxyCodeLine{00295\ \ \ \ \ \ \ \ \ E\_ERROR(\textcolor{stringliteral}{"{}Subvector\ specifications\ require\ single-\/stream\ features!"{}});}
\DoxyCodeLine{00296\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{return}\ -\/1;}
\DoxyCodeLine{00297\ \ \ \ \ \}}
\DoxyCodeLine{00298\ }
\DoxyCodeLine{00299\ \ \ \ \ n\_sv\ =\ 0;}
\DoxyCodeLine{00300\ \ \ \ \ n\_dim\ =\ 0;}
\DoxyCodeLine{00301\ \ \ \ \ \textcolor{keywordflow}{for}\ (sv\ =\ subvecs;\ sv\ \&\&\ *sv;\ ++sv)\ \{}
\DoxyCodeLine{00302\ \ \ \ \ \ \ \ \ int32\ *d;}
\DoxyCodeLine{00303\ }
\DoxyCodeLine{00304\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{for}\ (d\ =\ *sv;\ d\ \&\&\ *d\ !=\ -\/1;\ ++d)\ \{}
\DoxyCodeLine{00305\ \ \ \ \ \ \ \ \ \ \ \ \ ++n\_dim;}
\DoxyCodeLine{00306\ \ \ \ \ \ \ \ \ \}}
\DoxyCodeLine{00307\ \ \ \ \ \ \ \ \ ++n\_sv;}
\DoxyCodeLine{00308\ \ \ \ \ \}}
\DoxyCodeLine{00309\ \ \ \ \ \textcolor{keywordflow}{if}\ (n\_dim\ >\ feat\_dimension(fcb))\ \{}
\DoxyCodeLine{00310\ \ \ \ \ \ \ \ \ E\_ERROR(\textcolor{stringliteral}{"{}Total\ dimensionality\ of\ subvector\ specification\ \%d\ "{}}}
\DoxyCodeLine{00311\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{stringliteral}{"{}>\ feature\ dimensionality\ \%d\(\backslash\)n"{}},\ n\_dim,\ feat\_dimension(fcb));}
\DoxyCodeLine{00312\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{return}\ -\/1;}
\DoxyCodeLine{00313\ \ \ \ \ \}}
\DoxyCodeLine{00314\ }
\DoxyCodeLine{00315\ \ \ \ \ fcb-\/>n\_sv\ =\ n\_sv;}
\DoxyCodeLine{00316\ \ \ \ \ fcb-\/>subvecs\ =\ subvecs;}
\DoxyCodeLine{00317\ \ \ \ \ fcb-\/>sv\_len\ =\ ckd\_calloc(n\_sv,\ \textcolor{keyword}{sizeof}(*fcb-\/>sv\_len));}
\DoxyCodeLine{00318\ \ \ \ \ fcb-\/>sv\_buf\ =\ ckd\_calloc(n\_dim,\ \textcolor{keyword}{sizeof}(*fcb-\/>sv\_buf));}
\DoxyCodeLine{00319\ \ \ \ \ fcb-\/>sv\_dim\ =\ n\_dim;}
\DoxyCodeLine{00320\ \ \ \ \ \textcolor{keywordflow}{for}\ (i\ =\ 0;\ i\ <\ n\_sv;\ ++i)\ \{}
\DoxyCodeLine{00321\ \ \ \ \ \ \ \ \ int32\ *d;}
\DoxyCodeLine{00322\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{for}\ (d\ =\ subvecs[i];\ d\ \&\&\ *d\ !=\ -\/1;\ ++d)\ \{}
\DoxyCodeLine{00323\ \ \ \ \ \ \ \ \ \ \ \ \ ++fcb-\/>sv\_len[i];}
\DoxyCodeLine{00324\ \ \ \ \ \ \ \ \ \}}
\DoxyCodeLine{00325\ \ \ \ \ \}}
\DoxyCodeLine{00326\ }
\DoxyCodeLine{00327\ \ \ \ \ \textcolor{keywordflow}{return}\ 0;}
\DoxyCodeLine{00328\ \}}
\DoxyCodeLine{00329\ }
\DoxyCodeLine{00333\ \textcolor{keyword}{static}\ \textcolor{keywordtype}{void}}
\DoxyCodeLine{00334\ feat\_subvec\_project(feat\_t\ *fcb,\ mfcc\_t\ ***inout\_feat,\ uint32\ nfr)}
\DoxyCodeLine{00335\ \{}
\DoxyCodeLine{00336\ \ \ \ \ uint32\ i;}
\DoxyCodeLine{00337\ }
\DoxyCodeLine{00338\ \ \ \ \ \textcolor{keywordflow}{if}\ (fcb-\/>subvecs\ ==\ NULL)}
\DoxyCodeLine{00339\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{return};}
\DoxyCodeLine{00340\ \ \ \ \ \textcolor{keywordflow}{for}\ (i\ =\ 0;\ i\ <\ nfr;\ ++i)\ \{}
\DoxyCodeLine{00341\ \ \ \ \ \ \ \ \ mfcc\_t\ *out;}
\DoxyCodeLine{00342\ \ \ \ \ \ \ \ \ int32\ j;}
\DoxyCodeLine{00343\ }
\DoxyCodeLine{00344\ \ \ \ \ \ \ \ \ out\ =\ fcb-\/>sv\_buf;}
\DoxyCodeLine{00345\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{for}\ (j\ =\ 0;\ j\ <\ fcb-\/>n\_sv;\ ++j)\ \{}
\DoxyCodeLine{00346\ \ \ \ \ \ \ \ \ \ \ \ \ int32\ *d;}
\DoxyCodeLine{00347\ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{for}\ (d\ =\ fcb-\/>subvecs[j];\ d\ \&\&\ *d\ !=\ -\/1;\ ++d)\ \{}
\DoxyCodeLine{00348\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ *out++\ =\ inout\_feat[i][0][*d];}
\DoxyCodeLine{00349\ \ \ \ \ \ \ \ \ \ \ \ \ \}}
\DoxyCodeLine{00350\ \ \ \ \ \ \ \ \ \}}
\DoxyCodeLine{00351\ \ \ \ \ \ \ \ \ memcpy(inout\_feat[i][0],\ fcb-\/>sv\_buf,\ fcb-\/>sv\_dim\ *\ \textcolor{keyword}{sizeof}(*fcb-\/>sv\_buf));}
\DoxyCodeLine{00352\ \ \ \ \ \}}
\DoxyCodeLine{00353\ \}}
\DoxyCodeLine{00354\ }
\DoxyCodeLine{00355\ mfcc\_t\ ***}
\DoxyCodeLine{00356\ feat\_array\_alloc(feat\_t\ *\ fcb,\ int32\ nfr)}
\DoxyCodeLine{00357\ \{}
\DoxyCodeLine{00358\ \ \ \ \ int32\ i,\ j,\ k;}
\DoxyCodeLine{00359\ \ \ \ \ mfcc\_t\ *data,\ *d,\ ***feat;}
\DoxyCodeLine{00360\ }
\DoxyCodeLine{00361\ \ \ \ \ assert(fcb);}
\DoxyCodeLine{00362\ \ \ \ \ assert(nfr\ >\ 0);}
\DoxyCodeLine{00363\ \ \ \ \ assert(feat\_dimension(fcb)\ >\ 0);}
\DoxyCodeLine{00364\ }
\DoxyCodeLine{00365\ \ \ \ \ \textcolor{comment}{/*\ Make\ sure\ to\ use\ the\ dimensionality\ of\ the\ features\ *before*}}
\DoxyCodeLine{00366\ \textcolor{comment}{\ \ \ \ \ \ \ LDA\ and\ subvector\ projection.\ */}}
\DoxyCodeLine{00367\ \ \ \ \ k\ =\ 0;}
\DoxyCodeLine{00368\ \ \ \ \ \textcolor{keywordflow}{for}\ (i\ =\ 0;\ i\ <\ fcb-\/>n\_stream;\ ++i)}
\DoxyCodeLine{00369\ \ \ \ \ \ \ \ \ k\ +=\ fcb-\/>stream\_len[i];}
\DoxyCodeLine{00370\ \ \ \ \ assert(k\ >=\ feat\_dimension(fcb));}
\DoxyCodeLine{00371\ \ \ \ \ assert(k\ >=\ fcb-\/>sv\_dim);}
\DoxyCodeLine{00372\ }
\DoxyCodeLine{00373\ \ \ \ \ feat\ =}
\DoxyCodeLine{00374\ \ \ \ \ \ \ \ \ (mfcc\_t\ ***)\ ckd\_calloc\_2d(nfr,\ feat\_dimension1(fcb),\ \textcolor{keyword}{sizeof}(mfcc\_t\ *));}
\DoxyCodeLine{00375\ \ \ \ \ data\ =\ (mfcc\_t\ *)\ ckd\_calloc(nfr\ *\ k,\ \textcolor{keyword}{sizeof}(mfcc\_t));}
\DoxyCodeLine{00376\ }
\DoxyCodeLine{00377\ \ \ \ \ \textcolor{keywordflow}{for}\ (i\ =\ 0;\ i\ <\ nfr;\ i++)\ \{}
\DoxyCodeLine{00378\ \ \ \ \ \ \ \ \ d\ =\ data\ +\ i\ *\ k;}
\DoxyCodeLine{00379\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{for}\ (j\ =\ 0;\ j\ <\ feat\_dimension1(fcb);\ j++)\ \{}
\DoxyCodeLine{00380\ \ \ \ \ \ \ \ \ \ \ \ \ feat[i][j]\ =\ d;}
\DoxyCodeLine{00381\ \ \ \ \ \ \ \ \ \ \ \ \ d\ +=\ feat\_dimension2(fcb,\ j);}
\DoxyCodeLine{00382\ \ \ \ \ \ \ \ \ \}}
\DoxyCodeLine{00383\ \ \ \ \ \}}
\DoxyCodeLine{00384\ }
\DoxyCodeLine{00385\ \ \ \ \ \textcolor{keywordflow}{return}\ feat;}
\DoxyCodeLine{00386\ \}}
\DoxyCodeLine{00387\ }
\DoxyCodeLine{00388\ mfcc\_t\ ***}
\DoxyCodeLine{00389\ feat\_array\_realloc(feat\_t\ *fcb,\ mfcc\_t\ ***old\_feat,\ int32\ ofr,\ int32\ nfr)}
\DoxyCodeLine{00390\ \{}
\DoxyCodeLine{00391\ \ \ \ \ int32\ i,\ k,\ cf;}
\DoxyCodeLine{00392\ \ \ \ \ mfcc\_t***\ new\_feat;}
\DoxyCodeLine{00393\ }
\DoxyCodeLine{00394\ \ \ \ \ assert(fcb);}
\DoxyCodeLine{00395\ \ \ \ \ assert(nfr\ >\ 0);}
\DoxyCodeLine{00396\ \ \ \ \ assert(ofr\ >\ 0);}
\DoxyCodeLine{00397\ \ \ \ \ assert(feat\_dimension(fcb)\ >\ 0);}
\DoxyCodeLine{00398\ }
\DoxyCodeLine{00399\ \ \ \ \ \textcolor{comment}{/*\ Make\ sure\ to\ use\ the\ dimensionality\ of\ the\ features\ *before*}}
\DoxyCodeLine{00400\ \textcolor{comment}{\ \ \ \ \ \ \ LDA\ and\ subvector\ projection.\ */}}
\DoxyCodeLine{00401\ \ \ \ \ k\ =\ 0;}
\DoxyCodeLine{00402\ \ \ \ \ \textcolor{keywordflow}{for}\ (i\ =\ 0;\ i\ <\ fcb-\/>n\_stream;\ ++i)}
\DoxyCodeLine{00403\ \ \ \ \ \ \ \ \ k\ +=\ fcb-\/>stream\_len[i];}
\DoxyCodeLine{00404\ \ \ \ \ assert(k\ >=\ feat\_dimension(fcb));}
\DoxyCodeLine{00405\ \ \ \ \ assert(k\ >=\ fcb-\/>sv\_dim);}
\DoxyCodeLine{00406\ \ \ \ \ }
\DoxyCodeLine{00407\ \ \ \ \ new\_feat\ =\ feat\_array\_alloc(fcb,\ nfr);}
\DoxyCodeLine{00408\ }
\DoxyCodeLine{00409\ \ \ \ \ cf\ =\ (nfr\ <\ ofr)\ ?\ nfr\ :\ ofr;}
\DoxyCodeLine{00410\ \ \ \ \ memcpy(new\_feat[0][0],\ old\_feat[0][0],\ cf\ *\ k\ *\ \textcolor{keyword}{sizeof}(mfcc\_t));}
\DoxyCodeLine{00411\ }
\DoxyCodeLine{00412\ \ \ \ \ feat\_array\_free(old\_feat);}
\DoxyCodeLine{00413\ \ \ \ \ }
\DoxyCodeLine{00414\ \ \ \ \ \textcolor{keywordflow}{return}\ new\_feat;}
\DoxyCodeLine{00415\ \}}
\DoxyCodeLine{00416\ }
\DoxyCodeLine{00417\ \textcolor{keywordtype}{void}}
\DoxyCodeLine{00418\ feat\_array\_free(mfcc\_t\ ***feat)}
\DoxyCodeLine{00419\ \{}
\DoxyCodeLine{00420\ \ \ \ \ ckd\_free(feat[0][0]);}
\DoxyCodeLine{00421\ \ \ \ \ ckd\_free\_2d((\textcolor{keywordtype}{void}\ **)feat);}
\DoxyCodeLine{00422\ \}}
\DoxyCodeLine{00423\ }
\DoxyCodeLine{00424\ \textcolor{keyword}{static}\ \textcolor{keywordtype}{void}}
\DoxyCodeLine{00425\ feat\_s2\_4x\_cep2feat(feat\_t\ *\ fcb,\ mfcc\_t\ **\ mfc,\ mfcc\_t\ **\ feat)}
\DoxyCodeLine{00426\ \{}
\DoxyCodeLine{00427\ \ \ \ \ mfcc\_t\ *f;}
\DoxyCodeLine{00428\ \ \ \ \ mfcc\_t\ *w,\ *\_w;}
\DoxyCodeLine{00429\ \ \ \ \ mfcc\_t\ *w1,\ *w\_1,\ *\_w1,\ *\_w\_1;}
\DoxyCodeLine{00430\ \ \ \ \ mfcc\_t\ d1,\ d2;}
\DoxyCodeLine{00431\ \ \ \ \ int32\ i,\ j;}
\DoxyCodeLine{00432\ }
\DoxyCodeLine{00433\ \ \ \ \ assert(fcb);}
\DoxyCodeLine{00434\ \ \ \ \ assert(feat\_cepsize(fcb)\ ==\ 13);}
\DoxyCodeLine{00435\ \ \ \ \ assert(feat\_n\_stream(fcb)\ ==\ 4);}
\DoxyCodeLine{00436\ \ \ \ \ assert(feat\_stream\_len(fcb,\ 0)\ ==\ 12);}
\DoxyCodeLine{00437\ \ \ \ \ assert(feat\_stream\_len(fcb,\ 1)\ ==\ 24);}
\DoxyCodeLine{00438\ \ \ \ \ assert(feat\_stream\_len(fcb,\ 2)\ ==\ 3);}
\DoxyCodeLine{00439\ \ \ \ \ assert(feat\_stream\_len(fcb,\ 3)\ ==\ 12);}
\DoxyCodeLine{00440\ \ \ \ \ assert(feat\_window\_size(fcb)\ ==\ 4);}
\DoxyCodeLine{00441\ }
\DoxyCodeLine{00442\ \ \ \ \ \textcolor{comment}{/*\ CEP;\ skip\ C0\ */}}
\DoxyCodeLine{00443\ \ \ \ \ memcpy(feat[0],\ mfc[0]\ +\ 1,\ (feat\_cepsize(fcb)\ -\/\ 1)\ *\ \textcolor{keyword}{sizeof}(mfcc\_t));}
\DoxyCodeLine{00444\ }
\DoxyCodeLine{00445\ \ \ \ \ \textcolor{comment}{/*}}
\DoxyCodeLine{00446\ \textcolor{comment}{\ \ \ \ \ *\ DCEP(SHORT):\ mfc[2]\ -\/\ mfc[-\/2]}}
\DoxyCodeLine{00447\ \textcolor{comment}{\ \ \ \ \ *\ DCEP(LONG):\ \ mfc[4]\ -\/\ mfc[-\/4]}}
\DoxyCodeLine{00448\ \textcolor{comment}{\ \ \ \ \ */}}
\DoxyCodeLine{00449\ \ \ \ \ w\ =\ mfc[2]\ +\ 1;\ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{comment}{/*\ +1\ to\ skip\ C0\ */}}
\DoxyCodeLine{00450\ \ \ \ \ \_w\ =\ mfc[-\/2]\ +\ 1;}
\DoxyCodeLine{00451\ }
\DoxyCodeLine{00452\ \ \ \ \ f\ =\ feat[1];}
\DoxyCodeLine{00453\ \ \ \ \ \textcolor{keywordflow}{for}\ (i\ =\ 0;\ i\ <\ feat\_cepsize(fcb)\ -\/\ 1;\ i++)\ \textcolor{comment}{/*\ Short-\/term\ */}}
\DoxyCodeLine{00454\ \ \ \ \ \ \ \ \ f[i]\ =\ w[i]\ -\/\ \_w[i];}
\DoxyCodeLine{00455\ }
\DoxyCodeLine{00456\ \ \ \ \ w\ =\ mfc[4]\ +\ 1;\ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{comment}{/*\ +1\ to\ skip\ C0\ */}}
\DoxyCodeLine{00457\ \ \ \ \ \_w\ =\ mfc[-\/4]\ +\ 1;}
\DoxyCodeLine{00458\ }
\DoxyCodeLine{00459\ \ \ \ \ \textcolor{keywordflow}{for}\ (j\ =\ 0;\ j\ <\ feat\_cepsize(fcb)\ -\/\ 1;\ i++,\ j++)\ \ \ \ \textcolor{comment}{/*\ Long-\/term\ */}}
\DoxyCodeLine{00460\ \ \ \ \ \ \ \ \ f[i]\ =\ w[j]\ -\/\ \_w[j];}
\DoxyCodeLine{00461\ }
\DoxyCodeLine{00462\ \ \ \ \ \textcolor{comment}{/*\ D2CEP:\ (mfc[3]\ -\/\ mfc[-\/1])\ -\/\ (mfc[1]\ -\/\ mfc[-\/3])\ */}}
\DoxyCodeLine{00463\ \ \ \ \ w1\ =\ mfc[3]\ +\ 1;\ \ \ \ \ \ \ \ \ \ \ \ \textcolor{comment}{/*\ Final\ +1\ to\ skip\ C0\ */}}
\DoxyCodeLine{00464\ \ \ \ \ \_w1\ =\ mfc[-\/1]\ +\ 1;}
\DoxyCodeLine{00465\ \ \ \ \ w\_1\ =\ mfc[1]\ +\ 1;}
\DoxyCodeLine{00466\ \ \ \ \ \_w\_1\ =\ mfc[-\/3]\ +\ 1;}
\DoxyCodeLine{00467\ }
\DoxyCodeLine{00468\ \ \ \ \ f\ =\ feat[3];}
\DoxyCodeLine{00469\ \ \ \ \ \textcolor{keywordflow}{for}\ (i\ =\ 0;\ i\ <\ feat\_cepsize(fcb)\ -\/\ 1;\ i++)\ \{}
\DoxyCodeLine{00470\ \ \ \ \ \ \ \ \ d1\ =\ w1[i]\ -\/\ \_w1[i];}
\DoxyCodeLine{00471\ \ \ \ \ \ \ \ \ d2\ =\ w\_1[i]\ -\/\ \_w\_1[i];}
\DoxyCodeLine{00472\ }
\DoxyCodeLine{00473\ \ \ \ \ \ \ \ \ f[i]\ =\ d1\ -\/\ d2;}
\DoxyCodeLine{00474\ \ \ \ \ \}}
\DoxyCodeLine{00475\ }
\DoxyCodeLine{00476\ \ \ \ \ \textcolor{comment}{/*\ POW:\ C0,\ DC0,\ D2C0;\ differences\ computed\ as\ above\ for\ rest\ of\ cep\ */}}
\DoxyCodeLine{00477\ \ \ \ \ f\ =\ feat[2];}
\DoxyCodeLine{00478\ \ \ \ \ f[0]\ =\ mfc[0][0];}
\DoxyCodeLine{00479\ \ \ \ \ f[1]\ =\ mfc[2][0]\ -\/\ mfc[-\/2][0];}
\DoxyCodeLine{00480\ }
\DoxyCodeLine{00481\ \ \ \ \ d1\ =\ mfc[3][0]\ -\/\ mfc[-\/1][0];}
\DoxyCodeLine{00482\ \ \ \ \ d2\ =\ mfc[1][0]\ -\/\ mfc[-\/3][0];}
\DoxyCodeLine{00483\ \ \ \ \ f[2]\ =\ d1\ -\/\ d2;}
\DoxyCodeLine{00484\ \}}
\DoxyCodeLine{00485\ }
\DoxyCodeLine{00486\ }
\DoxyCodeLine{00487\ \textcolor{keyword}{static}\ \textcolor{keywordtype}{void}}
\DoxyCodeLine{00488\ feat\_s3\_1x39\_cep2feat(feat\_t\ *\ fcb,\ mfcc\_t\ **\ mfc,\ mfcc\_t\ **\ feat)}
\DoxyCodeLine{00489\ \{}
\DoxyCodeLine{00490\ \ \ \ \ mfcc\_t\ *f;}
\DoxyCodeLine{00491\ \ \ \ \ mfcc\_t\ *w,\ *\_w;}
\DoxyCodeLine{00492\ \ \ \ \ mfcc\_t\ *w1,\ *w\_1,\ *\_w1,\ *\_w\_1;}
\DoxyCodeLine{00493\ \ \ \ \ mfcc\_t\ d1,\ d2;}
\DoxyCodeLine{00494\ \ \ \ \ int32\ i;}
\DoxyCodeLine{00495\ }
\DoxyCodeLine{00496\ \ \ \ \ assert(fcb);}
\DoxyCodeLine{00497\ \ \ \ \ assert(feat\_cepsize(fcb)\ ==\ 13);}
\DoxyCodeLine{00498\ \ \ \ \ assert(feat\_n\_stream(fcb)\ ==\ 1);}
\DoxyCodeLine{00499\ \ \ \ \ assert(feat\_stream\_len(fcb,\ 0)\ ==\ 39);}
\DoxyCodeLine{00500\ \ \ \ \ assert(feat\_window\_size(fcb)\ ==\ 3);}
\DoxyCodeLine{00501\ }
\DoxyCodeLine{00502\ \ \ \ \ \textcolor{comment}{/*\ CEP;\ skip\ C0\ */}}
\DoxyCodeLine{00503\ \ \ \ \ memcpy(feat[0],\ mfc[0]\ +\ 1,\ (feat\_cepsize(fcb)\ -\/\ 1)\ *\ \textcolor{keyword}{sizeof}(mfcc\_t));}
\DoxyCodeLine{00504\ \ \ \ \ \textcolor{comment}{/*}}
\DoxyCodeLine{00505\ \textcolor{comment}{\ \ \ \ \ *\ DCEP:\ mfc[2]\ -\/\ mfc[-\/2];}}
\DoxyCodeLine{00506\ \textcolor{comment}{\ \ \ \ \ */}}
\DoxyCodeLine{00507\ \ \ \ \ f\ =\ feat[0]\ +\ feat\_cepsize(fcb)\ -\/\ 1;}
\DoxyCodeLine{00508\ \ \ \ \ w\ =\ mfc[2]\ +\ 1;\ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{comment}{/*\ +1\ to\ skip\ C0\ */}}
\DoxyCodeLine{00509\ \ \ \ \ \_w\ =\ mfc[-\/2]\ +\ 1;}
\DoxyCodeLine{00510\ }
\DoxyCodeLine{00511\ \ \ \ \ \textcolor{keywordflow}{for}\ (i\ =\ 0;\ i\ <\ feat\_cepsize(fcb)\ -\/\ 1;\ i++)}
\DoxyCodeLine{00512\ \ \ \ \ \ \ \ \ f[i]\ =\ w[i]\ -\/\ \_w[i];}
\DoxyCodeLine{00513\ }
\DoxyCodeLine{00514\ \ \ \ \ \textcolor{comment}{/*\ POW:\ C0,\ DC0,\ D2C0\ */}}
\DoxyCodeLine{00515\ \ \ \ \ f\ +=\ feat\_cepsize(fcb)\ -\/\ 1;}
\DoxyCodeLine{00516\ }
\DoxyCodeLine{00517\ \ \ \ \ f[0]\ =\ mfc[0][0];}
\DoxyCodeLine{00518\ \ \ \ \ f[1]\ =\ mfc[2][0]\ -\/\ mfc[-\/2][0];}
\DoxyCodeLine{00519\ }
\DoxyCodeLine{00520\ \ \ \ \ d1\ =\ mfc[3][0]\ -\/\ mfc[-\/1][0];}
\DoxyCodeLine{00521\ \ \ \ \ d2\ =\ mfc[1][0]\ -\/\ mfc[-\/3][0];}
\DoxyCodeLine{00522\ \ \ \ \ f[2]\ =\ d1\ -\/\ d2;}
\DoxyCodeLine{00523\ }
\DoxyCodeLine{00524\ \ \ \ \ \textcolor{comment}{/*\ D2CEP:\ (mfc[3]\ -\/\ mfc[-\/1])\ -\/\ (mfc[1]\ -\/\ mfc[-\/3])\ */}}
\DoxyCodeLine{00525\ \ \ \ \ f\ +=\ 3;}
\DoxyCodeLine{00526\ }
\DoxyCodeLine{00527\ \ \ \ \ w1\ =\ mfc[3]\ +\ 1;\ \ \ \ \ \ \ \ \ \ \ \ \textcolor{comment}{/*\ Final\ +1\ to\ skip\ C0\ */}}
\DoxyCodeLine{00528\ \ \ \ \ \_w1\ =\ mfc[-\/1]\ +\ 1;}
\DoxyCodeLine{00529\ \ \ \ \ w\_1\ =\ mfc[1]\ +\ 1;}
\DoxyCodeLine{00530\ \ \ \ \ \_w\_1\ =\ mfc[-\/3]\ +\ 1;}
\DoxyCodeLine{00531\ }
\DoxyCodeLine{00532\ \ \ \ \ \textcolor{keywordflow}{for}\ (i\ =\ 0;\ i\ <\ feat\_cepsize(fcb)\ -\/\ 1;\ i++)\ \{}
\DoxyCodeLine{00533\ \ \ \ \ \ \ \ \ d1\ =\ w1[i]\ -\/\ \_w1[i];}
\DoxyCodeLine{00534\ \ \ \ \ \ \ \ \ d2\ =\ w\_1[i]\ -\/\ \_w\_1[i];}
\DoxyCodeLine{00535\ }
\DoxyCodeLine{00536\ \ \ \ \ \ \ \ \ f[i]\ =\ d1\ -\/\ d2;}
\DoxyCodeLine{00537\ \ \ \ \ \}}
\DoxyCodeLine{00538\ \}}
\DoxyCodeLine{00539\ }
\DoxyCodeLine{00540\ }
\DoxyCodeLine{00541\ \textcolor{keyword}{static}\ \textcolor{keywordtype}{void}}
\DoxyCodeLine{00542\ feat\_s3\_cep(feat\_t\ *\ fcb,\ mfcc\_t\ **\ mfc,\ mfcc\_t\ **\ feat)}
\DoxyCodeLine{00543\ \{}
\DoxyCodeLine{00544\ \ \ \ \ assert(fcb);}
\DoxyCodeLine{00545\ \ \ \ \ assert(feat\_n\_stream(fcb)\ ==\ 1);}
\DoxyCodeLine{00546\ \ \ \ \ assert(feat\_window\_size(fcb)\ ==\ 0);}
\DoxyCodeLine{00547\ }
\DoxyCodeLine{00548\ \ \ \ \ \textcolor{comment}{/*\ CEP\ */}}
\DoxyCodeLine{00549\ \ \ \ \ memcpy(feat[0],\ mfc[0],\ feat\_cepsize(fcb)\ *\ \textcolor{keyword}{sizeof}(mfcc\_t));}
\DoxyCodeLine{00550\ \}}
\DoxyCodeLine{00551\ }
\DoxyCodeLine{00552\ \textcolor{keyword}{static}\ \textcolor{keywordtype}{void}}
\DoxyCodeLine{00553\ feat\_s3\_cep\_dcep(feat\_t\ *\ fcb,\ mfcc\_t\ **\ mfc,\ mfcc\_t\ **\ feat)}
\DoxyCodeLine{00554\ \{}
\DoxyCodeLine{00555\ \ \ \ \ mfcc\_t\ *f;}
\DoxyCodeLine{00556\ \ \ \ \ mfcc\_t\ *w,\ *\_w;}
\DoxyCodeLine{00557\ \ \ \ \ int32\ i;}
\DoxyCodeLine{00558\ }
\DoxyCodeLine{00559\ \ \ \ \ assert(fcb);}
\DoxyCodeLine{00560\ \ \ \ \ assert(feat\_n\_stream(fcb)\ ==\ 1);}
\DoxyCodeLine{00561\ \ \ \ \ assert(feat\_stream\_len(fcb,\ 0)\ ==\ feat\_cepsize(fcb)\ *\ 2);}
\DoxyCodeLine{00562\ \ \ \ \ assert(feat\_window\_size(fcb)\ ==\ 2);}
\DoxyCodeLine{00563\ }
\DoxyCodeLine{00564\ \ \ \ \ \textcolor{comment}{/*\ CEP\ */}}
\DoxyCodeLine{00565\ \ \ \ \ memcpy(feat[0],\ mfc[0],\ feat\_cepsize(fcb)\ *\ \textcolor{keyword}{sizeof}(mfcc\_t));}
\DoxyCodeLine{00566\ }
\DoxyCodeLine{00567\ \ \ \ \ \textcolor{comment}{/*}}
\DoxyCodeLine{00568\ \textcolor{comment}{\ \ \ \ \ *\ DCEP:\ mfc[2]\ -\/\ mfc[-\/2];}}
\DoxyCodeLine{00569\ \textcolor{comment}{\ \ \ \ \ */}}
\DoxyCodeLine{00570\ \ \ \ \ f\ =\ feat[0]\ +\ feat\_cepsize(fcb);}
\DoxyCodeLine{00571\ \ \ \ \ w\ =\ mfc[2];}
\DoxyCodeLine{00572\ \ \ \ \ \_w\ =\ mfc[-\/2];}
\DoxyCodeLine{00573\ }
\DoxyCodeLine{00574\ \ \ \ \ \textcolor{keywordflow}{for}\ (i\ =\ 0;\ i\ <\ feat\_cepsize(fcb);\ i++)}
\DoxyCodeLine{00575\ \ \ \ \ \ \ \ \ f[i]\ =\ w[i]\ -\/\ \_w[i];}
\DoxyCodeLine{00576\ \}}
\DoxyCodeLine{00577\ }
\DoxyCodeLine{00578\ \textcolor{keyword}{static}\ \textcolor{keywordtype}{void}}
\DoxyCodeLine{00579\ feat\_1s\_c\_d\_dd\_cep2feat(feat\_t\ *\ fcb,\ mfcc\_t\ **\ mfc,\ mfcc\_t\ **\ feat)}
\DoxyCodeLine{00580\ \{}
\DoxyCodeLine{00581\ \ \ \ \ mfcc\_t\ *f;}
\DoxyCodeLine{00582\ \ \ \ \ mfcc\_t\ *w,\ *\_w;}
\DoxyCodeLine{00583\ \ \ \ \ mfcc\_t\ *w1,\ *w\_1,\ *\_w1,\ *\_w\_1;}
\DoxyCodeLine{00584\ \ \ \ \ mfcc\_t\ d1,\ d2;}
\DoxyCodeLine{00585\ \ \ \ \ int32\ i;}
\DoxyCodeLine{00586\ }
\DoxyCodeLine{00587\ \ \ \ \ assert(fcb);}
\DoxyCodeLine{00588\ \ \ \ \ assert(feat\_n\_stream(fcb)\ ==\ 1);}
\DoxyCodeLine{00589\ \ \ \ \ assert(feat\_stream\_len(fcb,\ 0)\ ==\ feat\_cepsize(fcb)\ *\ 3);}
\DoxyCodeLine{00590\ \ \ \ \ assert(feat\_window\_size(fcb)\ ==\ FEAT\_DCEP\_WIN\ +\ 1);}
\DoxyCodeLine{00591\ }
\DoxyCodeLine{00592\ \ \ \ \ \textcolor{comment}{/*\ CEP\ */}}
\DoxyCodeLine{00593\ \ \ \ \ memcpy(feat[0],\ mfc[0],\ feat\_cepsize(fcb)\ *\ \textcolor{keyword}{sizeof}(mfcc\_t));}
\DoxyCodeLine{00594\ }
\DoxyCodeLine{00595\ \ \ \ \ \textcolor{comment}{/*}}
\DoxyCodeLine{00596\ \textcolor{comment}{\ \ \ \ \ *\ DCEP:\ mfc[w]\ -\/\ mfc[-\/w],\ where\ w\ =\ FEAT\_DCEP\_WIN;}}
\DoxyCodeLine{00597\ \textcolor{comment}{\ \ \ \ \ */}}
\DoxyCodeLine{00598\ \ \ \ \ f\ =\ feat[0]\ +\ feat\_cepsize(fcb);}
\DoxyCodeLine{00599\ \ \ \ \ w\ =\ mfc[FEAT\_DCEP\_WIN];}
\DoxyCodeLine{00600\ \ \ \ \ \_w\ =\ mfc[-\/FEAT\_DCEP\_WIN];}
\DoxyCodeLine{00601\ }
\DoxyCodeLine{00602\ \ \ \ \ \textcolor{keywordflow}{for}\ (i\ =\ 0;\ i\ <\ feat\_cepsize(fcb);\ i++)}
\DoxyCodeLine{00603\ \ \ \ \ \ \ \ \ f[i]\ =\ w[i]\ -\/\ \_w[i];}
\DoxyCodeLine{00604\ }
\DoxyCodeLine{00605\ \ \ \ \ \textcolor{comment}{/*\ }}
\DoxyCodeLine{00606\ \textcolor{comment}{\ \ \ \ \ *\ D2CEP:\ (mfc[w+1]\ -\/\ mfc[-\/w+1])\ -\/\ (mfc[w-\/1]\ -\/\ mfc[-\/w-\/1]),\ }}
\DoxyCodeLine{00607\ \textcolor{comment}{\ \ \ \ \ *\ where\ w\ =\ FEAT\_DCEP\_WIN\ }}
\DoxyCodeLine{00608\ \textcolor{comment}{\ \ \ \ \ */}}
\DoxyCodeLine{00609\ \ \ \ \ f\ +=\ feat\_cepsize(fcb);}
\DoxyCodeLine{00610\ }
\DoxyCodeLine{00611\ \ \ \ \ w1\ =\ mfc[FEAT\_DCEP\_WIN\ +\ 1];}
\DoxyCodeLine{00612\ \ \ \ \ \_w1\ =\ mfc[-\/FEAT\_DCEP\_WIN\ +\ 1];}
\DoxyCodeLine{00613\ \ \ \ \ w\_1\ =\ mfc[FEAT\_DCEP\_WIN\ -\/\ 1];}
\DoxyCodeLine{00614\ \ \ \ \ \_w\_1\ =\ mfc[-\/FEAT\_DCEP\_WIN\ -\/\ 1];}
\DoxyCodeLine{00615\ }
\DoxyCodeLine{00616\ \ \ \ \ \textcolor{keywordflow}{for}\ (i\ =\ 0;\ i\ <\ feat\_cepsize(fcb);\ i++)\ \{}
\DoxyCodeLine{00617\ \ \ \ \ \ \ \ \ d1\ =\ w1[i]\ -\/\ \_w1[i];}
\DoxyCodeLine{00618\ \ \ \ \ \ \ \ \ d2\ =\ w\_1[i]\ -\/\ \_w\_1[i];}
\DoxyCodeLine{00619\ }
\DoxyCodeLine{00620\ \ \ \ \ \ \ \ \ f[i]\ =\ d1\ -\/\ d2;}
\DoxyCodeLine{00621\ \ \ \ \ \}}
\DoxyCodeLine{00622\ \}}
\DoxyCodeLine{00623\ }
\DoxyCodeLine{00624\ \textcolor{keyword}{static}\ \textcolor{keywordtype}{void}}
\DoxyCodeLine{00625\ feat\_1s\_c\_d\_ld\_dd\_cep2feat(feat\_t\ *\ fcb,\ mfcc\_t\ **\ mfc,\ mfcc\_t\ **\ feat)}
\DoxyCodeLine{00626\ \{}
\DoxyCodeLine{00627\ \ \ \ \ mfcc\_t\ *f;}
\DoxyCodeLine{00628\ \ \ \ \ mfcc\_t\ *w,\ *\_w;}
\DoxyCodeLine{00629\ \ \ \ \ mfcc\_t\ *w1,\ *w\_1,\ *\_w1,\ *\_w\_1;}
\DoxyCodeLine{00630\ \ \ \ \ mfcc\_t\ d1,\ d2;}
\DoxyCodeLine{00631\ \ \ \ \ int32\ i;}
\DoxyCodeLine{00632\ }
\DoxyCodeLine{00633\ \ \ \ \ assert(fcb);}
\DoxyCodeLine{00634\ \ \ \ \ assert(feat\_n\_stream(fcb)\ ==\ 1);}
\DoxyCodeLine{00635\ \ \ \ \ assert(feat\_stream\_len(fcb,\ 0)\ ==\ feat\_cepsize(fcb)\ *\ 4);}
\DoxyCodeLine{00636\ \ \ \ \ assert(feat\_window\_size(fcb)\ ==\ FEAT\_DCEP\_WIN\ *\ 2);}
\DoxyCodeLine{00637\ }
\DoxyCodeLine{00638\ \ \ \ \ \textcolor{comment}{/*\ CEP\ */}}
\DoxyCodeLine{00639\ \ \ \ \ memcpy(feat[0],\ mfc[0],\ feat\_cepsize(fcb)\ *\ \textcolor{keyword}{sizeof}(mfcc\_t));}
\DoxyCodeLine{00640\ }
\DoxyCodeLine{00641\ \ \ \ \ \textcolor{comment}{/*}}
\DoxyCodeLine{00642\ \textcolor{comment}{\ \ \ \ \ *\ DCEP:\ mfc[w]\ -\/\ mfc[-\/w],\ where\ w\ =\ FEAT\_DCEP\_WIN;}}
\DoxyCodeLine{00643\ \textcolor{comment}{\ \ \ \ \ */}}
\DoxyCodeLine{00644\ \ \ \ \ f\ =\ feat[0]\ +\ feat\_cepsize(fcb);}
\DoxyCodeLine{00645\ \ \ \ \ w\ =\ mfc[FEAT\_DCEP\_WIN];}
\DoxyCodeLine{00646\ \ \ \ \ \_w\ =\ mfc[-\/FEAT\_DCEP\_WIN];}
\DoxyCodeLine{00647\ }
\DoxyCodeLine{00648\ \ \ \ \ \textcolor{keywordflow}{for}\ (i\ =\ 0;\ i\ <\ feat\_cepsize(fcb);\ i++)}
\DoxyCodeLine{00649\ \ \ \ \ \ \ \ \ f[i]\ =\ w[i]\ -\/\ \_w[i];}
\DoxyCodeLine{00650\ }
\DoxyCodeLine{00651\ \ \ \ \ \textcolor{comment}{/*}}
\DoxyCodeLine{00652\ \textcolor{comment}{\ \ \ \ \ *\ LDCEP:\ mfc[w]\ -\/\ mfc[-\/w],\ where\ w\ =\ FEAT\_DCEP\_WIN\ *\ 2;}}
\DoxyCodeLine{00653\ \textcolor{comment}{\ \ \ \ \ */}}
\DoxyCodeLine{00654\ \ \ \ \ f\ +=\ feat\_cepsize(fcb);}
\DoxyCodeLine{00655\ \ \ \ \ w\ =\ mfc[FEAT\_DCEP\_WIN\ *\ 2];}
\DoxyCodeLine{00656\ \ \ \ \ \_w\ =\ mfc[-\/FEAT\_DCEP\_WIN\ *\ 2];}
\DoxyCodeLine{00657\ }
\DoxyCodeLine{00658\ \ \ \ \ \textcolor{keywordflow}{for}\ (i\ =\ 0;\ i\ <\ feat\_cepsize(fcb);\ i++)}
\DoxyCodeLine{00659\ \ \ \ \ \ \ \ \ f[i]\ =\ w[i]\ -\/\ \_w[i];}
\DoxyCodeLine{00660\ }
\DoxyCodeLine{00661\ \ \ \ \ \textcolor{comment}{/*\ }}
\DoxyCodeLine{00662\ \textcolor{comment}{\ \ \ \ \ *\ D2CEP:\ (mfc[w+1]\ -\/\ mfc[-\/w+1])\ -\/\ (mfc[w-\/1]\ -\/\ mfc[-\/w-\/1]),\ }}
\DoxyCodeLine{00663\ \textcolor{comment}{\ \ \ \ \ *\ where\ w\ =\ FEAT\_DCEP\_WIN\ }}
\DoxyCodeLine{00664\ \textcolor{comment}{\ \ \ \ \ */}}
\DoxyCodeLine{00665\ \ \ \ \ f\ +=\ feat\_cepsize(fcb);}
\DoxyCodeLine{00666\ }
\DoxyCodeLine{00667\ \ \ \ \ w1\ =\ mfc[FEAT\_DCEP\_WIN\ +\ 1];}
\DoxyCodeLine{00668\ \ \ \ \ \_w1\ =\ mfc[-\/FEAT\_DCEP\_WIN\ +\ 1];}
\DoxyCodeLine{00669\ \ \ \ \ w\_1\ =\ mfc[FEAT\_DCEP\_WIN\ -\/\ 1];}
\DoxyCodeLine{00670\ \ \ \ \ \_w\_1\ =\ mfc[-\/FEAT\_DCEP\_WIN\ -\/\ 1];}
\DoxyCodeLine{00671\ }
\DoxyCodeLine{00672\ \ \ \ \ \textcolor{keywordflow}{for}\ (i\ =\ 0;\ i\ <\ feat\_cepsize(fcb);\ i++)\ \{}
\DoxyCodeLine{00673\ \ \ \ \ \ \ \ \ d1\ =\ w1[i]\ -\/\ \_w1[i];}
\DoxyCodeLine{00674\ \ \ \ \ \ \ \ \ d2\ =\ w\_1[i]\ -\/\ \_w\_1[i];}
\DoxyCodeLine{00675\ }
\DoxyCodeLine{00676\ \ \ \ \ \ \ \ \ f[i]\ =\ d1\ -\/\ d2;}
\DoxyCodeLine{00677\ \ \ \ \ \}}
\DoxyCodeLine{00678\ \}}
\DoxyCodeLine{00679\ }
\DoxyCodeLine{00680\ \textcolor{keyword}{static}\ \textcolor{keywordtype}{void}}
\DoxyCodeLine{00681\ feat\_copy(feat\_t\ *\ fcb,\ mfcc\_t\ **\ mfc,\ mfcc\_t\ **\ feat)}
\DoxyCodeLine{00682\ \{}
\DoxyCodeLine{00683\ \ \ \ \ int32\ win,\ i,\ j;}
\DoxyCodeLine{00684\ }
\DoxyCodeLine{00685\ \ \ \ \ win\ =\ feat\_window\_size(fcb);}
\DoxyCodeLine{00686\ }
\DoxyCodeLine{00687\ \ \ \ \ \textcolor{comment}{/*\ Concatenate\ input\ features\ */}}
\DoxyCodeLine{00688\ \ \ \ \ \textcolor{keywordflow}{for}\ (i\ =\ -\/win;\ i\ <=\ win;\ ++i)\ \{}
\DoxyCodeLine{00689\ \ \ \ \ \ \ \ \ uint32\ spos\ =\ 0;}
\DoxyCodeLine{00690\ }
\DoxyCodeLine{00691\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{for}\ (j\ =\ 0;\ j\ <\ feat\_n\_stream(fcb);\ ++j)\ \{}
\DoxyCodeLine{00692\ \ \ \ \ \ \ \ \ \ \ \ \ uint32\ stream\_len;}
\DoxyCodeLine{00693\ }
\DoxyCodeLine{00694\ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{comment}{/*\ Unscale\ the\ stream\ length\ by\ the\ window.\ */}}
\DoxyCodeLine{00695\ \ \ \ \ \ \ \ \ \ \ \ \ stream\_len\ =\ feat\_stream\_len(fcb,\ j)\ /\ (2\ *\ win\ +\ 1);}
\DoxyCodeLine{00696\ \ \ \ \ \ \ \ \ \ \ \ \ memcpy(feat[j]\ +\ ((i\ +\ win)\ *\ stream\_len),}
\DoxyCodeLine{00697\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ mfc[i]\ +\ spos,}
\DoxyCodeLine{00698\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ stream\_len\ *\ \textcolor{keyword}{sizeof}(mfcc\_t));}
\DoxyCodeLine{00699\ \ \ \ \ \ \ \ \ \ \ \ \ spos\ +=\ stream\_len;}
\DoxyCodeLine{00700\ \ \ \ \ \ \ \ \ \}}
\DoxyCodeLine{00701\ \ \ \ \ \}}
\DoxyCodeLine{00702\ \}}
\DoxyCodeLine{00703\ }
\DoxyCodeLine{00704\ feat\_t\ *}
\DoxyCodeLine{00705\ feat\_init(\textcolor{keywordtype}{char}\ \textcolor{keyword}{const}\ *type,\ cmn\_type\_t\ cmn,\ int32\ varnorm,}
\DoxyCodeLine{00706\ \ \ \ \ \ \ \ \ \ \ agc\_type\_t\ agc,\ int32\ breport,\ int32\ cepsize)}
\DoxyCodeLine{00707\ \{}
\DoxyCodeLine{00708\ \ \ \ \ feat\_t\ *fcb;}
\DoxyCodeLine{00709\ }
\DoxyCodeLine{00710\ \ \ \ \ \textcolor{keywordflow}{if}\ (cepsize\ ==\ 0)}
\DoxyCodeLine{00711\ \ \ \ \ \ \ \ \ cepsize\ =\ 13;}
\DoxyCodeLine{00712\ \ \ \ \ \textcolor{keywordflow}{if}\ (breport)}
\DoxyCodeLine{00713\ \ \ \ \ \ \ \ \ E\_INFO}
\DoxyCodeLine{00714\ \ \ \ \ \ \ \ \ \ \ \ \ (\textcolor{stringliteral}{"{}Initializing\ feature\ stream\ to\ type:\ '\%s',\ ceplen=\%d,\ CMN='\%s',\ VARNORM='\%s',\ AGC='\%s'\(\backslash\)n"{}},}
\DoxyCodeLine{00715\ \ \ \ \ \ \ \ \ \ \ \ \ \ type,\ cepsize,\ cmn\_type\_str[cmn],\ varnorm\ ?\ \textcolor{stringliteral}{"{}yes"{}}\ :\ \textcolor{stringliteral}{"{}no"{}},\ agc\_type\_str[agc]);}
\DoxyCodeLine{00716\ }
\DoxyCodeLine{00717\ \ \ \ \ fcb\ =\ (feat\_t\ *)\ ckd\_calloc(1,\ \textcolor{keyword}{sizeof}(feat\_t));}
\DoxyCodeLine{00718\ \ \ \ \ fcb-\/>refcount\ =\ 1;}
\DoxyCodeLine{00719\ \ \ \ \ fcb-\/>name\ =\ (\textcolor{keywordtype}{char}\ *)\ ckd\_salloc(type);}
\DoxyCodeLine{00720\ \ \ \ \ \textcolor{keywordflow}{if}\ (strcmp(type,\ \textcolor{stringliteral}{"{}s2\_4x"{}})\ ==\ 0)\ \{}
\DoxyCodeLine{00721\ \ \ \ \ \ \ \ \ \textcolor{comment}{/*\ Sphinx-\/II\ format\ 4-\/stream\ feature\ (Hack!!\ hardwired\ constants\ below)\ */}}
\DoxyCodeLine{00722\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{if}\ (cepsize\ !=\ 13)\ \{}
\DoxyCodeLine{00723\ \ \ \ \ \ \ \ \ \ \ \ \ E\_ERROR(\textcolor{stringliteral}{"{}s2\_4x\ features\ require\ cepsize\ ==\ 13\(\backslash\)n"{}});}
\DoxyCodeLine{00724\ \ \ \ \ \ \ \ \ \ \ \ \ ckd\_free(fcb);}
\DoxyCodeLine{00725\ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{return}\ NULL;}
\DoxyCodeLine{00726\ \ \ \ \ \ \ \ \ \}}
\DoxyCodeLine{00727\ \ \ \ \ \ \ \ \ fcb-\/>cepsize\ =\ 13;}
\DoxyCodeLine{00728\ \ \ \ \ \ \ \ \ fcb-\/>n\_stream\ =\ 4;}
\DoxyCodeLine{00729\ \ \ \ \ \ \ \ \ fcb-\/>stream\_len\ =\ (uint32\ *)\ ckd\_calloc(4,\ \textcolor{keyword}{sizeof}(uint32));}
\DoxyCodeLine{00730\ \ \ \ \ \ \ \ \ fcb-\/>stream\_len[0]\ =\ 12;}
\DoxyCodeLine{00731\ \ \ \ \ \ \ \ \ fcb-\/>stream\_len[1]\ =\ 24;}
\DoxyCodeLine{00732\ \ \ \ \ \ \ \ \ fcb-\/>stream\_len[2]\ =\ 3;}
\DoxyCodeLine{00733\ \ \ \ \ \ \ \ \ fcb-\/>stream\_len[3]\ =\ 12;}
\DoxyCodeLine{00734\ \ \ \ \ \ \ \ \ fcb-\/>out\_dim\ =\ 51;}
\DoxyCodeLine{00735\ \ \ \ \ \ \ \ \ fcb-\/>window\_size\ =\ 4;}
\DoxyCodeLine{00736\ \ \ \ \ \ \ \ \ fcb-\/>compute\_feat\ =\ feat\_s2\_4x\_cep2feat;}
\DoxyCodeLine{00737\ \ \ \ \ \}}
\DoxyCodeLine{00738\ \ \ \ \ \textcolor{keywordflow}{else}\ \textcolor{keywordflow}{if}\ ((strcmp(type,\ \textcolor{stringliteral}{"{}s3\_1x39"{}})\ ==\ 0)\ ||\ (strcmp(type,\ \textcolor{stringliteral}{"{}1s\_12c\_12d\_3p\_12dd"{}})\ ==\ 0))\ \{}
\DoxyCodeLine{00739\ \ \ \ \ \ \ \ \ \textcolor{comment}{/*\ 1-\/stream\ cep/dcep/pow/ddcep\ (Hack!!\ hardwired\ constants\ below)\ */}}
\DoxyCodeLine{00740\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{if}\ (cepsize\ !=\ 13)\ \{}
\DoxyCodeLine{00741\ \ \ \ \ \ \ \ \ \ \ \ \ E\_ERROR(\textcolor{stringliteral}{"{}s2\_4x\ features\ require\ cepsize\ ==\ 13\(\backslash\)n"{}});}
\DoxyCodeLine{00742\ \ \ \ \ \ \ \ \ \ \ \ \ ckd\_free(fcb);}
\DoxyCodeLine{00743\ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{return}\ NULL;}
\DoxyCodeLine{00744\ \ \ \ \ \ \ \ \ \}}
\DoxyCodeLine{00745\ \ \ \ \ \ \ \ \ fcb-\/>cepsize\ =\ 13;}
\DoxyCodeLine{00746\ \ \ \ \ \ \ \ \ fcb-\/>n\_stream\ =\ 1;}
\DoxyCodeLine{00747\ \ \ \ \ \ \ \ \ fcb-\/>stream\_len\ =\ (uint32\ *)\ ckd\_calloc(1,\ \textcolor{keyword}{sizeof}(uint32));}
\DoxyCodeLine{00748\ \ \ \ \ \ \ \ \ fcb-\/>stream\_len[0]\ =\ 39;}
\DoxyCodeLine{00749\ \ \ \ \ \ \ \ \ fcb-\/>out\_dim\ =\ 39;}
\DoxyCodeLine{00750\ \ \ \ \ \ \ \ \ fcb-\/>window\_size\ =\ 3;}
\DoxyCodeLine{00751\ \ \ \ \ \ \ \ \ fcb-\/>compute\_feat\ =\ feat\_s3\_1x39\_cep2feat;}
\DoxyCodeLine{00752\ \ \ \ \ \}}
\DoxyCodeLine{00753\ \ \ \ \ \textcolor{keywordflow}{else}\ \textcolor{keywordflow}{if}\ (strncmp(type,\ \textcolor{stringliteral}{"{}1s\_c\_d\_dd"{}},\ 9)\ ==\ 0)\ \{}
\DoxyCodeLine{00754\ \ \ \ \ \ \ \ \ fcb-\/>cepsize\ =\ cepsize;}
\DoxyCodeLine{00755\ \ \ \ \ \ \ \ \ fcb-\/>n\_stream\ =\ 1;}
\DoxyCodeLine{00756\ \ \ \ \ \ \ \ \ fcb-\/>stream\_len\ =\ (uint32\ *)\ ckd\_calloc(1,\ \textcolor{keyword}{sizeof}(uint32));}
\DoxyCodeLine{00757\ \ \ \ \ \ \ \ \ fcb-\/>stream\_len[0]\ =\ cepsize\ *\ 3;}
\DoxyCodeLine{00758\ \ \ \ \ \ \ \ \ fcb-\/>out\_dim\ =\ cepsize\ *\ 3;}
\DoxyCodeLine{00759\ \ \ \ \ \ \ \ \ fcb-\/>window\_size\ =\ FEAT\_DCEP\_WIN\ +\ 1;\ \textcolor{comment}{/*\ ddcep\ needs\ the\ extra\ 1\ */}}
\DoxyCodeLine{00760\ \ \ \ \ \ \ \ \ fcb-\/>compute\_feat\ =\ feat\_1s\_c\_d\_dd\_cep2feat;}
\DoxyCodeLine{00761\ \ \ \ \ \}}
\DoxyCodeLine{00762\ \ \ \ \ \textcolor{keywordflow}{else}\ \textcolor{keywordflow}{if}\ (strncmp(type,\ \textcolor{stringliteral}{"{}1s\_c\_d\_ld\_dd"{}},\ 12)\ ==\ 0)\ \{}
\DoxyCodeLine{00763\ \ \ \ \ \ \ \ \ fcb-\/>cepsize\ =\ cepsize;}
\DoxyCodeLine{00764\ \ \ \ \ \ \ \ \ fcb-\/>n\_stream\ =\ 1;}
\DoxyCodeLine{00765\ \ \ \ \ \ \ \ \ fcb-\/>stream\_len\ =\ (uint32\ *)\ ckd\_calloc(1,\ \textcolor{keyword}{sizeof}(uint32));}
\DoxyCodeLine{00766\ \ \ \ \ \ \ \ \ fcb-\/>stream\_len[0]\ =\ cepsize\ *\ 4;}
\DoxyCodeLine{00767\ \ \ \ \ \ \ \ \ fcb-\/>out\_dim\ =\ cepsize\ *\ 4;}
\DoxyCodeLine{00768\ \ \ \ \ \ \ \ \ fcb-\/>window\_size\ =\ FEAT\_DCEP\_WIN\ *\ 2;}
\DoxyCodeLine{00769\ \ \ \ \ \ \ \ \ fcb-\/>compute\_feat\ =\ feat\_1s\_c\_d\_ld\_dd\_cep2feat;}
\DoxyCodeLine{00770\ \ \ \ \ \}}
\DoxyCodeLine{00771\ \ \ \ \ \textcolor{keywordflow}{else}\ \textcolor{keywordflow}{if}\ (strncmp(type,\ \textcolor{stringliteral}{"{}cep\_dcep"{}},\ 8)\ ==\ 0\ ||\ strncmp(type,\ \textcolor{stringliteral}{"{}1s\_c\_d"{}},\ 6)\ ==\ 0)\ \{}
\DoxyCodeLine{00772\ \ \ \ \ \ \ \ \ \textcolor{comment}{/*\ 1-\/stream\ cep/dcep\ */}}
\DoxyCodeLine{00773\ \ \ \ \ \ \ \ \ fcb-\/>cepsize\ =\ cepsize;}
\DoxyCodeLine{00774\ \ \ \ \ \ \ \ \ fcb-\/>n\_stream\ =\ 1;}
\DoxyCodeLine{00775\ \ \ \ \ \ \ \ \ fcb-\/>stream\_len\ =\ (uint32\ *)\ ckd\_calloc(1,\ \textcolor{keyword}{sizeof}(uint32));}
\DoxyCodeLine{00776\ \ \ \ \ \ \ \ \ fcb-\/>stream\_len[0]\ =\ feat\_cepsize(fcb)\ *\ 2;}
\DoxyCodeLine{00777\ \ \ \ \ \ \ \ \ fcb-\/>out\_dim\ =\ fcb-\/>stream\_len[0];}
\DoxyCodeLine{00778\ \ \ \ \ \ \ \ \ fcb-\/>window\_size\ =\ 2;}
\DoxyCodeLine{00779\ \ \ \ \ \ \ \ \ fcb-\/>compute\_feat\ =\ feat\_s3\_cep\_dcep;}
\DoxyCodeLine{00780\ \ \ \ \ \}}
\DoxyCodeLine{00781\ \ \ \ \ \textcolor{keywordflow}{else}\ \textcolor{keywordflow}{if}\ (strncmp(type,\ \textcolor{stringliteral}{"{}cep"{}},\ 3)\ ==\ 0\ ||\ strncmp(type,\ \textcolor{stringliteral}{"{}1s\_c"{}},\ 4)\ ==\ 0)\ \{}
\DoxyCodeLine{00782\ \ \ \ \ \ \ \ \ \textcolor{comment}{/*\ 1-\/stream\ cep\ */}}
\DoxyCodeLine{00783\ \ \ \ \ \ \ \ \ fcb-\/>cepsize\ =\ cepsize;}
\DoxyCodeLine{00784\ \ \ \ \ \ \ \ \ fcb-\/>n\_stream\ =\ 1;}
\DoxyCodeLine{00785\ \ \ \ \ \ \ \ \ fcb-\/>stream\_len\ =\ (uint32\ *)\ ckd\_calloc(1,\ \textcolor{keyword}{sizeof}(uint32));}
\DoxyCodeLine{00786\ \ \ \ \ \ \ \ \ fcb-\/>stream\_len[0]\ =\ feat\_cepsize(fcb);}
\DoxyCodeLine{00787\ \ \ \ \ \ \ \ \ fcb-\/>out\_dim\ =\ fcb-\/>stream\_len[0];}
\DoxyCodeLine{00788\ \ \ \ \ \ \ \ \ fcb-\/>window\_size\ =\ 0;}
\DoxyCodeLine{00789\ \ \ \ \ \ \ \ \ fcb-\/>compute\_feat\ =\ feat\_s3\_cep;}
\DoxyCodeLine{00790\ \ \ \ \ \}}
\DoxyCodeLine{00791\ \ \ \ \ \textcolor{keywordflow}{else}\ \textcolor{keywordflow}{if}\ (strncmp(type,\ \textcolor{stringliteral}{"{}1s\_3c"{}},\ 5)\ ==\ 0\ ||\ strncmp(type,\ \textcolor{stringliteral}{"{}1s\_4c"{}},\ 5)\ ==\ 0)\ \{}
\DoxyCodeLine{00792\ \ \ \ \ \ \ \ \ \textcolor{comment}{/*\ 1-\/stream\ cep\ with\ frames\ concatenated,\ so\ called\ cepwin\ features\ */}}
\DoxyCodeLine{00793\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{if}\ (strncmp(type,\ \textcolor{stringliteral}{"{}1s\_3c"{}},\ 5)\ ==\ 0)}
\DoxyCodeLine{00794\ \ \ \ \ \ \ \ \ \ \ \ \ fcb-\/>window\_size\ =\ 3;}
\DoxyCodeLine{00795\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{else}}
\DoxyCodeLine{00796\ \ \ \ \ \ \ \ \ \ \ \ \ fcb-\/>window\_size\ =\ 4;}
\DoxyCodeLine{00797\ }
\DoxyCodeLine{00798\ \ \ \ \ \ \ \ \ fcb-\/>cepsize\ =\ cepsize;}
\DoxyCodeLine{00799\ \ \ \ \ \ \ \ \ fcb-\/>n\_stream\ =\ 1;}
\DoxyCodeLine{00800\ \ \ \ \ \ \ \ \ fcb-\/>stream\_len\ =\ (uint32\ *)\ ckd\_calloc(1,\ \textcolor{keyword}{sizeof}(uint32));}
\DoxyCodeLine{00801\ \ \ \ \ \ \ \ \ fcb-\/>stream\_len[0]\ =\ feat\_cepsize(fcb)\ *\ (2\ *\ fcb-\/>window\_size\ +\ 1);}
\DoxyCodeLine{00802\ \ \ \ \ \ \ \ \ fcb-\/>out\_dim\ =\ fcb-\/>stream\_len[0];}
\DoxyCodeLine{00803\ \ \ \ \ \ \ \ \ fcb-\/>compute\_feat\ =\ feat\_copy;}
\DoxyCodeLine{00804\ \ \ \ \ \}}
\DoxyCodeLine{00805\ \ \ \ \ \textcolor{keywordflow}{else}\ \{}
\DoxyCodeLine{00806\ \ \ \ \ \ \ \ \ int32\ i,\ l,\ k;}
\DoxyCodeLine{00807\ \ \ \ \ \ \ \ \ \textcolor{keywordtype}{char}\ *strp;}
\DoxyCodeLine{00808\ \ \ \ \ \ \ \ \ \textcolor{keywordtype}{char}\ *mtype\ =\ ckd\_salloc(type);}
\DoxyCodeLine{00809\ \ \ \ \ \ \ \ \ \textcolor{keywordtype}{char}\ *wd\ =\ ckd\_salloc(type);}
\DoxyCodeLine{00810\ \ \ \ \ \ \ \ \ \textcolor{comment}{/*}}
\DoxyCodeLine{00811\ \textcolor{comment}{\ \ \ \ \ \ \ \ \ *\ Generic\ definition:\ Format\ should\ be\ \%d,\%d,\%d,...,\%d\ (i.e.,}}
\DoxyCodeLine{00812\ \textcolor{comment}{\ \ \ \ \ \ \ \ \ *\ comma\ separated\ list\ of\ feature\ stream\ widths;\ \#items\ =}}
\DoxyCodeLine{00813\ \textcolor{comment}{\ \ \ \ \ \ \ \ \ *\ \#streams).\ \ An\ optional\ window\ size\ (frames\ will\ be}}
\DoxyCodeLine{00814\ \textcolor{comment}{\ \ \ \ \ \ \ \ \ *\ concatenated)\ is\ also\ allowed,\ which\ can\ be\ specified\ with}}
\DoxyCodeLine{00815\ \textcolor{comment}{\ \ \ \ \ \ \ \ \ *\ a\ colon\ after\ the\ list\ of\ feature\ streams.}}
\DoxyCodeLine{00816\ \textcolor{comment}{\ \ \ \ \ \ \ \ \ */}}
\DoxyCodeLine{00817\ \ \ \ \ \ \ \ \ l\ =\ strlen(mtype);}
\DoxyCodeLine{00818\ \ \ \ \ \ \ \ \ k\ =\ 0;}
\DoxyCodeLine{00819\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{for}\ (i\ =\ 1;\ i\ <\ l\ -\/\ 1;\ i++)\ \{}
\DoxyCodeLine{00820\ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{if}\ (mtype[i]\ ==\ \textcolor{charliteral}{','})\ \{}
\DoxyCodeLine{00821\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ mtype[i]\ =\ \textcolor{charliteral}{'\ '};}
\DoxyCodeLine{00822\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ k++;}
\DoxyCodeLine{00823\ \ \ \ \ \ \ \ \ \ \ \ \ \}}
\DoxyCodeLine{00824\ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{else}\ \textcolor{keywordflow}{if}\ (mtype[i]\ ==\ \textcolor{charliteral}{':'})\ \{}
\DoxyCodeLine{00825\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ mtype[i]\ =\ \textcolor{charliteral}{'\(\backslash\)0'};}
\DoxyCodeLine{00826\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ fcb-\/>window\_size\ =\ atoi(mtype\ +\ i\ +\ 1);}
\DoxyCodeLine{00827\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{break};}
\DoxyCodeLine{00828\ \ \ \ \ \ \ \ \ \ \ \ \ \}}
\DoxyCodeLine{00829\ \ \ \ \ \ \ \ \ \}}
\DoxyCodeLine{00830\ \ \ \ \ \ \ \ \ k++;\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{comment}{/*\ Presumably\ there\ are\ (\#commas+1)\ streams\ */}}
\DoxyCodeLine{00831\ \ \ \ \ \ \ \ \ fcb-\/>n\_stream\ =\ k;}
\DoxyCodeLine{00832\ \ \ \ \ \ \ \ \ fcb-\/>stream\_len\ =\ (uint32\ *)\ ckd\_calloc(k,\ \textcolor{keyword}{sizeof}(uint32));}
\DoxyCodeLine{00833\ }
\DoxyCodeLine{00834\ \ \ \ \ \ \ \ \ \textcolor{comment}{/*\ Scan\ individual\ feature\ stream\ lengths\ */}}
\DoxyCodeLine{00835\ \ \ \ \ \ \ \ \ strp\ =\ mtype;}
\DoxyCodeLine{00836\ \ \ \ \ \ \ \ \ i\ =\ 0;}
\DoxyCodeLine{00837\ \ \ \ \ \ \ \ \ fcb-\/>out\_dim\ =\ 0;}
\DoxyCodeLine{00838\ \ \ \ \ \ \ \ \ fcb-\/>cepsize\ =\ 0;}
\DoxyCodeLine{00839\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{while}\ (sscanf(strp,\ \textcolor{stringliteral}{"{}\%s\%n"{}},\ wd,\ \&l)\ ==\ 1)\ \{}
\DoxyCodeLine{00840\ \ \ \ \ \ \ \ \ \ \ \ \ strp\ +=\ l;}
\DoxyCodeLine{00841\ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{if}\ ((i\ >=\ fcb-\/>n\_stream)}
\DoxyCodeLine{00842\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ ||\ (sscanf(wd,\ \textcolor{stringliteral}{"{}\%d"{}},\ \&(fcb-\/>stream\_len[i]))\ !=\ 1)}
\DoxyCodeLine{00843\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ ||\ (fcb-\/>stream\_len[i]\ <=\ 0))}
\DoxyCodeLine{00844\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ E\_FATAL(\textcolor{stringliteral}{"{}Bad\ feature\ type\ argument\(\backslash\)n"{}});}
\DoxyCodeLine{00845\ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{comment}{/*\ Input\ size\ before\ windowing\ */}}
\DoxyCodeLine{00846\ \ \ \ \ \ \ \ \ \ \ \ \ fcb-\/>cepsize\ +=\ fcb-\/>stream\_len[i];}
\DoxyCodeLine{00847\ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{if}\ (fcb-\/>window\_size\ >\ 0)}
\DoxyCodeLine{00848\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ fcb-\/>stream\_len[i]\ *=\ (fcb-\/>window\_size\ *\ 2\ +\ 1);}
\DoxyCodeLine{00849\ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{comment}{/*\ Output\ size\ after\ windowing\ */}}
\DoxyCodeLine{00850\ \ \ \ \ \ \ \ \ \ \ \ \ fcb-\/>out\_dim\ +=\ fcb-\/>stream\_len[i];}
\DoxyCodeLine{00851\ \ \ \ \ \ \ \ \ \ \ \ \ i++;}
\DoxyCodeLine{00852\ \ \ \ \ \ \ \ \ \}}
\DoxyCodeLine{00853\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{if}\ (i\ !=\ fcb-\/>n\_stream)}
\DoxyCodeLine{00854\ \ \ \ \ \ \ \ \ \ \ \ \ E\_FATAL(\textcolor{stringliteral}{"{}Bad\ feature\ type\ argument\(\backslash\)n"{}});}
\DoxyCodeLine{00855\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{if}\ (fcb-\/>cepsize\ !=\ cepsize)}
\DoxyCodeLine{00856\ \ \ \ \ \ \ \ \ \ \ \ \ E\_FATAL(\textcolor{stringliteral}{"{}Bad\ feature\ type\ argument\(\backslash\)n"{}});}
\DoxyCodeLine{00857\ }
\DoxyCodeLine{00858\ \ \ \ \ \ \ \ \ \textcolor{comment}{/*\ Input\ is\ already\ the\ feature\ stream\ */}}
\DoxyCodeLine{00859\ \ \ \ \ \ \ \ \ fcb-\/>compute\_feat\ =\ feat\_copy;}
\DoxyCodeLine{00860\ \ \ \ \ \ \ \ \ ckd\_free(mtype);}
\DoxyCodeLine{00861\ \ \ \ \ \ \ \ \ ckd\_free(wd);}
\DoxyCodeLine{00862\ \ \ \ \ \}}
\DoxyCodeLine{00863\ }
\DoxyCodeLine{00864\ \ \ \ \ \textcolor{keywordflow}{if}\ (cmn\ !=\ CMN\_NONE)}
\DoxyCodeLine{00865\ \ \ \ \ \ \ \ \ fcb-\/>cmn\_struct\ =\ cmn\_init(feat\_cepsize(fcb));}
\DoxyCodeLine{00866\ \ \ \ \ fcb-\/>cmn\ =\ cmn;}
\DoxyCodeLine{00867\ \ \ \ \ fcb-\/>varnorm\ =\ varnorm;}
\DoxyCodeLine{00868\ \ \ \ \ \textcolor{keywordflow}{if}\ (agc\ !=\ AGC\_NONE)\ \{}
\DoxyCodeLine{00869\ \ \ \ \ \ \ \ \ fcb-\/>agc\_struct\ =\ agc\_init();}
\DoxyCodeLine{00870\ \ \ \ \ \ \ \ \ \textcolor{comment}{/*}}
\DoxyCodeLine{00871\ \textcolor{comment}{\ \ \ \ \ \ \ \ \ *\ No\ need\ to\ check\ if\ agc\ is\ set\ to\ EMAX;\ agc\_emax\_set()\ changes\ only\ emax\ related\ things}}
\DoxyCodeLine{00872\ \textcolor{comment}{\ \ \ \ \ \ \ \ \ *\ Moreover,\ if\ agc\ is\ not\ NONE\ and\ block\ mode\ is\ used,\ feat\_agc()\ SILENTLY}}
\DoxyCodeLine{00873\ \textcolor{comment}{\ \ \ \ \ \ \ \ \ *\ switches\ to\ EMAX}}
\DoxyCodeLine{00874\ \textcolor{comment}{\ \ \ \ \ \ \ \ \ */}}
\DoxyCodeLine{00875\ \ \ \ \ \ \ \ \ \textcolor{comment}{/*\ HACK:\ hardwired\ initial\ estimates\ based\ on\ use\ of\ CMN\ (from\ Sphinx2)\ */}}
\DoxyCodeLine{00876\ \ \ \ \ \ \ \ \ agc\_emax\_set(fcb-\/>agc\_struct,\ (cmn\ !=\ CMN\_NONE)\ ?\ 5.0\ :\ 10.0);}
\DoxyCodeLine{00877\ \ \ \ \ \}}
\DoxyCodeLine{00878\ \ \ \ \ fcb-\/>agc\ =\ agc;}
\DoxyCodeLine{00879\ \ \ \ \ \textcolor{comment}{/*}}
\DoxyCodeLine{00880\ \textcolor{comment}{\ \ \ \ \ *\ Make\ sure\ this\ buffer\ is\ large\ enough\ to\ be\ used\ in\ feat\_s2mfc2feat\_block\_utt()}}
\DoxyCodeLine{00881\ \textcolor{comment}{\ \ \ \ \ */}}
\DoxyCodeLine{00882\ \ \ \ \ fcb-\/>cepbuf\ =\ (mfcc\_t\ **)\ ckd\_calloc\_2d((LIVEBUFBLOCKSIZE\ <\ feat\_window\_size(fcb)\ *\ 2)\ ?\ feat\_window\_size(fcb)\ *\ 2\ :\ LIVEBUFBLOCKSIZE,}
\DoxyCodeLine{00883\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ feat\_cepsize(fcb),}
\DoxyCodeLine{00884\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keyword}{sizeof}(mfcc\_t));}
\DoxyCodeLine{00885\ \ \ \ \ \textcolor{comment}{/*\ This\ one\ is\ actually\ just\ an\ array\ of\ pointers\ to\ "{}flatten\ out"{}}}
\DoxyCodeLine{00886\ \textcolor{comment}{\ \ \ \ \ *\ wraparounds.\ */}}
\DoxyCodeLine{00887\ \ \ \ \ fcb-\/>tmpcepbuf\ =\ ckd\_calloc(2\ *\ feat\_window\_size(fcb)\ +\ 1,}
\DoxyCodeLine{00888\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keyword}{sizeof}(*fcb-\/>tmpcepbuf));}
\DoxyCodeLine{00889\ }
\DoxyCodeLine{00890\ \ \ \ \ \textcolor{keywordflow}{return}\ fcb;}
\DoxyCodeLine{00891\ \}}
\DoxyCodeLine{00892\ }
\DoxyCodeLine{00893\ }
\DoxyCodeLine{00894\ \textcolor{keywordtype}{void}}
\DoxyCodeLine{00895\ feat\_print(feat\_t\ *\ fcb,\ mfcc\_t\ ***\ feat,\ int32\ nfr,\ FILE\ *\ fp)}
\DoxyCodeLine{00896\ \{}
\DoxyCodeLine{00897\ \ \ \ \ int32\ i,\ j,\ k;}
\DoxyCodeLine{00898\ }
\DoxyCodeLine{00899\ \ \ \ \ \textcolor{keywordflow}{for}\ (i\ =\ 0;\ i\ <\ nfr;\ i++)\ \{}
\DoxyCodeLine{00900\ \ \ \ \ \ \ \ \ fprintf(fp,\ \textcolor{stringliteral}{"{}\%8d:\(\backslash\)n"{}},\ i);}
\DoxyCodeLine{00901\ }
\DoxyCodeLine{00902\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{for}\ (j\ =\ 0;\ j\ <\ feat\_dimension1(fcb);\ j++)\ \{}
\DoxyCodeLine{00903\ \ \ \ \ \ \ \ \ \ \ \ \ fprintf(fp,\ \textcolor{stringliteral}{"{}\(\backslash\)t\%2d:"{}},\ j);}
\DoxyCodeLine{00904\ }
\DoxyCodeLine{00905\ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{for}\ (k\ =\ 0;\ k\ <\ feat\_dimension2(fcb,\ j);\ k++)}
\DoxyCodeLine{00906\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ fprintf(fp,\ \textcolor{stringliteral}{"{}\ \%8.4f"{}},\ MFCC2FLOAT(feat[i][j][k]));}
\DoxyCodeLine{00907\ \ \ \ \ \ \ \ \ \ \ \ \ fprintf(fp,\ \textcolor{stringliteral}{"{}\(\backslash\)n"{}});}
\DoxyCodeLine{00908\ \ \ \ \ \ \ \ \ \}}
\DoxyCodeLine{00909\ \ \ \ \ \}}
\DoxyCodeLine{00910\ }
\DoxyCodeLine{00911\ \ \ \ \ fflush(fp);}
\DoxyCodeLine{00912\ \}}
\DoxyCodeLine{00913\ }
\DoxyCodeLine{00914\ \textcolor{keyword}{static}\ \textcolor{keywordtype}{void}}
\DoxyCodeLine{00915\ feat\_cmn(feat\_t\ *fcb,\ mfcc\_t\ **mfc,\ int32\ nfr,\ int32\ beginutt,\ int32\ endutt)}
\DoxyCodeLine{00916\ \{}
\DoxyCodeLine{00917\ \ \ \ \ cmn\_type\_t\ cmn\_type\ =\ fcb-\/>cmn;}
\DoxyCodeLine{00918\ }
\DoxyCodeLine{00919\ \ \ \ \ \textcolor{keywordflow}{if}\ (!(beginutt\ \&\&\ endutt)}
\DoxyCodeLine{00920\ \ \ \ \ \ \ \ \ \&\&\ cmn\_type\ !=\ CMN\_NONE)\ \textcolor{comment}{/*\ Only\ cmn\_prior\ in\ block\ computation\ mode.\ */}}
\DoxyCodeLine{00921\ \ \ \ \ \ \ \ \ cmn\_type\ =\ CMN\_PRIOR;}
\DoxyCodeLine{00922\ }
\DoxyCodeLine{00923\ \ \ \ \ \textcolor{keywordflow}{switch}\ (cmn\_type)\ \{}
\DoxyCodeLine{00924\ \ \ \ \ \textcolor{keywordflow}{case}\ CMN\_CURRENT:}
\DoxyCodeLine{00925\ \ \ \ \ \ \ \ \ cmn(fcb-\/>cmn\_struct,\ mfc,\ fcb-\/>varnorm,\ nfr);}
\DoxyCodeLine{00926\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{break};}
\DoxyCodeLine{00927\ \ \ \ \ \textcolor{keywordflow}{case}\ CMN\_PRIOR:}
\DoxyCodeLine{00928\ \ \ \ \ \ \ \ \ cmn\_prior(fcb-\/>cmn\_struct,\ mfc,\ fcb-\/>varnorm,\ nfr);}
\DoxyCodeLine{00929\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{if}\ (endutt)}
\DoxyCodeLine{00930\ \ \ \ \ \ \ \ \ \ \ \ \ cmn\_prior\_update(fcb-\/>cmn\_struct);}
\DoxyCodeLine{00931\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{break};}
\DoxyCodeLine{00932\ \ \ \ \ \textcolor{keywordflow}{default}:}
\DoxyCodeLine{00933\ \ \ \ \ \ \ \ \ ;}
\DoxyCodeLine{00934\ \ \ \ \ \}}
\DoxyCodeLine{00935\ \ \ \ \ cep\_dump\_dbg(fcb,\ mfc,\ nfr,\ \textcolor{stringliteral}{"{}After\ CMN"{}});}
\DoxyCodeLine{00936\ \}}
\DoxyCodeLine{00937\ }
\DoxyCodeLine{00938\ \textcolor{keyword}{static}\ \textcolor{keywordtype}{void}}
\DoxyCodeLine{00939\ feat\_agc(feat\_t\ *fcb,\ mfcc\_t\ **mfc,\ int32\ nfr,\ int32\ beginutt,\ int32\ endutt)}
\DoxyCodeLine{00940\ \{}
\DoxyCodeLine{00941\ \ \ \ \ agc\_type\_t\ agc\_type\ =\ fcb-\/>agc;}
\DoxyCodeLine{00942\ }
\DoxyCodeLine{00943\ \ \ \ \ \textcolor{keywordflow}{if}\ (!(beginutt\ \&\&\ endutt)}
\DoxyCodeLine{00944\ \ \ \ \ \ \ \ \ \&\&\ agc\_type\ !=\ AGC\_NONE)\ \textcolor{comment}{/*\ Only\ agc\_emax\ in\ block\ computation\ mode.\ */}}
\DoxyCodeLine{00945\ \ \ \ \ \ \ \ \ agc\_type\ =\ AGC\_EMAX;}
\DoxyCodeLine{00946\ }
\DoxyCodeLine{00947\ \ \ \ \ \textcolor{keywordflow}{switch}\ (agc\_type)\ \{}
\DoxyCodeLine{00948\ \ \ \ \ \textcolor{keywordflow}{case}\ AGC\_MAX:}
\DoxyCodeLine{00949\ \ \ \ \ \ \ \ \ agc\_max(fcb-\/>agc\_struct,\ mfc,\ nfr);}
\DoxyCodeLine{00950\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{break};}
\DoxyCodeLine{00951\ \ \ \ \ \textcolor{keywordflow}{case}\ AGC\_EMAX:}
\DoxyCodeLine{00952\ \ \ \ \ \ \ \ \ agc\_emax(fcb-\/>agc\_struct,\ mfc,\ nfr);}
\DoxyCodeLine{00953\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{if}\ (endutt)}
\DoxyCodeLine{00954\ \ \ \ \ \ \ \ \ \ \ \ \ agc\_emax\_update(fcb-\/>agc\_struct);}
\DoxyCodeLine{00955\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{break};}
\DoxyCodeLine{00956\ \ \ \ \ \textcolor{keywordflow}{case}\ AGC\_NOISE:}
\DoxyCodeLine{00957\ \ \ \ \ \ \ \ \ agc\_noise(fcb-\/>agc\_struct,\ mfc,\ nfr);}
\DoxyCodeLine{00958\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{break};}
\DoxyCodeLine{00959\ \ \ \ \ \textcolor{keywordflow}{default}:}
\DoxyCodeLine{00960\ \ \ \ \ \ \ \ \ ;}
\DoxyCodeLine{00961\ \ \ \ \ \}}
\DoxyCodeLine{00962\ \ \ \ \ cep\_dump\_dbg(fcb,\ mfc,\ nfr,\ \textcolor{stringliteral}{"{}After\ AGC"{}});}
\DoxyCodeLine{00963\ \}}
\DoxyCodeLine{00964\ }
\DoxyCodeLine{00965\ \textcolor{keyword}{static}\ \textcolor{keywordtype}{void}}
\DoxyCodeLine{00966\ feat\_compute\_utt(feat\_t\ *fcb,\ mfcc\_t\ **mfc,\ int32\ nfr,\ int32\ win,\ mfcc\_t\ ***feat)}
\DoxyCodeLine{00967\ \{}
\DoxyCodeLine{00968\ \ \ \ \ int32\ i;}
\DoxyCodeLine{00969\ }
\DoxyCodeLine{00970\ \ \ \ \ cep\_dump\_dbg(fcb,\ mfc,\ nfr,\ \textcolor{stringliteral}{"{}Incoming\ features\ (after\ padding)"{}});}
\DoxyCodeLine{00971\ }
\DoxyCodeLine{00972\ \ \ \ \ \textcolor{comment}{/*\ Create\ feature\ vectors\ */}}
\DoxyCodeLine{00973\ \ \ \ \ \textcolor{keywordflow}{for}\ (i\ =\ win;\ i\ <\ nfr\ -\/\ win;\ i++)\ \{}
\DoxyCodeLine{00974\ \ \ \ \ \ \ \ \ fcb-\/>compute\_feat(fcb,\ mfc\ +\ i,\ feat[i\ -\/\ win]);}
\DoxyCodeLine{00975\ \ \ \ \ \}}
\DoxyCodeLine{00976\ }
\DoxyCodeLine{00977\ \ \ \ \ feat\_print\_dbg(fcb,\ feat,\ nfr\ -\/\ win\ *\ 2,\ \textcolor{stringliteral}{"{}After\ dynamic\ feature\ computation"{}});}
\DoxyCodeLine{00978\ }
\DoxyCodeLine{00979\ \ \ \ \ \textcolor{keywordflow}{if}\ (fcb-\/>lda)\ \{}
\DoxyCodeLine{00980\ \ \ \ \ \ \ \ \ feat\_lda\_transform(fcb,\ feat,\ nfr\ -\/\ win\ *\ 2);}
\DoxyCodeLine{00981\ \ \ \ \ \ \ \ \ feat\_print\_dbg(fcb,\ feat,\ nfr\ -\/\ win\ *\ 2,\ \textcolor{stringliteral}{"{}After\ LDA"{}});}
\DoxyCodeLine{00982\ \ \ \ \ \}}
\DoxyCodeLine{00983\ }
\DoxyCodeLine{00984\ \ \ \ \ \textcolor{keywordflow}{if}\ (fcb-\/>subvecs)\ \{}
\DoxyCodeLine{00985\ \ \ \ \ \ \ \ \ feat\_subvec\_project(fcb,\ feat,\ nfr\ -\/\ win\ *\ 2);}
\DoxyCodeLine{00986\ \ \ \ \ \ \ \ \ feat\_print\_dbg(fcb,\ feat,\ nfr\ -\/\ win\ *\ 2,\ \textcolor{stringliteral}{"{}After\ subvector\ projection"{}});}
\DoxyCodeLine{00987\ \ \ \ \ \}}
\DoxyCodeLine{00988\ \}}
\DoxyCodeLine{00989\ }
\DoxyCodeLine{00990\ }
\DoxyCodeLine{01003\ \textcolor{keyword}{static}\ int32}
\DoxyCodeLine{01004\ feat\_s2mfc\_read\_norm\_pad(feat\_t\ *fcb,\ \textcolor{keywordtype}{char}\ *file,\ int32\ win,}
\DoxyCodeLine{01005\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ int32\ sf,\ int32\ ef,}
\DoxyCodeLine{01006\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ mfcc\_t\ ***out\_mfc,}
\DoxyCodeLine{01007\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ int32\ maxfr,}
\DoxyCodeLine{01008\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ int32\ cepsize)}
\DoxyCodeLine{01009\ \{}
\DoxyCodeLine{01010\ \ \ \ \ FILE\ *fp;}
\DoxyCodeLine{01011\ \ \ \ \ int32\ n\_float32;}
\DoxyCodeLine{01012\ \ \ \ \ float32\ *float\_feat;}
\DoxyCodeLine{01013\ \ \ \ \ \textcolor{keyword}{struct\ }stat\ statbuf;}
\DoxyCodeLine{01014\ \ \ \ \ int32\ i,\ n,\ byterev;}
\DoxyCodeLine{01015\ \ \ \ \ int32\ start\_pad,\ end\_pad;}
\DoxyCodeLine{01016\ \ \ \ \ mfcc\_t\ **mfc;}
\DoxyCodeLine{01017\ }
\DoxyCodeLine{01018\ \ \ \ \ \textcolor{comment}{/*\ Initialize\ the\ output\ pointer\ to\ NULL,\ so\ that\ any\ attempts\ to}}
\DoxyCodeLine{01019\ \textcolor{comment}{\ \ \ \ \ \ \ free()\ it\ if\ we\ fail\ before\ allocating\ it\ will\ not\ segfault!\ */}}
\DoxyCodeLine{01020\ \ \ \ \ \textcolor{keywordflow}{if}\ (out\_mfc)}
\DoxyCodeLine{01021\ \ \ \ \ \ \ \ \ *out\_mfc\ =\ NULL;}
\DoxyCodeLine{01022\ \ \ \ \ E\_INFO(\textcolor{stringliteral}{"{}Reading\ mfc\ file:\ '\%s'[\%d..\%d]\(\backslash\)n"{}},\ file,\ sf,\ ef);}
\DoxyCodeLine{01023\ \ \ \ \ \textcolor{keywordflow}{if}\ (ef\ >=\ 0\ \&\&\ ef\ <=\ sf)\ \{}
\DoxyCodeLine{01024\ \ \ \ \ \ \ \ \ E\_ERROR(\textcolor{stringliteral}{"{}\%s:\ End\ frame\ (\%d)\ <=\ Start\ frame\ (\%d)\(\backslash\)n"{}},\ file,\ ef,\ sf);}
\DoxyCodeLine{01025\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{return}\ -\/1;}
\DoxyCodeLine{01026\ \ \ \ \ \}}
\DoxyCodeLine{01027\ }
\DoxyCodeLine{01028\ \ \ \ \ \textcolor{comment}{/*\ Find\ filesize;\ HACK!!\ To\ get\ around\ intermittent\ NFS\ failures,\ use\ stat\_retry\ */}}
\DoxyCodeLine{01029\ \ \ \ \ \textcolor{keywordflow}{if}\ ((stat\_retry(file,\ \&statbuf)\ <\ 0)}
\DoxyCodeLine{01030\ \ \ \ \ \ \ \ \ ||\ ((fp\ =\ fopen(file,\ \textcolor{stringliteral}{"{}rb"{}}))\ ==\ NULL))\ \{}
\DoxyCodeLine{01031\ \ \ \ \ \ \ \ \ E\_ERROR(\textcolor{stringliteral}{"{}Failed\ to\ open\ file\ '\%s'\ for\ reading:\ \%s\(\backslash\)n"{}},\ file,\ strerror(errno));}
\DoxyCodeLine{01032\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{return}\ -\/1;}
\DoxyCodeLine{01033\ \ \ \ \ \}}
\DoxyCodeLine{01034\ }
\DoxyCodeLine{01035\ \ \ \ \ \textcolor{comment}{/*\ Read\ \#floats\ in\ header\ */}}
\DoxyCodeLine{01036\ \ \ \ \ \textcolor{keywordflow}{if}\ (fread\_retry(\&n\_float32,\ \textcolor{keyword}{sizeof}(int32),\ 1,\ fp)\ !=\ 1)\ \{}
\DoxyCodeLine{01037\ \ \ \ \ \ \ \ \ E\_ERROR(\textcolor{stringliteral}{"{}\%s:\ fread(\#floats)\ failed\(\backslash\)n"{}},\ file);}
\DoxyCodeLine{01038\ \ \ \ \ \ \ \ \ fclose(fp);}
\DoxyCodeLine{01039\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{return}\ -\/1;}
\DoxyCodeLine{01040\ \ \ \ \ \}}
\DoxyCodeLine{01041\ }
\DoxyCodeLine{01042\ \ \ \ \ \textcolor{comment}{/*\ Check\ if\ n\_float32\ matches\ file\ size\ */}}
\DoxyCodeLine{01043\ \ \ \ \ byterev\ =\ 0;}
\DoxyCodeLine{01044\ \ \ \ \ \textcolor{keywordflow}{if}\ ((int32)\ (n\_float32\ *\ \textcolor{keyword}{sizeof}(float32)\ +\ 4)\ !=\ (int32)\ statbuf.st\_size)\ \{\ \textcolor{comment}{/*\ RAH,\ typecast\ both\ sides\ to\ remove\ compile\ warning\ */}}
\DoxyCodeLine{01045\ \ \ \ \ \ \ \ \ n\ =\ n\_float32;}
\DoxyCodeLine{01046\ \ \ \ \ \ \ \ \ SWAP\_INT32(\&n);}
\DoxyCodeLine{01047\ }
\DoxyCodeLine{01048\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{if}\ ((int32)\ (n\ *\ \textcolor{keyword}{sizeof}(float32)\ +\ 4)\ !=\ (int32)\ (statbuf.st\_size))\ \{\ \ \ \textcolor{comment}{/*\ RAH,\ typecast\ both\ sides\ to\ remove\ compile\ warning\ */}}
\DoxyCodeLine{01049\ \ \ \ \ \ \ \ \ \ \ \ \ E\_ERROR}
\DoxyCodeLine{01050\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ (\textcolor{stringliteral}{"{}\%s:\ Header\ size\ field:\ \%d(\%08x);\ filesize:\ \%d(\%08x)\(\backslash\)n"{}},}
\DoxyCodeLine{01051\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ file,\ n\_float32,\ n\_float32,\ statbuf.st\_size,}
\DoxyCodeLine{01052\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ statbuf.st\_size);}
\DoxyCodeLine{01053\ \ \ \ \ \ \ \ \ \ \ \ \ fclose(fp);}
\DoxyCodeLine{01054\ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{return}\ -\/1;}
\DoxyCodeLine{01055\ \ \ \ \ \ \ \ \ \}}
\DoxyCodeLine{01056\ }
\DoxyCodeLine{01057\ \ \ \ \ \ \ \ \ n\_float32\ =\ n;}
\DoxyCodeLine{01058\ \ \ \ \ \ \ \ \ byterev\ =\ 1;}
\DoxyCodeLine{01059\ \ \ \ \ \}}
\DoxyCodeLine{01060\ \ \ \ \ \textcolor{keywordflow}{if}\ (n\_float32\ <=\ 0)\ \{}
\DoxyCodeLine{01061\ \ \ \ \ \ \ \ \ E\_ERROR(\textcolor{stringliteral}{"{}\%s:\ Header\ size\ field\ (\#floats)\ =\ \%d\(\backslash\)n"{}},\ file,\ n\_float32);}
\DoxyCodeLine{01062\ \ \ \ \ \ \ \ \ fclose(fp);}
\DoxyCodeLine{01063\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{return}\ -\/1;}
\DoxyCodeLine{01064\ \ \ \ \ \}}
\DoxyCodeLine{01065\ }
\DoxyCodeLine{01066\ \ \ \ \ \textcolor{comment}{/*\ Convert\ n\ to\ \#frames\ of\ input\ */}}
\DoxyCodeLine{01067\ \ \ \ \ n\ =\ n\_float32\ /\ cepsize;}
\DoxyCodeLine{01068\ \ \ \ \ \textcolor{keywordflow}{if}\ (n\ *\ cepsize\ !=\ n\_float32)\ \{}
\DoxyCodeLine{01069\ \ \ \ \ \ \ \ \ E\_ERROR(\textcolor{stringliteral}{"{}Header\ size\ field:\ \%d;\ not\ multiple\ of\ \%d\(\backslash\)n"{}},\ n\_float32,}
\DoxyCodeLine{01070\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ cepsize);}
\DoxyCodeLine{01071\ \ \ \ \ \ \ \ \ fclose(fp);}
\DoxyCodeLine{01072\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{return}\ -\/1;}
\DoxyCodeLine{01073\ \ \ \ \ \}}
\DoxyCodeLine{01074\ }
\DoxyCodeLine{01075\ \ \ \ \ \textcolor{comment}{/*\ Check\ start\ and\ end\ frames\ */}}
\DoxyCodeLine{01076\ \ \ \ \ \textcolor{keywordflow}{if}\ (sf\ >\ 0)\ \{}
\DoxyCodeLine{01077\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{if}\ (sf\ >=\ n)\ \{}
\DoxyCodeLine{01078\ \ \ \ \ \ \ \ \ \ \ \ \ E\_ERROR(\textcolor{stringliteral}{"{}\%s:\ Start\ frame\ (\%d)\ beyond\ file\ size\ (\%d)\(\backslash\)n"{}},\ file,}
\DoxyCodeLine{01079\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ sf,\ n);}
\DoxyCodeLine{01080\ \ \ \ \ \ \ \ \ \ \ \ \ fclose(fp);}
\DoxyCodeLine{01081\ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{return}\ -\/1;}
\DoxyCodeLine{01082\ \ \ \ \ \ \ \ \ \}}
\DoxyCodeLine{01083\ \ \ \ \ \}}
\DoxyCodeLine{01084\ \ \ \ \ \textcolor{keywordflow}{if}\ (ef\ <\ 0)}
\DoxyCodeLine{01085\ \ \ \ \ \ \ \ \ ef\ =\ n-\/1;}
\DoxyCodeLine{01086\ \ \ \ \ \textcolor{keywordflow}{else}\ \textcolor{keywordflow}{if}\ (ef\ >=\ n)\ \{}
\DoxyCodeLine{01087\ \ \ \ \ \ \ \ \ E\_WARN(\textcolor{stringliteral}{"{}\%s:\ End\ frame\ (\%d)\ beyond\ file\ size\ (\%d),\ will\ truncate\(\backslash\)n"{}},}
\DoxyCodeLine{01088\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ file,\ ef,\ n);}
\DoxyCodeLine{01089\ \ \ \ \ \ \ \ \ ef\ =\ n-\/1;}
\DoxyCodeLine{01090\ \ \ \ \ \}}
\DoxyCodeLine{01091\ }
\DoxyCodeLine{01092\ \ \ \ \ \textcolor{comment}{/*\ Add\ window\ to\ start\ and\ end\ frames\ */}}
\DoxyCodeLine{01093\ \ \ \ \ sf\ -\/=\ win;}
\DoxyCodeLine{01094\ \ \ \ \ ef\ +=\ win;}
\DoxyCodeLine{01095\ \ \ \ \ \textcolor{keywordflow}{if}\ (sf\ <\ 0)\ \{}
\DoxyCodeLine{01096\ \ \ \ \ \ \ \ \ start\_pad\ =\ -\/sf;}
\DoxyCodeLine{01097\ \ \ \ \ \ \ \ \ sf\ =\ 0;}
\DoxyCodeLine{01098\ \ \ \ \ \}}
\DoxyCodeLine{01099\ \ \ \ \ \textcolor{keywordflow}{else}}
\DoxyCodeLine{01100\ \ \ \ \ \ \ \ \ start\_pad\ =\ 0;}
\DoxyCodeLine{01101\ \ \ \ \ \textcolor{keywordflow}{if}\ (ef\ >=\ n)\ \{}
\DoxyCodeLine{01102\ \ \ \ \ \ \ \ \ end\_pad\ =\ ef\ -\/\ n\ +\ 1;}
\DoxyCodeLine{01103\ \ \ \ \ \ \ \ \ ef\ =\ n\ -\/\ 1;}
\DoxyCodeLine{01104\ \ \ \ \ \}}
\DoxyCodeLine{01105\ \ \ \ \ \textcolor{keywordflow}{else}}
\DoxyCodeLine{01106\ \ \ \ \ \ \ \ \ end\_pad\ =\ 0;}
\DoxyCodeLine{01107\ }
\DoxyCodeLine{01108\ \ \ \ \ \textcolor{comment}{/*\ Limit\ n\ if\ indicated\ by\ [sf..ef]\ */}}
\DoxyCodeLine{01109\ \ \ \ \ \textcolor{keywordflow}{if}\ ((ef\ -\/\ sf\ +\ 1)\ <\ n)}
\DoxyCodeLine{01110\ \ \ \ \ \ \ \ \ n\ =\ (ef\ -\/\ sf\ +\ 1);}
\DoxyCodeLine{01111\ \ \ \ \ \textcolor{keywordflow}{if}\ (maxfr\ >\ 0\ \&\&\ n\ +\ start\_pad\ +\ end\_pad\ >\ maxfr)\ \{}
\DoxyCodeLine{01112\ \ \ \ \ \ \ \ \ E\_ERROR(\textcolor{stringliteral}{"{}\%s:\ Maximum\ output\ size(\%d\ frames)\ <\ actual\ \#frames(\%d)\(\backslash\)n"{}},}
\DoxyCodeLine{01113\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ file,\ maxfr,\ n\ +\ start\_pad\ +\ end\_pad);}
\DoxyCodeLine{01114\ \ \ \ \ \ \ \ \ fclose(fp);}
\DoxyCodeLine{01115\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{return}\ -\/1;}
\DoxyCodeLine{01116\ \ \ \ \ \}}
\DoxyCodeLine{01117\ }
\DoxyCodeLine{01118\ \ \ \ \ \textcolor{comment}{/*\ If\ no\ output\ buffer\ was\ supplied,\ then\ skip\ the\ actual\ data\ reading.\ */}}
\DoxyCodeLine{01119\ \ \ \ \ \textcolor{keywordflow}{if}\ (out\_mfc\ !=\ NULL)\ \{}
\DoxyCodeLine{01120\ \ \ \ \ \ \ \ \ \textcolor{comment}{/*\ Position\ at\ desired\ start\ frame\ and\ read\ actual\ MFC\ data\ */}}
\DoxyCodeLine{01121\ \ \ \ \ \ \ \ \ mfc\ =\ (mfcc\_t\ **)ckd\_calloc\_2d(n\ +\ start\_pad\ +\ end\_pad,\ cepsize,\ \textcolor{keyword}{sizeof}(mfcc\_t));}
\DoxyCodeLine{01122\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{if}\ (sf\ >\ 0)}
\DoxyCodeLine{01123\ \ \ \ \ \ \ \ \ \ \ \ \ fseek(fp,\ sf\ *\ cepsize\ *\ \textcolor{keyword}{sizeof}(float32),\ SEEK\_CUR);}
\DoxyCodeLine{01124\ \ \ \ \ \ \ \ \ n\_float32\ =\ n\ *\ cepsize;}
\DoxyCodeLine{01125\ \textcolor{preprocessor}{\#ifdef\ FIXED\_POINT}}
\DoxyCodeLine{01126\ \ \ \ \ \ \ \ \ float\_feat\ =\ ckd\_calloc(n\_float32,\ \textcolor{keyword}{sizeof}(float32));}
\DoxyCodeLine{01127\ \textcolor{preprocessor}{\#else}}
\DoxyCodeLine{01128\ \ \ \ \ \ \ \ \ float\_feat\ =\ mfc[start\_pad];}
\DoxyCodeLine{01129\ \textcolor{preprocessor}{\#endif}}
\DoxyCodeLine{01130\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{if}\ (fread\_retry(float\_feat,\ \textcolor{keyword}{sizeof}(float32),\ n\_float32,\ fp)\ !=\ n\_float32)\ \{}
\DoxyCodeLine{01131\ \ \ \ \ \ \ \ \ \ \ \ \ E\_ERROR(\textcolor{stringliteral}{"{}\%s:\ fread(\%dx\%d)\ (MFC\ data)\ failed\(\backslash\)n"{}},\ file,\ n,\ cepsize);}
\DoxyCodeLine{01132\ \ \ \ \ \ \ \ \ \ \ \ \ ckd\_free\_2d(mfc);}
\DoxyCodeLine{01133\ \ \ \ \ \ \ \ \ \ \ \ \ fclose(fp);}
\DoxyCodeLine{01134\ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{return}\ -\/1;}
\DoxyCodeLine{01135\ \ \ \ \ \ \ \ \ \}}
\DoxyCodeLine{01136\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{if}\ (byterev)\ \{}
\DoxyCodeLine{01137\ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{for}\ (i\ =\ 0;\ i\ <\ n\_float32;\ i++)\ \{}
\DoxyCodeLine{01138\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ SWAP\_FLOAT32(\&float\_feat[i]);}
\DoxyCodeLine{01139\ \ \ \ \ \ \ \ \ \ \ \ \ \}}
\DoxyCodeLine{01140\ \ \ \ \ \ \ \ \ \}}
\DoxyCodeLine{01141\ \textcolor{preprocessor}{\#ifdef\ FIXED\_POINT}}
\DoxyCodeLine{01142\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{for}\ (i\ =\ 0;\ i\ <\ n\_float32;\ ++i)\ \{}
\DoxyCodeLine{01143\ \ \ \ \ \ \ \ \ \ \ \ \ mfc[start\_pad][i]\ =\ FLOAT2MFCC(float\_feat[i]);}
\DoxyCodeLine{01144\ \ \ \ \ \ \ \ \ \}}
\DoxyCodeLine{01145\ \ \ \ \ \ \ \ \ ckd\_free(float\_feat);}
\DoxyCodeLine{01146\ \textcolor{preprocessor}{\#endif}}
\DoxyCodeLine{01147\ }
\DoxyCodeLine{01148\ \ \ \ \ \ \ \ \ \textcolor{comment}{/*\ Normalize\ */}}
\DoxyCodeLine{01149\ \ \ \ \ \ \ \ \ feat\_cmn(fcb,\ mfc\ +\ start\_pad,\ n,\ 1,\ 1);}
\DoxyCodeLine{01150\ \ \ \ \ \ \ \ \ feat\_agc(fcb,\ mfc\ +\ start\_pad,\ n,\ 1,\ 1);}
\DoxyCodeLine{01151\ }
\DoxyCodeLine{01152\ \ \ \ \ \ \ \ \ \textcolor{comment}{/*\ Replicate\ start\ and\ end\ frames\ if\ necessary.\ */}}
\DoxyCodeLine{01153\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{for}\ (i\ =\ 0;\ i\ <\ start\_pad;\ ++i)}
\DoxyCodeLine{01154\ \ \ \ \ \ \ \ \ \ \ \ \ memcpy(mfc[i],\ mfc[start\_pad],\ cepsize\ *\ \textcolor{keyword}{sizeof}(mfcc\_t));}
\DoxyCodeLine{01155\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{for}\ (i\ =\ 0;\ i\ <\ end\_pad;\ ++i)}
\DoxyCodeLine{01156\ \ \ \ \ \ \ \ \ \ \ \ \ memcpy(mfc[start\_pad\ +\ n\ +\ i],\ mfc[start\_pad\ +\ n\ -\/\ 1],}
\DoxyCodeLine{01157\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ cepsize\ *\ \textcolor{keyword}{sizeof}(mfcc\_t));}
\DoxyCodeLine{01158\ }
\DoxyCodeLine{01159\ \ \ \ \ \ \ \ \ *out\_mfc\ =\ mfc;}
\DoxyCodeLine{01160\ \ \ \ \ \}}
\DoxyCodeLine{01161\ }
\DoxyCodeLine{01162\ \ \ \ \ fclose(fp);}
\DoxyCodeLine{01163\ \ \ \ \ \textcolor{keywordflow}{return}\ n\ +\ start\_pad\ +\ end\_pad;}
\DoxyCodeLine{01164\ \}}
\DoxyCodeLine{01165\ }
\DoxyCodeLine{01166\ }
\DoxyCodeLine{01167\ }
\DoxyCodeLine{01168\ int32}
\DoxyCodeLine{01169\ feat\_s2mfc2feat(feat\_t\ *\ fcb,\ \textcolor{keyword}{const}\ \textcolor{keywordtype}{char}\ *file,\ \textcolor{keyword}{const}\ \textcolor{keywordtype}{char}\ *dir,\ \textcolor{keyword}{const}\ \textcolor{keywordtype}{char}\ *cepext,}
\DoxyCodeLine{01170\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ int32\ sf,\ int32\ ef,\ mfcc\_t\ ***\ feat,\ int32\ maxfr)}
\DoxyCodeLine{01171\ \{}
\DoxyCodeLine{01172\ \ \ \ \ \textcolor{keywordtype}{char}\ *path;}
\DoxyCodeLine{01173\ \ \ \ \ \textcolor{keywordtype}{char}\ *ps\ =\ \textcolor{stringliteral}{"{}/"{}};}
\DoxyCodeLine{01174\ \ \ \ \ int32\ win,\ nfr;}
\DoxyCodeLine{01175\ \ \ \ \ int32\ file\_length,\ cepext\_length,\ path\_length\ =\ 0;}
\DoxyCodeLine{01176\ \ \ \ \ mfcc\_t\ **mfc;}
\DoxyCodeLine{01177\ }
\DoxyCodeLine{01178\ \ \ \ \ \textcolor{keywordflow}{if}\ (fcb-\/>cepsize\ <=\ 0)\ \{}
\DoxyCodeLine{01179\ \ \ \ \ \ \ \ \ E\_ERROR(\textcolor{stringliteral}{"{}Bad\ cepsize:\ \%d\(\backslash\)n"{}},\ fcb-\/>cepsize);}
\DoxyCodeLine{01180\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{return}\ -\/1;}
\DoxyCodeLine{01181\ \ \ \ \ \}}
\DoxyCodeLine{01182\ }
\DoxyCodeLine{01183\ \ \ \ \ \textcolor{keywordflow}{if}\ (cepext\ ==\ NULL)}
\DoxyCodeLine{01184\ \ \ \ \ \ \ \ \ cepext\ =\ \textcolor{stringliteral}{"{}"{}};}
\DoxyCodeLine{01185\ }
\DoxyCodeLine{01186\ \ \ \ \ \textcolor{comment}{/*}}
\DoxyCodeLine{01187\ \textcolor{comment}{\ \ \ \ \ *\ Create\ mfc\ filename,\ combining\ file,\ dir\ and\ extension\ if}}
\DoxyCodeLine{01188\ \textcolor{comment}{\ \ \ \ \ *\ necessary}}
\DoxyCodeLine{01189\ \textcolor{comment}{\ \ \ \ \ */}}
\DoxyCodeLine{01190\ }
\DoxyCodeLine{01191\ \ \ \ \ \textcolor{comment}{/*}}
\DoxyCodeLine{01192\ \textcolor{comment}{\ \ \ \ \ *\ First\ we\ decide\ about\ the\ path.\ If\ dir\ is\ defined,\ then\ use}}
\DoxyCodeLine{01193\ \textcolor{comment}{\ \ \ \ \ *\ it.\ Otherwise\ assume\ the\ filename\ already\ contains\ the\ path.}}
\DoxyCodeLine{01194\ \textcolor{comment}{\ \ \ \ \ */}}
\DoxyCodeLine{01195\ \ \ \ \ \textcolor{keywordflow}{if}\ (dir\ ==\ NULL)\ \{}
\DoxyCodeLine{01196\ \ \ \ \ \ \ \ \ dir\ =\ \textcolor{stringliteral}{"{}"{}};}
\DoxyCodeLine{01197\ \ \ \ \ \ \ \ \ ps\ =\ \textcolor{stringliteral}{"{}"{}};}
\DoxyCodeLine{01198\ \ \ \ \ \ \ \ \ \textcolor{comment}{/*}}
\DoxyCodeLine{01199\ \textcolor{comment}{\ \ \ \ \ \ \ \ \ *\ This\ is\ not\ true\ but\ some\ 3rd\ party\ apps}}
\DoxyCodeLine{01200\ \textcolor{comment}{\ \ \ \ \ \ \ \ \ *\ may\ parse\ the\ output\ explicitly\ checking\ for\ this\ line}}
\DoxyCodeLine{01201\ \textcolor{comment}{\ \ \ \ \ \ \ \ \ */}}
\DoxyCodeLine{01202\ \ \ \ \ \ \ \ \ E\_INFO(\textcolor{stringliteral}{"{}At\ directory\ .\ (current\ directory)\(\backslash\)n"{}});}
\DoxyCodeLine{01203\ \ \ \ \ \}}
\DoxyCodeLine{01204\ \ \ \ \ \textcolor{keywordflow}{else}\ \{}
\DoxyCodeLine{01205\ \ \ \ \ \ \ \ \ E\_INFO(\textcolor{stringliteral}{"{}At\ directory\ \%s\(\backslash\)n"{}},\ dir);}
\DoxyCodeLine{01206\ \ \ \ \ \ \ \ \ \textcolor{comment}{/*}}
\DoxyCodeLine{01207\ \textcolor{comment}{\ \ \ \ \ \ \ \ \ *\ Do\ not\ forget\ the\ path\ separator!}}
\DoxyCodeLine{01208\ \textcolor{comment}{\ \ \ \ \ \ \ \ \ */}}
\DoxyCodeLine{01209\ \ \ \ \ \ \ \ \ path\_length\ +=\ strlen(dir)\ +\ 1;}
\DoxyCodeLine{01210\ \ \ \ \ \}}
\DoxyCodeLine{01211\ }
\DoxyCodeLine{01212\ \ \ \ \ \textcolor{comment}{/*}}
\DoxyCodeLine{01213\ \textcolor{comment}{\ \ \ \ \ *\ Include\ cepext,\ if\ it's\ not\ already\ part\ of\ the\ filename.}}
\DoxyCodeLine{01214\ \textcolor{comment}{\ \ \ \ \ */}}
\DoxyCodeLine{01215\ \ \ \ \ file\_length\ =\ strlen(file);}
\DoxyCodeLine{01216\ \ \ \ \ cepext\_length\ =\ strlen(cepext);}
\DoxyCodeLine{01217\ \ \ \ \ \textcolor{keywordflow}{if}\ ((file\_length\ >\ cepext\_length)}
\DoxyCodeLine{01218\ \ \ \ \ \ \ \ \ \&\&\ (strcmp(file\ +\ file\_length\ -\/\ cepext\_length,\ cepext)\ ==\ 0))\ \{}
\DoxyCodeLine{01219\ \ \ \ \ \ \ \ \ cepext\ =\ \textcolor{stringliteral}{"{}"{}};}
\DoxyCodeLine{01220\ \ \ \ \ \ \ \ \ cepext\_length\ =\ 0;}
\DoxyCodeLine{01221\ \ \ \ \ \}}
\DoxyCodeLine{01222\ }
\DoxyCodeLine{01223\ \ \ \ \ \textcolor{comment}{/*}}
\DoxyCodeLine{01224\ \textcolor{comment}{\ \ \ \ \ *\ Do\ not\ forget\ the\ '\(\backslash\)0'}}
\DoxyCodeLine{01225\ \textcolor{comment}{\ \ \ \ \ */}}
\DoxyCodeLine{01226\ \ \ \ \ path\_length\ +=\ file\_length\ +\ cepext\_length\ +\ 1;}
\DoxyCodeLine{01227\ \ \ \ \ path\ =\ (\textcolor{keywordtype}{char}*)\ ckd\_calloc(path\_length,\ \textcolor{keyword}{sizeof}(\textcolor{keywordtype}{char}));}
\DoxyCodeLine{01228\ }
\DoxyCodeLine{01229\ \textcolor{preprocessor}{\#ifdef\ HAVE\_SNPRINTF}}
\DoxyCodeLine{01230\ \ \ \ \ \textcolor{comment}{/*}}
\DoxyCodeLine{01231\ \textcolor{comment}{\ \ \ \ \ *\ Paranoia\ is\ our\ best\ friend...}}
\DoxyCodeLine{01232\ \textcolor{comment}{\ \ \ \ \ */}}
\DoxyCodeLine{01233\ \ \ \ \ \textcolor{keywordflow}{while}\ ((file\_length\ =\ snprintf(path,\ path\_length,\ \textcolor{stringliteral}{"{}\%s\%s\%s\%s"{}},\ dir,\ ps,\ file,\ cepext))\ >\ path\_length)\ \{}
\DoxyCodeLine{01234\ \ \ \ \ \ \ \ \ path\_length\ =\ file\_length;}
\DoxyCodeLine{01235\ \ \ \ \ \ \ \ \ path\ =\ (\textcolor{keywordtype}{char}*)\ ckd\_realloc(path,\ path\_length\ *\ \textcolor{keyword}{sizeof}(\textcolor{keywordtype}{char}));}
\DoxyCodeLine{01236\ \ \ \ \ \}}
\DoxyCodeLine{01237\ \textcolor{preprocessor}{\#else}}
\DoxyCodeLine{01238\ \ \ \ \ sprintf(path,\ \textcolor{stringliteral}{"{}\%s\%s\%s\%s"{}},\ dir,\ ps,\ file,\ cepext);}
\DoxyCodeLine{01239\ \textcolor{preprocessor}{\#endif}}
\DoxyCodeLine{01240\ }
\DoxyCodeLine{01241\ \ \ \ \ win\ =\ feat\_window\_size(fcb);}
\DoxyCodeLine{01242\ \ \ \ \ \textcolor{comment}{/*\ Pad\ maxfr\ with\ win,\ so\ we\ read\ enough\ raw\ feature\ data\ to}}
\DoxyCodeLine{01243\ \textcolor{comment}{\ \ \ \ \ *\ calculate\ the\ requisite\ number\ of\ dynamic\ features.\ */}}
\DoxyCodeLine{01244\ \ \ \ \ \textcolor{keywordflow}{if}\ (maxfr\ >=\ 0)}
\DoxyCodeLine{01245\ \ \ \ \ \ \ \ \ maxfr\ +=\ win\ *\ 2;}
\DoxyCodeLine{01246\ }
\DoxyCodeLine{01247\ \ \ \ \ \textcolor{keywordflow}{if}\ (feat\ !=\ NULL)\ \{}
\DoxyCodeLine{01248\ \ \ \ \ \ \ \ \ \textcolor{comment}{/*\ Read\ mfc\ file\ including\ window\ or\ padding\ if\ necessary.\ */}}
\DoxyCodeLine{01249\ \ \ \ \ \ \ \ \ nfr\ =\ feat\_s2mfc\_read\_norm\_pad(fcb,\ path,\ win,\ sf,\ ef,\ \&mfc,\ maxfr,\ fcb-\/>cepsize);}
\DoxyCodeLine{01250\ \ \ \ \ \ \ \ \ ckd\_free(path);}
\DoxyCodeLine{01251\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{if}\ (nfr\ <\ 0)\ \{}
\DoxyCodeLine{01252\ \ \ \ \ \ \ \ \ \ \ \ \ ckd\_free\_2d((\textcolor{keywordtype}{void}\ **)\ mfc);}
\DoxyCodeLine{01253\ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{return}\ -\/1;}
\DoxyCodeLine{01254\ \ \ \ \ \ \ \ \ \}}
\DoxyCodeLine{01255\ }
\DoxyCodeLine{01256\ \ \ \ \ \ \ \ \ \textcolor{comment}{/*\ Actually\ compute\ the\ features\ */}}
\DoxyCodeLine{01257\ \ \ \ \ \ \ \ \ feat\_compute\_utt(fcb,\ mfc,\ nfr,\ win,\ feat);}
\DoxyCodeLine{01258\ \ \ \ \ \ \ \ \ }
\DoxyCodeLine{01259\ \ \ \ \ \ \ \ \ ckd\_free\_2d((\textcolor{keywordtype}{void}\ **)\ mfc);}
\DoxyCodeLine{01260\ \ \ \ \ \}}
\DoxyCodeLine{01261\ \ \ \ \ \textcolor{keywordflow}{else}\ \{}
\DoxyCodeLine{01262\ \ \ \ \ \ \ \ \ \textcolor{comment}{/*\ Just\ calculate\ the\ number\ of\ frames\ we\ would\ need.\ */}}
\DoxyCodeLine{01263\ \ \ \ \ \ \ \ \ nfr\ =\ feat\_s2mfc\_read\_norm\_pad(fcb,\ path,\ win,\ sf,\ ef,\ NULL,\ maxfr,\ fcb-\/>cepsize);}
\DoxyCodeLine{01264\ \ \ \ \ \ \ \ \ ckd\_free(path);}
\DoxyCodeLine{01265\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{if}\ (nfr\ <\ 0)}
\DoxyCodeLine{01266\ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{return}\ nfr;}
\DoxyCodeLine{01267\ \ \ \ \ \}}
\DoxyCodeLine{01268\ }
\DoxyCodeLine{01269\ }
\DoxyCodeLine{01270\ \ \ \ \ \textcolor{keywordflow}{return}\ (nfr\ -\/\ win\ *\ 2);}
\DoxyCodeLine{01271\ \}}
\DoxyCodeLine{01272\ }
\DoxyCodeLine{01273\ \textcolor{keyword}{static}\ int32}
\DoxyCodeLine{01274\ feat\_s2mfc2feat\_block\_utt(feat\_t\ *\ fcb,\ mfcc\_t\ **\ uttcep,}
\DoxyCodeLine{01275\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ int32\ nfr,\ mfcc\_t\ ***\ ofeat)}
\DoxyCodeLine{01276\ \{}
\DoxyCodeLine{01277\ \ \ \ \ mfcc\_t\ **cepbuf;}
\DoxyCodeLine{01278\ \ \ \ \ int32\ i,\ win,\ cepsize;}
\DoxyCodeLine{01279\ }
\DoxyCodeLine{01280\ \ \ \ \ win\ =\ feat\_window\_size(fcb);}
\DoxyCodeLine{01281\ \ \ \ \ cepsize\ =\ feat\_cepsize(fcb);}
\DoxyCodeLine{01282\ }
\DoxyCodeLine{01283\ \ \ \ \ \textcolor{comment}{/*\ Copy\ and\ pad\ out\ the\ utterance\ (this\ requires\ that\ the}}
\DoxyCodeLine{01284\ \textcolor{comment}{\ \ \ \ \ *\ feature\ computation\ functions\ always\ access\ the\ buffer\ via}}
\DoxyCodeLine{01285\ \textcolor{comment}{\ \ \ \ \ *\ the\ frame\ pointers,\ which\ they\ do)\ \ */}}
\DoxyCodeLine{01286\ \ \ \ \ cepbuf\ =\ ckd\_calloc(nfr\ +\ win\ *\ 2,\ \textcolor{keyword}{sizeof}(mfcc\_t\ *));}
\DoxyCodeLine{01287\ \ \ \ \ memcpy(cepbuf\ +\ win,\ uttcep,\ nfr\ *\ \textcolor{keyword}{sizeof}(mfcc\_t\ *));}
\DoxyCodeLine{01288\ }
\DoxyCodeLine{01289\ \ \ \ \ \textcolor{comment}{/*\ Do\ normalization\ before\ we\ interpolate\ on\ the\ boundary\ */}\ \ \ \ }
\DoxyCodeLine{01290\ \ \ \ \ feat\_cmn(fcb,\ cepbuf\ +\ win,\ nfr,\ 1,\ 1);}
\DoxyCodeLine{01291\ \ \ \ \ feat\_agc(fcb,\ cepbuf\ +\ win,\ nfr,\ 1,\ 1);}
\DoxyCodeLine{01292\ }
\DoxyCodeLine{01293\ \ \ \ \ \textcolor{comment}{/*\ Now\ interpolate\ */}\ \ \ \ }
\DoxyCodeLine{01294\ \ \ \ \ \textcolor{keywordflow}{for}\ (i\ =\ 0;\ i\ <\ win;\ ++i)\ \{}
\DoxyCodeLine{01295\ \ \ \ \ \ \ \ \ cepbuf[i]\ =\ fcb-\/>cepbuf[i];}
\DoxyCodeLine{01296\ \ \ \ \ \ \ \ \ memcpy(cepbuf[i],\ uttcep[0],\ cepsize\ *\ \textcolor{keyword}{sizeof}(mfcc\_t));}
\DoxyCodeLine{01297\ \ \ \ \ \ \ \ \ cepbuf[nfr\ +\ win\ +\ i]\ =\ fcb-\/>cepbuf[win\ +\ i];}
\DoxyCodeLine{01298\ \ \ \ \ \ \ \ \ memcpy(cepbuf[nfr\ +\ win\ +\ i],\ uttcep[nfr\ -\/\ 1],\ cepsize\ *\ \textcolor{keyword}{sizeof}(mfcc\_t));}
\DoxyCodeLine{01299\ \ \ \ \ \}}
\DoxyCodeLine{01300\ \ \ \ \ \textcolor{comment}{/*\ Compute\ as\ usual.\ */}}
\DoxyCodeLine{01301\ \ \ \ \ feat\_compute\_utt(fcb,\ cepbuf,\ nfr\ +\ win\ *\ 2,\ win,\ ofeat);}
\DoxyCodeLine{01302\ \ \ \ \ ckd\_free(cepbuf);}
\DoxyCodeLine{01303\ \ \ \ \ \textcolor{keywordflow}{return}\ nfr;}
\DoxyCodeLine{01304\ \}}
\DoxyCodeLine{01305\ }
\DoxyCodeLine{01306\ int32}
\DoxyCodeLine{01307\ feat\_s2mfc2feat\_live(feat\_t\ *\ fcb,\ mfcc\_t\ **\ uttcep,\ int32\ *inout\_ncep,}
\DoxyCodeLine{01308\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ int32\ beginutt,\ int32\ endutt,\ mfcc\_t\ ***\ ofeat)}
\DoxyCodeLine{01309\ \{}
\DoxyCodeLine{01310\ \ \ \ \ int32\ win,\ cepsize,\ nbufcep;}
\DoxyCodeLine{01311\ \ \ \ \ int32\ i,\ j,\ nfeatvec;}
\DoxyCodeLine{01312\ \ \ \ \ int32\ zero\ =\ 0;}
\DoxyCodeLine{01313\ }
\DoxyCodeLine{01314\ \ \ \ \ \textcolor{comment}{/*\ Avoid\ having\ to\ check\ this\ everywhere.\ */}}
\DoxyCodeLine{01315\ \ \ \ \ \textcolor{keywordflow}{if}\ (inout\_ncep\ ==\ NULL)\ inout\_ncep\ =\ \&zero;}
\DoxyCodeLine{01316\ }
\DoxyCodeLine{01317\ \ \ \ \ \textcolor{comment}{/*\ Special\ case\ for\ entire\ utterances.\ */}}
\DoxyCodeLine{01318\ \ \ \ \ \textcolor{keywordflow}{if}\ (beginutt\ \&\&\ endutt\ \&\&\ *inout\_ncep\ >\ 0)}
\DoxyCodeLine{01319\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{return}\ feat\_s2mfc2feat\_block\_utt(fcb,\ uttcep,\ *inout\_ncep,\ ofeat);}
\DoxyCodeLine{01320\ }
\DoxyCodeLine{01321\ \ \ \ \ win\ =\ feat\_window\_size(fcb);}
\DoxyCodeLine{01322\ \ \ \ \ cepsize\ =\ feat\_cepsize(fcb);}
\DoxyCodeLine{01323\ }
\DoxyCodeLine{01324\ \ \ \ \ \textcolor{comment}{/*\ Empty\ the\ input\ buffer\ on\ start\ of\ utterance.\ */}}
\DoxyCodeLine{01325\ \ \ \ \ \textcolor{keywordflow}{if}\ (beginutt)}
\DoxyCodeLine{01326\ \ \ \ \ \ \ \ \ fcb-\/>bufpos\ =\ fcb-\/>curpos;}
\DoxyCodeLine{01327\ }
\DoxyCodeLine{01328\ \ \ \ \ \textcolor{comment}{/*\ Calculate\ how\ much\ data\ is\ in\ the\ buffer\ already.\ */}}
\DoxyCodeLine{01329\ \ \ \ \ nbufcep\ =\ fcb-\/>bufpos\ -\/\ fcb-\/>curpos;}
\DoxyCodeLine{01330\ \ \ \ \ \textcolor{keywordflow}{if}\ (nbufcep\ <\ 0)}
\DoxyCodeLine{01331\ \ \ \ \ \ \ \ \ nbufcep\ =\ fcb-\/>bufpos\ +\ LIVEBUFBLOCKSIZE\ -\/\ fcb-\/>curpos;}
\DoxyCodeLine{01332\ \ \ \ \ \textcolor{comment}{/*\ Add\ any\ data\ that\ we\ have\ to\ replicate.\ */}}
\DoxyCodeLine{01333\ \ \ \ \ \textcolor{keywordflow}{if}\ (beginutt\ \&\&\ *inout\_ncep\ >\ 0)}
\DoxyCodeLine{01334\ \ \ \ \ \ \ \ \ nbufcep\ +=\ win;}
\DoxyCodeLine{01335\ \ \ \ \ \textcolor{keywordflow}{if}\ (endutt)}
\DoxyCodeLine{01336\ \ \ \ \ \ \ \ \ nbufcep\ +=\ win;}
\DoxyCodeLine{01337\ }
\DoxyCodeLine{01338\ \ \ \ \ \textcolor{comment}{/*\ Only\ consume\ as\ much\ input\ as\ will\ fit\ in\ the\ buffer.\ */}}
\DoxyCodeLine{01339\ \ \ \ \ \textcolor{keywordflow}{if}\ (nbufcep\ +\ *inout\_ncep\ >\ LIVEBUFBLOCKSIZE)\ \{}
\DoxyCodeLine{01340\ \ \ \ \ \ \ \ \ \textcolor{comment}{/*\ We\ also\ can't\ overwrite\ the\ trailing\ window,\ hence\ the}}
\DoxyCodeLine{01341\ \textcolor{comment}{\ \ \ \ \ \ \ \ \ *\ reason\ why\ win\ is\ subtracted\ here.\ */}}
\DoxyCodeLine{01342\ \ \ \ \ \ \ \ \ *inout\_ncep\ =\ LIVEBUFBLOCKSIZE\ -\/\ nbufcep\ -\/\ win;}
\DoxyCodeLine{01343\ \ \ \ \ \ \ \ \ \textcolor{comment}{/*\ Cancel\ end\ of\ utterance\ processing.\ */}}
\DoxyCodeLine{01344\ \ \ \ \ \ \ \ \ endutt\ =\ FALSE;}
\DoxyCodeLine{01345\ \ \ \ \ \}}
\DoxyCodeLine{01346\ }
\DoxyCodeLine{01347\ \ \ \ \ \textcolor{comment}{/*\ FIXME:\ Don't\ modify\ the\ input!\ */}}
\DoxyCodeLine{01348\ \ \ \ \ feat\_cmn(fcb,\ uttcep,\ *inout\_ncep,\ beginutt,\ endutt);}
\DoxyCodeLine{01349\ \ \ \ \ feat\_agc(fcb,\ uttcep,\ *inout\_ncep,\ beginutt,\ endutt);}
\DoxyCodeLine{01350\ }
\DoxyCodeLine{01351\ \ \ \ \ \textcolor{comment}{/*\ Replicate\ first\ frame\ into\ the\ first\ win\ frames\ if\ we're\ at\ the}}
\DoxyCodeLine{01352\ \textcolor{comment}{\ \ \ \ \ *\ beginning\ of\ the\ utterance\ and\ there\ was\ some\ actual\ input\ to}}
\DoxyCodeLine{01353\ \textcolor{comment}{\ \ \ \ \ *\ deal\ with.\ \ (FIXME:\ Not\ entirely\ sure\ why\ that\ condition)\ */}}
\DoxyCodeLine{01354\ \ \ \ \ \textcolor{keywordflow}{if}\ (beginutt\ \&\&\ *inout\_ncep\ >\ 0)\ \{}
\DoxyCodeLine{01355\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{for}\ (i\ =\ 0;\ i\ <\ win;\ i++)\ \{}
\DoxyCodeLine{01356\ \ \ \ \ \ \ \ \ \ \ \ \ memcpy(fcb-\/>cepbuf[fcb-\/>bufpos++],\ uttcep[0],}
\DoxyCodeLine{01357\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ cepsize\ *\ \textcolor{keyword}{sizeof}(mfcc\_t));}
\DoxyCodeLine{01358\ \ \ \ \ \ \ \ \ \ \ \ \ fcb-\/>bufpos\ \%=\ LIVEBUFBLOCKSIZE;}
\DoxyCodeLine{01359\ \ \ \ \ \ \ \ \ \}}
\DoxyCodeLine{01360\ \ \ \ \ \ \ \ \ \textcolor{comment}{/*\ Move\ the\ current\ pointer\ past\ this\ data.\ */}}
\DoxyCodeLine{01361\ \ \ \ \ \ \ \ \ fcb-\/>curpos\ =\ fcb-\/>bufpos;}
\DoxyCodeLine{01362\ \ \ \ \ \ \ \ \ nbufcep\ -\/=\ win;}
\DoxyCodeLine{01363\ \ \ \ \ \}}
\DoxyCodeLine{01364\ }
\DoxyCodeLine{01365\ \ \ \ \ \textcolor{comment}{/*\ Copy\ in\ frame\ data\ to\ the\ circular\ buffer.\ */}}
\DoxyCodeLine{01366\ \ \ \ \ \textcolor{keywordflow}{for}\ (i\ =\ 0;\ i\ <\ *inout\_ncep;\ ++i)\ \{}
\DoxyCodeLine{01367\ \ \ \ \ \ \ \ \ memcpy(fcb-\/>cepbuf[fcb-\/>bufpos++],\ uttcep[i],}
\DoxyCodeLine{01368\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ cepsize\ *\ \textcolor{keyword}{sizeof}(mfcc\_t));}
\DoxyCodeLine{01369\ \ \ \ \ \ \ \ \ fcb-\/>bufpos\ \%=\ LIVEBUFBLOCKSIZE;}
\DoxyCodeLine{01370\ \ \ \ \ \ \ \ \ ++nbufcep;}
\DoxyCodeLine{01371\ \ \ \ \ \}}
\DoxyCodeLine{01372\ }
\DoxyCodeLine{01373\ \ \ \ \ \textcolor{comment}{/*\ Replicate\ last\ frame\ into\ the\ last\ win\ frames\ if\ we're\ at\ the}}
\DoxyCodeLine{01374\ \textcolor{comment}{\ \ \ \ \ *\ end\ of\ the\ utterance\ (even\ if\ there\ was\ no\ input,\ so\ we\ can}}
\DoxyCodeLine{01375\ \textcolor{comment}{\ \ \ \ \ *\ flush\ the\ output).\ */}}
\DoxyCodeLine{01376\ \ \ \ \ \textcolor{keywordflow}{if}\ (endutt)\ \{}
\DoxyCodeLine{01377\ \ \ \ \ \ \ \ \ int32\ tpos;\ \textcolor{comment}{/*\ Index\ of\ last\ input\ frame.\ */}}
\DoxyCodeLine{01378\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{if}\ (fcb-\/>bufpos\ ==\ 0)}
\DoxyCodeLine{01379\ \ \ \ \ \ \ \ \ \ \ \ \ tpos\ =\ LIVEBUFBLOCKSIZE\ -\/\ 1;}
\DoxyCodeLine{01380\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{else}}
\DoxyCodeLine{01381\ \ \ \ \ \ \ \ \ \ \ \ \ tpos\ =\ fcb-\/>bufpos\ -\/\ 1;}
\DoxyCodeLine{01382\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{for}\ (i\ =\ 0;\ i\ <\ win;\ ++i)\ \{}
\DoxyCodeLine{01383\ \ \ \ \ \ \ \ \ \ \ \ \ memcpy(fcb-\/>cepbuf[fcb-\/>bufpos++],\ fcb-\/>cepbuf[tpos],}
\DoxyCodeLine{01384\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ cepsize\ *\ \textcolor{keyword}{sizeof}(mfcc\_t));}
\DoxyCodeLine{01385\ \ \ \ \ \ \ \ \ \ \ \ \ fcb-\/>bufpos\ \%=\ LIVEBUFBLOCKSIZE;}
\DoxyCodeLine{01386\ \ \ \ \ \ \ \ \ \}}
\DoxyCodeLine{01387\ \ \ \ \ \}}
\DoxyCodeLine{01388\ }
\DoxyCodeLine{01389\ \ \ \ \ \textcolor{comment}{/*\ We\ have\ to\ leave\ the\ trailing\ window\ of\ frames.\ */}}
\DoxyCodeLine{01390\ \ \ \ \ nfeatvec\ =\ nbufcep\ -\/\ win;}
\DoxyCodeLine{01391\ \ \ \ \ \textcolor{keywordflow}{if}\ (nfeatvec\ <=\ 0)}
\DoxyCodeLine{01392\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{return}\ 0;\ \textcolor{comment}{/*\ Do\ nothing.\ */}}
\DoxyCodeLine{01393\ }
\DoxyCodeLine{01394\ \ \ \ \ \textcolor{keywordflow}{for}\ (i\ =\ 0;\ i\ <\ nfeatvec;\ ++i)\ \{}
\DoxyCodeLine{01395\ \ \ \ \ \ \ \ \ \textcolor{comment}{/*\ Handle\ wraparound\ cases.\ */}}
\DoxyCodeLine{01396\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{if}\ (fcb-\/>curpos\ -\/\ win\ <\ 0\ ||\ fcb-\/>curpos\ +\ win\ >=\ LIVEBUFBLOCKSIZE)\ \{}
\DoxyCodeLine{01397\ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{comment}{/*\ Use\ tmpcepbuf\ for\ this\ case.\ \ Actually,\ we\ just\ need\ the\ pointers.\ */}}
\DoxyCodeLine{01398\ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{for}\ (j\ =\ -\/win;\ j\ <=\ win;\ ++j)\ \{}
\DoxyCodeLine{01399\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ int32\ tmppos\ =}
\DoxyCodeLine{01400\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ (fcb-\/>curpos\ +\ j\ +\ LIVEBUFBLOCKSIZE)\ \%\ LIVEBUFBLOCKSIZE;}
\DoxyCodeLine{01401\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ fcb-\/>tmpcepbuf[win\ +\ j]\ =\ fcb-\/>cepbuf[tmppos];}
\DoxyCodeLine{01402\ \ \ \ \ \ \ \ \ \ \ \ \ \}}
\DoxyCodeLine{01403\ \ \ \ \ \ \ \ \ \ \ \ \ fcb-\/>compute\_feat(fcb,\ fcb-\/>tmpcepbuf\ +\ win,\ ofeat[i]);}
\DoxyCodeLine{01404\ \ \ \ \ \ \ \ \ \}}
\DoxyCodeLine{01405\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{else}\ \{}
\DoxyCodeLine{01406\ \ \ \ \ \ \ \ \ \ \ \ \ fcb-\/>compute\_feat(fcb,\ fcb-\/>cepbuf\ +\ fcb-\/>curpos,\ ofeat[i]);}
\DoxyCodeLine{01407\ \ \ \ \ \ \ \ \ \}}
\DoxyCodeLine{01408\ \ \ \ \ \ \ \ \ \textcolor{comment}{/*\ Move\ the\ read\ pointer\ forward.\ */}}
\DoxyCodeLine{01409\ \ \ \ \ \ \ \ \ ++fcb-\/>curpos;}
\DoxyCodeLine{01410\ \ \ \ \ \ \ \ \ fcb-\/>curpos\ \%=\ LIVEBUFBLOCKSIZE;}
\DoxyCodeLine{01411\ \ \ \ \ \}}
\DoxyCodeLine{01412\ }
\DoxyCodeLine{01413\ \ \ \ \ \textcolor{keywordflow}{if}\ (fcb-\/>lda)}
\DoxyCodeLine{01414\ \ \ \ \ \ \ \ \ feat\_lda\_transform(fcb,\ ofeat,\ nfeatvec);}
\DoxyCodeLine{01415\ }
\DoxyCodeLine{01416\ \ \ \ \ \textcolor{keywordflow}{if}\ (fcb-\/>subvecs)}
\DoxyCodeLine{01417\ \ \ \ \ \ \ \ \ feat\_subvec\_project(fcb,\ ofeat,\ nfeatvec);}
\DoxyCodeLine{01418\ }
\DoxyCodeLine{01419\ \ \ \ \ \textcolor{keywordflow}{return}\ nfeatvec;}
\DoxyCodeLine{01420\ \}}
\DoxyCodeLine{01421\ }
\DoxyCodeLine{01422\ feat\_t\ *}
\DoxyCodeLine{01423\ feat\_retain(feat\_t\ *f)}
\DoxyCodeLine{01424\ \{}
\DoxyCodeLine{01425\ \ \ \ \ ++f-\/>refcount;}
\DoxyCodeLine{01426\ \ \ \ \ \textcolor{keywordflow}{return}\ f;}
\DoxyCodeLine{01427\ \}}
\DoxyCodeLine{01428\ }
\DoxyCodeLine{01429\ \textcolor{keywordtype}{int}}
\DoxyCodeLine{01430\ feat\_free(feat\_t\ *\ f)}
\DoxyCodeLine{01431\ \{}
\DoxyCodeLine{01432\ \ \ \ \ \textcolor{keywordflow}{if}\ (f\ ==\ NULL)}
\DoxyCodeLine{01433\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{return}\ 0;}
\DoxyCodeLine{01434\ \ \ \ \ \textcolor{keywordflow}{if}\ (-\/-\/f-\/>refcount\ >\ 0)}
\DoxyCodeLine{01435\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{return}\ f-\/>refcount;}
\DoxyCodeLine{01436\ }
\DoxyCodeLine{01437\ \ \ \ \ \textcolor{keywordflow}{if}\ (f-\/>cepbuf)}
\DoxyCodeLine{01438\ \ \ \ \ \ \ \ \ ckd\_free\_2d((\textcolor{keywordtype}{void}\ **)\ f-\/>cepbuf);}
\DoxyCodeLine{01439\ \ \ \ \ ckd\_free(f-\/>tmpcepbuf);}
\DoxyCodeLine{01440\ }
\DoxyCodeLine{01441\ \ \ \ \ \textcolor{keywordflow}{if}\ (f-\/>name)\ \{}
\DoxyCodeLine{01442\ \ \ \ \ \ \ \ \ ckd\_free((\textcolor{keywordtype}{void}\ *)\ f-\/>name);}
\DoxyCodeLine{01443\ \ \ \ \ \}}
\DoxyCodeLine{01444\ \ \ \ \ \textcolor{keywordflow}{if}\ (f-\/>lda)}
\DoxyCodeLine{01445\ \ \ \ \ \ \ \ \ ckd\_free\_3d((\textcolor{keywordtype}{void}\ ***)\ f-\/>lda);}
\DoxyCodeLine{01446\ }
\DoxyCodeLine{01447\ \ \ \ \ ckd\_free(f-\/>stream\_len);}
\DoxyCodeLine{01448\ \ \ \ \ ckd\_free(f-\/>sv\_len);}
\DoxyCodeLine{01449\ \ \ \ \ ckd\_free(f-\/>sv\_buf);}
\DoxyCodeLine{01450\ \ \ \ \ subvecs\_free(f-\/>subvecs);}
\DoxyCodeLine{01451\ }
\DoxyCodeLine{01452\ \ \ \ \ cmn\_free(f-\/>cmn\_struct);}
\DoxyCodeLine{01453\ \ \ \ \ agc\_free(f-\/>agc\_struct);}
\DoxyCodeLine{01454\ }
\DoxyCodeLine{01455\ \ \ \ \ ckd\_free(f);}
\DoxyCodeLine{01456\ \ \ \ \ \textcolor{keywordflow}{return}\ 0;}
\DoxyCodeLine{01457\ \}}
\DoxyCodeLine{01458\ }
\DoxyCodeLine{01459\ }
\DoxyCodeLine{01460\ \textcolor{keywordtype}{void}}
\DoxyCodeLine{01461\ feat\_report(feat\_t\ *\ f)}
\DoxyCodeLine{01462\ \{}
\DoxyCodeLine{01463\ \ \ \ \ \textcolor{keywordtype}{int}\ i;}
\DoxyCodeLine{01464\ \ \ \ \ E\_INFO\_NOFN(\textcolor{stringliteral}{"{}Initialization\ of\ feat\_t,\ report:\(\backslash\)n"{}});}
\DoxyCodeLine{01465\ \ \ \ \ E\_INFO\_NOFN(\textcolor{stringliteral}{"{}Feature\ type\ \ \ \ \ \ \ \ \ =\ \%s\(\backslash\)n"{}},\ f-\/>name);}
\DoxyCodeLine{01466\ \ \ \ \ E\_INFO\_NOFN(\textcolor{stringliteral}{"{}Cepstral\ size\ \ \ \ \ \ \ \ =\ \%d\(\backslash\)n"{}},\ f-\/>cepsize);}
\DoxyCodeLine{01467\ \ \ \ \ E\_INFO\_NOFN(\textcolor{stringliteral}{"{}Number\ of\ streams\ \ \ \ =\ \%d\(\backslash\)n"{}},\ f-\/>n\_stream);}
\DoxyCodeLine{01468\ \ \ \ \ \textcolor{keywordflow}{for}\ (i\ =\ 0;\ i\ <\ f-\/>n\_stream;\ i++)\ \{}
\DoxyCodeLine{01469\ \ \ \ \ \ \ \ \ E\_INFO\_NOFN(\textcolor{stringliteral}{"{}Vector\ size\ of\ stream[\%d]:\ \%d\(\backslash\)n"{}},\ i,}
\DoxyCodeLine{01470\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ f-\/>stream\_len[i]);}
\DoxyCodeLine{01471\ \ \ \ \ \}}
\DoxyCodeLine{01472\ \ \ \ \ E\_INFO\_NOFN(\textcolor{stringliteral}{"{}Number\ of\ subvectors\ =\ \%d\(\backslash\)n"{}},\ f-\/>n\_sv);}
\DoxyCodeLine{01473\ \ \ \ \ \textcolor{keywordflow}{for}\ (i\ =\ 0;\ i\ <\ f-\/>n\_sv;\ i++)\ \{}
\DoxyCodeLine{01474\ \ \ \ \ \ \ \ \ int32\ *sv;}
\DoxyCodeLine{01475\ }
\DoxyCodeLine{01476\ \ \ \ \ \ \ \ \ E\_INFO\_NOFN(\textcolor{stringliteral}{"{}Components\ of\ subvector[\%d]:"{}},\ i);}
\DoxyCodeLine{01477\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{for}\ (sv\ =\ f-\/>subvecs[i];\ sv\ \&\&\ *sv\ !=\ -\/1;\ ++sv)}
\DoxyCodeLine{01478\ \ \ \ \ \ \ \ \ \ \ \ \ E\_INFOCONT(\textcolor{stringliteral}{"{}\ \%d"{}},\ *sv);}
\DoxyCodeLine{01479\ \ \ \ \ \ \ \ \ E\_INFOCONT(\textcolor{stringliteral}{"{}\(\backslash\)n"{}});}
\DoxyCodeLine{01480\ \ \ \ \ \}}
\DoxyCodeLine{01481\ \ \ \ \ E\_INFO\_NOFN(\textcolor{stringliteral}{"{}Whether\ CMN\ is\ used\ \ =\ \%d\(\backslash\)n"{}},\ f-\/>cmn);}
\DoxyCodeLine{01482\ \ \ \ \ E\_INFO\_NOFN(\textcolor{stringliteral}{"{}Whether\ AGC\ is\ used\ \ =\ \%d\(\backslash\)n"{}},\ f-\/>agc);}
\DoxyCodeLine{01483\ \ \ \ \ E\_INFO\_NOFN(\textcolor{stringliteral}{"{}Whether\ variance\ is\ normalized\ =\ \%d\(\backslash\)n"{}},\ f-\/>varnorm);}
\DoxyCodeLine{01484\ \ \ \ \ E\_INFO\_NOFN(\textcolor{stringliteral}{"{}\(\backslash\)n"{}});}
\DoxyCodeLine{01485\ \}}

\end{DoxyCode}
