\doxysection{AMBE vocoder -\/ internal API}
\label{group__codec__private}\index{AMBE vocoder -\/ internal API@{AMBE vocoder -\/ internal API}}
\doxysubsection*{Files}
\begin{DoxyCompactItemize}
\item 
file \textbf{ ambe.\+c}
\begin{DoxyCompactList}\small\item\em Osmocom GMR-\/1 AMBE internal API. \end{DoxyCompactList}\item 
file \textbf{ frame.\+c}
\begin{DoxyCompactList}\small\item\em Osmocom GMR-\/1 AMBE speech parameters to/from frame. \end{DoxyCompactList}\item 
file \textbf{ math.\+c}
\begin{DoxyCompactList}\small\item\em Osmocom GMR-\/1 AMBE vocoder math functions. \end{DoxyCompactList}\item 
file \textbf{ private.\+h}
\begin{DoxyCompactList}\small\item\em Osmocom GMR-\/1 AMBE vocoder private header. \end{DoxyCompactList}\item 
file \textbf{ synth.\+c}
\begin{DoxyCompactList}\small\item\em Osmocom GMR-\/1 AMBE vocoder speech synthesis. \end{DoxyCompactList}\item 
file \textbf{ tables.\+c}
\begin{DoxyCompactList}\small\item\em Osmocom GMR-\/1 AMBE vocoder tables. \end{DoxyCompactList}\item 
file \textbf{ tone.\+c}
\begin{DoxyCompactList}\small\item\em Osmocom GMR-\/1 AMBE vocoder tone frames handling. \end{DoxyCompactList}\end{DoxyCompactItemize}
\doxysubsection*{Data Structures}
\begin{DoxyCompactItemize}
\item 
struct \textbf{ ambe\+\_\+raw\+\_\+params}
\begin{DoxyCompactList}\small\item\em AMBE encoded frame raw parameters. \end{DoxyCompactList}\item 
struct \textbf{ ambe\+\_\+subframe}
\begin{DoxyCompactList}\small\item\em AMBE subframe parameters. \end{DoxyCompactList}\item 
struct \textbf{ ambe\+\_\+synth}
\begin{DoxyCompactList}\small\item\em AMBE synthesizer state. \end{DoxyCompactList}\item 
struct \textbf{ ambe\+\_\+decoder}
\begin{DoxyCompactList}\small\item\em AMBE decoder state. \end{DoxyCompactList}\item 
struct \textbf{ tone\+\_\+desc}
\begin{DoxyCompactList}\small\item\em Structure describing a dual-\/frequency tone. \end{DoxyCompactList}\end{DoxyCompactItemize}
\doxysubsection*{Macros}
\begin{DoxyCompactItemize}
\item 
\mbox{\label{group__codec__private_gac1723f2fb63e31519d15815b05cc2a67}} 
\#define {\bfseries AMBE\+\_\+\+RATE}~8000
\begin{DoxyCompactList}\small\item\em AMBE sample rate (Hz) \end{DoxyCompactList}\item 
\mbox{\label{group__codec__private_gacbb42dc053fedc161079f0a4d20a64e8}} 
\#define {\bfseries M\+\_\+\+PIf}~(3.\+141592653589793f)
\begin{DoxyCompactList}\small\item\em Value of pi as a float. \end{DoxyCompactList}\end{DoxyCompactItemize}
\doxysubsection*{Enumerations}
\begin{DoxyCompactItemize}
\item 
enum \textbf{ ambe\+\_\+frame\+\_\+type} \{ \textbf{ AMBE\+\_\+\+SPEECH}
, \textbf{ AMBE\+\_\+\+SILENCE}
, \textbf{ AMBE\+\_\+\+TONE}
 \}
\begin{DoxyCompactList}\small\item\em AMBE possible frame types. \end{DoxyCompactList}\end{DoxyCompactItemize}
\doxysubsection*{Functions}
\begin{DoxyCompactItemize}
\item 
void \textbf{ ambe\+\_\+decode\+\_\+init} (struct \textbf{ ambe\+\_\+decoder} $\ast$dec)
\begin{DoxyCompactList}\small\item\em Initializes decoder state. \end{DoxyCompactList}\item 
void \textbf{ ambe\+\_\+decode\+\_\+fini} (struct \textbf{ ambe\+\_\+decoder} $\ast$dec)
\begin{DoxyCompactList}\small\item\em Release all resources associated with a decoder. \end{DoxyCompactList}\item 
int \textbf{ ambe\+\_\+decode\+\_\+frame} (struct \textbf{ ambe\+\_\+decoder} $\ast$dec, 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{ ambe\+\_\+decode\+\_\+dtx} (struct \textbf{ ambe\+\_\+decoder} $\ast$dec, int16\+\_\+t $\ast$audio, int N)
\begin{DoxyCompactList}\small\item\em Generates audio for DTX period. \end{DoxyCompactList}\item 
void \textbf{ ambe\+\_\+frame\+\_\+unpack\+\_\+raw} (struct \textbf{ ambe\+\_\+raw\+\_\+params} $\ast$rp, const uint8\+\_\+t $\ast$frame)
\begin{DoxyCompactList}\small\item\em Unpack a frame into its raw encoded parameters. \end{DoxyCompactList}\item 
void \textbf{ ambe\+\_\+frame\+\_\+decode\+\_\+params} (struct \textbf{ ambe\+\_\+subframe} $\ast$sf, struct \textbf{ ambe\+\_\+subframe} $\ast$sf\+\_\+prev, struct \textbf{ ambe\+\_\+raw\+\_\+params} $\ast$rp)
\begin{DoxyCompactList}\small\item\em Decodes the speech parameters for both subframes from raw params. \end{DoxyCompactList}\item 
void \textbf{ ambe\+\_\+subframe\+\_\+expand} (struct \textbf{ ambe\+\_\+subframe} $\ast$sf)
\begin{DoxyCompactList}\small\item\em Expands the decoded subframe params to prepare for synthesis. \end{DoxyCompactList}\item 
float \textbf{ cosf\+\_\+fast} (float angle)
\begin{DoxyCompactList}\small\item\em Fast Cosinus approximation using a simple table. \end{DoxyCompactList}\item 
float \textbf{ sinf\+\_\+fast} (float angle)
\begin{DoxyCompactList}\small\item\em Fast Sinus approximation using a simple table. \end{DoxyCompactList}\item 
void \textbf{ ambe\+\_\+fdct} (float $\ast$out, float $\ast$in, int N, int M)
\begin{DoxyCompactList}\small\item\em Forward Discrete Cosine Transform (f\+DCT) \end{DoxyCompactList}\item 
void \textbf{ ambe\+\_\+idct} (float $\ast$out, float $\ast$in, int N, int M)
\begin{DoxyCompactList}\small\item\em Inverse Discrete Cosine Transform (i\+DCT) \end{DoxyCompactList}\item 
void \textbf{ ambe\+\_\+fdft\+\_\+fc} (float $\ast$out\+\_\+i, float $\ast$out\+\_\+q, float $\ast$in, int N, int M)
\begin{DoxyCompactList}\small\item\em Forward Discrete Fourrier Transform (float-\/$>$complex) \end{DoxyCompactList}\item 
void \textbf{ ambe\+\_\+idft\+\_\+cf} (float $\ast$out, float $\ast$in\+\_\+i, float $\ast$in\+\_\+q, int N, int M)
\begin{DoxyCompactList}\small\item\em Inverse Discret Fourrier Transform (complex-\/$>$float) \end{DoxyCompactList}\item 
void \textbf{ ambe\+\_\+synth\+\_\+init} (struct \textbf{ ambe\+\_\+synth} $\ast$synth)
\begin{DoxyCompactList}\small\item\em Initialized Synthesizer state. \end{DoxyCompactList}\item 
void \textbf{ ambe\+\_\+synth\+\_\+enhance} (struct \textbf{ ambe\+\_\+synth} $\ast$synth, struct \textbf{ ambe\+\_\+subframe} $\ast$sf)
\begin{DoxyCompactList}\small\item\em Apply the spectral magnitude enhancement on the subframe. \end{DoxyCompactList}\item 
void \textbf{ ambe\+\_\+synth\+\_\+audio} (struct \textbf{ ambe\+\_\+synth} $\ast$synth, int16\+\_\+t $\ast$audio, struct \textbf{ ambe\+\_\+subframe} $\ast$sf, struct \textbf{ ambe\+\_\+subframe} $\ast$sf\+\_\+prev)
\begin{DoxyCompactList}\small\item\em Generate audio for a given subframe. \end{DoxyCompactList}\item 
int \textbf{ ambe\+\_\+decode\+\_\+tone} (struct \textbf{ ambe\+\_\+decoder} $\ast$dec, int16\+\_\+t $\ast$audio, int N, const uint8\+\_\+t $\ast$frame)
\begin{DoxyCompactList}\small\item\em Decodes an AMBE tone frame. \end{DoxyCompactList}\end{DoxyCompactItemize}
\doxysubsection*{Variables}
\begin{DoxyCompactItemize}
\item 
\mbox{\label{group__codec__private_gafaaf0c3cc5a7cd0f44133e1f5922a52d}} 
const uint8\+\_\+t {\bfseries ambe\+\_\+hpg\+\_\+tbl} [48][4]
\begin{DoxyCompactList}\small\item\em Number of harmonics per group for a given L (starts at L=9) \end{DoxyCompactList}\item 
\mbox{\label{group__codec__private_ga8782e94d4fc86ce45ea714a7316eecd4}} 
const float {\bfseries ambe\+\_\+gain\+\_\+tbl} [256][2]
\begin{DoxyCompactList}\small\item\em Gain (subframe 0, subframe 1) \end{DoxyCompactList}\item 
\mbox{\label{group__codec__private_ga735cc90f20631506f7a5fc4827f4e8d5}} 
const uint16\+\_\+t {\bfseries ambe\+\_\+v\+\_\+uv\+\_\+tbl} [64]
\begin{DoxyCompactList}\small\item\em V/\+UV decisions (subframe 0 = low byte. MSBs = low freq) \end{DoxyCompactList}\item 
\mbox{\label{group__codec__private_gae5a94c3201e655989c87379268c30623}} 
const float {\bfseries ambe\+\_\+prba12\+\_\+tbl} [128][2]
\begin{DoxyCompactList}\small\item\em PRBA[1\+:2]. \end{DoxyCompactList}\item 
\mbox{\label{group__codec__private_gaadea447d12d8536738479b549eb42fdf}} 
const float {\bfseries ambe\+\_\+prba34\+\_\+tbl} [64][2]
\begin{DoxyCompactList}\small\item\em PRBA[3\+:4]. \end{DoxyCompactList}\item 
\mbox{\label{group__codec__private_ga35df9825da65a2015f7576c83c9843f4}} 
const float {\bfseries ambe\+\_\+prba57\+\_\+tbl} [128][3]
\begin{DoxyCompactList}\small\item\em PRBA[5\+:7]. \end{DoxyCompactList}\item 
\mbox{\label{group__codec__private_gac6bf71952dbf30ef32fb5cc91681d8d6}} 
const float {\bfseries ambe\+\_\+hoc0\+\_\+tbl} [128][4]
\begin{DoxyCompactList}\small\item\em HOC for 1st frequency block. \end{DoxyCompactList}\item 
\mbox{\label{group__codec__private_ga934c67cf74ce3f2944594eab3958139c}} 
const float {\bfseries ambe\+\_\+hoc1\+\_\+tbl} [64][4]
\begin{DoxyCompactList}\small\item\em HOC for 2nd frequency block. \end{DoxyCompactList}\item 
\mbox{\label{group__codec__private_ga8992a95357c191374ac100f76f8b42fe}} 
const float {\bfseries ambe\+\_\+hoc2\+\_\+tbl} [64][4]
\begin{DoxyCompactList}\small\item\em HOC for 3rd frequency block. \end{DoxyCompactList}\item 
\mbox{\label{group__codec__private_ga616fdb311356f3430ade8e24d45479b4}} 
const float {\bfseries ambe\+\_\+hoc3\+\_\+tbl} [64][4]
\begin{DoxyCompactList}\small\item\em HOC for last frequency block. \end{DoxyCompactList}\item 
\mbox{\label{group__codec__private_gab7a7b1219368c43c898cfb24ff3cb5cd}} 
const float {\bfseries ambe\+\_\+sf0\+\_\+interp\+\_\+tbl} [4]
\begin{DoxyCompactList}\small\item\em Interpolation ratios for subframe 0 magnitude prediction. \end{DoxyCompactList}\item 
\mbox{\label{group__codec__private_ga42a2421d73b8b9021b2b88698057b53b}} 
const float {\bfseries ambe\+\_\+sf0\+\_\+perr14\+\_\+tbl} [64][4]
\begin{DoxyCompactList}\small\item\em Prediction Error [1\+:4] for subframe 0. \end{DoxyCompactList}\item 
\mbox{\label{group__codec__private_ga109dca33b432f87d6d6a14a4a0787e06}} 
const float {\bfseries ambe\+\_\+sf0\+\_\+perr58\+\_\+tbl} [32][4]
\begin{DoxyCompactList}\small\item\em Prediction Error [5\+:8] for subframe 0. \end{DoxyCompactList}\item 
\mbox{\label{group__codec__private_gafaaf0c3cc5a7cd0f44133e1f5922a52d}} 
const uint8\+\_\+t {\bfseries ambe\+\_\+hpg\+\_\+tbl} [48][4]
\begin{DoxyCompactList}\small\item\em Number of harmonics per group for a given L (starts at L=9) \end{DoxyCompactList}\item 
\mbox{\label{group__codec__private_ga8782e94d4fc86ce45ea714a7316eecd4}} 
const float {\bfseries ambe\+\_\+gain\+\_\+tbl} [256][2]
\begin{DoxyCompactList}\small\item\em Gain (subframe 0, subframe 1) \end{DoxyCompactList}\item 
const uint16\+\_\+t \textbf{ ambe\+\_\+v\+\_\+uv\+\_\+tbl} [64]
\begin{DoxyCompactList}\small\item\em V/\+UV decisions (subframe 0 = low byte. MSBs = low freq) \end{DoxyCompactList}\item 
\mbox{\label{group__codec__private_gae5a94c3201e655989c87379268c30623}} 
const float {\bfseries ambe\+\_\+prba12\+\_\+tbl} [128][2]
\begin{DoxyCompactList}\small\item\em PRBA[1\+:2]. \end{DoxyCompactList}\item 
\mbox{\label{group__codec__private_gaadea447d12d8536738479b549eb42fdf}} 
const float {\bfseries ambe\+\_\+prba34\+\_\+tbl} [64][2]
\begin{DoxyCompactList}\small\item\em PRBA[3\+:4]. \end{DoxyCompactList}\item 
\mbox{\label{group__codec__private_ga35df9825da65a2015f7576c83c9843f4}} 
const float {\bfseries ambe\+\_\+prba57\+\_\+tbl} [128][3]
\begin{DoxyCompactList}\small\item\em PRBA[5\+:7]. \end{DoxyCompactList}\item 
\mbox{\label{group__codec__private_gac6bf71952dbf30ef32fb5cc91681d8d6}} 
const float {\bfseries ambe\+\_\+hoc0\+\_\+tbl} [128][4]
\begin{DoxyCompactList}\small\item\em HOC for 1st frequency block. \end{DoxyCompactList}\item 
\mbox{\label{group__codec__private_ga934c67cf74ce3f2944594eab3958139c}} 
const float {\bfseries ambe\+\_\+hoc1\+\_\+tbl} [64][4]
\begin{DoxyCompactList}\small\item\em HOC for 2nd frequency block. \end{DoxyCompactList}\item 
\mbox{\label{group__codec__private_ga8992a95357c191374ac100f76f8b42fe}} 
const float {\bfseries ambe\+\_\+hoc2\+\_\+tbl} [64][4]
\begin{DoxyCompactList}\small\item\em HOC for 3rd frequency block. \end{DoxyCompactList}\item 
\mbox{\label{group__codec__private_ga616fdb311356f3430ade8e24d45479b4}} 
const float {\bfseries ambe\+\_\+hoc3\+\_\+tbl} [64][4]
\begin{DoxyCompactList}\small\item\em HOC for last frequency block. \end{DoxyCompactList}\item 
const float \textbf{ ambe\+\_\+sf0\+\_\+interp\+\_\+tbl} [4]
\begin{DoxyCompactList}\small\item\em Interpolation ratios for subframe 0 magnitude prediction. \end{DoxyCompactList}\item 
\mbox{\label{group__codec__private_ga42a2421d73b8b9021b2b88698057b53b}} 
const float {\bfseries ambe\+\_\+sf0\+\_\+perr14\+\_\+tbl} [64][4]
\begin{DoxyCompactList}\small\item\em Prediction Error [1\+:4] for subframe 0. \end{DoxyCompactList}\item 
\mbox{\label{group__codec__private_ga109dca33b432f87d6d6a14a4a0787e06}} 
const float {\bfseries ambe\+\_\+sf0\+\_\+perr58\+\_\+tbl} [32][4]
\begin{DoxyCompactList}\small\item\em Prediction Error [5\+:8] for subframe 0. \end{DoxyCompactList}\end{DoxyCompactItemize}


\doxysubsection{Detailed Description}


\doxysubsection{Enumeration Type Documentation}
\mbox{\label{group__codec__private_ga109f07fd3782470868b1d1d2ec099eb6}} 
\index{AMBE vocoder -\/ internal API@{AMBE vocoder -\/ internal API}!ambe\_frame\_type@{ambe\_frame\_type}}
\index{ambe\_frame\_type@{ambe\_frame\_type}!AMBE vocoder -\/ internal API@{AMBE vocoder -\/ internal API}}
\doxysubsubsection{ambe\_frame\_type}
{\footnotesize\ttfamily enum \textbf{ ambe\+\_\+frame\+\_\+type}}



AMBE possible frame types. 

\begin{DoxyEnumFields}{Enumerator}
\raisebox{\heightof{T}}[0pt][0pt]{\index{AMBE\_SPEECH@{AMBE\_SPEECH}!AMBE vocoder -\/ internal API@{AMBE vocoder -\/ internal API}}\index{AMBE vocoder -\/ internal API@{AMBE vocoder -\/ internal API}!AMBE\_SPEECH@{AMBE\_SPEECH}}}\mbox{\label{group__codec__private_gga109f07fd3782470868b1d1d2ec099eb6a14419c7969d8bb6cf9b2d8b71f30f33b}} 
AMBE\+\_\+\+SPEECH&Speech frame. \\
\hline

\raisebox{\heightof{T}}[0pt][0pt]{\index{AMBE\_SILENCE@{AMBE\_SILENCE}!AMBE vocoder -\/ internal API@{AMBE vocoder -\/ internal API}}\index{AMBE vocoder -\/ internal API@{AMBE vocoder -\/ internal API}!AMBE\_SILENCE@{AMBE\_SILENCE}}}\mbox{\label{group__codec__private_gga109f07fd3782470868b1d1d2ec099eb6a719fb04a91460753423334efdad424b5}} 
AMBE\+\_\+\+SILENCE&Silence indication frame. \\
\hline

\raisebox{\heightof{T}}[0pt][0pt]{\index{AMBE\_TONE@{AMBE\_TONE}!AMBE vocoder -\/ internal API@{AMBE vocoder -\/ internal API}}\index{AMBE vocoder -\/ internal API@{AMBE vocoder -\/ internal API}!AMBE\_TONE@{AMBE\_TONE}}}\mbox{\label{group__codec__private_gga109f07fd3782470868b1d1d2ec099eb6a3ed83bce1686c0614c9377ff191cc8d1}} 
AMBE\+\_\+\+TONE&Tone frame ~\newline
 \\
\hline

\end{DoxyEnumFields}


\doxysubsection{Function Documentation}
\mbox{\label{group__codec__private_ga8f0cf32d32bde050a40a3e7087185aad}} 
\index{AMBE vocoder -\/ internal API@{AMBE vocoder -\/ internal API}!ambe\_decode\_dtx@{ambe\_decode\_dtx}}
\index{ambe\_decode\_dtx@{ambe\_decode\_dtx}!AMBE vocoder -\/ internal API@{AMBE vocoder -\/ internal API}}
\doxysubsubsection{ambe\_decode\_dtx()}
{\footnotesize\ttfamily int ambe\+\_\+decode\+\_\+dtx (\begin{DoxyParamCaption}\item[{struct \textbf{ ambe\+\_\+decoder} $\ast$}]{dec,  }\item[{int16\+\_\+t $\ast$}]{audio,  }\item[{int}]{N }\end{DoxyParamCaption})}



Generates audio for DTX period. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em dec} & Decoder state structure \\
\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}


Referenced by \textbf{ gmr1\+\_\+codec\+\_\+decode\+\_\+dtx()}.

\mbox{\label{group__codec__private_ga8a426acea7ced6d46716695e243462dd}} 
\index{AMBE vocoder -\/ internal API@{AMBE vocoder -\/ internal API}!ambe\_decode\_fini@{ambe\_decode\_fini}}
\index{ambe\_decode\_fini@{ambe\_decode\_fini}!AMBE vocoder -\/ internal API@{AMBE vocoder -\/ internal API}}
\doxysubsubsection{ambe\_decode\_fini()}
{\footnotesize\ttfamily void ambe\+\_\+decode\+\_\+fini (\begin{DoxyParamCaption}\item[{struct \textbf{ ambe\+\_\+decoder} $\ast$}]{dec }\end{DoxyParamCaption})}



Release all resources associated with a decoder. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em dec} & Decoder state structure \\
\hline
\end{DoxyParams}


Referenced by \textbf{ gmr1\+\_\+codec\+\_\+release()}.

\mbox{\label{group__codec__private_ga96427955e6f3174ea846064627843bc3}} 
\index{AMBE vocoder -\/ internal API@{AMBE vocoder -\/ internal API}!ambe\_decode\_frame@{ambe\_decode\_frame}}
\index{ambe\_decode\_frame@{ambe\_decode\_frame}!AMBE vocoder -\/ internal API@{AMBE vocoder -\/ internal API}}
\doxysubsubsection{ambe\_decode\_frame()}
{\footnotesize\ttfamily int ambe\+\_\+decode\+\_\+frame (\begin{DoxyParamCaption}\item[{struct \textbf{ ambe\+\_\+decoder} $\ast$}]{dec,  }\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 dec} & Decoder state structure \\
\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}


Referenced by \textbf{ gmr1\+\_\+codec\+\_\+decode\+\_\+frame()}.

\mbox{\label{group__codec__private_gaac2c306e18df0fb45f2487e83ba4f9e9}} 
\index{AMBE vocoder -\/ internal API@{AMBE vocoder -\/ internal API}!ambe\_decode\_init@{ambe\_decode\_init}}
\index{ambe\_decode\_init@{ambe\_decode\_init}!AMBE vocoder -\/ internal API@{AMBE vocoder -\/ internal API}}
\doxysubsubsection{ambe\_decode\_init()}
{\footnotesize\ttfamily void ambe\+\_\+decode\+\_\+init (\begin{DoxyParamCaption}\item[{struct \textbf{ ambe\+\_\+decoder} $\ast$}]{dec }\end{DoxyParamCaption})}



Initializes decoder state. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em dec} & Decoder state structure \\
\hline
\end{DoxyParams}


References \textbf{ ambe\+\_\+synth\+\_\+init()}, \textbf{ ambe\+\_\+subframe\+::f0}, \textbf{ ambe\+\_\+subframe\+::L}, \textbf{ M\+\_\+\+PIf}, \textbf{ ambe\+\_\+decoder\+::sf\+\_\+prev}, \textbf{ ambe\+\_\+decoder\+::synth}, and \textbf{ ambe\+\_\+subframe\+::w0}.



Referenced by \textbf{ gmr1\+\_\+codec\+\_\+alloc()}.

\mbox{\label{group__codec__private_gaf5856df7a0f19188013d6c610a2b7f60}} 
\index{AMBE vocoder -\/ internal API@{AMBE vocoder -\/ internal API}!ambe\_decode\_tone@{ambe\_decode\_tone}}
\index{ambe\_decode\_tone@{ambe\_decode\_tone}!AMBE vocoder -\/ internal API@{AMBE vocoder -\/ internal API}}
\doxysubsubsection{ambe\_decode\_tone()}
{\footnotesize\ttfamily int ambe\+\_\+decode\+\_\+tone (\begin{DoxyParamCaption}\item[{struct \textbf{ ambe\+\_\+decoder} $\ast$}]{dec,  }\item[{int16\+\_\+t $\ast$}]{audio,  }\item[{int}]{N,  }\item[{const uint8\+\_\+t $\ast$}]{frame }\end{DoxyParamCaption})}



Decodes an AMBE tone frame. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em dec} & AMBE decoder state \\
\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). Must be tone frame ! \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
0 for success. -\/EINVAL if frame was invalid. 
\end{DoxyReturn}
\mbox{\label{group__codec__private_ga83063f9ee0607fe61bacc11bd42d059f}} 
\index{AMBE vocoder -\/ internal API@{AMBE vocoder -\/ internal API}!ambe\_fdct@{ambe\_fdct}}
\index{ambe\_fdct@{ambe\_fdct}!AMBE vocoder -\/ internal API@{AMBE vocoder -\/ internal API}}
\doxysubsubsection{ambe\_fdct()}
{\footnotesize\ttfamily void ambe\+\_\+fdct (\begin{DoxyParamCaption}\item[{float $\ast$}]{out,  }\item[{float $\ast$}]{in,  }\item[{int}]{N,  }\item[{int}]{M }\end{DoxyParamCaption})}



Forward Discrete Cosine Transform (f\+DCT) 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ out}}  & {\em out} & f\+DCT result buffer (freq domain, M elements) \\
\hline
\mbox{\texttt{ in}}  & {\em in} & f\+DCT input buffer (time domain, N elements) \\
\hline
\mbox{\texttt{ in}}  & {\em N} & Number of points of the DCT \\
\hline
\mbox{\texttt{ in}}  & {\em M} & Limit to the number of frequency components (M $<$= N) \\
\hline
\end{DoxyParams}


References \textbf{ cosf\+\_\+fast()}, and \textbf{ M\+\_\+\+PIf}.

\mbox{\label{group__codec__private_ga9d9e8b11e46bf3ccf14d22be87f1c719}} 
\index{AMBE vocoder -\/ internal API@{AMBE vocoder -\/ internal API}!ambe\_fdft\_fc@{ambe\_fdft\_fc}}
\index{ambe\_fdft\_fc@{ambe\_fdft\_fc}!AMBE vocoder -\/ internal API@{AMBE vocoder -\/ internal API}}
\doxysubsubsection{ambe\_fdft\_fc()}
{\footnotesize\ttfamily void ambe\+\_\+fdft\+\_\+fc (\begin{DoxyParamCaption}\item[{float $\ast$}]{out\+\_\+i,  }\item[{float $\ast$}]{out\+\_\+q,  }\item[{float $\ast$}]{in,  }\item[{int}]{N,  }\item[{int}]{M }\end{DoxyParamCaption})}



Forward Discrete Fourrier Transform (float-\/$>$complex) 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ out}}  & {\em out\+\_\+i} & Real component result buffer (freq domain, N/2+1 elements) \\
\hline
\mbox{\texttt{ out}}  & {\em out\+\_\+q} & Imag component result buffer (freq domain, N/2+1 elements) \\
\hline
\mbox{\texttt{ in}}  & {\em in} & Input buffer (time domain, M elements) \\
\hline
\mbox{\texttt{ in}}  & {\em N} & Number of points of the DFT \\
\hline
\mbox{\texttt{ in}}  & {\em M} & Limit to to the number of available time domain elements\\
\hline
\end{DoxyParams}
Since the input is float, the result is symmetric and so only one side is computed. The output index 0 is DC. 

References \textbf{ cosf\+\_\+fast()}, \textbf{ M\+\_\+\+PIf}, and \textbf{ sinf\+\_\+fast()}.

\mbox{\label{group__codec__private_ga55a71c63c53e21c1d6fc9c91ddf519cd}} 
\index{AMBE vocoder -\/ internal API@{AMBE vocoder -\/ internal API}!ambe\_frame\_decode\_params@{ambe\_frame\_decode\_params}}
\index{ambe\_frame\_decode\_params@{ambe\_frame\_decode\_params}!AMBE vocoder -\/ internal API@{AMBE vocoder -\/ internal API}}
\doxysubsubsection{ambe\_frame\_decode\_params()}
{\footnotesize\ttfamily void ambe\+\_\+frame\+\_\+decode\+\_\+params (\begin{DoxyParamCaption}\item[{struct \textbf{ ambe\+\_\+subframe} $\ast$}]{sf,  }\item[{struct \textbf{ ambe\+\_\+subframe} $\ast$}]{sf\+\_\+prev,  }\item[{struct \textbf{ ambe\+\_\+raw\+\_\+params} $\ast$}]{rp }\end{DoxyParamCaption})}



Decodes the speech parameters for both subframes from raw params. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ out}}  & {\em sf} & Array of 2 subframes data to fill-\/in \\
\hline
\mbox{\texttt{ in}}  & {\em sf\+\_\+prev} & Previous subframe 1 data \\
\hline
\mbox{\texttt{ in}}  & {\em rp} & Encoded frame raw parameters \\
\hline
\end{DoxyParams}


References \textbf{ ambe\+\_\+subframe\+::f0}, \textbf{ ambe\+\_\+subframe\+::f0log}, and \textbf{ ambe\+\_\+raw\+\_\+params\+::pitch}.

\mbox{\label{group__codec__private_ga8a4e007b142973be5b44ef1637c9bfee}} 
\index{AMBE vocoder -\/ internal API@{AMBE vocoder -\/ internal API}!ambe\_frame\_unpack\_raw@{ambe\_frame\_unpack\_raw}}
\index{ambe\_frame\_unpack\_raw@{ambe\_frame\_unpack\_raw}!AMBE vocoder -\/ internal API@{AMBE vocoder -\/ internal API}}
\doxysubsubsection{ambe\_frame\_unpack\_raw()}
{\footnotesize\ttfamily void ambe\+\_\+frame\+\_\+unpack\+\_\+raw (\begin{DoxyParamCaption}\item[{struct \textbf{ ambe\+\_\+raw\+\_\+params} $\ast$}]{rp,  }\item[{const uint8\+\_\+t $\ast$}]{frame }\end{DoxyParamCaption})}



Unpack a frame into its raw encoded parameters. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ out}}  & {\em rp} & Encoded frame raw parameters to unpack into \\
\hline
\mbox{\texttt{ in}}  & {\em frame} & Frame data (10 bytes = 80 bits) \\
\hline
\end{DoxyParams}


References \textbf{ ambe\+\_\+raw\+\_\+params\+::pitch}.

\mbox{\label{group__codec__private_ga0d2a102900214d2ebdab56bf85024cf2}} 
\index{AMBE vocoder -\/ internal API@{AMBE vocoder -\/ internal API}!ambe\_idct@{ambe\_idct}}
\index{ambe\_idct@{ambe\_idct}!AMBE vocoder -\/ internal API@{AMBE vocoder -\/ internal API}}
\doxysubsubsection{ambe\_idct()}
{\footnotesize\ttfamily void ambe\+\_\+idct (\begin{DoxyParamCaption}\item[{float $\ast$}]{out,  }\item[{float $\ast$}]{in,  }\item[{int}]{N,  }\item[{int}]{M }\end{DoxyParamCaption})}



Inverse Discrete Cosine Transform (i\+DCT) 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ out}}  & {\em out} & i\+DCT result buffer (time domain, N elements) \\
\hline
\mbox{\texttt{ in}}  & {\em in} & i\+DCT input buffer (freq domain, M elements) \\
\hline
\mbox{\texttt{ in}}  & {\em N} & Number of points of the DCT \\
\hline
\mbox{\texttt{ in}}  & {\em M} & Limit to the number of frequency components (M $<$= N) \\
\hline
\end{DoxyParams}


References \textbf{ cosf\+\_\+fast()}, and \textbf{ M\+\_\+\+PIf}.

\mbox{\label{group__codec__private_gadbfdcbf5186cc1c567112e4edc29a1a1}} 
\index{AMBE vocoder -\/ internal API@{AMBE vocoder -\/ internal API}!ambe\_idft\_cf@{ambe\_idft\_cf}}
\index{ambe\_idft\_cf@{ambe\_idft\_cf}!AMBE vocoder -\/ internal API@{AMBE vocoder -\/ internal API}}
\doxysubsubsection{ambe\_idft\_cf()}
{\footnotesize\ttfamily void ambe\+\_\+idft\+\_\+cf (\begin{DoxyParamCaption}\item[{float $\ast$}]{out,  }\item[{float $\ast$}]{in\+\_\+i,  }\item[{float $\ast$}]{in\+\_\+q,  }\item[{int}]{N,  }\item[{int}]{M }\end{DoxyParamCaption})}



Inverse Discret Fourrier Transform (complex-\/$>$float) 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ out}}  & {\em out} & Result buffer (time domain, M \\
\hline
\mbox{\texttt{ in}}  & {\em in\+\_\+i} & Real component input buffer (freq domain, N/2+1 elements) \\
\hline
\mbox{\texttt{ in}}  & {\em in\+\_\+q} & Imag component input buffer (freq domain, N/2+1 elements) \\
\hline
\mbox{\texttt{ in}}  & {\em N} & Number of points of the DFT \\
\hline
\mbox{\texttt{ in}}  & {\em M} & Limit to the number of time domain elements to generate\\
\hline
\end{DoxyParams}
The input is assumed to be symmetric and so only N/2+1 inputs are needed. DC component must be input index 0. 

References \textbf{ cosf\+\_\+fast()}, \textbf{ M\+\_\+\+PIf}, and \textbf{ sinf\+\_\+fast()}.

\mbox{\label{group__codec__private_ga2d3ff962344089d1a44fd0d659c55df8}} 
\index{AMBE vocoder -\/ internal API@{AMBE vocoder -\/ internal API}!ambe\_subframe\_expand@{ambe\_subframe\_expand}}
\index{ambe\_subframe\_expand@{ambe\_subframe\_expand}!AMBE vocoder -\/ internal API@{AMBE vocoder -\/ internal API}}
\doxysubsubsection{ambe\_subframe\_expand()}
{\footnotesize\ttfamily void ambe\+\_\+subframe\+\_\+expand (\begin{DoxyParamCaption}\item[{struct \textbf{ ambe\+\_\+subframe} $\ast$}]{sf }\end{DoxyParamCaption})}



Expands the decoded subframe params to prepare for synthesis. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em sf} & The subframe to expand \\
\hline
\end{DoxyParams}


References \textbf{ ambe\+\_\+subframe\+::f0}, \textbf{ ambe\+\_\+subframe\+::L}, \textbf{ M\+\_\+\+PIf}, \textbf{ ambe\+\_\+subframe\+::\+Ml}, \textbf{ ambe\+\_\+subframe\+::\+Mlog}, \textbf{ ambe\+\_\+subframe\+::v\+\_\+uv}, \textbf{ ambe\+\_\+subframe\+::\+Vl}, and \textbf{ ambe\+\_\+subframe\+::w0}.

\mbox{\label{group__codec__private_ga7ca25dc5919fcff4c7494eb02d25fda2}} 
\index{AMBE vocoder -\/ internal API@{AMBE vocoder -\/ internal API}!ambe\_synth\_audio@{ambe\_synth\_audio}}
\index{ambe\_synth\_audio@{ambe\_synth\_audio}!AMBE vocoder -\/ internal API@{AMBE vocoder -\/ internal API}}
\doxysubsubsection{ambe\_synth\_audio()}
{\footnotesize\ttfamily void ambe\+\_\+synth\+\_\+audio (\begin{DoxyParamCaption}\item[{struct \textbf{ ambe\+\_\+synth} $\ast$}]{synth,  }\item[{int16\+\_\+t $\ast$}]{audio,  }\item[{struct \textbf{ ambe\+\_\+subframe} $\ast$}]{sf,  }\item[{struct \textbf{ ambe\+\_\+subframe} $\ast$}]{sf\+\_\+prev }\end{DoxyParamCaption})}



Generate audio for a given subframe. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em synth} & Synthesizer state structure \\
\hline
\mbox{\texttt{ out}}  & {\em audio} & Result buffer (80 samples) \\
\hline
\mbox{\texttt{ in}}  & {\em sf} & Expanded subframe data for current subframe \\
\hline
\mbox{\texttt{ in}}  & {\em sf\+\_\+prev} & Expanded subframe data for prevous subframe \\
\hline
\end{DoxyParams}
\mbox{\label{group__codec__private_ga5fdca2bf0b039f3bb0dd97b0f601fe62}} 
\index{AMBE vocoder -\/ internal API@{AMBE vocoder -\/ internal API}!ambe\_synth\_enhance@{ambe\_synth\_enhance}}
\index{ambe\_synth\_enhance@{ambe\_synth\_enhance}!AMBE vocoder -\/ internal API@{AMBE vocoder -\/ internal API}}
\doxysubsubsection{ambe\_synth\_enhance()}
{\footnotesize\ttfamily void ambe\+\_\+synth\+\_\+enhance (\begin{DoxyParamCaption}\item[{struct \textbf{ ambe\+\_\+synth} $\ast$}]{synth,  }\item[{struct \textbf{ ambe\+\_\+subframe} $\ast$}]{sf }\end{DoxyParamCaption})}



Apply the spectral magnitude enhancement on the subframe. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em synth} & Synthesizer state structure \\
\hline
\mbox{\texttt{ in}}  & {\em sf} & Expanded subframe data for subframe to enhance \\
\hline
\end{DoxyParams}


References \textbf{ cosf\+\_\+fast()}, \textbf{ ambe\+\_\+subframe\+::L}, \textbf{ M\+\_\+\+PIf}, \textbf{ ambe\+\_\+subframe\+::\+Ml}, \textbf{ ambe\+\_\+synth\+::\+SE}, and \textbf{ ambe\+\_\+subframe\+::w0}.

\mbox{\label{group__codec__private_ga31252750e130d6bf531c483df2ec8a49}} 
\index{AMBE vocoder -\/ internal API@{AMBE vocoder -\/ internal API}!ambe\_synth\_init@{ambe\_synth\_init}}
\index{ambe\_synth\_init@{ambe\_synth\_init}!AMBE vocoder -\/ internal API@{AMBE vocoder -\/ internal API}}
\doxysubsubsection{ambe\_synth\_init()}
{\footnotesize\ttfamily void ambe\+\_\+synth\+\_\+init (\begin{DoxyParamCaption}\item[{struct \textbf{ ambe\+\_\+synth} $\ast$}]{synth }\end{DoxyParamCaption})}



Initialized Synthesizer state. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ out}}  & {\em synth} & The structure to reset \\
\hline
\end{DoxyParams}


References \textbf{ ambe\+\_\+synth\+::u\+\_\+prev}.



Referenced by \textbf{ ambe\+\_\+decode\+\_\+init()}.

\mbox{\label{group__codec__private_ga62bc434f8483f0198f86b388ab30ced6}} 
\index{AMBE vocoder -\/ internal API@{AMBE vocoder -\/ internal API}!cosf\_fast@{cosf\_fast}}
\index{cosf\_fast@{cosf\_fast}!AMBE vocoder -\/ internal API@{AMBE vocoder -\/ internal API}}
\doxysubsubsection{cosf\_fast()}
{\footnotesize\ttfamily float cosf\+\_\+fast (\begin{DoxyParamCaption}\item[{float}]{angle }\end{DoxyParamCaption})}



Fast Cosinus approximation using a simple table. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em angle} & The angle value \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
The cosinus of the angle 
\end{DoxyReturn}


References \textbf{ M\+\_\+\+PIf}.



Referenced by \textbf{ ambe\+\_\+fdct()}, \textbf{ ambe\+\_\+fdft\+\_\+fc()}, \textbf{ ambe\+\_\+idct()}, \textbf{ ambe\+\_\+idft\+\_\+cf()}, and \textbf{ ambe\+\_\+synth\+\_\+enhance()}.

\mbox{\label{group__codec__private_gade8a6e65fb5db286835ffd82b0f61dd1}} 
\index{AMBE vocoder -\/ internal API@{AMBE vocoder -\/ internal API}!sinf\_fast@{sinf\_fast}}
\index{sinf\_fast@{sinf\_fast}!AMBE vocoder -\/ internal API@{AMBE vocoder -\/ internal API}}
\doxysubsubsection{sinf\_fast()}
{\footnotesize\ttfamily float sinf\+\_\+fast (\begin{DoxyParamCaption}\item[{float}]{angle }\end{DoxyParamCaption})}



Fast Sinus approximation using a simple table. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em angle} & The angle value \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
The sinus of the angle 
\end{DoxyReturn}


References \textbf{ M\+\_\+\+PIf}.



Referenced by \textbf{ ambe\+\_\+fdft\+\_\+fc()}, and \textbf{ ambe\+\_\+idft\+\_\+cf()}.



\doxysubsection{Variable Documentation}
\mbox{\label{group__codec__private_gab7a7b1219368c43c898cfb24ff3cb5cd}} 
\index{AMBE vocoder -\/ internal API@{AMBE vocoder -\/ internal API}!ambe\_sf0\_interp\_tbl@{ambe\_sf0\_interp\_tbl}}
\index{ambe\_sf0\_interp\_tbl@{ambe\_sf0\_interp\_tbl}!AMBE vocoder -\/ internal API@{AMBE vocoder -\/ internal API}}
\doxysubsubsection{ambe\_sf0\_interp\_tbl}
{\footnotesize\ttfamily const float ambe\+\_\+sf0\+\_\+interp\+\_\+tbl[4]}

{\bfseries Initial value\+:}
\begin{DoxyCode}{0}
\DoxyCodeLine{= \{}
\DoxyCodeLine{        0.90f,}
\DoxyCodeLine{        0.70f,}
\DoxyCodeLine{        0.50f,}
\DoxyCodeLine{        0.17f,}
\DoxyCodeLine{\}}

\end{DoxyCode}


Interpolation ratios for subframe 0 magnitude prediction. 

\mbox{\label{group__codec__private_ga735cc90f20631506f7a5fc4827f4e8d5}} 
\index{AMBE vocoder -\/ internal API@{AMBE vocoder -\/ internal API}!ambe\_v\_uv\_tbl@{ambe\_v\_uv\_tbl}}
\index{ambe\_v\_uv\_tbl@{ambe\_v\_uv\_tbl}!AMBE vocoder -\/ internal API@{AMBE vocoder -\/ internal API}}
\doxysubsubsection{ambe\_v\_uv\_tbl}
{\footnotesize\ttfamily const uint16\+\_\+t ambe\+\_\+v\+\_\+uv\+\_\+tbl[64]}

{\bfseries Initial value\+:}
\begin{DoxyCode}{0}
\DoxyCodeLine{= \{}
\DoxyCodeLine{        0x0000, 0xffff, 0xc0c0, 0xe0e0, 0xf0f0, 0x8080, 0xfefe, 0x0080,}
\DoxyCodeLine{        0xfcfc, 0x80c0, 0xf8f8, 0x8000, 0x00c0, 0xfffe, 0xfeff, 0xc000,}
\DoxyCodeLine{        0xf0e0, 0xc0e0, 0xfbfb, 0xfcfe, 0xf8f0, 0xfdfd, 0xfffb, 0xe000,}
\DoxyCodeLine{        0xe0f0, 0xfcff, 0xfdff, 0xe0c0, 0xfffc, 0xf0f8, 0xfefc, 0xfffd,}
\DoxyCodeLine{        0xf8fc, 0xfcf8, 0xfcfd, 0x4000, 0xf0c0, 0xf9f9, 0xfbff, 0xefef,}
\DoxyCodeLine{        0xf3f3, 0xc080, 0xf0e0, 0xfff8, 0xf0fc, 0xf1f1, 0x0040, 0xc0d0,}
\DoxyCodeLine{        0xc0f0, 0xf7f7, 0xfaf8, 0xfafa, 0xfcf0, 0xfef8, 0x00e0, 0x0100,}
\DoxyCodeLine{        0x1000, 0xe0e1, 0xe0f8, 0xf2f0, 0xf8ff, 0xfafe, 0xfff7, 0xdfdf,}
\DoxyCodeLine{\}}

\end{DoxyCode}


V/\+UV decisions (subframe 0 = low byte. MSBs = low freq) 

