\doxysection{Bit compression}
\label{group__bitcomp}\index{Bit compression@{Bit compression}}
\doxysubsection*{Files}
\begin{DoxyCompactItemize}
\item 
file \textbf{ bitcomp.\+h}
\begin{DoxyCompactList}\small\item\em Osmocom bit compression routines. \end{DoxyCompactList}\item 
file \textbf{ bitcomp.\+c}
\begin{DoxyCompactList}\small\item\em Osmocom bit compression routines. \end{DoxyCompactList}\end{DoxyCompactItemize}
\doxysubsection*{Functions}
\begin{DoxyCompactItemize}
\item 
int \textbf{ osmo\+\_\+t4\+\_\+encode} (struct \textbf{ bitvec} $\ast$bv)
\begin{DoxyCompactList}\small\item\em encode bit vector in-\/place using T4 encoding Assumes MSB first encoding. \end{DoxyCompactList}\item 
static int \textbf{ t4\+\_\+rle} (struct \textbf{ bitvec} $\ast$bv, unsigned \textbf{ len}, bool b)
\begin{DoxyCompactList}\small\item\em Make-\/up codes for a given length. \end{DoxyCompactList}\end{DoxyCompactItemize}
\doxysubsection*{Variables}
\begin{DoxyCompactItemize}
\item 
static const unsigned \textbf{ t4\+\_\+term} [2][64]
\item 
static const unsigned \textbf{ t4\+\_\+term\+\_\+length} [2][64]
\item 
static const unsigned \textbf{ t4\+\_\+make\+\_\+up\+\_\+length} [2][15]
\item 
static const unsigned \textbf{ t4\+\_\+make\+\_\+up} [2][15]
\end{DoxyCompactItemize}


\doxysubsection{Detailed Description}


\doxysubsection{Function Documentation}
\mbox{\label{group__bitcomp_gaa4f70ee3b6e93fff44240366f0b6fedd}} 
\index{Bit compression@{Bit compression}!osmo\_t4\_encode@{osmo\_t4\_encode}}
\index{osmo\_t4\_encode@{osmo\_t4\_encode}!Bit compression@{Bit compression}}
\doxysubsubsection{osmo\_t4\_encode()}
{\footnotesize\ttfamily int osmo\+\_\+t4\+\_\+encode (\begin{DoxyParamCaption}\item[{struct \textbf{ bitvec} $\ast$}]{bv }\end{DoxyParamCaption})}



encode bit vector in-\/place using T4 encoding Assumes MSB first encoding. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em bv} & bit vector to be encoded \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
color code (if the encoding started with 0 or 1) or -\/1 on failure (encoded is bigger than original) 
\end{DoxyReturn}


References \textbf{ bitvec\+\_\+rl()}, \textbf{ bitvec\+\_\+shiftl()}, \textbf{ bitvec\+\_\+zero()}, \textbf{ bitvec\+::cur\+\_\+bit}, \textbf{ bitvec\+::data}, \textbf{ bitvec\+::data\+\_\+len}, and \textbf{ t4\+\_\+rle()}.

\mbox{\label{group__bitcomp_ga756816bc8897122169638ebaa12532c4}} 
\index{Bit compression@{Bit compression}!t4\_rle@{t4\_rle}}
\index{t4\_rle@{t4\_rle}!Bit compression@{Bit compression}}
\doxysubsubsection{t4\_rle()}
{\footnotesize\ttfamily static int t4\+\_\+rle (\begin{DoxyParamCaption}\item[{struct \textbf{ bitvec} $\ast$}]{bv,  }\item[{unsigned}]{len,  }\item[{bool}]{b }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [inline]}, {\ttfamily [static]}}



Make-\/up codes for a given length. 

\begin{DoxyReturn}{Returns}
Return proper make-\/up code word for an uninterrupted sequence of b bits of length len according to modified ITU-\/T T.\+4 from TS 44.\+060 Table 9.\+1.\+10.\+2 
\end{DoxyReturn}


References \textbf{ bitvec\+\_\+set\+\_\+uint()}, \textbf{ len()}, \textbf{ t4\+\_\+make\+\_\+up}, \textbf{ t4\+\_\+make\+\_\+up\+\_\+length}, \textbf{ t4\+\_\+term}, and \textbf{ t4\+\_\+term\+\_\+length}.



Referenced by \textbf{ osmo\+\_\+t4\+\_\+encode()}.



\doxysubsection{Variable Documentation}
\mbox{\label{group__bitcomp_ga49df6e5268e7a8b4327e5d61ddc0bb04}} 
\index{Bit compression@{Bit compression}!t4\_make\_up@{t4\_make\_up}}
\index{t4\_make\_up@{t4\_make\_up}!Bit compression@{Bit compression}}
\doxysubsubsection{t4\_make\_up}
{\footnotesize\ttfamily const unsigned t4\+\_\+make\+\_\+up[2][15]\hspace{0.3cm}{\ttfamily [static]}}



Referenced by \textbf{ t4\+\_\+rle()}.

\mbox{\label{group__bitcomp_ga8149edc38a2202a6fbaf3a39f388e50f}} 
\index{Bit compression@{Bit compression}!t4\_make\_up\_length@{t4\_make\_up\_length}}
\index{t4\_make\_up\_length@{t4\_make\_up\_length}!Bit compression@{Bit compression}}
\doxysubsubsection{t4\_make\_up\_length}
{\footnotesize\ttfamily const unsigned t4\+\_\+make\+\_\+up\+\_\+length[2][15]\hspace{0.3cm}{\ttfamily [static]}}

{\bfseries Initial value\+:}
\begin{DoxyCode}{0}
\DoxyCodeLine{= \{}
\DoxyCodeLine{        \{10, 12, 12, 12, 12, 12, 12, 13, 13, 13, 13, 13, 13, 13, 13\},}
\DoxyCodeLine{        \{5, 5, 6, 7, 8, 8, 8, 8, 8, 8, 9, 9, 9, 9, 9\}}
\DoxyCodeLine{\}}

\end{DoxyCode}


Referenced by \textbf{ t4\+\_\+rle()}.

\mbox{\label{group__bitcomp_ga23f45a8097583b94fd090f42cb402bd3}} 
\index{Bit compression@{Bit compression}!t4\_term@{t4\_term}}
\index{t4\_term@{t4\_term}!Bit compression@{Bit compression}}
\doxysubsubsection{t4\_term}
{\footnotesize\ttfamily const unsigned t4\+\_\+term[2][64]\hspace{0.3cm}{\ttfamily [static]}}



Referenced by \textbf{ t4\+\_\+rle()}.

\mbox{\label{group__bitcomp_ga5668d0369e3659129c72d2293da52d7b}} 
\index{Bit compression@{Bit compression}!t4\_term\_length@{t4\_term\_length}}
\index{t4\_term\_length@{t4\_term\_length}!Bit compression@{Bit compression}}
\doxysubsubsection{t4\_term\_length}
{\footnotesize\ttfamily const unsigned t4\+\_\+term\+\_\+length[2][64]\hspace{0.3cm}{\ttfamily [static]}}

{\bfseries Initial value\+:}
\begin{DoxyCode}{0}
\DoxyCodeLine{= \{}
\DoxyCodeLine{        \{10, 2, 2, 3, 3, 4, 4, 5, 6, 6, 7, 7, 7, 8, 8, 9, 10, 10, 10, 11, 11, 11, 11, 11, 11, 11, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12\},}
\DoxyCodeLine{        \{8, 6, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8\}}
\DoxyCodeLine{\}}

\end{DoxyCode}


Referenced by \textbf{ t4\+\_\+rle()}.

