\doxysection{src/codec/private.h File Reference}
\label{private_8h}\index{src/codec/private.h@{src/codec/private.h}}


Osmocom GMR-\/1 AMBE vocoder private header.  


{\ttfamily \#include $<$stdint.\+h$>$}\newline
\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}\end{DoxyCompactItemize}
\doxysubsection*{Macros}
\begin{DoxyCompactItemize}
\item 
\#define {\bfseries AMBE\+\_\+\+RATE}~8000
\begin{DoxyCompactList}\small\item\em AMBE sample rate (Hz) \end{DoxyCompactList}\item 
\#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 
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 
const float {\bfseries ambe\+\_\+gain\+\_\+tbl} [256][2]
\begin{DoxyCompactList}\small\item\em Gain (subframe 0, subframe 1) \end{DoxyCompactList}\item 
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 
const float {\bfseries ambe\+\_\+prba12\+\_\+tbl} [128][2]
\begin{DoxyCompactList}\small\item\em PRBA[1\+:2]. \end{DoxyCompactList}\item 
const float {\bfseries ambe\+\_\+prba34\+\_\+tbl} [64][2]
\begin{DoxyCompactList}\small\item\em PRBA[3\+:4]. \end{DoxyCompactList}\item 
const float {\bfseries ambe\+\_\+prba57\+\_\+tbl} [128][3]
\begin{DoxyCompactList}\small\item\em PRBA[5\+:7]. \end{DoxyCompactList}\item 
const float {\bfseries ambe\+\_\+hoc0\+\_\+tbl} [128][4]
\begin{DoxyCompactList}\small\item\em HOC for 1st frequency block. \end{DoxyCompactList}\item 
const float {\bfseries ambe\+\_\+hoc1\+\_\+tbl} [64][4]
\begin{DoxyCompactList}\small\item\em HOC for 2nd frequency block. \end{DoxyCompactList}\item 
const float {\bfseries ambe\+\_\+hoc2\+\_\+tbl} [64][4]
\begin{DoxyCompactList}\small\item\em HOC for 3rd frequency block. \end{DoxyCompactList}\item 
const float {\bfseries ambe\+\_\+hoc3\+\_\+tbl} [64][4]
\begin{DoxyCompactList}\small\item\em HOC for last frequency block. \end{DoxyCompactList}\item 
const float {\bfseries ambe\+\_\+sf0\+\_\+interp\+\_\+tbl} [4]
\begin{DoxyCompactList}\small\item\em Interpolation ratios for subframe 0 magnitude prediction. \end{DoxyCompactList}\item 
const float {\bfseries ambe\+\_\+sf0\+\_\+perr14\+\_\+tbl} [64][4]
\begin{DoxyCompactList}\small\item\em Prediction Error [1\+:4] for subframe 0. \end{DoxyCompactList}\item 
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}
Osmocom GMR-\/1 AMBE vocoder private header. 

