\section{include/sphinxbase/feat.h File Reference}
\label{feat_8h}\index{include/sphinxbase/feat.\+h@{include/sphinxbase/feat.\+h}}


compute the dynamic coefficients from the cepstral vector.  


{\ttfamily \#include $<$stdio.\+h$>$}\newline
{\ttfamily \#include $<$sphinxbase/sphinxbase\+\_\+export.\+h$>$}\newline
{\ttfamily \#include $<$sphinxbase/prim\+\_\+type.\+h$>$}\newline
{\ttfamily \#include $<$sphinxbase/fe.\+h$>$}\newline
{\ttfamily \#include $<$sphinxbase/cmn.\+h$>$}\newline
{\ttfamily \#include $<$sphinxbase/agc.\+h$>$}\newline
\subsection*{Data Structures}
\begin{DoxyCompactItemize}
\item 
struct \textbf{ feat\+\_\+s}
\end{DoxyCompactItemize}
\subsection*{Macros}
\begin{DoxyCompactItemize}
\item 
\#define {\bfseries L\+I\+V\+E\+B\+U\+F\+B\+L\+O\+C\+K\+S\+I\+ZE}
\item 
\mbox{\label{feat_8h_a7858f0e32903e11a6cb9d659ad4f6542}} 
\#define {\bfseries S3\+\_\+\+M\+A\+X\+\_\+\+F\+R\+A\+M\+ES}~15000    /$\ast$ R\+AH, I believe this is still too large, but better than before $\ast$/
\item 
\mbox{\label{feat_8h_ada461d1a4db89192fbd7d8a7e15ca22d}} 
\#define {\bfseries cepstral\+\_\+to\+\_\+feature\+\_\+command\+\_\+line\+\_\+macro}()
\item 
\mbox{\label{feat_8h_a196b41ab9dfffcea885ee1a9075ede9e}} 
\#define \textbf{ feat\+\_\+name}(f)~((f)-\/$>$name)
\begin{DoxyCompactList}\small\item\em Name of feature type. \end{DoxyCompactList}\item 
\mbox{\label{feat_8h_ac691993ec890de3daefbcffe89788f5a}} 
\#define \textbf{ feat\+\_\+cepsize}(f)~((f)-\/$>$cepsize)
\begin{DoxyCompactList}\small\item\em Input dimensionality of feature. \end{DoxyCompactList}\item 
\mbox{\label{feat_8h_a69cdcd91578c26565c7653ad6f2eb510}} 
\#define \textbf{ feat\+\_\+window\+\_\+size}(f)~((f)-\/$>$window\+\_\+size)
\begin{DoxyCompactList}\small\item\em Size of dynamic feature window. \end{DoxyCompactList}\item 
\#define \textbf{ feat\+\_\+n\+\_\+stream}(f)~((f)-\/$>$n\+\_\+stream)
\begin{DoxyCompactList}\small\item\em Number of feature streams. \end{DoxyCompactList}\item 
\#define \textbf{ feat\+\_\+stream\+\_\+len}(f,  i)~((f)-\/$>$stream\+\_\+len[i])
\begin{DoxyCompactList}\small\item\em Length of feature stream i. \end{DoxyCompactList}\item 
\mbox{\label{feat_8h_abadd19e2cc72df33e81e9d73a7ddffdb}} 
\#define \textbf{ feat\+\_\+dimension1}(f)~((f)-\/$>$n\+\_\+sv ? (f)-\/$>$n\+\_\+sv \+: f-\/$>$n\+\_\+stream)
\begin{DoxyCompactList}\small\item\em Number of streams or subvectors in feature output. \end{DoxyCompactList}\item 
\mbox{\label{feat_8h_a5bd29a80c7f23f281d55555757f97f34}} 
\#define \textbf{ feat\+\_\+dimension2}(f,  i)~((f)-\/$>$lda ? (f)-\/$>$out\+\_\+dim \+: ((f)-\/$>$sv\+\_\+len ? (f)-\/$>$sv\+\_\+len[i] \+: f-\/$>$stream\+\_\+len[i]))
\begin{DoxyCompactList}\small\item\em Dimensionality of stream/subvector i in feature output. \end{DoxyCompactList}\item 
\mbox{\label{feat_8h_a66dc16aeea4307bf36ec4e08e05d0c7c}} 
\#define \textbf{ feat\+\_\+dimension}(f)~((f)-\/$>$out\+\_\+dim)
\begin{DoxyCompactList}\small\item\em Total dimensionality of feature output. \end{DoxyCompactList}\item 
\mbox{\label{feat_8h_afc74f6114cc2151cef1c9e40bdd45e46}} 
\#define \textbf{ feat\+\_\+stream\+\_\+lengths}(f)~((f)-\/$>$lda ? (\&(f)-\/$>$out\+\_\+dim) \+: (f)-\/$>$sv\+\_\+len ? (f)-\/$>$sv\+\_\+len \+: f-\/$>$stream\+\_\+len)
\begin{DoxyCompactList}\small\item\em Array with stream/subvector lengths. \end{DoxyCompactList}\end{DoxyCompactItemize}
\subsection*{Typedefs}
\begin{DoxyCompactItemize}
\item 
\mbox{\label{feat_8h_acce3586bdd820afe9518147a6ada8bd9}} 
typedef struct \textbf{ feat\+\_\+s} {\bfseries feat\+\_\+t}
\end{DoxyCompactItemize}
\subsection*{Functions}
\begin{DoxyCompactItemize}
\item 
S\+P\+H\+I\+N\+X\+B\+A\+S\+E\+\_\+\+E\+X\+P\+O\+RT int32 $\ast$$\ast$ \textbf{ parse\+\_\+subvecs} (char const $\ast$str)
\begin{DoxyCompactList}\small\item\em Parse subvector specification string. \end{DoxyCompactList}\item 
\mbox{\label{feat_8h_ad209a1028b315a96a3a2447eccdb8605}} 
S\+P\+H\+I\+N\+X\+B\+A\+S\+E\+\_\+\+E\+X\+P\+O\+RT void \textbf{ subvecs\+\_\+free} (int32 $\ast$$\ast$subvecs)
\begin{DoxyCompactList}\small\item\em Free array of subvector specs. \end{DoxyCompactList}\item 
S\+P\+H\+I\+N\+X\+B\+A\+S\+E\+\_\+\+E\+X\+P\+O\+RT mfcc\+\_\+t $\ast$$\ast$$\ast$ \textbf{ feat\+\_\+array\+\_\+alloc} (\textbf{ feat\+\_\+t} $\ast$fcb, int32 nfr)
\begin{DoxyCompactList}\small\item\em Allocate an array to hold several frames worth of feature vectors. \end{DoxyCompactList}\item 
S\+P\+H\+I\+N\+X\+B\+A\+S\+E\+\_\+\+E\+X\+P\+O\+RT mfcc\+\_\+t $\ast$$\ast$$\ast$ \textbf{ feat\+\_\+array\+\_\+realloc} (\textbf{ feat\+\_\+t} $\ast$fcb, mfcc\+\_\+t $\ast$$\ast$$\ast$old\+\_\+feat, int32 ofr, int32 nfr)
\begin{DoxyCompactList}\small\item\em Realloate the array of features. \end{DoxyCompactList}\item 
\mbox{\label{feat_8h_ad5c87f80af670b7a949af65bc3ba82a8}} 
S\+P\+H\+I\+N\+X\+B\+A\+S\+E\+\_\+\+E\+X\+P\+O\+RT void \textbf{ feat\+\_\+array\+\_\+free} (mfcc\+\_\+t $\ast$$\ast$$\ast$feat)
\begin{DoxyCompactList}\small\item\em Free a buffer allocated with \doxyref{feat\+\_\+array\+\_\+alloc()}{p.}{feat_8h_a03071d6d5c6b233117871f583c258b1e} \end{DoxyCompactList}\item 
S\+P\+H\+I\+N\+X\+B\+A\+S\+E\+\_\+\+E\+X\+P\+O\+RT \textbf{ feat\+\_\+t} $\ast$ \textbf{ feat\+\_\+init} (char const $\ast$type, \textbf{ cmn\+\_\+type\+\_\+t} \textbf{ cmn}, int32 varnorm, \textbf{ agc\+\_\+type\+\_\+t} agc, int32 breport, int32 cepsize)
\begin{DoxyCompactList}\small\item\em Initialize feature module to use the selected type of feature stream. \end{DoxyCompactList}\item 
S\+P\+H\+I\+N\+X\+B\+A\+S\+E\+\_\+\+E\+X\+P\+O\+RT int32 \textbf{ feat\+\_\+read\+\_\+lda} (\textbf{ feat\+\_\+t} $\ast$feat, const char $\ast$ldafile, int32 dim)
\begin{DoxyCompactList}\small\item\em Add an L\+DA transformation to the feature module from a file. \end{DoxyCompactList}\item 
S\+P\+H\+I\+N\+X\+B\+A\+S\+E\+\_\+\+E\+X\+P\+O\+RT void \textbf{ feat\+\_\+lda\+\_\+transform} (\textbf{ feat\+\_\+t} $\ast$fcb, mfcc\+\_\+t $\ast$$\ast$$\ast$inout\+\_\+feat, uint32 nfr)
\begin{DoxyCompactList}\small\item\em Transform a block of features using the feature module\textquotesingle{}s L\+DA transform. \end{DoxyCompactList}\item 
S\+P\+H\+I\+N\+X\+B\+A\+S\+E\+\_\+\+E\+X\+P\+O\+RT int \textbf{ feat\+\_\+set\+\_\+subvecs} (\textbf{ feat\+\_\+t} $\ast$fcb, int32 $\ast$$\ast$subvecs)
\begin{DoxyCompactList}\small\item\em Add a subvector specification to the feature module. \end{DoxyCompactList}\item 
S\+P\+H\+I\+N\+X\+B\+A\+S\+E\+\_\+\+E\+X\+P\+O\+RT void \textbf{ feat\+\_\+print} (\textbf{ feat\+\_\+t} $\ast$fcb, mfcc\+\_\+t $\ast$$\ast$$\ast$feat, int32 nfr, F\+I\+LE $\ast$fp)
\begin{DoxyCompactList}\small\item\em Print the given block of feature vectors to the given F\+I\+LE. \end{DoxyCompactList}\item 
S\+P\+H\+I\+N\+X\+B\+A\+S\+E\+\_\+\+E\+X\+P\+O\+RT int32 \textbf{ feat\+\_\+s2mfc2feat} (\textbf{ feat\+\_\+t} $\ast$fcb, const char $\ast$file, const char $\ast$dir, const char $\ast$cepext, int32 sf, int32 ef, mfcc\+\_\+t $\ast$$\ast$$\ast$feat, int32 maxfr)
\begin{DoxyCompactList}\small\item\em Read a specified M\+FC file (or given segment within it), perform C\+M\+N/\+A\+GC as indicated by {\ttfamily fcb}, and compute feature vectors. \end{DoxyCompactList}\item 
S\+P\+H\+I\+N\+X\+B\+A\+S\+E\+\_\+\+E\+X\+P\+O\+RT int32 \textbf{ feat\+\_\+s2mfc2feat\+\_\+live} (\textbf{ feat\+\_\+t} $\ast$fcb, mfcc\+\_\+t $\ast$$\ast$uttcep, int32 $\ast$inout\+\_\+ncep, int32 beginutt, int32 endutt, mfcc\+\_\+t $\ast$$\ast$$\ast$ofeat)
\begin{DoxyCompactList}\small\item\em Feature computation routine for live mode decoder. \end{DoxyCompactList}\item 
S\+P\+H\+I\+N\+X\+B\+A\+S\+E\+\_\+\+E\+X\+P\+O\+RT \textbf{ feat\+\_\+t} $\ast$ \textbf{ feat\+\_\+retain} (\textbf{ feat\+\_\+t} $\ast$f)
\begin{DoxyCompactList}\small\item\em Retain ownership of \doxyref{feat\+\_\+t}{p.}{structfeat__t}. \end{DoxyCompactList}\item 
S\+P\+H\+I\+N\+X\+B\+A\+S\+E\+\_\+\+E\+X\+P\+O\+RT int \textbf{ feat\+\_\+free} (\textbf{ feat\+\_\+t} $\ast$f)
\begin{DoxyCompactList}\small\item\em Release resource associated with \doxyref{feat\+\_\+t}{p.}{structfeat__t}. \end{DoxyCompactList}\item 
S\+P\+H\+I\+N\+X\+B\+A\+S\+E\+\_\+\+E\+X\+P\+O\+RT void \textbf{ feat\+\_\+report} (\textbf{ feat\+\_\+t} $\ast$f)
\begin{DoxyCompactList}\small\item\em Report the \doxyref{feat\+\_\+t}{p.}{structfeat__t} data structure. \end{DoxyCompactList}\end{DoxyCompactItemize}


\subsection{Detailed Description}
compute the dynamic coefficients from the cepstral vector. 



\subsection{Macro Definition Documentation}
\mbox{\label{feat_8h_a1fe686c88d5b0598d7509af21acd9b76}} 
\index{feat.\+h@{feat.\+h}!feat\+\_\+n\+\_\+stream@{feat\+\_\+n\+\_\+stream}}
\index{feat\+\_\+n\+\_\+stream@{feat\+\_\+n\+\_\+stream}!feat.\+h@{feat.\+h}}
\subsubsection{feat\+\_\+n\+\_\+stream}
{\footnotesize\ttfamily \#define feat\+\_\+n\+\_\+stream(\begin{DoxyParamCaption}\item[{}]{f }\end{DoxyParamCaption})~((f)-\/$>$n\+\_\+stream)}



Number of feature streams. 

\begin{DoxyRefDesc}{Deprecated}
\item[\textbf{ Deprecated}]Do not use this, use \doxyref{feat\+\_\+dimension1()}{p.}{feat_8h_abadd19e2cc72df33e81e9d73a7ddffdb} instead. \end{DoxyRefDesc}


Definition at line 219 of file feat.\+h.



Referenced by feat\+\_\+array\+\_\+free().

\mbox{\label{feat_8h_a3d50283fc416fff87f3b907a12c2c11e}} 
\index{feat.\+h@{feat.\+h}!feat\+\_\+stream\+\_\+len@{feat\+\_\+stream\+\_\+len}}
\index{feat\+\_\+stream\+\_\+len@{feat\+\_\+stream\+\_\+len}!feat.\+h@{feat.\+h}}
\subsubsection{feat\+\_\+stream\+\_\+len}
{\footnotesize\ttfamily \#define feat\+\_\+stream\+\_\+len(\begin{DoxyParamCaption}\item[{}]{f,  }\item[{}]{i }\end{DoxyParamCaption})~((f)-\/$>$stream\+\_\+len[i])}



Length of feature stream i. 

\begin{DoxyRefDesc}{Deprecated}
\item[\textbf{ Deprecated}]Do not use this, use \doxyref{feat\+\_\+dimension2()}{p.}{feat_8h_a5bd29a80c7f23f281d55555757f97f34} instead. \end{DoxyRefDesc}


Definition at line 225 of file feat.\+h.



Referenced by feat\+\_\+array\+\_\+free().

\mbox{\label{feat_8h_a0e0d4a6b5ad951229bec259ce9637325}} 
\index{feat.\+h@{feat.\+h}!L\+I\+V\+E\+B\+U\+F\+B\+L\+O\+C\+K\+S\+I\+ZE@{L\+I\+V\+E\+B\+U\+F\+B\+L\+O\+C\+K\+S\+I\+ZE}}
\index{L\+I\+V\+E\+B\+U\+F\+B\+L\+O\+C\+K\+S\+I\+ZE@{L\+I\+V\+E\+B\+U\+F\+B\+L\+O\+C\+K\+S\+I\+ZE}!feat.\+h@{feat.\+h}}
\subsubsection{L\+I\+V\+E\+B\+U\+F\+B\+L\+O\+C\+K\+S\+I\+ZE}
{\footnotesize\ttfamily \#define L\+I\+V\+E\+B\+U\+F\+B\+L\+O\+C\+K\+S\+I\+ZE}

{\bfseries Value\+:}
\begin{DoxyCode}
256    
\end{DoxyCode}


Definition at line 102 of file feat.\+h.



\subsection{Function Documentation}
\mbox{\label{feat_8h_a03071d6d5c6b233117871f583c258b1e}} 
\index{feat.\+h@{feat.\+h}!feat\+\_\+array\+\_\+alloc@{feat\+\_\+array\+\_\+alloc}}
\index{feat\+\_\+array\+\_\+alloc@{feat\+\_\+array\+\_\+alloc}!feat.\+h@{feat.\+h}}
\subsubsection{feat\+\_\+array\+\_\+alloc()}
{\footnotesize\ttfamily S\+P\+H\+I\+N\+X\+B\+A\+S\+E\+\_\+\+E\+X\+P\+O\+RT mfcc\+\_\+t$\ast$$\ast$$\ast$ feat\+\_\+array\+\_\+alloc (\begin{DoxyParamCaption}\item[{\textbf{ feat\+\_\+t} $\ast$}]{fcb,  }\item[{int32}]{nfr }\end{DoxyParamCaption})}



Allocate an array to hold several frames worth of feature vectors. 

The returned value is the mfcc\+\_\+t $\ast$$\ast$$\ast$data array, organized as follows\+:


\begin{DoxyItemize}
\item data[0][0] = frame 0 stream 0 vector, data[0][1] = frame 0 stream 1 vector, ...
\item data[1][0] = frame 1 stream 0 vector, data[0][1] = frame 1 stream 1 vector, ...
\item data[2][0] = frame 2 stream 0 vector, data[0][1] = frame 2 stream 1 vector, ...
\item ...
\end{DoxyItemize}

N\+O\+TE\+: For I/O convenience, the entire data area is allocated as one contiguous block. \begin{DoxyReturn}{Returns}
pointer to the allocated space if successful, N\+U\+LL if any error. 
\end{DoxyReturn}

\begin{DoxyParams}{Parameters}
{\em fcb} & In\+: Descriptor from \doxyref{feat\+\_\+init()}{p.}{feat_8h_a7a5e2e02e99e368e1e9e3b1ded35e3dc}, used to obtain number of streams and stream sizes \\
\hline
{\em nfr} & In\+: Number of frames for which to allocate \\
\hline
\end{DoxyParams}


Definition at line 356 of file feat.\+c.



References ckd\+\_\+calloc, ckd\+\_\+calloc\+\_\+2d, feat\+\_\+dimension, feat\+\_\+dimension1, and feat\+\_\+dimension2.



Referenced by feat\+\_\+array\+\_\+realloc().

\mbox{\label{feat_8h_aba5f4070ae18062a19c5abac3ba1ac89}} 
\index{feat.\+h@{feat.\+h}!feat\+\_\+array\+\_\+realloc@{feat\+\_\+array\+\_\+realloc}}
\index{feat\+\_\+array\+\_\+realloc@{feat\+\_\+array\+\_\+realloc}!feat.\+h@{feat.\+h}}
\subsubsection{feat\+\_\+array\+\_\+realloc()}
{\footnotesize\ttfamily S\+P\+H\+I\+N\+X\+B\+A\+S\+E\+\_\+\+E\+X\+P\+O\+RT mfcc\+\_\+t$\ast$$\ast$$\ast$ feat\+\_\+array\+\_\+realloc (\begin{DoxyParamCaption}\item[{\textbf{ feat\+\_\+t} $\ast$}]{fcb,  }\item[{mfcc\+\_\+t $\ast$$\ast$$\ast$}]{old\+\_\+feat,  }\item[{int32}]{ofr,  }\item[{int32}]{nfr }\end{DoxyParamCaption})}



Realloate the array of features. 

Requires us to know the old size 
\begin{DoxyParams}{Parameters}
{\em fcb} & In\+: Descriptor from \doxyref{feat\+\_\+init()}{p.}{feat_8h_a7a5e2e02e99e368e1e9e3b1ded35e3dc}, used to obtain number of streams and stream sizes \\
\hline
{\em old\+\_\+feat} & Feature array. Freed \\
\hline
{\em ofr} & In\+: Previous number of frames \\
\hline
{\em nfr} & In\+: Number of frames for which to allocate \\
\hline
\end{DoxyParams}


Definition at line 389 of file feat.\+c.



References feat\+\_\+array\+\_\+alloc(), feat\+\_\+array\+\_\+free(), and feat\+\_\+dimension.

\mbox{\label{feat_8h_a98463b4ab5fe4265fc817523b0e25ee9}} 
\index{feat.\+h@{feat.\+h}!feat\+\_\+free@{feat\+\_\+free}}
\index{feat\+\_\+free@{feat\+\_\+free}!feat.\+h@{feat.\+h}}
\subsubsection{feat\+\_\+free()}
{\footnotesize\ttfamily S\+P\+H\+I\+N\+X\+B\+A\+S\+E\+\_\+\+E\+X\+P\+O\+RT int feat\+\_\+free (\begin{DoxyParamCaption}\item[{\textbf{ feat\+\_\+t} $\ast$}]{f }\end{DoxyParamCaption})}



Release resource associated with \doxyref{feat\+\_\+t}{p.}{structfeat__t}. 

\begin{DoxyReturn}{Returns}
new reference count (0 if freed) 
\end{DoxyReturn}

\begin{DoxyParams}{Parameters}
{\em f} & In\+: \doxyref{feat\+\_\+t}{p.}{structfeat__t} \\
\hline
\end{DoxyParams}


Definition at line 1430 of file feat.\+c.

\mbox{\label{feat_8h_a7a5e2e02e99e368e1e9e3b1ded35e3dc}} 
\index{feat.\+h@{feat.\+h}!feat\+\_\+init@{feat\+\_\+init}}
\index{feat\+\_\+init@{feat\+\_\+init}!feat.\+h@{feat.\+h}}
\subsubsection{feat\+\_\+init()}
{\footnotesize\ttfamily S\+P\+H\+I\+N\+X\+B\+A\+S\+E\+\_\+\+E\+X\+P\+O\+RT \textbf{ feat\+\_\+t}$\ast$ feat\+\_\+init (\begin{DoxyParamCaption}\item[{char const $\ast$}]{type,  }\item[{\textbf{ cmn\+\_\+type\+\_\+t}}]{cmn,  }\item[{int32}]{varnorm,  }\item[{\textbf{ agc\+\_\+type\+\_\+t}}]{agc,  }\item[{int32}]{breport,  }\item[{int32}]{cepsize }\end{DoxyParamCaption})}



Initialize feature module to use the selected type of feature stream. 

One-\/time only initialization at the beginning of the program. Input type is a string defining the kind of input-\/$>$feature conversion desired\+:


\begin{DoxyItemize}
\item \char`\"{}s2\+\_\+4x\char`\"{}\+: s2mfc-\/$>$Sphinx-\/\+II 4-\/feature stream,
\item \char`\"{}1s\+\_\+c\+\_\+d\+\_\+dd\char`\"{}\+: s2mfc-\/$>$Sphinx 3.\+x single feature stream,
\item \char`\"{}s3\+\_\+1x39\char`\"{}\+: s2mfc-\/$>$Sphinx 3.\+0 single feature stream,
\item \char`\"{}n1,n2,n3,...\char`\"{}\+: Explicit feature vector layout spec. with comma-\/separated feature stream lengths. In this case, the input data is already in the feature format and there is no conversion necessary.
\end{DoxyItemize}

\begin{DoxyReturn}{Returns}
(\doxyref{feat\+\_\+t}{p.}{structfeat__t} $\ast$) descriptor if successful, N\+U\+LL if error. Caller must not directly modify the contents of the returned value. 
\end{DoxyReturn}

\begin{DoxyParams}{Parameters}
{\em type} & In\+: Type of feature stream \\
\hline
{\em cmn} & In\+: Type of cepstram mean normalization to be done before feature computation; can be C\+M\+N\+\_\+\+N\+O\+NE (for none) \\
\hline
{\em varnorm} & In\+: (boolean) Whether variance normalization done on each utt; only applicable if C\+MN also done \\
\hline
{\em agc} & In\+: Type of automatic gain control to be done before feature computation \\
\hline
{\em breport} & In\+: Whether to show a report for \doxyref{feat\+\_\+t}{p.}{structfeat__t} \\
\hline
{\em cepsize} & Number of components in the input vector (or 0 for the default for this feature type, which is usually 13) \\
\hline
\end{DoxyParams}


Definition at line 705 of file feat.\+c.



References agc\+\_\+type\+\_\+str, ckd\+\_\+calloc, ckd\+\_\+free(), ckd\+\_\+salloc, cmn\+\_\+type\+\_\+str, E\+\_\+\+E\+R\+R\+OR, and E\+\_\+\+I\+N\+FO.

\mbox{\label{feat_8h_a7452702cb435ea9244c7e1f61bbf5da1}} 
\index{feat.\+h@{feat.\+h}!feat\+\_\+lda\+\_\+transform@{feat\+\_\+lda\+\_\+transform}}
\index{feat\+\_\+lda\+\_\+transform@{feat\+\_\+lda\+\_\+transform}!feat.\+h@{feat.\+h}}
\subsubsection{feat\+\_\+lda\+\_\+transform()}
{\footnotesize\ttfamily S\+P\+H\+I\+N\+X\+B\+A\+S\+E\+\_\+\+E\+X\+P\+O\+RT void feat\+\_\+lda\+\_\+transform (\begin{DoxyParamCaption}\item[{\textbf{ feat\+\_\+t} $\ast$}]{fcb,  }\item[{mfcc\+\_\+t $\ast$$\ast$$\ast$}]{inout\+\_\+feat,  }\item[{uint32}]{nfr }\end{DoxyParamCaption})}



Transform a block of features using the feature module\textquotesingle{}s L\+DA transform. 


\begin{DoxyParams}{Parameters}
{\em fcb} & In\+: Descriptor from \doxyref{feat\+\_\+init()}{p.}{feat_8h_a7a5e2e02e99e368e1e9e3b1ded35e3dc} \\
\hline
{\em inout\+\_\+feat} & Feature block to transform. \\
\hline
{\em nfr} & In\+: Number of frames in inout\+\_\+feat. \\
\hline
\end{DoxyParams}


Definition at line 139 of file lda.\+c.



References ckd\+\_\+calloc, ckd\+\_\+free(), and feat\+\_\+dimension.

\mbox{\label{feat_8h_afeaef030a5ec32c2164b5bd55e912714}} 
\index{feat.\+h@{feat.\+h}!feat\+\_\+print@{feat\+\_\+print}}
\index{feat\+\_\+print@{feat\+\_\+print}!feat.\+h@{feat.\+h}}
\subsubsection{feat\+\_\+print()}
{\footnotesize\ttfamily S\+P\+H\+I\+N\+X\+B\+A\+S\+E\+\_\+\+E\+X\+P\+O\+RT void feat\+\_\+print (\begin{DoxyParamCaption}\item[{\textbf{ feat\+\_\+t} $\ast$}]{fcb,  }\item[{mfcc\+\_\+t $\ast$$\ast$$\ast$}]{feat,  }\item[{int32}]{nfr,  }\item[{F\+I\+LE $\ast$}]{fp }\end{DoxyParamCaption})}



Print the given block of feature vectors to the given F\+I\+LE. 


\begin{DoxyParams}{Parameters}
{\em fcb} & In\+: Descriptor from \doxyref{feat\+\_\+init()}{p.}{feat_8h_a7a5e2e02e99e368e1e9e3b1ded35e3dc} \\
\hline
{\em feat} & In\+: Feature data to be printed \\
\hline
{\em nfr} & In\+: Number of frames of feature data above \\
\hline
{\em fp} & In\+: Output file pointer \\
\hline
\end{DoxyParams}


Definition at line 895 of file feat.\+c.



References feat\+\_\+dimension1, and feat\+\_\+dimension2.

\mbox{\label{feat_8h_a7639fbc34e3328d7e3259e61372c64b8}} 
\index{feat.\+h@{feat.\+h}!feat\+\_\+read\+\_\+lda@{feat\+\_\+read\+\_\+lda}}
\index{feat\+\_\+read\+\_\+lda@{feat\+\_\+read\+\_\+lda}!feat.\+h@{feat.\+h}}
\subsubsection{feat\+\_\+read\+\_\+lda()}
{\footnotesize\ttfamily S\+P\+H\+I\+N\+X\+B\+A\+S\+E\+\_\+\+E\+X\+P\+O\+RT int32 feat\+\_\+read\+\_\+lda (\begin{DoxyParamCaption}\item[{\textbf{ feat\+\_\+t} $\ast$}]{feat,  }\item[{const char $\ast$}]{ldafile,  }\item[{int32}]{dim }\end{DoxyParamCaption})}



Add an L\+DA transformation to the feature module from a file. 

\begin{DoxyReturn}{Returns}
0 for success or -\/1 if reading the L\+DA file failed. 
\end{DoxyReturn}

\begin{DoxyParams}{Parameters}
{\em feat} & In\+: Descriptor from \doxyref{feat\+\_\+init()}{p.}{feat_8h_a7a5e2e02e99e368e1e9e3b1ded35e3dc} \\
\hline
{\em ldafile} & In\+: File to read the L\+DA matrix from. \\
\hline
{\em dim} & In\+: Dimensionality of L\+DA output. \\
\hline
\end{DoxyParams}


Definition at line 61 of file lda.\+c.



References E\+\_\+\+E\+R\+R\+OR.

\mbox{\label{feat_8h_ae3e67bd629f9756ddb6c5a599d223f6e}} 
\index{feat.\+h@{feat.\+h}!feat\+\_\+report@{feat\+\_\+report}}
\index{feat\+\_\+report@{feat\+\_\+report}!feat.\+h@{feat.\+h}}
\subsubsection{feat\+\_\+report()}
{\footnotesize\ttfamily S\+P\+H\+I\+N\+X\+B\+A\+S\+E\+\_\+\+E\+X\+P\+O\+RT void feat\+\_\+report (\begin{DoxyParamCaption}\item[{\textbf{ feat\+\_\+t} $\ast$}]{f }\end{DoxyParamCaption})}



Report the \doxyref{feat\+\_\+t}{p.}{structfeat__t} data structure. 


\begin{DoxyParams}{Parameters}
{\em f} & In\+: \doxyref{feat\+\_\+t}{p.}{structfeat__t} \\
\hline
\end{DoxyParams}


Definition at line 1461 of file feat.\+c.



References E\+\_\+\+I\+N\+F\+O\+\_\+\+N\+O\+FN, and E\+\_\+\+I\+N\+F\+O\+C\+O\+NT.

\mbox{\label{feat_8h_a80d6eabf01ff119d324a07c1de8fda80}} 
\index{feat.\+h@{feat.\+h}!feat\+\_\+retain@{feat\+\_\+retain}}
\index{feat\+\_\+retain@{feat\+\_\+retain}!feat.\+h@{feat.\+h}}
\subsubsection{feat\+\_\+retain()}
{\footnotesize\ttfamily S\+P\+H\+I\+N\+X\+B\+A\+S\+E\+\_\+\+E\+X\+P\+O\+RT \textbf{ feat\+\_\+t}$\ast$ feat\+\_\+retain (\begin{DoxyParamCaption}\item[{\textbf{ feat\+\_\+t} $\ast$}]{f }\end{DoxyParamCaption})}



Retain ownership of \doxyref{feat\+\_\+t}{p.}{structfeat__t}. 

\begin{DoxyReturn}{Returns}
pointer to retained \doxyref{feat\+\_\+t}{p.}{structfeat__t}. 
\end{DoxyReturn}


Definition at line 1423 of file feat.\+c.

\mbox{\label{feat_8h_a918e21c2b28a6951a83c64f7023126a7}} 
\index{feat.\+h@{feat.\+h}!feat\+\_\+s2mfc2feat@{feat\+\_\+s2mfc2feat}}
\index{feat\+\_\+s2mfc2feat@{feat\+\_\+s2mfc2feat}!feat.\+h@{feat.\+h}}
\subsubsection{feat\+\_\+s2mfc2feat()}
{\footnotesize\ttfamily S\+P\+H\+I\+N\+X\+B\+A\+S\+E\+\_\+\+E\+X\+P\+O\+RT int32 feat\+\_\+s2mfc2feat (\begin{DoxyParamCaption}\item[{\textbf{ feat\+\_\+t} $\ast$}]{fcb,  }\item[{const char $\ast$}]{file,  }\item[{const char $\ast$}]{dir,  }\item[{const char $\ast$}]{cepext,  }\item[{int32}]{sf,  }\item[{int32}]{ef,  }\item[{mfcc\+\_\+t $\ast$$\ast$$\ast$}]{feat,  }\item[{int32}]{maxfr }\end{DoxyParamCaption})}



Read a specified M\+FC file (or given segment within it), perform C\+M\+N/\+A\+GC as indicated by {\ttfamily fcb}, and compute feature vectors. 

Feature vectors are computed for the entire segment specified, by including additional surrounding or padding frames to accommodate the feature windows.

\begin{DoxyReturn}{Returns}
Number of frames of feature vectors computed if successful; -\/1 if any error. {\ttfamily If} feat is N\+U\+LL, then no actual computation will be done, and the number of frames which must be allocated will be returned.
\end{DoxyReturn}
A note on how the file path is constructed\+: If the control file already specifies extension or absolute path, then these are not applied. The default extension is defined by the application. 
\begin{DoxyParams}{Parameters}
{\em fcb} & In\+: Descriptor from \doxyref{feat\+\_\+init()}{p.}{feat_8h_a7a5e2e02e99e368e1e9e3b1ded35e3dc} \\
\hline
{\em file} & In\+: File to be read \\
\hline
{\em dir} & In\+: Directory prefix for file, if needed; can be N\+U\+LL \\
\hline
{\em cepext} & In\+: Extension of the cepstrum file.\+It cannot be N\+U\+LL \\
\hline
{\em feat} & Out\+: Computed feature vectors; caller must allocate this space \\
\hline
{\em maxfr} & In\+: Available space (number of frames) in above feat array; it must be sufficient to hold the result. Pass -\/1 for no limit. \\
\hline
\end{DoxyParams}


Definition at line 1169 of file feat.\+c.



References E\+\_\+\+E\+R\+R\+OR.

\mbox{\label{feat_8h_a68bf7d2c15e3f76b08833449eb254aed}} 
\index{feat.\+h@{feat.\+h}!feat\+\_\+s2mfc2feat\+\_\+live@{feat\+\_\+s2mfc2feat\+\_\+live}}
\index{feat\+\_\+s2mfc2feat\+\_\+live@{feat\+\_\+s2mfc2feat\+\_\+live}!feat.\+h@{feat.\+h}}
\subsubsection{feat\+\_\+s2mfc2feat\+\_\+live()}
{\footnotesize\ttfamily S\+P\+H\+I\+N\+X\+B\+A\+S\+E\+\_\+\+E\+X\+P\+O\+RT int32 feat\+\_\+s2mfc2feat\+\_\+live (\begin{DoxyParamCaption}\item[{\textbf{ feat\+\_\+t} $\ast$}]{fcb,  }\item[{mfcc\+\_\+t $\ast$$\ast$}]{uttcep,  }\item[{int32 $\ast$}]{inout\+\_\+ncep,  }\item[{int32}]{beginutt,  }\item[{int32}]{endutt,  }\item[{mfcc\+\_\+t $\ast$$\ast$$\ast$}]{ofeat }\end{DoxyParamCaption})}



Feature computation routine for live mode decoder. 

This function computes features for blocks of incoming data. It retains an internal buffer for computing deltas, which means that the number of output frames will not necessarily equal the number of input frames.

{\bfseries It is very important} to realize that the number of output frames can be {\bfseries greater than} the number of input frames, specifically when {\ttfamily endutt} is true. It is guaranteed to never exceed {\ttfamily $\ast$inout\+\_\+ncep + \doxyref{feat\+\_\+window\+\_\+size(fcb)}{p.}{feat_8h_a69cdcd91578c26565c7653ad6f2eb510}}. You {\bfseries M\+U\+ST} have allocated at least that many frames in {\ttfamily ofeat}, or you will experience a buffer overflow.

If beginutt and endutt are both true, C\+M\+N\+\_\+\+C\+U\+R\+R\+E\+NT and A\+G\+C\+\_\+\+M\+AX will be done. Otherwise only C\+M\+N\+\_\+\+P\+R\+I\+OR and A\+G\+C\+\_\+\+E\+M\+AX will be done.

If beginutt is false, endutt is true, and the number of input frames exceeds the input size, then end-\/of-\/utterance processing won\textquotesingle{}t actually be done. This condition can easily be checked, because {\ttfamily $\ast$inout\+\_\+ncep} will equal the return value on exit, and will also be smaller than the value of {\ttfamily $\ast$inout\+\_\+ncep} on entry.

\begin{DoxyReturn}{Returns}
The number of output frames actually computed. 
\end{DoxyReturn}

\begin{DoxyParams}{Parameters}
{\em fcb} & In\+: Descriptor from \doxyref{feat\+\_\+init()}{p.}{feat_8h_a7a5e2e02e99e368e1e9e3b1ded35e3dc} \\
\hline
{\em uttcep} & In\+: Incoming cepstral buffer \\
\hline
{\em inout\+\_\+ncep} & In\+: Size of incoming buffer. Out\+: Number of incoming frames consumed. \\
\hline
{\em beginutt} & In\+: Begining of utterance flag \\
\hline
{\em endutt} & In\+: End of utterance flag \\
\hline
{\em ofeat} & In\+: Output feature buffer. See {\bfseries V\+E\+RY I\+M\+P\+O\+R\+T\+A\+NT} note about the size of this buffer above. \\
\hline
\end{DoxyParams}


Definition at line 1307 of file feat.\+c.

\mbox{\label{feat_8h_a9a79c7278d484fa8178cd7c06156b794}} 
\index{feat.\+h@{feat.\+h}!feat\+\_\+set\+\_\+subvecs@{feat\+\_\+set\+\_\+subvecs}}
\index{feat\+\_\+set\+\_\+subvecs@{feat\+\_\+set\+\_\+subvecs}!feat.\+h@{feat.\+h}}
\subsubsection{feat\+\_\+set\+\_\+subvecs()}
{\footnotesize\ttfamily S\+P\+H\+I\+N\+X\+B\+A\+S\+E\+\_\+\+E\+X\+P\+O\+RT int feat\+\_\+set\+\_\+subvecs (\begin{DoxyParamCaption}\item[{\textbf{ feat\+\_\+t} $\ast$}]{fcb,  }\item[{int32 $\ast$$\ast$}]{subvecs }\end{DoxyParamCaption})}



Add a subvector specification to the feature module. 

The subvector splitting will be performed after dynamic feature computation, C\+MN, A\+GC, and any L\+DA transformation. The number of streams in the dynamic feature type must be one, as with L\+DA.

After adding a subvector specification, the output of feature computation will be split into multiple subvectors, and \doxyref{feat\+\_\+array\+\_\+alloc()}{p.}{feat_8h_a03071d6d5c6b233117871f583c258b1e} will allocate pointers accordingly. The number of {\itshape streams} will remain the


\begin{DoxyParams}{Parameters}
{\em fcb} & the feature descriptor. \\
\hline
{\em subvecs} & subvector specification. This pointer is retained by the \doxyref{feat\+\_\+t}{p.}{structfeat__t} and should not be freed manually. \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
0 for success or -\/1 if the subvector specification was invalid. 
\end{DoxyReturn}


Definition at line 277 of file feat.\+c.

\mbox{\label{feat_8h_a613aca09a7f45f5ddc550efe685cb83b}} 
\index{feat.\+h@{feat.\+h}!parse\+\_\+subvecs@{parse\+\_\+subvecs}}
\index{parse\+\_\+subvecs@{parse\+\_\+subvecs}!feat.\+h@{feat.\+h}}
\subsubsection{parse\+\_\+subvecs()}
{\footnotesize\ttfamily S\+P\+H\+I\+N\+X\+B\+A\+S\+E\+\_\+\+E\+X\+P\+O\+RT int32$\ast$$\ast$ parse\+\_\+subvecs (\begin{DoxyParamCaption}\item[{char const $\ast$}]{str }\end{DoxyParamCaption})}



Parse subvector specification string. 

Format of specification\+: \begin{DoxyItemize}
\item \textquotesingle{}/\textquotesingle{} separated list of subvectors \item each subvector is a \textquotesingle{},\textquotesingle{} separated list of subranges \item each subrange is a single\begin{DoxyVerb}<number> \end{DoxyVerb}
 or \begin{DoxyVerb}<number>-<number> \end{DoxyVerb}
 (inclusive), where \begin{DoxyVerb}<number> \end{DoxyVerb}
 is a feature vector dimension specifier.\end{DoxyItemize}
E.\+g., \char`\"{}24,0-\/11/25,12-\/23/26,27-\/38\char`\"{} has\+: \begin{DoxyItemize}
\item 3 subvectors \item the 1st subvector has feature dims\+: 24, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, and 11. \item etc.\end{DoxyItemize}

\begin{DoxyParams}{Parameters}
{\em str} & subvector specification string. \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
allocated 2-\/D array of subvector specs (free with \doxyref{subvecs\+\_\+free()}{p.}{feat_8h_ad209a1028b315a96a3a2447eccdb8605}). If there are N subvectors specified, subvec[N] = N\+U\+LL; and each subvec[0]..subvec[N-\/1] is -\/1 terminated vector of feature dims. 
\end{DoxyReturn}


Definition at line 169 of file feat.\+c.

