\hypertarget{HUFF_8h}{
\section{HUFF.h File Reference}
\label{HUFF_8h}\index{HUFF.h@{HUFF.h}}
}
Huffman Encode/Decode, interface file. 



This graph shows which files directly or indirectly include this file:\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[width=93pt]{HUFF_8h__dep__incl}
\end{center}
\end{figure}
\subsection*{Data Structures}
\begin{CompactItemize}
\item 
struct \hyperlink{struct__HUFF__node}{\_\-HUFF\_\-node}
\begin{CompactList}\small\item\em Node in a Huffman tree. \item\end{CompactList}\item 
struct \hyperlink{struct__HUFF__code}{\_\-HUFF\_\-code}
\begin{CompactList}\small\item\em Huffman code for a symbol. \item\end{CompactList}\end{CompactItemize}
\subsection*{Typedefs}
\begin{CompactItemize}
\item 
\hypertarget{HUFF_8h_a0}{
typedef \hyperlink{struct__HUFF__node}{\_\-HUFF\_\-node} \hyperlink{HUFF_8h_a0}{HUFF\_\-node}}
\label{HUFF_8h_a0}

\begin{CompactList}\small\item\em Typedef for struct {\em \hyperlink{struct__HUFF__node}{\_\-HUFF\_\-node}\/}. \item\end{CompactList}\item 
\hypertarget{HUFF_8h_a1}{
typedef \hyperlink{struct__HUFF__code}{\_\-HUFF\_\-code} \hyperlink{HUFF_8h_a1}{HUFF\_\-code}}
\label{HUFF_8h_a1}

\begin{CompactList}\small\item\em Typedef for struct {\em \hyperlink{struct__HUFF__code}{\_\-HUFF\_\-code}\/}. \item\end{CompactList}\end{CompactItemize}
\subsection*{Functions}
\begin{CompactItemize}
\item 
void \hyperlink{HUFF_8h_a2}{HUFF\_\-accumulate} (int $\ast$freqs, const unsigned char $\ast$original, int size)
\begin{CompactList}\small\item\em Accumulates the frequency distribution. \item\end{CompactList}\item 
int \hyperlink{HUFF_8h_a3}{HUFF\_\-build} (\hyperlink{struct__HUFF__code}{HUFF\_\-code} $\ast$table, const int $\ast$freqs, int count)
\begin{CompactList}\small\item\em Builds a Huffman code table from the input frequency distribution. \item\end{CompactList}\item 
int \hyperlink{HUFF_8h_a4}{HUFF\_\-compress} (const unsigned char $\ast$original, int size, const \hyperlink{struct__HUFF__code}{HUFF\_\-code} $\ast$table, unsigned char $\ast$$\ast$compressed)
\begin{CompactList}\small\item\em Compresses the input array {\em original\/} into the output array. \item\end{CompactList}\item 
int \hyperlink{HUFF_8h_a5}{HUFF\_\-size} (const \hyperlink{struct__HUFF__code}{HUFF\_\-code} $\ast$table, const int $\ast$freqs, int count)
\begin{CompactList}\small\item\em Computes the size, in bits, of the specified encode {\em freqs\/}. \item\end{CompactList}\item 
int \hyperlink{HUFF_8h_a6}{HUFF\_\-uncompress} (const unsigned char $\ast$compressed, unsigned char $\ast$$\ast$original)
\begin{CompactList}\small\item\em Decompresses the input byte stream {\em compressed\/}. \item\end{CompactList}\end{CompactItemize}


\subsection{Detailed Description}
Huffman Encode/Decode, interface file. 

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


\footnotesize\begin{verbatim}CVS $Id
\end{verbatim}
\normalsize


\begin{Desc}
\item[Warning:]In their current state, these routines are not fit for Flight use. They can be used to determine compression factors and, in general, study the properties of Huffman encoding/decoding. However, they malloc all over the place and involve recursive calling techniques, neither of is appropriate for Flight code.\end{Desc}


\subsection{Function Documentation}
\hypertarget{HUFF_8h_a2}{
\index{HUFF.h@{HUFF.h}!HUFF_accumulate@{HUFF\_\-accumulate}}
\index{HUFF_accumulate@{HUFF\_\-accumulate}!HUFF.h@{HUFF.h}}
\subsubsection[HUFF\_\-accumulate]{\setlength{\rightskip}{0pt plus 5cm}void HUFF\_\-accumulate (int $\ast$ {\em freqs}, const unsigned char $\ast$ {\em original}, int {\em size})}}
\label{HUFF_8h_a2}


Accumulates the frequency distribution. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em freqs}]The accumulated and appropriately scaled frequency distribution. Must be at 256 characters in width \item[{\em original}]The input set of characters. The distribution is created from this set \item[{\em size}]The number of characters in {\em original\/} \end{description}
\end{Desc}
\hypertarget{HUFF_8h_a3}{
\index{HUFF.h@{HUFF.h}!HUFF_build@{HUFF\_\-build}}
\index{HUFF_build@{HUFF\_\-build}!HUFF.h@{HUFF.h}}
\subsubsection[HUFF\_\-build]{\setlength{\rightskip}{0pt plus 5cm}int HUFF\_\-build (\hyperlink{struct__HUFF__code}{HUFF\_\-code} $\ast$ {\em table}, const int $\ast$ {\em freqs}, int {\em count})}}
\label{HUFF_8h_a3}


Builds a Huffman code table from the input frequency distribution. 

\begin{Desc}
\item[Returns:]Status\end{Desc}
\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em table}]The table, must have at least {\em count\/} elements \item[{\em freqs}]The frequency distribution \item[{\em count}]The number of elements in the frequency distribution\end{description}
\end{Desc}
\hypertarget{HUFF_8h_a4}{
\index{HUFF.h@{HUFF.h}!HUFF_compress@{HUFF\_\-compress}}
\index{HUFF_compress@{HUFF\_\-compress}!HUFF.h@{HUFF.h}}
\subsubsection[HUFF\_\-compress]{\setlength{\rightskip}{0pt plus 5cm}int HUFF\_\-compress (const unsigned char $\ast$ {\em original}, int {\em size}, const \hyperlink{struct__HUFF__code}{HUFF\_\-code} $\ast$ {\em table}, unsigned char $\ast$$\ast$ {\em compressed})}}
\label{HUFF_8h_a4}


Compresses the input array {\em original\/} into the output array. 

\begin{Desc}
\item[Returns:]Size of the compressed data in bytes.\end{Desc}
\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em original}]The array of bytes to compress \item[{\em size}]The number of bytes in original to compress \item[{\em table}]A previously built Huffman table used to encode the data \item[{\em compressed}]Returned as a pointer to the compressed data\end{description}
\end{Desc}
\hypertarget{HUFF_8h_a5}{
\index{HUFF.h@{HUFF.h}!HUFF_size@{HUFF\_\-size}}
\index{HUFF_size@{HUFF\_\-size}!HUFF.h@{HUFF.h}}
\subsubsection[HUFF\_\-size]{\setlength{\rightskip}{0pt plus 5cm}int HUFF\_\-size (const \hyperlink{struct__HUFF__code}{HUFF\_\-code} $\ast$ {\em table}, const int $\ast$ {\em freqs}, int {\em count})}}
\label{HUFF_8h_a5}


Computes the size, in bits, of the specified encode {\em freqs\/}. 

\begin{Desc}
\item[Returns:]The size in bits.\end{Desc}
\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em table}]The table, must have at least {\em count\/} elements \item[{\em freqs}]The frequency distribution \item[{\em count}]The number of elements in the frequency distribution\end{description}
\end{Desc}
\hypertarget{HUFF_8h_a6}{
\index{HUFF.h@{HUFF.h}!HUFF_uncompress@{HUFF\_\-uncompress}}
\index{HUFF_uncompress@{HUFF\_\-uncompress}!HUFF.h@{HUFF.h}}
\subsubsection[HUFF\_\-uncompress]{\setlength{\rightskip}{0pt plus 5cm}int HUFF\_\-uncompress (const unsigned char $\ast$ {\em compressed}, unsigned char $\ast$$\ast$ {\em original})}}
\label{HUFF_8h_a6}


Decompresses the input byte stream {\em compressed\/}. 

\begin{Desc}
\item[Returns:]The number of decompressed bytes, {\em i.e\/}. the size of original\end{Desc}
\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em compressed}]The compressed bit stream \item[{\em original}]Returned as a pointer to the decompressed data\end{description}
\end{Desc}
