\doxysection{AMBE vocoder}
\label{group__codec}\index{AMBE vocoder@{AMBE vocoder}}
\doxysubsection*{Modules}
\begin{DoxyCompactItemize}
\item 
\textbf{ AMBE vocoder -\/ internal API}
\end{DoxyCompactItemize}
\doxysubsection*{Files}
\begin{DoxyCompactItemize}
\item 
file \textbf{ codec.\+h}
\begin{DoxyCompactList}\small\item\em Osmocom GMR-\/1 AMBE vocoder header. \end{DoxyCompactList}\item 
file \textbf{ codec.\+c}
\begin{DoxyCompactList}\small\item\em Osmocom GMR-\/1 AMBE vocoder public API implementation. \end{DoxyCompactList}\end{DoxyCompactItemize}
\doxysubsection*{Data Structures}
\begin{DoxyCompactItemize}
\item 
struct \textbf{ gmr1\+\_\+codec}
\begin{DoxyCompactList}\small\item\em Structure for GMR1 codec state. \end{DoxyCompactList}\end{DoxyCompactItemize}
\doxysubsection*{Functions}
\begin{DoxyCompactItemize}
\item 
struct \textbf{ gmr1\+\_\+codec} $\ast$ \textbf{ gmr1\+\_\+codec\+\_\+alloc} (void)
\begin{DoxyCompactList}\small\item\em Allocates and inits a codec object. \end{DoxyCompactList}\item 
void \textbf{ gmr1\+\_\+codec\+\_\+release} (struct \textbf{ gmr1\+\_\+codec} $\ast$codec)
\begin{DoxyCompactList}\small\item\em Release a codec object created by \doxyref{gmr1\+\_\+codec\+\_\+alloc}{p.}{group__codec_ga34e0de595c6498ae39695d5909bec094}. \end{DoxyCompactList}\item 
int \textbf{ gmr1\+\_\+codec\+\_\+decode\+\_\+frame} (struct \textbf{ gmr1\+\_\+codec} $\ast$codec, int16\+\_\+t $\ast$audio, int N, const uint8\+\_\+t $\ast$frame, int bad)
\begin{DoxyCompactList}\small\item\em Decodes an AMBE frame to audio. \end{DoxyCompactList}\item 
int \textbf{ gmr1\+\_\+codec\+\_\+decode\+\_\+dtx} (struct \textbf{ gmr1\+\_\+codec} $\ast$codec, int16\+\_\+t $\ast$audio, int N)
\begin{DoxyCompactList}\small\item\em Generates audio for DTX period. \end{DoxyCompactList}\end{DoxyCompactItemize}


\doxysubsection{Detailed Description}


\doxysubsection{Function Documentation}
\mbox{\label{group__codec_ga34e0de595c6498ae39695d5909bec094}} 
\index{AMBE vocoder@{AMBE vocoder}!gmr1\_codec\_alloc@{gmr1\_codec\_alloc}}
\index{gmr1\_codec\_alloc@{gmr1\_codec\_alloc}!AMBE vocoder@{AMBE vocoder}}
\doxysubsubsection{gmr1\_codec\_alloc()}
{\footnotesize\ttfamily struct \textbf{ gmr1\+\_\+codec} $\ast$ gmr1\+\_\+codec\+\_\+alloc (\begin{DoxyParamCaption}\item[{void}]{ }\end{DoxyParamCaption})}



Allocates and inits a codec object. 

\begin{DoxyReturn}{Returns}
A newly allocated codec, to be freed with \doxyref{gmr1\+\_\+codec\+\_\+release}{p.}{group__codec_gad1c2b9c16672bcd48076af0b0f162557} 
\end{DoxyReturn}


References \textbf{ ambe\+\_\+decode\+\_\+init()}, and \textbf{ gmr1\+\_\+codec\+::dec}.

\mbox{\label{group__codec_ga23fe43b3790482c7f99d3aa33940f54f}} 
\index{AMBE vocoder@{AMBE vocoder}!gmr1\_codec\_decode\_dtx@{gmr1\_codec\_decode\_dtx}}
\index{gmr1\_codec\_decode\_dtx@{gmr1\_codec\_decode\_dtx}!AMBE vocoder@{AMBE vocoder}}
\doxysubsubsection{gmr1\_codec\_decode\_dtx()}
{\footnotesize\ttfamily int gmr1\+\_\+codec\+\_\+decode\+\_\+dtx (\begin{DoxyParamCaption}\item[{struct \textbf{ gmr1\+\_\+codec} $\ast$}]{codec,  }\item[{int16\+\_\+t $\ast$}]{audio,  }\item[{int}]{N }\end{DoxyParamCaption})}



Generates audio for DTX period. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em codec} & Codec object \\
\hline
\mbox{\texttt{ out}}  & {\em audio} & Output audio buffer \\
\hline
\mbox{\texttt{ in}}  & {\em N} & number of audio samples to produce (152..168) \\
\hline
\end{DoxyParams}


References \textbf{ ambe\+\_\+decode\+\_\+dtx()}, and \textbf{ gmr1\+\_\+codec\+::dec}.

\mbox{\label{group__codec_ga81d71b9b1e226a344a896d926ad4537a}} 
\index{AMBE vocoder@{AMBE vocoder}!gmr1\_codec\_decode\_frame@{gmr1\_codec\_decode\_frame}}
\index{gmr1\_codec\_decode\_frame@{gmr1\_codec\_decode\_frame}!AMBE vocoder@{AMBE vocoder}}
\doxysubsubsection{gmr1\_codec\_decode\_frame()}
{\footnotesize\ttfamily int gmr1\+\_\+codec\+\_\+decode\+\_\+frame (\begin{DoxyParamCaption}\item[{struct \textbf{ gmr1\+\_\+codec} $\ast$}]{codec,  }\item[{int16\+\_\+t $\ast$}]{audio,  }\item[{int}]{N,  }\item[{const uint8\+\_\+t $\ast$}]{frame,  }\item[{int}]{bad }\end{DoxyParamCaption})}



Decodes an AMBE frame to audio. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em codec} & Codec object \\
\hline
\mbox{\texttt{ out}}  & {\em audio} & Output audio buffer \\
\hline
\mbox{\texttt{ in}}  & {\em N} & number of audio samples to produce (152..168) \\
\hline
\mbox{\texttt{ in}}  & {\em frame} & Frame data (10 bytes = 80 bits) \\
\hline
\mbox{\texttt{ in}}  & {\em bad} & Bad Frame Indicator. Set to 1 if frame is corrupt \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
0 for success. Negative error code otherwise. 
\end{DoxyReturn}


References \textbf{ ambe\+\_\+decode\+\_\+frame()}, and \textbf{ gmr1\+\_\+codec\+::dec}.

\mbox{\label{group__codec_gad1c2b9c16672bcd48076af0b0f162557}} 
\index{AMBE vocoder@{AMBE vocoder}!gmr1\_codec\_release@{gmr1\_codec\_release}}
\index{gmr1\_codec\_release@{gmr1\_codec\_release}!AMBE vocoder@{AMBE vocoder}}
\doxysubsubsection{gmr1\_codec\_release()}
{\footnotesize\ttfamily void gmr1\+\_\+codec\+\_\+release (\begin{DoxyParamCaption}\item[{struct \textbf{ gmr1\+\_\+codec} $\ast$}]{codec }\end{DoxyParamCaption})}



Release a codec object created by \doxyref{gmr1\+\_\+codec\+\_\+alloc}{p.}{group__codec_ga34e0de595c6498ae39695d5909bec094}. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em codec} & The codec object to release \\
\hline
\end{DoxyParams}


References \textbf{ ambe\+\_\+decode\+\_\+fini()}, and \textbf{ gmr1\+\_\+codec\+::dec}.

