\hypertarget{APM_8h}{
\section{APM.h File Reference}
\label{APM_8h}\index{APM.h@{APM.h}}
}
Arithmetic Probability Encoder, interface to the modeling table routines. 



This graph shows which files directly or indirectly include this file:\nopagebreak
\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[width=44pt]{APM_8h__dep__incl}
\end{center}
\end{figure}
\subsection*{Functions}
\begin{CompactItemize}
\item 
unsigned int \hyperlink{APM_8h_bd52d05bbc78fd52114c417f1574b3c5}{APM\_\-build} (unsigned int $\ast$table, const unsigned int $\ast$freqs, int cnt)
\begin{CompactList}\small\item\em Creates an appropriately scaled probability table based on the the frequency distribution, {\em f\/}. \item\end{CompactList}\end{CompactItemize}


\subsection{Detailed Description}
Arithmetic Probability Encoder, interface to the modeling table routines. 

\begin{Desc}
\item[Author:]JJRussell - \href{mailto:russell@slac.stanford.edu}{\tt russell@slac.stanford.edu}\end{Desc}


\footnotesize\begin{verbatim}

   CVS $Id: APM.h,v 1.2 2006/01/24 00:20:23 russell Exp $
\end{verbatim}
\normalsize
 

\subsection{Function Documentation}
\hypertarget{APM_8h_bd52d05bbc78fd52114c417f1574b3c5}{
\index{APM.h@{APM.h}!APM_build@{APM\_\-build}}
\index{APM_build@{APM\_\-build}!APM.h@{APM.h}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}unsigned int APM\_\-build (unsigned int $\ast$ {\em table}, const unsigned int $\ast$ {\em f}, int {\em cnt})}}
\label{APM_8h_bd52d05bbc78fd52114c417f1574b3c5}


Creates an appropriately scaled probability table based on the the frequency distribution, {\em f\/}. 

\begin{Desc}
\item[Returns:]The sum of the frequency distribution (not all that interesting)\end{Desc}
\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em table}]The table to be filled out. This must be an array of {\em cnt\/} + 2 values. The first entry is used to hold the number of entries in the table for integrity purposes, and the other extra entry is to hold the sum of the frequencies. \item[{\em f}]The frequency distribution of the symbols. There must be one entry, indexed by the symbol value, for each symbol \item[{\em cnt}]The number of entries (or the number of symbols, they are equivalent) in {\em f\/}.\end{description}
\end{Desc}
As a performance hint, symbols that have 0 probability of occurring should not be present in the frequency distribution. In this case, one should define a lookup table mapping only the non-zero values.

If symbols with a frequency of 0 appear in the input, this code will interpret such symbols as having a small, but finite, possibly of being present in an encoding scheme. Such symbols will be set to the lowest value probability, ensuring that they will get encoded. 