\hypertarget{classSPL_1_1MEncoder}{}\section{S\+P\+L\+:\+:M\+Encoder Class Reference}
\label{classSPL_1_1MEncoder}\index{S\+P\+L\+::\+M\+Encoder@{S\+P\+L\+::\+M\+Encoder}}


The M-\/\+Coder (binary) arithmetic encoder class.  




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



Inherits S\+P\+L\+::\+M\+Coder.

\subsection*{Public Member Functions}
\begin{DoxyCompactItemize}
\item 
\hyperlink{classSPL_1_1MEncoder_a0a1601a7a5ff1161796ae0c9f331f89f}{M\+Encoder} (int num\+Contexts=0, \hyperlink{classSPL_1_1OutputBitStream}{Output\+Bit\+Stream} $\ast$out=0)
\begin{DoxyCompactList}\small\item\em Create an encoder with a specified number of contexts that sends output to a given bit stream. \end{DoxyCompactList}\item 
\hyperlink{classSPL_1_1MEncoder_a354a9a30a49655e9ca9f72b85d1f08d0}{$\sim$\+M\+Encoder} ()
\begin{DoxyCompactList}\small\item\em Destroy an encoder. \end{DoxyCompactList}\item 
void \hyperlink{classSPL_1_1MEncoder_a33fd4b29d26549e1b6136956e95cce40}{set\+Num\+Contexts} (int num\+Contexts)
\begin{DoxyCompactList}\small\item\em Set the number of contexts. \end{DoxyCompactList}\item 
int \hyperlink{group__MCoder_ga16408ee66d2342f464b4580d961ba63b}{get\+Num\+Contexts} () const 
\begin{DoxyCompactList}\small\item\em Get the number of contexts. \end{DoxyCompactList}\item 
void \hyperlink{classSPL_1_1MEncoder_ad07fc242aa744df3e27ae1233f123051}{clear\+Contexts} ()
\begin{DoxyCompactList}\small\item\em Clear the state of all of the contexts. \end{DoxyCompactList}\item 
void \hyperlink{group__MCoder_ga5c7a92969f5e8cc1ee6a8617b15e9765}{set\+Output} (\hyperlink{classSPL_1_1OutputBitStream}{Output\+Bit\+Stream} $\ast$out)
\begin{DoxyCompactList}\small\item\em Set the bit stream to use for output. \end{DoxyCompactList}\item 
\hyperlink{classSPL_1_1OutputBitStream}{Output\+Bit\+Stream} $\ast$ \hyperlink{group__MCoder_ga0ba0be00034c4f60d8587df037f272ee}{get\+Output} () const 
\begin{DoxyCompactList}\small\item\em Get the bit stream being used for output. \end{DoxyCompactList}\item 
long \hyperlink{group__MCoder_gad82a207d2e2887473ef152bbad891c26}{get\+Sym\+Count} () const 
\begin{DoxyCompactList}\small\item\em Get the number of symbols that have been encoded so far. \end{DoxyCompactList}\item 
long \hyperlink{group__MCoder_ga1c9307ec229b68c64e2497bd073f3b1d}{get\+Bit\+Count} () const 
\begin{DoxyCompactList}\small\item\em Get the number of bits (of encoded data) that have been output to the underlying bit stream so far. \end{DoxyCompactList}\item 
void \hyperlink{classSPL_1_1MEncoder_a02f0d588eabf2d7bb6873c23f6c774d9}{start} ()
\begin{DoxyCompactList}\small\item\em Start the arithmetic code word. \end{DoxyCompactList}\item 
int \hyperlink{classSPL_1_1MEncoder_a42c8bad8771c16893ddce20b64fb34fa}{terminate} ()
\begin{DoxyCompactList}\small\item\em Terminate the arithmetic code word. \end{DoxyCompactList}\item 
int \hyperlink{classSPL_1_1MEncoder_ab1e34c043065feaa2ccb45fb88ac4af2}{encode\+Regular} (int context\+Id, int bin\+Val)
\begin{DoxyCompactList}\small\item\em Encode a symbol in the specified context. \end{DoxyCompactList}\item 
int \hyperlink{classSPL_1_1MEncoder_aea414282c76409fd676668caf8ec7f0d}{encode\+Bypass} (int bin\+Val)
\begin{DoxyCompactList}\small\item\em Encode a symbol in bypass mode (i.\+e., assuming that both symbols are equiprobable). \end{DoxyCompactList}\item 
void \hyperlink{classSPL_1_1MEncoder_a4dda5b5ff8a0b71530a45f271977b487}{dump} (std\+::ostream \&out) const 
\begin{DoxyCompactList}\small\item\em Dump the internal state of the encoder for debugging. \end{DoxyCompactList}\end{DoxyCompactItemize}
\subsection*{Static Public Member Functions}
\begin{DoxyCompactItemize}
\item 
static void \hyperlink{classSPL_1_1MEncoder_a0294706e9585a43677446944cf010091}{set\+Debug\+Level} (int debug\+Level)
\begin{DoxyCompactList}\small\item\em Set the debug level. \end{DoxyCompactList}\item 
static void \hyperlink{classSPL_1_1MEncoder_a9e6fecc327bd8a4182d6c65694e4d757}{set\+Debug\+Stream} (std\+::ostream \&debug\+Stream)
\begin{DoxyCompactList}\small\item\em Set the stream for debugging output. \end{DoxyCompactList}\item 
static std\+::ostream \& \hyperlink{classSPL_1_1MEncoder_a4998665746bc5f3d9c11e46d9a3a8c74}{get\+Debug\+Stream} ()
\begin{DoxyCompactList}\small\item\em Get the stream used for debugging output. \end{DoxyCompactList}\end{DoxyCompactItemize}


\subsection{Detailed Description}
The M-\/\+Coder (binary) arithmetic encoder class. 

\subsection{Constructor \& Destructor Documentation}
\hypertarget{classSPL_1_1MEncoder_a0a1601a7a5ff1161796ae0c9f331f89f}{}\index{S\+P\+L\+::\+M\+Encoder@{S\+P\+L\+::\+M\+Encoder}!M\+Encoder@{M\+Encoder}}
\index{M\+Encoder@{M\+Encoder}!S\+P\+L\+::\+M\+Encoder@{S\+P\+L\+::\+M\+Encoder}}
\subsubsection[{M\+Encoder}]{\setlength{\rightskip}{0pt plus 5cm}S\+P\+L\+::\+M\+Encoder\+::\+M\+Encoder (
\begin{DoxyParamCaption}
\item[{int}]{num\+Contexts = {\ttfamily 0}, }
\item[{{\bf Output\+Bit\+Stream} $\ast$}]{out = {\ttfamily 0}}
\end{DoxyParamCaption}
)}\label{classSPL_1_1MEncoder_a0a1601a7a5ff1161796ae0c9f331f89f}


Create an encoder with a specified number of contexts that sends output to a given bit stream. 

\hypertarget{classSPL_1_1MEncoder_a354a9a30a49655e9ca9f72b85d1f08d0}{}\index{S\+P\+L\+::\+M\+Encoder@{S\+P\+L\+::\+M\+Encoder}!````~M\+Encoder@{$\sim$\+M\+Encoder}}
\index{````~M\+Encoder@{$\sim$\+M\+Encoder}!S\+P\+L\+::\+M\+Encoder@{S\+P\+L\+::\+M\+Encoder}}
\subsubsection[{$\sim$\+M\+Encoder}]{\setlength{\rightskip}{0pt plus 5cm}S\+P\+L\+::\+M\+Encoder\+::$\sim$\+M\+Encoder (
\begin{DoxyParamCaption}
{}
\end{DoxyParamCaption}
)}\label{classSPL_1_1MEncoder_a354a9a30a49655e9ca9f72b85d1f08d0}


Destroy an encoder. 



\subsection{Member Function Documentation}
\hypertarget{classSPL_1_1MEncoder_ad07fc242aa744df3e27ae1233f123051}{}\index{S\+P\+L\+::\+M\+Encoder@{S\+P\+L\+::\+M\+Encoder}!clear\+Contexts@{clear\+Contexts}}
\index{clear\+Contexts@{clear\+Contexts}!S\+P\+L\+::\+M\+Encoder@{S\+P\+L\+::\+M\+Encoder}}
\subsubsection[{clear\+Contexts}]{\setlength{\rightskip}{0pt plus 5cm}void S\+P\+L\+::\+M\+Encoder\+::clear\+Contexts (
\begin{DoxyParamCaption}
{}
\end{DoxyParamCaption}
)}\label{classSPL_1_1MEncoder_ad07fc242aa744df3e27ae1233f123051}


Clear the state of all of the contexts. 

\hypertarget{classSPL_1_1MEncoder_a4dda5b5ff8a0b71530a45f271977b487}{}\index{S\+P\+L\+::\+M\+Encoder@{S\+P\+L\+::\+M\+Encoder}!dump@{dump}}
\index{dump@{dump}!S\+P\+L\+::\+M\+Encoder@{S\+P\+L\+::\+M\+Encoder}}
\subsubsection[{dump}]{\setlength{\rightskip}{0pt plus 5cm}void S\+P\+L\+::\+M\+Encoder\+::dump (
\begin{DoxyParamCaption}
\item[{std\+::ostream \&}]{out}
\end{DoxyParamCaption}
) const}\label{classSPL_1_1MEncoder_a4dda5b5ff8a0b71530a45f271977b487}


Dump the internal state of the encoder for debugging. 

\hypertarget{classSPL_1_1MEncoder_aea414282c76409fd676668caf8ec7f0d}{}\index{S\+P\+L\+::\+M\+Encoder@{S\+P\+L\+::\+M\+Encoder}!encode\+Bypass@{encode\+Bypass}}
\index{encode\+Bypass@{encode\+Bypass}!S\+P\+L\+::\+M\+Encoder@{S\+P\+L\+::\+M\+Encoder}}
\subsubsection[{encode\+Bypass}]{\setlength{\rightskip}{0pt plus 5cm}int S\+P\+L\+::\+M\+Encoder\+::encode\+Bypass (
\begin{DoxyParamCaption}
\item[{int}]{bin\+Val}
\end{DoxyParamCaption}
)}\label{classSPL_1_1MEncoder_aea414282c76409fd676668caf8ec7f0d}


Encode a symbol in bypass mode (i.\+e., assuming that both symbols are equiprobable). 

\hypertarget{classSPL_1_1MEncoder_ab1e34c043065feaa2ccb45fb88ac4af2}{}\index{S\+P\+L\+::\+M\+Encoder@{S\+P\+L\+::\+M\+Encoder}!encode\+Regular@{encode\+Regular}}
\index{encode\+Regular@{encode\+Regular}!S\+P\+L\+::\+M\+Encoder@{S\+P\+L\+::\+M\+Encoder}}
\subsubsection[{encode\+Regular}]{\setlength{\rightskip}{0pt plus 5cm}int S\+P\+L\+::\+M\+Encoder\+::encode\+Regular (
\begin{DoxyParamCaption}
\item[{int}]{context\+Id, }
\item[{int}]{bin\+Val}
\end{DoxyParamCaption}
)}\label{classSPL_1_1MEncoder_ab1e34c043065feaa2ccb45fb88ac4af2}


Encode a symbol in the specified context. 

The symbol bin\+Val is encoded using context context\+Id. \hypertarget{classSPL_1_1MEncoder_a4998665746bc5f3d9c11e46d9a3a8c74}{}\index{S\+P\+L\+::\+M\+Encoder@{S\+P\+L\+::\+M\+Encoder}!get\+Debug\+Stream@{get\+Debug\+Stream}}
\index{get\+Debug\+Stream@{get\+Debug\+Stream}!S\+P\+L\+::\+M\+Encoder@{S\+P\+L\+::\+M\+Encoder}}
\subsubsection[{get\+Debug\+Stream}]{\setlength{\rightskip}{0pt plus 5cm}std\+::ostream \& S\+P\+L\+::\+M\+Encoder\+::get\+Debug\+Stream (
\begin{DoxyParamCaption}
{}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily [static]}}\label{classSPL_1_1MEncoder_a4998665746bc5f3d9c11e46d9a3a8c74}


Get the stream used for debugging output. 

\hypertarget{classSPL_1_1MEncoder_a0294706e9585a43677446944cf010091}{}\index{S\+P\+L\+::\+M\+Encoder@{S\+P\+L\+::\+M\+Encoder}!set\+Debug\+Level@{set\+Debug\+Level}}
\index{set\+Debug\+Level@{set\+Debug\+Level}!S\+P\+L\+::\+M\+Encoder@{S\+P\+L\+::\+M\+Encoder}}
\subsubsection[{set\+Debug\+Level}]{\setlength{\rightskip}{0pt plus 5cm}void S\+P\+L\+::\+M\+Encoder\+::set\+Debug\+Level (
\begin{DoxyParamCaption}
\item[{int}]{debug\+Level}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily [static]}}\label{classSPL_1_1MEncoder_a0294706e9585a43677446944cf010091}


Set the debug level. 

\hypertarget{classSPL_1_1MEncoder_a9e6fecc327bd8a4182d6c65694e4d757}{}\index{S\+P\+L\+::\+M\+Encoder@{S\+P\+L\+::\+M\+Encoder}!set\+Debug\+Stream@{set\+Debug\+Stream}}
\index{set\+Debug\+Stream@{set\+Debug\+Stream}!S\+P\+L\+::\+M\+Encoder@{S\+P\+L\+::\+M\+Encoder}}
\subsubsection[{set\+Debug\+Stream}]{\setlength{\rightskip}{0pt plus 5cm}void S\+P\+L\+::\+M\+Encoder\+::set\+Debug\+Stream (
\begin{DoxyParamCaption}
\item[{std\+::ostream \&}]{debug\+Stream}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily [static]}}\label{classSPL_1_1MEncoder_a9e6fecc327bd8a4182d6c65694e4d757}


Set the stream for debugging output. 

\hypertarget{classSPL_1_1MEncoder_a33fd4b29d26549e1b6136956e95cce40}{}\index{S\+P\+L\+::\+M\+Encoder@{S\+P\+L\+::\+M\+Encoder}!set\+Num\+Contexts@{set\+Num\+Contexts}}
\index{set\+Num\+Contexts@{set\+Num\+Contexts}!S\+P\+L\+::\+M\+Encoder@{S\+P\+L\+::\+M\+Encoder}}
\subsubsection[{set\+Num\+Contexts}]{\setlength{\rightskip}{0pt plus 5cm}void S\+P\+L\+::\+M\+Encoder\+::set\+Num\+Contexts (
\begin{DoxyParamCaption}
\item[{int}]{num\+Contexts}
\end{DoxyParamCaption}
)}\label{classSPL_1_1MEncoder_a33fd4b29d26549e1b6136956e95cce40}


Set the number of contexts. 

\hypertarget{classSPL_1_1MEncoder_a02f0d588eabf2d7bb6873c23f6c774d9}{}\index{S\+P\+L\+::\+M\+Encoder@{S\+P\+L\+::\+M\+Encoder}!start@{start}}
\index{start@{start}!S\+P\+L\+::\+M\+Encoder@{S\+P\+L\+::\+M\+Encoder}}
\subsubsection[{start}]{\setlength{\rightskip}{0pt plus 5cm}void S\+P\+L\+::\+M\+Encoder\+::start (
\begin{DoxyParamCaption}
{}
\end{DoxyParamCaption}
)}\label{classSPL_1_1MEncoder_a02f0d588eabf2d7bb6873c23f6c774d9}


Start the arithmetic code word. 

\hypertarget{classSPL_1_1MEncoder_a42c8bad8771c16893ddce20b64fb34fa}{}\index{S\+P\+L\+::\+M\+Encoder@{S\+P\+L\+::\+M\+Encoder}!terminate@{terminate}}
\index{terminate@{terminate}!S\+P\+L\+::\+M\+Encoder@{S\+P\+L\+::\+M\+Encoder}}
\subsubsection[{terminate}]{\setlength{\rightskip}{0pt plus 5cm}int S\+P\+L\+::\+M\+Encoder\+::terminate (
\begin{DoxyParamCaption}
{}
\end{DoxyParamCaption}
)}\label{classSPL_1_1MEncoder_a42c8bad8771c16893ddce20b64fb34fa}


Terminate the arithmetic code word. 



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