\hypertarget{classSPL_1_1BinArithDecoder}{}\section{S\+P\+L\+:\+:Bin\+Arith\+Decoder Class Reference}
\label{classSPL_1_1BinArithDecoder}\index{S\+P\+L\+::\+Bin\+Arith\+Decoder@{S\+P\+L\+::\+Bin\+Arith\+Decoder}}


Binary arithmetic decoder class.  




{\ttfamily \#include $<$arith\+Coder.\+hpp$>$}

\subsection*{Public Member Functions}
\begin{DoxyCompactItemize}
\item 
\hyperlink{classSPL_1_1BinArithDecoder_a6bcf8a37d0d220430373ce1ccd3e8fa3}{Bin\+Arith\+Decoder} (int num\+Contexts, \hyperlink{classSPL_1_1InputBitStream}{Input\+Bit\+Stream} $\ast$in=nullptr)
\begin{DoxyCompactList}\small\item\em Create a decoder with the specified number of contexts that receives input from the given bit stream. \end{DoxyCompactList}\item 
\hyperlink{classSPL_1_1BinArithDecoder_ae6bec2594acfad885f72906143f604c8}{$\sim$\+Bin\+Arith\+Decoder} ()
\begin{DoxyCompactList}\small\item\em Destroy a decoder. \end{DoxyCompactList}\item 
S\+P\+L\+\_\+\+Arith\+Coder\+\_\+ulong \hyperlink{group__ArithCoder_ga8d3afa4aa788b0a0c6c7215bbd89a3d6}{get\+Sym\+Count} () const 
\begin{DoxyCompactList}\small\item\em Get the number of symbols decoded so far. \end{DoxyCompactList}\item 
S\+P\+L\+\_\+\+Arith\+Coder\+\_\+ulong \hyperlink{group__ArithCoder_gacf8bff5789cb524d2bd9ff79c0ef09a9}{get\+Bit\+Count} () const 
\begin{DoxyCompactList}\small\item\em Get the number of bits read so far. \end{DoxyCompactList}\item 
void \hyperlink{group__ArithCoder_gacc3930e2a540e9a2d71c0eeb72a435b1}{set\+Input} (\hyperlink{classSPL_1_1InputBitStream}{Input\+Bit\+Stream} $\ast$in)
\begin{DoxyCompactList}\small\item\em Set the bit stream from which to read encoded data. \end{DoxyCompactList}\item 
\hyperlink{classSPL_1_1InputBitStream}{Input\+Bit\+Stream} $\ast$ \hyperlink{group__ArithCoder_ga1bf7f26558c0d6750910e88f9c812a3f}{get\+Input} () const 
\begin{DoxyCompactList}\small\item\em Get the bit stream from which to read encoded data. \end{DoxyCompactList}\item 
int \hyperlink{group__ArithCoder_ga5f52148ae3c83c85d2d4bb5a58448ca6}{get\+Num\+Contexts} () const 
\begin{DoxyCompactList}\small\item\em Get the number of contexts. \end{DoxyCompactList}\item 
void \hyperlink{classSPL_1_1BinArithDecoder_a4d09f60254065f641a12a5eb0630ce0e}{set\+Context\+State} (int context\+Id, Arith\+Coder\+::\+Freq one\+Freq, Arith\+Coder\+::\+Freq total\+Freq, Arith\+Coder\+::\+Freq max\+Freq, bool adaptive)
\begin{DoxyCompactList}\small\item\em Set the symbol probabilities and adaptivity for the specified context. \end{DoxyCompactList}\item 
void \hyperlink{classSPL_1_1BinArithDecoder_a72bc56f6bf3931cca42efbb805217c3a}{get\+Context\+State} (int context\+Id, Arith\+Coder\+::\+Freq \&one\+Freq, Arith\+Coder\+::\+Freq \&total\+Freq, Arith\+Coder\+::\+Freq \&max\+Freq, bool \&adaptive)
\begin{DoxyCompactList}\small\item\em Get the symbol probabilities and adaptivity for the specified context. \end{DoxyCompactList}\item 
int \hyperlink{classSPL_1_1BinArithDecoder_a892e6b2d93752164275139c3bc2838cf}{start} ()
\begin{DoxyCompactList}\small\item\em Start a code word. \end{DoxyCompactList}\item 
int \hyperlink{classSPL_1_1BinArithDecoder_a5923fd241b5c85410913e04f636cc31e}{terminate} ()
\begin{DoxyCompactList}\small\item\em Terminate the code word (for synchonization with the encoder). \end{DoxyCompactList}\item 
int \hyperlink{classSPL_1_1BinArithDecoder_a36e4087a6f681bf4f1a4a14ad74cc5fa}{decode\+Regular} (int context\+Id)
\begin{DoxyCompactList}\small\item\em Decode a symbol in the specified context. \end{DoxyCompactList}\item 
int \hyperlink{classSPL_1_1BinArithDecoder_a144a763f1891c7cfa1fda9bd134ab50f}{decode\+Bypass} ()
\begin{DoxyCompactList}\small\item\em Decode a symbol in bypass mode (i.\+e., using a fixed probability distribution with all symbols being equiprobable). \end{DoxyCompactList}\item 
void \hyperlink{classSPL_1_1BinArithDecoder_a9b7dbf19261cc86d1e51bf57d265c6a6}{dump} (std\+::ostream \&out) const 
\begin{DoxyCompactList}\small\item\em Dump the internal decoder state to the specified stream for debugging purposes. \end{DoxyCompactList}\end{DoxyCompactItemize}
\subsection*{Static Public Member Functions}
\begin{DoxyCompactItemize}
\item 
static void \hyperlink{group__ArithCoder_gaef0c845e69da4d0a6939b28d630c3227}{set\+Debug\+Level} (int debug\+Level)
\begin{DoxyCompactList}\small\item\em Set the debug level. \end{DoxyCompactList}\item 
static void \hyperlink{group__ArithCoder_ga35b518d35fc868f8c962efd04ec2c068}{set\+Debug\+Stream} (std\+::ostream \&out)
\begin{DoxyCompactList}\small\item\em Set the stream to be used for debugging output. \end{DoxyCompactList}\item 
static std\+::ostream \& \hyperlink{group__ArithCoder_ga2174c4f28c8cc305d7db21410356b7e6}{get\+Debug\+Stream} ()
\begin{DoxyCompactList}\small\item\em Get the stream used for debugging output. \end{DoxyCompactList}\end{DoxyCompactItemize}


\subsection{Detailed Description}
Binary arithmetic decoder class. 

\subsection{Constructor \& Destructor Documentation}
\hypertarget{classSPL_1_1BinArithDecoder_a6bcf8a37d0d220430373ce1ccd3e8fa3}{}\index{S\+P\+L\+::\+Bin\+Arith\+Decoder@{S\+P\+L\+::\+Bin\+Arith\+Decoder}!Bin\+Arith\+Decoder@{Bin\+Arith\+Decoder}}
\index{Bin\+Arith\+Decoder@{Bin\+Arith\+Decoder}!S\+P\+L\+::\+Bin\+Arith\+Decoder@{S\+P\+L\+::\+Bin\+Arith\+Decoder}}
\subsubsection[{Bin\+Arith\+Decoder}]{\setlength{\rightskip}{0pt plus 5cm}S\+P\+L\+::\+Bin\+Arith\+Decoder\+::\+Bin\+Arith\+Decoder (
\begin{DoxyParamCaption}
\item[{int}]{num\+Contexts, }
\item[{{\bf Input\+Bit\+Stream} $\ast$}]{in = {\ttfamily nullptr}}
\end{DoxyParamCaption}
)}\label{classSPL_1_1BinArithDecoder_a6bcf8a37d0d220430373ce1ccd3e8fa3}


Create a decoder with the specified number of contexts that receives input from the given bit stream. 


\begin{DoxyParams}{Parameters}
{\em num\+Contexts} & The number of contexts. \\
\hline
{\em in} & The input bit stream.\\
\hline
\end{DoxyParams}
This function creates an arithmetic decoder with the number of contexts being {\ttfamily num\+Contexts} that receives input from the bit stream {\ttfamily in}. \hypertarget{classSPL_1_1BinArithDecoder_ae6bec2594acfad885f72906143f604c8}{}\index{S\+P\+L\+::\+Bin\+Arith\+Decoder@{S\+P\+L\+::\+Bin\+Arith\+Decoder}!````~Bin\+Arith\+Decoder@{$\sim$\+Bin\+Arith\+Decoder}}
\index{````~Bin\+Arith\+Decoder@{$\sim$\+Bin\+Arith\+Decoder}!S\+P\+L\+::\+Bin\+Arith\+Decoder@{S\+P\+L\+::\+Bin\+Arith\+Decoder}}
\subsubsection[{$\sim$\+Bin\+Arith\+Decoder}]{\setlength{\rightskip}{0pt plus 5cm}S\+P\+L\+::\+Bin\+Arith\+Decoder\+::$\sim$\+Bin\+Arith\+Decoder (
\begin{DoxyParamCaption}
{}
\end{DoxyParamCaption}
)}\label{classSPL_1_1BinArithDecoder_ae6bec2594acfad885f72906143f604c8}


Destroy a decoder. 

This function destroys an arithmetic decoder. 

\subsection{Member Function Documentation}
\hypertarget{classSPL_1_1BinArithDecoder_a144a763f1891c7cfa1fda9bd134ab50f}{}\index{S\+P\+L\+::\+Bin\+Arith\+Decoder@{S\+P\+L\+::\+Bin\+Arith\+Decoder}!decode\+Bypass@{decode\+Bypass}}
\index{decode\+Bypass@{decode\+Bypass}!S\+P\+L\+::\+Bin\+Arith\+Decoder@{S\+P\+L\+::\+Bin\+Arith\+Decoder}}
\subsubsection[{decode\+Bypass}]{\setlength{\rightskip}{0pt plus 5cm}int S\+P\+L\+::\+Bin\+Arith\+Decoder\+::decode\+Bypass (
\begin{DoxyParamCaption}
{}
\end{DoxyParamCaption}
)}\label{classSPL_1_1BinArithDecoder_a144a763f1891c7cfa1fda9bd134ab50f}


Decode a symbol in bypass mode (i.\+e., using a fixed probability distribution with all symbols being equiprobable). 

This function decodes a symbol in bypass mode (i.\+e., using a fixed probability distribution with all symbols being equiprobable).

\begin{DoxyReturn}{Returns}
Upon success, the decoded symbol is returned (which is either 0 or 1); otherwise, a negative value is returned. 
\end{DoxyReturn}
\hypertarget{classSPL_1_1BinArithDecoder_a36e4087a6f681bf4f1a4a14ad74cc5fa}{}\index{S\+P\+L\+::\+Bin\+Arith\+Decoder@{S\+P\+L\+::\+Bin\+Arith\+Decoder}!decode\+Regular@{decode\+Regular}}
\index{decode\+Regular@{decode\+Regular}!S\+P\+L\+::\+Bin\+Arith\+Decoder@{S\+P\+L\+::\+Bin\+Arith\+Decoder}}
\subsubsection[{decode\+Regular}]{\setlength{\rightskip}{0pt plus 5cm}int S\+P\+L\+::\+Bin\+Arith\+Decoder\+::decode\+Regular (
\begin{DoxyParamCaption}
\item[{int}]{context\+Id}
\end{DoxyParamCaption}
)}\label{classSPL_1_1BinArithDecoder_a36e4087a6f681bf4f1a4a14ad74cc5fa}


Decode a symbol in the specified context. 


\begin{DoxyParams}{Parameters}
{\em context\+Id} & The I\+D of the context to be used for decoding.\\
\hline
\end{DoxyParams}
The function decodes a symbol using the context specified by {\ttfamily context\+Id}. The value of {\ttfamily context\+Id} must be from 0 to n -\/ 1 (inclusive), where n is the number of contexts employed by the arithmetic decoder.

\begin{DoxyReturn}{Returns}
Upon success, the decoded symbol is returned (which is either 0 or 1); otherwise, a negative value is returned. 
\end{DoxyReturn}
\hypertarget{classSPL_1_1BinArithDecoder_a9b7dbf19261cc86d1e51bf57d265c6a6}{}\index{S\+P\+L\+::\+Bin\+Arith\+Decoder@{S\+P\+L\+::\+Bin\+Arith\+Decoder}!dump@{dump}}
\index{dump@{dump}!S\+P\+L\+::\+Bin\+Arith\+Decoder@{S\+P\+L\+::\+Bin\+Arith\+Decoder}}
\subsubsection[{dump}]{\setlength{\rightskip}{0pt plus 5cm}void S\+P\+L\+::\+Bin\+Arith\+Decoder\+::dump (
\begin{DoxyParamCaption}
\item[{std\+::ostream \&}]{out}
\end{DoxyParamCaption}
) const}\label{classSPL_1_1BinArithDecoder_a9b7dbf19261cc86d1e51bf57d265c6a6}


Dump the internal decoder state to the specified stream for debugging purposes. 

\hypertarget{classSPL_1_1BinArithDecoder_a72bc56f6bf3931cca42efbb805217c3a}{}\index{S\+P\+L\+::\+Bin\+Arith\+Decoder@{S\+P\+L\+::\+Bin\+Arith\+Decoder}!get\+Context\+State@{get\+Context\+State}}
\index{get\+Context\+State@{get\+Context\+State}!S\+P\+L\+::\+Bin\+Arith\+Decoder@{S\+P\+L\+::\+Bin\+Arith\+Decoder}}
\subsubsection[{get\+Context\+State}]{\setlength{\rightskip}{0pt plus 5cm}void S\+P\+L\+::\+Bin\+Arith\+Decoder\+::get\+Context\+State (
\begin{DoxyParamCaption}
\item[{int}]{context\+Id, }
\item[{Arith\+Coder\+::\+Freq \&}]{one\+Freq, }
\item[{Arith\+Coder\+::\+Freq \&}]{total\+Freq, }
\item[{Arith\+Coder\+::\+Freq \&}]{max\+Freq, }
\item[{bool \&}]{adaptive}
\end{DoxyParamCaption}
)}\label{classSPL_1_1BinArithDecoder_a72bc56f6bf3931cca42efbb805217c3a}


Get the symbol probabilities and adaptivity for the specified context. 


\begin{DoxyParams}[1]{Parameters}
 & {\em context\+Id} & The I\+D of the context to query. \\
\hline
\mbox{\tt out}  & {\em one\+Freq} & The frequency count for a one symbol. \\
\hline
\mbox{\tt out}  & {\em total\+Freq} & The normalizing frequency count for all symbols. \\
\hline
\mbox{\tt out}  & {\em max\+Freq} & The maximum normalizing frequency count. \\
\hline
\mbox{\tt out}  & {\em adaptive} & The adaptivity flag.\\
\hline
\end{DoxyParams}
This function queries the state of the context with the context I\+D {\ttfamily context\+Id}, and sets the parameters {\ttfamily one\+Freq}, {\ttfamily total\+Freq}, {\ttfamily max\+Freq}, and {\ttfamily adaptive} appropriately. The probability of a one symbol is given by {\ttfamily one\+Freq} / {\ttfamily total\+Freq}, while the probability of a zero symbol is given by 1 -\/ {\ttfamily one\+Freq} / {\ttfamily total\+Freq}. \hypertarget{classSPL_1_1BinArithDecoder_a4d09f60254065f641a12a5eb0630ce0e}{}\index{S\+P\+L\+::\+Bin\+Arith\+Decoder@{S\+P\+L\+::\+Bin\+Arith\+Decoder}!set\+Context\+State@{set\+Context\+State}}
\index{set\+Context\+State@{set\+Context\+State}!S\+P\+L\+::\+Bin\+Arith\+Decoder@{S\+P\+L\+::\+Bin\+Arith\+Decoder}}
\subsubsection[{set\+Context\+State}]{\setlength{\rightskip}{0pt plus 5cm}void S\+P\+L\+::\+Bin\+Arith\+Decoder\+::set\+Context\+State (
\begin{DoxyParamCaption}
\item[{int}]{context\+Id, }
\item[{Arith\+Coder\+::\+Freq}]{one\+Freq, }
\item[{Arith\+Coder\+::\+Freq}]{total\+Freq, }
\item[{Arith\+Coder\+::\+Freq}]{max\+Freq, }
\item[{bool}]{adaptive}
\end{DoxyParamCaption}
)}\label{classSPL_1_1BinArithDecoder_a4d09f60254065f641a12a5eb0630ce0e}


Set the symbol probabilities and adaptivity for the specified context. 

\hypertarget{classSPL_1_1BinArithDecoder_a892e6b2d93752164275139c3bc2838cf}{}\index{S\+P\+L\+::\+Bin\+Arith\+Decoder@{S\+P\+L\+::\+Bin\+Arith\+Decoder}!start@{start}}
\index{start@{start}!S\+P\+L\+::\+Bin\+Arith\+Decoder@{S\+P\+L\+::\+Bin\+Arith\+Decoder}}
\subsubsection[{start}]{\setlength{\rightskip}{0pt plus 5cm}int S\+P\+L\+::\+Bin\+Arith\+Decoder\+::start (
\begin{DoxyParamCaption}
{}
\end{DoxyParamCaption}
)}\label{classSPL_1_1BinArithDecoder_a892e6b2d93752164275139c3bc2838cf}


Start a code word. 

This function starts the decoding of a new arithmetic code word. This function must be called before attempting to decode any symbols.

\begin{DoxyReturn}{Returns}
Upon success, zero is returned; otherwise, a nonzero value is returned. 
\end{DoxyReturn}
\hypertarget{classSPL_1_1BinArithDecoder_a5923fd241b5c85410913e04f636cc31e}{}\index{S\+P\+L\+::\+Bin\+Arith\+Decoder@{S\+P\+L\+::\+Bin\+Arith\+Decoder}!terminate@{terminate}}
\index{terminate@{terminate}!S\+P\+L\+::\+Bin\+Arith\+Decoder@{S\+P\+L\+::\+Bin\+Arith\+Decoder}}
\subsubsection[{terminate}]{\setlength{\rightskip}{0pt plus 5cm}int S\+P\+L\+::\+Bin\+Arith\+Decoder\+::terminate (
\begin{DoxyParamCaption}
{}
\end{DoxyParamCaption}
)}\label{classSPL_1_1BinArithDecoder_a5923fd241b5c85410913e04f636cc31e}


Terminate the code word (for synchonization with the encoder). 

This function terminates the decoding of the current arithmetic code word.

\begin{DoxyReturn}{Returns}
Upon success, zero is returned; otherwise, a nonzero value is returned. 
\end{DoxyReturn}


The documentation for this class was generated from the following files\+:\begin{DoxyCompactItemize}
\item 
\hyperlink{arithCoder_8hpp}{arith\+Coder.\+hpp}\item 
arith\+Coder.\+cpp\end{DoxyCompactItemize}
