\hypertarget{decompress_8h}{
\section{decompress.h File Reference}
\label{decompress_8h}\index{decompress.h@{decompress.h}}
}
Lowest-level decompression routines. 

{\tt \#include \char`\"{}LDT/APD.h\char`\"{}}\par
{\tt \#include $<$stdlib.h$>$}\par
{\tt \#include $<$stdio.h$>$}\par
\subsection*{Typedefs}
\begin{CompactItemize}
\item 
\hypertarget{decompress_8h_41f225efe39c1b0a55f5352092e79c33}{
typedef struct \hyperlink{structQSEC__decompression__}{QSEC\_\-decompression\_\-} \hyperlink{decompress_8h_41f225efe39c1b0a55f5352092e79c33}{QSEC\_\-decompression}}
\label{decompress_8h_41f225efe39c1b0a55f5352092e79c33}

\begin{CompactList}\small\item\em Declaration of the opaque decompression structure. \item\end{CompactList}\end{CompactItemize}
\subsection*{Functions}
\begin{CompactItemize}
\item 
void \hyperlink{decompress_8h_c62a71c256186b30de049043981640d5}{QSEC\_\-clearDecompression} (\hyperlink{structQSEC__decompression__}{QSEC\_\-decompression} $\ast$dcm)
\begin{CompactList}\small\item\em Clear the decompression structrure of any data from a previous cycle. \item\end{CompactList}\item 
\hyperlink{structQSEC__decompression__}{QSEC\_\-decompression} $\ast$ \hyperlink{decompress_8h_6afe934b8d875845dc6009f7b8931631}{QSEC\_\-constructDecompression} (void $\ast$buffer, unsigned int nbits, const char $\ast$name)
\begin{CompactList}\small\item\em Initialise the buffer as a decompression structure. \item\end{CompactList}\item 
unsigned \hyperlink{decompress_8h_cfd3a288b77da21be7fafbb828272b48}{QSEC\_\-decompress} (\hyperlink{structQSEC__decompression__}{QSEC\_\-decompression} $\ast$dcm, APD\_\-dtx $\ast$dtx)
\begin{CompactList}\small\item\em Decode the next symbol. \item\end{CompactList}\item 
void \hyperlink{decompress_8h_8e1340f1268535a22d719b926ea9d6bf}{QSEC\_\-deleteDecompression} (\hyperlink{structQSEC__decompression__}{QSEC\_\-decompression} $\ast$dcm)
\begin{CompactList}\small\item\em Free the memory associated with the decompression structure. \item\end{CompactList}\item 
unsigned int \hyperlink{decompress_8h_4ea59426abbf9a9d29ccff4b722264f7}{QSEC\_\-getCount} (\hyperlink{structQSEC__decompression__}{QSEC\_\-decompression} $\ast$dcm)
\begin{CompactList}\small\item\em Return the number of non-zero bins in the histogram. \item\end{CompactList}\item 
\hyperlink{structQSEC__decompression__}{QSEC\_\-decompression} $\ast$ \hyperlink{decompress_8h_de340d0845160b2d9f724d8492de9c0a}{QSEC\_\-newDecompression} (unsigned int nbits, const char $\ast$name)
\begin{CompactList}\small\item\em Allocate and initialise a new decompression structure. \item\end{CompactList}\item 
void \hyperlink{decompress_8h_9500b01a3ec3df5a23d43cef2c2c58b2}{QSEC\_\-reportDecompression} (\hyperlink{structQSEC__decompression__}{QSEC\_\-decompression} $\ast$dcm, FILE $\ast$fp)
\begin{CompactList}\small\item\em Describe the contents of the decompression structure in formatted ASCII send to the file {\em fp\/}. \item\end{CompactList}\item 
size\_\-t \hyperlink{decompress_8h_fb51bf6fcc032ed0be71fbf548003027}{QSEC\_\-sizeofDecompression} (unsigned int nbits)
\begin{CompactList}\small\item\em Calculate the total size required to accomodate a decompression structure. \item\end{CompactList}\item 
const unsigned int $\ast$ \hyperlink{decompress_8h_d748284e49f28c0552b8926738dde8a6}{QSEC\_\-unpack} (\hyperlink{structQSEC__decompression__}{QSEC\_\-decompression} $\ast$dcm, const unsigned int $\ast$buf)
\begin{CompactList}\small\item\em Build the lookup and freqency tables by retrieving and unpacking data from the consignment. \item\end{CompactList}\end{CompactItemize}


\subsection{Detailed Description}
Lowest-level decompression routines. 

\begin{Desc}
\item[Author:]James Swain \& Owen Saxton\end{Desc}
\begin{Desc}
\item[Id]\end{Desc}


\subsection{Function Documentation}
\hypertarget{decompress_8h_c62a71c256186b30de049043981640d5}{
\index{decompress.h@{decompress.h}!QSEC_clearDecompression@{QSEC\_\-clearDecompression}}
\index{QSEC_clearDecompression@{QSEC\_\-clearDecompression}!decompress.h@{decompress.h}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void QSEC\_\-clearDecompression ({\bf QSEC\_\-decompression} $\ast$ {\em dcm})}}
\label{decompress_8h_c62a71c256186b30de049043981640d5}


Clear the decompression structrure of any data from a previous cycle. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em dcm}]Pointer to an allocated, initialised, decompression structure \end{description}
\end{Desc}
\hypertarget{decompress_8h_6afe934b8d875845dc6009f7b8931631}{
\index{decompress.h@{decompress.h}!QSEC_constructDecompression@{QSEC\_\-constructDecompression}}
\index{QSEC_constructDecompression@{QSEC\_\-constructDecompression}!decompress.h@{decompress.h}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf QSEC\_\-decompression}$\ast$ QSEC\_\-constructDecompression (void $\ast$ {\em buffer}, unsigned int {\em nbits}, const char $\ast$ {\em name})}}
\label{decompress_8h_6afe934b8d875845dc6009f7b8931631}


Initialise the buffer as a decompression structure. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em buffer}]Pointer to the uninitialised memory to use for this decompression structure\item[{\em nbits}]Number of bits in the symbols to be handled by this decompression strcuture\item[{\em name}]String identifying this structure\end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]Pointer to an initialised decompression structure \end{Desc}
\hypertarget{decompress_8h_cfd3a288b77da21be7fafbb828272b48}{
\index{decompress.h@{decompress.h}!QSEC_decompress@{QSEC\_\-decompress}}
\index{QSEC_decompress@{QSEC\_\-decompress}!decompress.h@{decompress.h}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}unsigned QSEC\_\-decompress ({\bf QSEC\_\-decompression} $\ast$ {\em dcm}, APD\_\-dtx $\ast$ {\em dtx})}}
\label{decompress_8h_cfd3a288b77da21be7fafbb828272b48}


Decode the next symbol. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em dcm}]Pointer to an initialsed, populated and processed decompression structure\item[{\em dtx}]Pointer to the arithmetic encoder context\end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]The next symbol \end{Desc}
\hypertarget{decompress_8h_8e1340f1268535a22d719b926ea9d6bf}{
\index{decompress.h@{decompress.h}!QSEC_deleteDecompression@{QSEC\_\-deleteDecompression}}
\index{QSEC_deleteDecompression@{QSEC\_\-deleteDecompression}!decompress.h@{decompress.h}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void QSEC\_\-deleteDecompression ({\bf QSEC\_\-decompression} $\ast$ {\em dcm})}}
\label{decompress_8h_8e1340f1268535a22d719b926ea9d6bf}


Free the memory associated with the decompression structure. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em dcm}]Pointer to an allocated decompression structure \end{description}
\end{Desc}
\hypertarget{decompress_8h_4ea59426abbf9a9d29ccff4b722264f7}{
\index{decompress.h@{decompress.h}!QSEC_getCount@{QSEC\_\-getCount}}
\index{QSEC_getCount@{QSEC\_\-getCount}!decompress.h@{decompress.h}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}unsigned int QSEC\_\-getCount ({\bf QSEC\_\-decompression} $\ast$ {\em dcm})}}
\label{decompress_8h_4ea59426abbf9a9d29ccff4b722264f7}


Return the number of non-zero bins in the histogram. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em dcm}]Pointer to a decompression structure\end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]Number of non-zero bins in the histogram \end{Desc}
\hypertarget{decompress_8h_de340d0845160b2d9f724d8492de9c0a}{
\index{decompress.h@{decompress.h}!QSEC_newDecompression@{QSEC\_\-newDecompression}}
\index{QSEC_newDecompression@{QSEC\_\-newDecompression}!decompress.h@{decompress.h}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf QSEC\_\-decompression}$\ast$ QSEC\_\-newDecompression (unsigned int {\em nbits}, const char $\ast$ {\em name})}}
\label{decompress_8h_de340d0845160b2d9f724d8492de9c0a}


Allocate and initialise a new decompression structure. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em name}]String used in the reporting of error to identify a decompression structure\item[{\em nbits}]Number of symbols in the complete range of possible symbols (including excluded internal sub-ranges), hence the number of bins in the histogram and frequency tables\end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]Pointer to an allocated and initialised QSEC\_\-decompression structure \end{Desc}
\hypertarget{decompress_8h_9500b01a3ec3df5a23d43cef2c2c58b2}{
\index{decompress.h@{decompress.h}!QSEC_reportDecompression@{QSEC\_\-reportDecompression}}
\index{QSEC_reportDecompression@{QSEC\_\-reportDecompression}!decompress.h@{decompress.h}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void QSEC\_\-reportDecompression ({\bf QSEC\_\-decompression} $\ast$ {\em dcm}, FILE $\ast$ {\em fp})}}
\label{decompress_8h_9500b01a3ec3df5a23d43cef2c2c58b2}


Describe the contents of the decompression structure in formatted ASCII send to the file {\em fp\/}. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em dcm}]Pointer to the decompression structure\item[{\em fp}]Pointer to the file used as the destination \end{description}
\end{Desc}
\hypertarget{decompress_8h_fb51bf6fcc032ed0be71fbf548003027}{
\index{decompress.h@{decompress.h}!QSEC_sizeofDecompression@{QSEC\_\-sizeofDecompression}}
\index{QSEC_sizeofDecompression@{QSEC\_\-sizeofDecompression}!decompress.h@{decompress.h}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}size\_\-t QSEC\_\-sizeofDecompression (unsigned int {\em nbits})}}
\label{decompress_8h_fb51bf6fcc032ed0be71fbf548003027}


Calculate the total size required to accomodate a decompression structure. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em nbits}]Number of symbols in the complete range of possible symbols (including excluded internal sub-ranges), hence the number of bins in the histogram and frequency tables\end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]Size of memory block required to accomodate a decompression structure \end{Desc}
\hypertarget{decompress_8h_d748284e49f28c0552b8926738dde8a6}{
\index{decompress.h@{decompress.h}!QSEC_unpack@{QSEC\_\-unpack}}
\index{QSEC_unpack@{QSEC\_\-unpack}!decompress.h@{decompress.h}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}const unsigned int$\ast$ QSEC\_\-unpack ({\bf QSEC\_\-decompression} $\ast$ {\em dcm}, const unsigned int $\ast$ {\em buffer})}}
\label{decompress_8h_d748284e49f28c0552b8926738dde8a6}


Build the lookup and freqency tables by retrieving and unpacking data from the consignment. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em dcm}]Pointer to an initialsed decompression structure\item[{\em buffer}]Pointer to the start of the buffer holding the packed structure\end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]Pointer to the next input location or NULL if there is an error in the unpacking \end{Desc}
