\doxysection{agc.\+c}
\label{agc_8c_source}\index{src/libsphinxbase/feat/agc.c@{src/libsphinxbase/feat/agc.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}{\ *\ agc.c\ -\/-\/\ Various\ forms\ of\ automatic\ gain\ control\ (AGC)}}
\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.5\ \ 2005/06/21\ \ 19:25:41\ \ arthchan2003}}
\DoxyCodeLine{00050\ \textcolor{comment}{\ *\ 1,\ Fixed\ doxygen\ documentation.\ 2,\ Added\ \$\ keyword.}}
\DoxyCodeLine{00051\ \textcolor{comment}{\ *\ }}
\DoxyCodeLine{00052\ \textcolor{comment}{\ *\ Revision\ 1.3\ \ 2005/03/30\ 01:22:46\ \ archan}}
\DoxyCodeLine{00053\ \textcolor{comment}{\ *\ Fixed\ mistakes\ in\ last\ updates.\ Add}}
\DoxyCodeLine{00054\ \textcolor{comment}{\ *}}
\DoxyCodeLine{00055\ \textcolor{comment}{\ *\ }}
\DoxyCodeLine{00056\ \textcolor{comment}{\ *\ 04-\/Nov-\/95\ \ \ \ M\ K\ Ravishankar\ (rkm@cs.cmu.edu)\ at\ Carnegie\ Mellon\ University}}
\DoxyCodeLine{00057\ \textcolor{comment}{\ *\ \ \ \ \ \ \ \ \ \ \ \ \ \ Created.}}
\DoxyCodeLine{00058\ \textcolor{comment}{\ */}}
\DoxyCodeLine{00059\ }
\DoxyCodeLine{00060\ \textcolor{preprocessor}{\#include\ <string.h>}}
\DoxyCodeLine{00061\ \textcolor{preprocessor}{\#ifdef\ HAVE\_CONFIG\_H}}
\DoxyCodeLine{00062\ \textcolor{preprocessor}{\#include\ <config.h>}}
\DoxyCodeLine{00063\ \textcolor{preprocessor}{\#endif}}
\DoxyCodeLine{00064\ }
\DoxyCodeLine{00065\ \textcolor{preprocessor}{\#include\ "{}sphinxbase/err.h"{}}}
\DoxyCodeLine{00066\ \textcolor{preprocessor}{\#include\ "{}sphinxbase/ckd\_alloc.h"{}}}
\DoxyCodeLine{00067\ \textcolor{preprocessor}{\#include\ "{}sphinxbase/agc.h"{}}}
\DoxyCodeLine{00068\ }
\DoxyCodeLine{00069\ \textcolor{comment}{/*\ NOTE!\ \ These\ must\ match\ the\ enum\ in\ agc.h\ */}}
\DoxyCodeLine{00070\ \textcolor{keyword}{const}\ \textcolor{keywordtype}{char}\ *agc\_type\_str[]\ =\ \{}
\DoxyCodeLine{00071\ \ \ \ \ \textcolor{stringliteral}{"{}none"{}},}
\DoxyCodeLine{00072\ \ \ \ \ \textcolor{stringliteral}{"{}max"{}},}
\DoxyCodeLine{00073\ \ \ \ \ \textcolor{stringliteral}{"{}emax"{}},}
\DoxyCodeLine{00074\ \ \ \ \ \textcolor{stringliteral}{"{}noise"{}}}
\DoxyCodeLine{00075\ \};}
\DoxyCodeLine{00076\ \textcolor{keyword}{static}\ \textcolor{keyword}{const}\ \textcolor{keywordtype}{int}\ n\_agc\_type\_str\ =\ \textcolor{keyword}{sizeof}(agc\_type\_str)/\textcolor{keyword}{sizeof}(agc\_type\_str[0]);}
\DoxyCodeLine{00077\ }
\DoxyCodeLine{00078\ agc\_type\_t}
\DoxyCodeLine{00079\ agc\_type\_from\_str(\textcolor{keyword}{const}\ \textcolor{keywordtype}{char}\ *str)}
\DoxyCodeLine{00080\ \{}
\DoxyCodeLine{00081\ \ \ \ \ \textcolor{keywordtype}{int}\ i;}
\DoxyCodeLine{00082\ }
\DoxyCodeLine{00083\ \ \ \ \ \textcolor{keywordflow}{for}\ (i\ =\ 0;\ i\ <\ n\_agc\_type\_str;\ ++i)\ \{}
\DoxyCodeLine{00084\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{if}\ (0\ ==\ strcmp(str,\ agc\_type\_str[i]))}
\DoxyCodeLine{00085\ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{return}\ (agc\_type\_t)i;}
\DoxyCodeLine{00086\ \ \ \ \ \}}
\DoxyCodeLine{00087\ \ \ \ \ E\_FATAL(\textcolor{stringliteral}{"{}Unknown\ AGC\ type\ '\%s'\(\backslash\)n"{}},\ str);}
\DoxyCodeLine{00088\ \ \ \ \ \textcolor{keywordflow}{return}\ AGC\_NONE;}
\DoxyCodeLine{00089\ \}}
\DoxyCodeLine{00090\ }
\DoxyCodeLine{00091\ agc\_t\ *agc\_init(\textcolor{keywordtype}{void})}
\DoxyCodeLine{00092\ \{}
\DoxyCodeLine{00093\ \ \ \ \ agc\_t\ *agc;}
\DoxyCodeLine{00094\ \ \ \ \ agc\ =\ ckd\_calloc(1,\ \textcolor{keyword}{sizeof}(*agc));}
\DoxyCodeLine{00095\ \ \ \ \ agc-\/>noise\_thresh\ =\ FLOAT2MFCC(2.0);}
\DoxyCodeLine{00096\ \ \ \ \ }
\DoxyCodeLine{00097\ \ \ \ \ \textcolor{keywordflow}{return}\ agc;}
\DoxyCodeLine{00098\ \}}
\DoxyCodeLine{00099\ }
\DoxyCodeLine{00100\ \textcolor{keywordtype}{void}\ agc\_free(agc\_t\ *agc)}
\DoxyCodeLine{00101\ \{}
\DoxyCodeLine{00102\ \ \ \ \ ckd\_free(agc);}
\DoxyCodeLine{00103\ \}}
\DoxyCodeLine{00104\ }
\DoxyCodeLine{00108\ \textcolor{keywordtype}{void}}
\DoxyCodeLine{00109\ agc\_max(agc\_t\ *agc,\ mfcc\_t\ **mfc,\ int32\ n\_frame)}
\DoxyCodeLine{00110\ \{}
\DoxyCodeLine{00111\ \ \ \ \ int32\ i;}
\DoxyCodeLine{00112\ }
\DoxyCodeLine{00113\ \ \ \ \ \textcolor{keywordflow}{if}\ (n\_frame\ <=\ 0)}
\DoxyCodeLine{00114\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{return};}
\DoxyCodeLine{00115\ \ \ \ \ agc-\/>obs\_max\ =\ mfc[0][0];}
\DoxyCodeLine{00116\ \ \ \ \ \textcolor{keywordflow}{for}\ (i\ =\ 1;\ i\ <\ n\_frame;\ i++)\ \{}
\DoxyCodeLine{00117\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{if}\ (mfc[i][0]\ >\ agc-\/>obs\_max)\ \{}
\DoxyCodeLine{00118\ \ \ \ \ \ \ \ \ \ \ \ \ agc-\/>obs\_max\ =\ mfc[i][0];}
\DoxyCodeLine{00119\ \ \ \ \ \ \ \ \ \ \ \ \ agc-\/>obs\_frame\ =\ 1;}
\DoxyCodeLine{00120\ \ \ \ \ \ \ \ \ \}}
\DoxyCodeLine{00121\ \ \ \ \ \}}
\DoxyCodeLine{00122\ }
\DoxyCodeLine{00123\ \ \ \ \ E\_INFO(\textcolor{stringliteral}{"{}AGCMax:\ obs=max=\ \%.2f\(\backslash\)n"{}},\ agc-\/>obs\_max);}
\DoxyCodeLine{00124\ \ \ \ \ \textcolor{keywordflow}{for}\ (i\ =\ 0;\ i\ <\ n\_frame;\ i++)}
\DoxyCodeLine{00125\ \ \ \ \ \ \ \ \ mfc[i][0]\ -\/=\ agc-\/>obs\_max;}
\DoxyCodeLine{00126\ \}}
\DoxyCodeLine{00127\ }
\DoxyCodeLine{00128\ \textcolor{keywordtype}{void}}
\DoxyCodeLine{00129\ agc\_emax\_set(agc\_t\ *agc,\ float32\ m)}
\DoxyCodeLine{00130\ \{}
\DoxyCodeLine{00131\ \ \ \ \ agc-\/>max\ =\ FLOAT2MFCC(m);}
\DoxyCodeLine{00132\ \ \ \ \ E\_INFO(\textcolor{stringliteral}{"{}AGCEMax:\ max=\ \%.2f\(\backslash\)n"{}},\ m);}
\DoxyCodeLine{00133\ \}}
\DoxyCodeLine{00134\ }
\DoxyCodeLine{00135\ float32}
\DoxyCodeLine{00136\ agc\_emax\_get(agc\_t\ *agc)}
\DoxyCodeLine{00137\ \{}
\DoxyCodeLine{00138\ \ \ \ \ \textcolor{keywordflow}{return}\ MFCC2FLOAT(agc-\/>max);}
\DoxyCodeLine{00139\ \}}
\DoxyCodeLine{00140\ }
\DoxyCodeLine{00141\ \textcolor{keywordtype}{void}}
\DoxyCodeLine{00142\ agc\_emax(agc\_t\ *agc,\ mfcc\_t\ **mfc,\ int32\ n\_frame)}
\DoxyCodeLine{00143\ \{}
\DoxyCodeLine{00144\ \ \ \ \ \textcolor{keywordtype}{int}\ i;}
\DoxyCodeLine{00145\ }
\DoxyCodeLine{00146\ \ \ \ \ \textcolor{keywordflow}{if}\ (n\_frame\ <=\ 0)}
\DoxyCodeLine{00147\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{return};}
\DoxyCodeLine{00148\ \ \ \ \ \textcolor{keywordflow}{for}\ (i\ =\ 0;\ i\ <\ n\_frame;\ ++i)\ \{}
\DoxyCodeLine{00149\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{if}\ (mfc[i][0]\ >\ agc-\/>obs\_max)\ \{}
\DoxyCodeLine{00150\ \ \ \ \ \ \ \ \ \ \ \ \ agc-\/>obs\_max\ =\ mfc[i][0];}
\DoxyCodeLine{00151\ \ \ \ \ \ \ \ \ \ \ \ \ agc-\/>obs\_frame\ =\ 1;}
\DoxyCodeLine{00152\ \ \ \ \ \ \ \ \ \}}
\DoxyCodeLine{00153\ \ \ \ \ \ \ \ \ mfc[i][0]\ -\/=\ agc-\/>max;}
\DoxyCodeLine{00154\ \ \ \ \ \}}
\DoxyCodeLine{00155\ \}}
\DoxyCodeLine{00156\ }
\DoxyCodeLine{00157\ \textcolor{comment}{/*\ Update\ estimated\ max\ for\ next\ utterance\ */}}
\DoxyCodeLine{00158\ \textcolor{keywordtype}{void}}
\DoxyCodeLine{00159\ agc\_emax\_update(agc\_t\ *agc)}
\DoxyCodeLine{00160\ \{}
\DoxyCodeLine{00161\ \ \ \ \ \textcolor{keywordflow}{if}\ (agc-\/>obs\_frame)\ \{\ \ \ \ \ \ \ \ \ \ \ \ \textcolor{comment}{/*\ Update\ only\ if\ some\ data\ observed\ */}}
\DoxyCodeLine{00162\ \ \ \ \ \ \ \ \ agc-\/>obs\_max\_sum\ +=\ agc-\/>obs\_max;}
\DoxyCodeLine{00163\ \ \ \ \ \ \ \ \ agc-\/>obs\_utt++;}
\DoxyCodeLine{00164\ }
\DoxyCodeLine{00165\ \ \ \ \ \ \ \ \ \textcolor{comment}{/*\ Re-\/estimate\ max\ over\ past\ history;\ decay\ the\ history\ */}}
\DoxyCodeLine{00166\ \ \ \ \ \ \ \ \ agc-\/>max\ =\ agc-\/>obs\_max\_sum\ /\ agc-\/>obs\_utt;}
\DoxyCodeLine{00167\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{if}\ (agc-\/>obs\_utt\ ==\ 8)\ \{}
\DoxyCodeLine{00168\ \ \ \ \ \ \ \ \ \ \ \ \ agc-\/>obs\_max\_sum\ /=\ 2;}
\DoxyCodeLine{00169\ \ \ \ \ \ \ \ \ \ \ \ \ agc-\/>obs\_utt\ =\ 4;}
\DoxyCodeLine{00170\ \ \ \ \ \ \ \ \ \}}
\DoxyCodeLine{00171\ \ \ \ \ \}}
\DoxyCodeLine{00172\ \ \ \ \ E\_INFO(\textcolor{stringliteral}{"{}AGCEMax:\ obs=\ \%.2f,\ new=\ \%.2f\(\backslash\)n"{}},\ agc-\/>obs\_max,\ agc-\/>max);}
\DoxyCodeLine{00173\ }
\DoxyCodeLine{00174\ \ \ \ \ \textcolor{comment}{/*\ Reset\ the\ accumulators\ for\ the\ next\ utterance.\ */}}
\DoxyCodeLine{00175\ \ \ \ \ agc-\/>obs\_frame\ =\ 0;}
\DoxyCodeLine{00176\ \ \ \ \ agc-\/>obs\_max\ =\ FLOAT2MFCC(-\/1000.0);\ \textcolor{comment}{/*\ Less\ than\ any\ real\ C0\ value\ (hopefully!!)\ */}}
\DoxyCodeLine{00177\ \}}
\DoxyCodeLine{00178\ }
\DoxyCodeLine{00179\ \textcolor{keywordtype}{void}}
\DoxyCodeLine{00180\ agc\_noise(agc\_t\ *agc,}
\DoxyCodeLine{00181\ \ \ \ \ \ \ \ \ \ \ mfcc\_t\ **cep,}
\DoxyCodeLine{00182\ \ \ \ \ \ \ \ \ \ \ int32\ nfr)}
\DoxyCodeLine{00183\ \{}
\DoxyCodeLine{00184\ \ \ \ \ mfcc\_t\ min\_energy;\ \textcolor{comment}{/*\ Minimum\ log-\/energy\ */}}
\DoxyCodeLine{00185\ \ \ \ \ mfcc\_t\ noise\_level;\ \ \ \ \ \ \ \ \textcolor{comment}{/*\ Average\ noise\_level\ */}}
\DoxyCodeLine{00186\ \ \ \ \ int32\ i;\ \ \ \ \ \ \ \ \ \ \ \textcolor{comment}{/*\ frame\ index\ */}}
\DoxyCodeLine{00187\ \ \ \ \ int32\ noise\_frames;\ \ \ \ \ \ \ \ \textcolor{comment}{/*\ Number\ of\ noise\ frames\ */}}
\DoxyCodeLine{00188\ }
\DoxyCodeLine{00189\ \ \ \ \ \textcolor{comment}{/*\ Determine\ minimum\ log-\/energy\ in\ utterance\ */}}
\DoxyCodeLine{00190\ \ \ \ \ min\_energy\ =\ cep[0][0];}
\DoxyCodeLine{00191\ \ \ \ \ \textcolor{keywordflow}{for}\ (i\ =\ 0;\ i\ <\ nfr;\ ++i)\ \{}
\DoxyCodeLine{00192\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{if}\ (cep[i][0]\ <\ min\_energy)}
\DoxyCodeLine{00193\ \ \ \ \ \ \ \ \ \ \ \ \ min\_energy\ =\ cep[i][0];}
\DoxyCodeLine{00194\ \ \ \ \ \}}
\DoxyCodeLine{00195\ }
\DoxyCodeLine{00196\ \ \ \ \ \textcolor{comment}{/*\ Average\ all\ frames\ between\ min\_energy\ and\ min\_energy\ +\ agc-\/>noise\_thresh\ */}}
\DoxyCodeLine{00197\ \ \ \ \ noise\_frames\ =\ 0;}
\DoxyCodeLine{00198\ \ \ \ \ noise\_level\ =\ 0;}
\DoxyCodeLine{00199\ \ \ \ \ min\_energy\ +=\ agc-\/>noise\_thresh;}
\DoxyCodeLine{00200\ \ \ \ \ \textcolor{keywordflow}{for}\ (i\ =\ 0;\ i\ <\ nfr;\ ++i)\ \{}
\DoxyCodeLine{00201\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{if}\ (cep[i][0]\ <\ min\_energy)\ \{}
\DoxyCodeLine{00202\ \ \ \ \ \ \ \ \ \ \ \ \ noise\_level\ +=\ cep[i][0];}
\DoxyCodeLine{00203\ \ \ \ \ \ \ \ \ \ \ \ \ noise\_frames++;}
\DoxyCodeLine{00204\ \ \ \ \ \ \ \ \ \}}
\DoxyCodeLine{00205\ \ \ \ \ \}}
\DoxyCodeLine{00206\ \ \ \ \ noise\_level\ /=\ noise\_frames;}
\DoxyCodeLine{00207\ }
\DoxyCodeLine{00208\ \ \ \ \ E\_INFO(\textcolor{stringliteral}{"{}AGC\ NOISE:\ max=\ \%6.3f\(\backslash\)n"{}},\ MFCC2FLOAT(noise\_level));}
\DoxyCodeLine{00209\ }
\DoxyCodeLine{00210\ \ \ \ \ \textcolor{comment}{/*\ Subtract\ noise\_level\ from\ all\ log\_energy\ values\ */}}
\DoxyCodeLine{00211\ \ \ \ \ \textcolor{keywordflow}{for}\ (i\ =\ 0;\ i\ <\ nfr;\ ++i)}
\DoxyCodeLine{00212\ \ \ \ \ \ \ \ \ cep[i][0]\ -\/=\ noise\_level;}
\DoxyCodeLine{00213\ \}}
\DoxyCodeLine{00214\ }
\DoxyCodeLine{00215\ \textcolor{keywordtype}{void}}
\DoxyCodeLine{00216\ agc\_set\_threshold(agc\_t\ *agc,\ float32\ threshold)}
\DoxyCodeLine{00217\ \{}
\DoxyCodeLine{00218\ \ \ \ \ agc-\/>noise\_thresh\ =\ FLOAT2MFCC(threshold);}
\DoxyCodeLine{00219\ \}}
\DoxyCodeLine{00220\ }
\DoxyCodeLine{00221\ float32}
\DoxyCodeLine{00222\ agc\_get\_threshold(agc\_t\ *agc)}
\DoxyCodeLine{00223\ \{}
\DoxyCodeLine{00224\ \ \ \ \ \textcolor{keywordflow}{return}\ FLOAT2MFCC(agc-\/>noise\_thresh);}
\DoxyCodeLine{00225\ \}}

\end{DoxyCode}
