\hypertarget{classCEncoder_1_1CMacroBlock}{}\section{C\+Encoder\+::C\+Macro\+Block Class Reference}
\label{classCEncoder_1_1CMacroBlock}\index{CEncoder::CMacroBlock@{CEncoder::CMacroBlock}}


A macro block is an encoding unit of fixed size (uncoded)  


\subsection*{Public Member Functions}
\begin{DoxyCompactItemize}
\item 
\mbox{\hyperlink{classCEncoder_1_1CMacroBlock_a70f3cc1cb204a4bcce871bf6b5b134f6}{C\+Macro\+Block}} (\mbox{\hyperlink{classCEncoder}{C\+Encoder}} $\ast$encoder)
\item 
void \mbox{\hyperlink{classCEncoder_1_1CMacroBlock_af3ecc039cc0e3000b394c15265107b38}{Init}} (int last\+Level\+Index)
\item 
void \mbox{\hyperlink{classCEncoder_1_1CMacroBlock_af95842ac15879ab2b3a9b5232bb4f1a5}{Bitplane\+Encode}} ()
\end{DoxyCompactItemize}
\subsection*{Public Attributes}
\begin{DoxyCompactItemize}
\item 
\mbox{\hyperlink{PGFtypes_8h_acb1ee3f52ccfad782dcaa0abd79e5d05}{DataT}} \mbox{\hyperlink{classCEncoder_1_1CMacroBlock_a139b60f3f0d76b9158573e4d897423d6}{m\+\_\+value}} \mbox{[}\mbox{\hyperlink{PGFtypes_8h_aa362edf6db9662acf6ef958a6db19c35}{Buffer\+Size}}\mbox{]}
\begin{DoxyCompactList}\small\item\em input buffer of values with index m\+\_\+value\+Pos \end{DoxyCompactList}\item 
U\+I\+N\+T32 \mbox{\hyperlink{classCEncoder_1_1CMacroBlock_a527667f1e0529ff577dcbe7f0aa38d77}{m\+\_\+code\+Buffer}} \mbox{[}\mbox{\hyperlink{Encoder_8h_a05a74e73e6c734fcad194efbca053ed5}{Code\+Buffer\+Len}}\mbox{]}
\begin{DoxyCompactList}\small\item\em output buffer for encoded bitstream \end{DoxyCompactList}\item 
\mbox{\hyperlink{unionROIBlockHeader}{R\+O\+I\+Block\+Header}} \mbox{\hyperlink{classCEncoder_1_1CMacroBlock_aa5abc7cc9df3402a233367f0087168f8}{m\+\_\+header}}
\begin{DoxyCompactList}\small\item\em block header \end{DoxyCompactList}\item 
U\+I\+N\+T32 \mbox{\hyperlink{classCEncoder_1_1CMacroBlock_a7ab47e29ad9e3397869fdfb50b53e035}{m\+\_\+value\+Pos}}
\begin{DoxyCompactList}\small\item\em current buffer position \end{DoxyCompactList}\item 
U\+I\+N\+T32 \mbox{\hyperlink{classCEncoder_1_1CMacroBlock_a865f294ffa568a165224c2105bf1bb01}{m\+\_\+max\+Abs\+Value}}
\begin{DoxyCompactList}\small\item\em maximum absolute coefficient in each buffer \end{DoxyCompactList}\item 
U\+I\+N\+T32 \mbox{\hyperlink{classCEncoder_1_1CMacroBlock_a6e15685fcab5aa06f0f5ed17312774c7}{m\+\_\+code\+Pos}}
\begin{DoxyCompactList}\small\item\em current position in encoded bitstream \end{DoxyCompactList}\item 
int \mbox{\hyperlink{classCEncoder_1_1CMacroBlock_a68163a823248889d9d407f4b0331245d}{m\+\_\+last\+Level\+Index}}
\begin{DoxyCompactList}\small\item\em index of last encoded level\+: \mbox{[}0, n\+Levels); used because a level-\/end can occur before a buffer is full \end{DoxyCompactList}\end{DoxyCompactItemize}
\subsection*{Private Member Functions}
\begin{DoxyCompactItemize}
\item 
U\+I\+N\+T32 \mbox{\hyperlink{classCEncoder_1_1CMacroBlock_a50637f0c6ccc3d29b10063204a55253b}{R\+L\+E\+Signs}} (U\+I\+N\+T32 code\+Pos, U\+I\+N\+T32 $\ast$sign\+Bits, U\+I\+N\+T32 sign\+Len)
\item 
U\+I\+N\+T32 \mbox{\hyperlink{classCEncoder_1_1CMacroBlock_a171a6f1d0d6297823542acc3cb43338a}{Decompose\+Bitplane}} (U\+I\+N\+T32 buffer\+Size, U\+I\+N\+T32 plane\+Mask, U\+I\+N\+T32 code\+Pos, U\+I\+N\+T32 $\ast$sig\+Bits, U\+I\+N\+T32 $\ast$ref\+Bits, U\+I\+N\+T32 $\ast$sign\+Bits, U\+I\+N\+T32 \&sign\+Len, U\+I\+N\+T32 \&code\+Len)
\item 
U\+I\+N\+T8 \mbox{\hyperlink{classCEncoder_1_1CMacroBlock_a152834c140a4fcf478a2295eb247f4d4}{Number\+Of\+Bitplanes}} ()
\item 
bool \mbox{\hyperlink{classCEncoder_1_1CMacroBlock_a84aa40ee75fb9d993c0cec207b4092e3}{Get\+Bit\+At\+Pos}} (U\+I\+N\+T32 pos, U\+I\+N\+T32 plane\+Mask) const
\end{DoxyCompactItemize}
\subsection*{Private Attributes}
\begin{DoxyCompactItemize}
\item 
\mbox{\hyperlink{classCEncoder}{C\+Encoder}} $\ast$ \mbox{\hyperlink{classCEncoder_1_1CMacroBlock_adf5e8e4952216e6fdd189224618edd50}{m\+\_\+encoder}}
\item 
bool \mbox{\hyperlink{classCEncoder_1_1CMacroBlock_a7acaa42598512b958d5e16b8bcded13b}{m\+\_\+sig\+Flag\+Vector}} \mbox{[}\mbox{\hyperlink{PGFtypes_8h_aa362edf6db9662acf6ef958a6db19c35}{Buffer\+Size}}+1\mbox{]}
\end{DoxyCompactItemize}


\subsection{Detailed Description}
A macro block is an encoding unit of fixed size (uncoded) 

P\+GF encoder macro block class. \begin{DoxyAuthor}{Author}
C. Stamm, I. Bauersachs 
\end{DoxyAuthor}


Definition at line 51 of file Encoder.\+h.



\subsection{Constructor \& Destructor Documentation}
\mbox{\Hypertarget{classCEncoder_1_1CMacroBlock_a70f3cc1cb204a4bcce871bf6b5b134f6}\label{classCEncoder_1_1CMacroBlock_a70f3cc1cb204a4bcce871bf6b5b134f6}} 
\index{CEncoder::CMacroBlock@{CEncoder::CMacroBlock}!CMacroBlock@{CMacroBlock}}
\index{CMacroBlock@{CMacroBlock}!CEncoder::CMacroBlock@{CEncoder::CMacroBlock}}
\subsubsection{\texorpdfstring{CMacroBlock()}{CMacroBlock()}}
{\footnotesize\ttfamily C\+Encoder\+::\+C\+Macro\+Block\+::\+C\+Macro\+Block (\begin{DoxyParamCaption}\item[{\mbox{\hyperlink{classCEncoder}{C\+Encoder}} $\ast$}]{encoder }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [inline]}}

Constructor\+: Initializes new macro block. 
\begin{DoxyParams}{Parameters}
{\em encoder} & Pointer to outer class. \\
\hline
\end{DoxyParams}


Definition at line 56 of file Encoder.\+h.


\begin{DoxyCode}{0}
\DoxyCodeLine{57                           : 4351 )}
\DoxyCodeLine{58                 : \mbox{\hyperlink{classCEncoder_1_1CMacroBlock_a139b60f3f0d76b9158573e4d897423d6}{m\_value}}()}
\DoxyCodeLine{59                 , \mbox{\hyperlink{classCEncoder_1_1CMacroBlock_a527667f1e0529ff577dcbe7f0aa38d77}{m\_codeBuffer}}()}
\DoxyCodeLine{60                 , \mbox{\hyperlink{classCEncoder_1_1CMacroBlock_aa5abc7cc9df3402a233367f0087168f8}{m\_header}}(0)}
\DoxyCodeLine{61                 , \mbox{\hyperlink{classCEncoder_1_1CMacroBlock_adf5e8e4952216e6fdd189224618edd50}{m\_encoder}}(encoder)}
\DoxyCodeLine{62                 , \mbox{\hyperlink{classCEncoder_1_1CMacroBlock_a7acaa42598512b958d5e16b8bcded13b}{m\_sigFlagVector}}()}
\DoxyCodeLine{63                 \{}
\DoxyCodeLine{64                         ASSERT(\mbox{\hyperlink{classCEncoder_1_1CMacroBlock_adf5e8e4952216e6fdd189224618edd50}{m\_encoder}});}
\DoxyCodeLine{65                         \mbox{\hyperlink{classCEncoder_1_1CMacroBlock_af3ecc039cc0e3000b394c15265107b38}{Init}}(-1);}
\DoxyCodeLine{66                 \}}

\end{DoxyCode}


\subsection{Member Function Documentation}
\mbox{\Hypertarget{classCEncoder_1_1CMacroBlock_af95842ac15879ab2b3a9b5232bb4f1a5}\label{classCEncoder_1_1CMacroBlock_af95842ac15879ab2b3a9b5232bb4f1a5}} 
\index{CEncoder::CMacroBlock@{CEncoder::CMacroBlock}!BitplaneEncode@{BitplaneEncode}}
\index{BitplaneEncode@{BitplaneEncode}!CEncoder::CMacroBlock@{CEncoder::CMacroBlock}}
\subsubsection{\texorpdfstring{BitplaneEncode()}{BitplaneEncode()}}
{\footnotesize\ttfamily void C\+Encoder\+::\+C\+Macro\+Block\+::\+Bitplane\+Encode (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption})}

Encodes this macro block into internal code buffer. Several macro blocks can be encoded in parallel. Call \mbox{\hyperlink{classCEncoder_ab64923561baadef47bea653e9a52238e}{C\+Encoder\+::\+Write\+Macro\+Block}} after this method. 

Definition at line 482 of file Encoder.\+cpp.


\begin{DoxyCode}{0}
\DoxyCodeLine{482                                          \{}
\DoxyCodeLine{483         UINT8   nPlanes;}
\DoxyCodeLine{484         UINT32  sigLen, codeLen = 0, wordPos, refLen, signLen;}
\DoxyCodeLine{485         UINT32  sigBits[\mbox{\hyperlink{Decoder_8h_a309eafbca7ed5953ef9102861479f4ed}{BufferLen}}] = \{ 0 \}; }
\DoxyCodeLine{486         UINT32  refBits[\mbox{\hyperlink{Decoder_8h_a309eafbca7ed5953ef9102861479f4ed}{BufferLen}}] = \{ 0 \}; }
\DoxyCodeLine{487         UINT32  signBits[\mbox{\hyperlink{Decoder_8h_a309eafbca7ed5953ef9102861479f4ed}{BufferLen}}] = \{ 0 \}; }
\DoxyCodeLine{488         UINT32  planeMask;}
\DoxyCodeLine{489         UINT32  bufferSize = \mbox{\hyperlink{classCEncoder_1_1CMacroBlock_aa5abc7cc9df3402a233367f0087168f8}{m\_header}}.\mbox{\hyperlink{unionROIBlockHeader_a15ceb2e488c3767cc1ab774323c02ded}{rbh}}.\mbox{\hyperlink{structROIBlockHeader_1_1RBH_af0c3de8c247b06116a9d84d2f9515762}{bufferSize}}; ASSERT(bufferSize <= \mbox{\hyperlink{PGFtypes_8h_aa362edf6db9662acf6ef958a6db19c35}{BufferSize}});}
\DoxyCodeLine{490         \textcolor{keywordtype}{bool}    useRL;}
\DoxyCodeLine{491 }
\DoxyCodeLine{492 \textcolor{preprocessor}{\#ifdef TRACE}}
\DoxyCodeLine{493         \textcolor{comment}{//printf("which thread: \%d\(\backslash\)n", omp\_get\_thread\_num());}}
\DoxyCodeLine{494 \textcolor{preprocessor}{\#endif }}
\DoxyCodeLine{495 }
\DoxyCodeLine{496         \textcolor{comment}{// clear significance vector}}
\DoxyCodeLine{497         \textcolor{keywordflow}{for} (UINT32 k=0; k < bufferSize; k++) \{}
\DoxyCodeLine{498                 \mbox{\hyperlink{classCEncoder_1_1CMacroBlock_a7acaa42598512b958d5e16b8bcded13b}{m\_sigFlagVector}}[k] = \textcolor{keyword}{false};}
\DoxyCodeLine{499         \}}
\DoxyCodeLine{500         \mbox{\hyperlink{classCEncoder_1_1CMacroBlock_a7acaa42598512b958d5e16b8bcded13b}{m\_sigFlagVector}}[bufferSize] = \textcolor{keyword}{true}; \textcolor{comment}{// sentinel}}
\DoxyCodeLine{501 }
\DoxyCodeLine{502         \textcolor{comment}{// clear output buffer}}
\DoxyCodeLine{503         \textcolor{keywordflow}{for} (UINT32 k=0; k < bufferSize; k++) \{}
\DoxyCodeLine{504                 \mbox{\hyperlink{classCEncoder_1_1CMacroBlock_a527667f1e0529ff577dcbe7f0aa38d77}{m\_codeBuffer}}[k] = 0;}
\DoxyCodeLine{505         \}}
\DoxyCodeLine{506         \mbox{\hyperlink{classCEncoder_1_1CMacroBlock_a6e15685fcab5aa06f0f5ed17312774c7}{m\_codePos}} = 0;}
\DoxyCodeLine{507 }
\DoxyCodeLine{508         \textcolor{comment}{// compute number of bit planes and split buffer into separate bit planes}}
\DoxyCodeLine{509         nPlanes = \mbox{\hyperlink{classCEncoder_1_1CMacroBlock_a152834c140a4fcf478a2295eb247f4d4}{NumberOfBitplanes}}();}
\DoxyCodeLine{510 }
\DoxyCodeLine{511         \textcolor{comment}{// write number of bit planes to m\_codeBuffer}}
\DoxyCodeLine{512         \textcolor{comment}{// <nPlanes>}}
\DoxyCodeLine{513         \mbox{\hyperlink{BitStream_8h_a0e3b853e6738b0af470d485c46a8be5e}{SetValueBlock}}(\mbox{\hyperlink{classCEncoder_1_1CMacroBlock_a527667f1e0529ff577dcbe7f0aa38d77}{m\_codeBuffer}}, 0, nPlanes, \mbox{\hyperlink{PGFtypes_8h_a0acbc7f581c1eceef6a70713308987d5}{MaxBitPlanesLog}});}
\DoxyCodeLine{514         \mbox{\hyperlink{classCEncoder_1_1CMacroBlock_a6e15685fcab5aa06f0f5ed17312774c7}{m\_codePos}} += \mbox{\hyperlink{PGFtypes_8h_a0acbc7f581c1eceef6a70713308987d5}{MaxBitPlanesLog}};}
\DoxyCodeLine{515 }
\DoxyCodeLine{516         \textcolor{comment}{// loop through all bit planes}}
\DoxyCodeLine{517         \textcolor{keywordflow}{if} (nPlanes == 0) nPlanes = \mbox{\hyperlink{PGFtypes_8h_ae0625b6a0d1a8187599a680c6b559860}{MaxBitPlanes}} + 1;}
\DoxyCodeLine{518         planeMask = 1 << (nPlanes - 1);}
\DoxyCodeLine{519 }
\DoxyCodeLine{520         \textcolor{keywordflow}{for} (\textcolor{keywordtype}{int} plane = nPlanes - 1; plane >= 0; plane--) \{}
\DoxyCodeLine{521                 \textcolor{comment}{// clear significant bitset}}
\DoxyCodeLine{522                 \textcolor{keywordflow}{for} (UINT32 k=0; k < \mbox{\hyperlink{Decoder_8h_a309eafbca7ed5953ef9102861479f4ed}{BufferLen}}; k++) \{}
\DoxyCodeLine{523                         sigBits[k] = 0;}
\DoxyCodeLine{524                 \}}
\DoxyCodeLine{525 }
\DoxyCodeLine{526                 \textcolor{comment}{// split bitplane in significant bitset and refinement bitset}}
\DoxyCodeLine{527                 sigLen = \mbox{\hyperlink{classCEncoder_1_1CMacroBlock_a171a6f1d0d6297823542acc3cb43338a}{DecomposeBitplane}}(bufferSize, planeMask, \mbox{\hyperlink{classCEncoder_1_1CMacroBlock_a6e15685fcab5aa06f0f5ed17312774c7}{m\_codePos}} + \mbox{\hyperlink{PGFtypes_8h_ac0d66809e03f0e5939ed8de744700079}{RLblockSizeLen}} + 1, sigBits, refBits, signBits, signLen, codeLen);}
\DoxyCodeLine{528 }
\DoxyCodeLine{529                 \textcolor{keywordflow}{if} (sigLen > 0 \&\& codeLen <= \mbox{\hyperlink{Encoder_8cpp_add8bd7fd3fbb318e2f76b4ae33cf6020}{MaxCodeLen}} \&\& codeLen < \mbox{\hyperlink{BitStream_8h_a02bb2289d37f806f66c6ba6fd51977a4}{AlignWordPos}}(sigLen) + \mbox{\hyperlink{BitStream_8h_a02bb2289d37f806f66c6ba6fd51977a4}{AlignWordPos}}(signLen) + 2*\mbox{\hyperlink{PGFtypes_8h_ac0d66809e03f0e5939ed8de744700079}{RLblockSizeLen}}) \{}
\DoxyCodeLine{530                         \textcolor{comment}{// set RL code bit}}
\DoxyCodeLine{531                         \textcolor{comment}{// <1><codeLen>}}
\DoxyCodeLine{532                         \mbox{\hyperlink{BitStream_8h_a0cfbc258d5f10464b6046e700e2311a1}{SetBit}}(\mbox{\hyperlink{classCEncoder_1_1CMacroBlock_a527667f1e0529ff577dcbe7f0aa38d77}{m\_codeBuffer}}, \mbox{\hyperlink{classCEncoder_1_1CMacroBlock_a6e15685fcab5aa06f0f5ed17312774c7}{m\_codePos}}++);}
\DoxyCodeLine{533 }
\DoxyCodeLine{534                         \textcolor{comment}{// write length codeLen to m\_codeBuffer}}
\DoxyCodeLine{535                         \mbox{\hyperlink{BitStream_8h_a0e3b853e6738b0af470d485c46a8be5e}{SetValueBlock}}(\mbox{\hyperlink{classCEncoder_1_1CMacroBlock_a527667f1e0529ff577dcbe7f0aa38d77}{m\_codeBuffer}}, \mbox{\hyperlink{classCEncoder_1_1CMacroBlock_a6e15685fcab5aa06f0f5ed17312774c7}{m\_codePos}}, codeLen, \mbox{\hyperlink{PGFtypes_8h_ac0d66809e03f0e5939ed8de744700079}{RLblockSizeLen}});}
\DoxyCodeLine{536                         \mbox{\hyperlink{classCEncoder_1_1CMacroBlock_a6e15685fcab5aa06f0f5ed17312774c7}{m\_codePos}} += \mbox{\hyperlink{PGFtypes_8h_ac0d66809e03f0e5939ed8de744700079}{RLblockSizeLen}} + codeLen;}
\DoxyCodeLine{537                 \} \textcolor{keywordflow}{else} \{}
\DoxyCodeLine{538 \textcolor{preprocessor}{                \#ifdef TRACE}}
\DoxyCodeLine{539                         \textcolor{comment}{//printf("new\(\backslash\)n");}}
\DoxyCodeLine{540                         \textcolor{comment}{//for (UINT32 i=0; i < bufferSize; i++) \{}}
\DoxyCodeLine{541                         \textcolor{comment}{//      printf("\%s", (GetBit(sigBits, i)) ? "1" : "\_");}}
\DoxyCodeLine{542                         \textcolor{comment}{//      if (i\%120 == 119) printf("\(\backslash\)n");}}
\DoxyCodeLine{543                         \textcolor{comment}{//\}}}
\DoxyCodeLine{544                         \textcolor{comment}{//printf("\(\backslash\)n");}}
\DoxyCodeLine{545 \textcolor{preprocessor}{                \#endif // TRACE}}
\DoxyCodeLine{546 }
\DoxyCodeLine{547                         \textcolor{comment}{// run-length coding wasn't efficient enough}}
\DoxyCodeLine{548                         \textcolor{comment}{// we don't use RL coding for sigBits}}
\DoxyCodeLine{549                         \textcolor{comment}{// <0><sigLen>}}
\DoxyCodeLine{550                         \mbox{\hyperlink{BitStream_8h_a3f00211230dd7a9469f3b9062567d4f7}{ClearBit}}(\mbox{\hyperlink{classCEncoder_1_1CMacroBlock_a527667f1e0529ff577dcbe7f0aa38d77}{m\_codeBuffer}}, \mbox{\hyperlink{classCEncoder_1_1CMacroBlock_a6e15685fcab5aa06f0f5ed17312774c7}{m\_codePos}}++);}
\DoxyCodeLine{551 }
\DoxyCodeLine{552                         \textcolor{comment}{// write length sigLen to m\_codeBuffer}}
\DoxyCodeLine{553                         ASSERT(sigLen <= \mbox{\hyperlink{Encoder_8cpp_add8bd7fd3fbb318e2f76b4ae33cf6020}{MaxCodeLen}}); }
\DoxyCodeLine{554                         \mbox{\hyperlink{BitStream_8h_a0e3b853e6738b0af470d485c46a8be5e}{SetValueBlock}}(\mbox{\hyperlink{classCEncoder_1_1CMacroBlock_a527667f1e0529ff577dcbe7f0aa38d77}{m\_codeBuffer}}, \mbox{\hyperlink{classCEncoder_1_1CMacroBlock_a6e15685fcab5aa06f0f5ed17312774c7}{m\_codePos}}, sigLen, \mbox{\hyperlink{PGFtypes_8h_ac0d66809e03f0e5939ed8de744700079}{RLblockSizeLen}});}
\DoxyCodeLine{555                         \mbox{\hyperlink{classCEncoder_1_1CMacroBlock_a6e15685fcab5aa06f0f5ed17312774c7}{m\_codePos}} += \mbox{\hyperlink{PGFtypes_8h_ac0d66809e03f0e5939ed8de744700079}{RLblockSizeLen}};}
\DoxyCodeLine{556 }
\DoxyCodeLine{557                         \textcolor{keywordflow}{if} (\mbox{\hyperlink{classCEncoder_1_1CMacroBlock_adf5e8e4952216e6fdd189224618edd50}{m\_encoder}}->\mbox{\hyperlink{classCEncoder_a1d51c113f3f7f4f2c94bd7a8c05c12ee}{m\_favorSpeed}} || signLen == 0) \{}
\DoxyCodeLine{558                                 useRL = \textcolor{keyword}{false};}
\DoxyCodeLine{559                         \} \textcolor{keywordflow}{else} \{}
\DoxyCodeLine{560                                 \textcolor{comment}{// overwrite m\_codeBuffer}}
\DoxyCodeLine{561                                 useRL = \textcolor{keyword}{true};}
\DoxyCodeLine{562                                 \textcolor{comment}{// run-length encode m\_sign and append them to the m\_codeBuffer}}
\DoxyCodeLine{563                                 codeLen = \mbox{\hyperlink{classCEncoder_1_1CMacroBlock_a50637f0c6ccc3d29b10063204a55253b}{RLESigns}}(\mbox{\hyperlink{classCEncoder_1_1CMacroBlock_a6e15685fcab5aa06f0f5ed17312774c7}{m\_codePos}} + \mbox{\hyperlink{PGFtypes_8h_ac0d66809e03f0e5939ed8de744700079}{RLblockSizeLen}} + 1, signBits, signLen);}
\DoxyCodeLine{564                         \}}
\DoxyCodeLine{565 }
\DoxyCodeLine{566                         \textcolor{keywordflow}{if} (useRL \&\& codeLen <= \mbox{\hyperlink{Encoder_8cpp_add8bd7fd3fbb318e2f76b4ae33cf6020}{MaxCodeLen}} \&\& codeLen < signLen) \{}
\DoxyCodeLine{567                                 \textcolor{comment}{// RL encoding of m\_sign was efficient}}
\DoxyCodeLine{568                                 \textcolor{comment}{// <1><codeLen><codedSignBits>\_}}
\DoxyCodeLine{569                                 \textcolor{comment}{// write RL code bit}}
\DoxyCodeLine{570                                 \mbox{\hyperlink{BitStream_8h_a0cfbc258d5f10464b6046e700e2311a1}{SetBit}}(\mbox{\hyperlink{classCEncoder_1_1CMacroBlock_a527667f1e0529ff577dcbe7f0aa38d77}{m\_codeBuffer}}, \mbox{\hyperlink{classCEncoder_1_1CMacroBlock_a6e15685fcab5aa06f0f5ed17312774c7}{m\_codePos}}++);}
\DoxyCodeLine{571                                 }
\DoxyCodeLine{572                                 \textcolor{comment}{// write codeLen to m\_codeBuffer}}
\DoxyCodeLine{573                                 \mbox{\hyperlink{BitStream_8h_a0e3b853e6738b0af470d485c46a8be5e}{SetValueBlock}}(\mbox{\hyperlink{classCEncoder_1_1CMacroBlock_a527667f1e0529ff577dcbe7f0aa38d77}{m\_codeBuffer}}, \mbox{\hyperlink{classCEncoder_1_1CMacroBlock_a6e15685fcab5aa06f0f5ed17312774c7}{m\_codePos}}, codeLen, \mbox{\hyperlink{PGFtypes_8h_ac0d66809e03f0e5939ed8de744700079}{RLblockSizeLen}});}
\DoxyCodeLine{574 }
\DoxyCodeLine{575                                 \textcolor{comment}{// compute position of sigBits}}
\DoxyCodeLine{576                                 wordPos = \mbox{\hyperlink{BitStream_8h_aec0f6865df9443d08000c0fe4d446031}{NumberOfWords}}(\mbox{\hyperlink{classCEncoder_1_1CMacroBlock_a6e15685fcab5aa06f0f5ed17312774c7}{m\_codePos}} + \mbox{\hyperlink{PGFtypes_8h_ac0d66809e03f0e5939ed8de744700079}{RLblockSizeLen}} + codeLen);}
\DoxyCodeLine{577                                 ASSERT(0 <= wordPos \&\& wordPos < \mbox{\hyperlink{Decoder_8h_a05a74e73e6c734fcad194efbca053ed5}{CodeBufferLen}});}
\DoxyCodeLine{578                         \} \textcolor{keywordflow}{else} \{}
\DoxyCodeLine{579                                 \textcolor{comment}{// RL encoding of signBits wasn't efficient}}
\DoxyCodeLine{580                                 \textcolor{comment}{// <0><signLen>\_<signBits>\_}}
\DoxyCodeLine{581                                 \textcolor{comment}{// clear RL code bit}}
\DoxyCodeLine{582                                 \mbox{\hyperlink{BitStream_8h_a3f00211230dd7a9469f3b9062567d4f7}{ClearBit}}(\mbox{\hyperlink{classCEncoder_1_1CMacroBlock_a527667f1e0529ff577dcbe7f0aa38d77}{m\_codeBuffer}}, \mbox{\hyperlink{classCEncoder_1_1CMacroBlock_a6e15685fcab5aa06f0f5ed17312774c7}{m\_codePos}}++);}
\DoxyCodeLine{583 }
\DoxyCodeLine{584                                 \textcolor{comment}{// write signLen to m\_codeBuffer}}
\DoxyCodeLine{585                                 ASSERT(signLen <= \mbox{\hyperlink{Encoder_8cpp_add8bd7fd3fbb318e2f76b4ae33cf6020}{MaxCodeLen}}); }
\DoxyCodeLine{586                                 \mbox{\hyperlink{BitStream_8h_a0e3b853e6738b0af470d485c46a8be5e}{SetValueBlock}}(\mbox{\hyperlink{classCEncoder_1_1CMacroBlock_a527667f1e0529ff577dcbe7f0aa38d77}{m\_codeBuffer}}, \mbox{\hyperlink{classCEncoder_1_1CMacroBlock_a6e15685fcab5aa06f0f5ed17312774c7}{m\_codePos}}, signLen, \mbox{\hyperlink{PGFtypes_8h_ac0d66809e03f0e5939ed8de744700079}{RLblockSizeLen}});}
\DoxyCodeLine{587 }
\DoxyCodeLine{588                                 \textcolor{comment}{// write signBits to m\_codeBuffer}}
\DoxyCodeLine{589                                 wordPos = \mbox{\hyperlink{BitStream_8h_aec0f6865df9443d08000c0fe4d446031}{NumberOfWords}}(\mbox{\hyperlink{classCEncoder_1_1CMacroBlock_a6e15685fcab5aa06f0f5ed17312774c7}{m\_codePos}} + \mbox{\hyperlink{PGFtypes_8h_ac0d66809e03f0e5939ed8de744700079}{RLblockSizeLen}});}
\DoxyCodeLine{590                                 ASSERT(0 <= wordPos \&\& wordPos < \mbox{\hyperlink{Decoder_8h_a05a74e73e6c734fcad194efbca053ed5}{CodeBufferLen}});}
\DoxyCodeLine{591                                 codeLen = \mbox{\hyperlink{BitStream_8h_aec0f6865df9443d08000c0fe4d446031}{NumberOfWords}}(signLen);}
\DoxyCodeLine{592 }
\DoxyCodeLine{593                                 \textcolor{keywordflow}{for} (UINT32 k=0; k < codeLen; k++) \{}
\DoxyCodeLine{594                                         \mbox{\hyperlink{classCEncoder_1_1CMacroBlock_a527667f1e0529ff577dcbe7f0aa38d77}{m\_codeBuffer}}[wordPos++] = signBits[k];}
\DoxyCodeLine{595                                 \}}
\DoxyCodeLine{596                         \}}
\DoxyCodeLine{597 }
\DoxyCodeLine{598                         \textcolor{comment}{// write sigBits}}
\DoxyCodeLine{599                         \textcolor{comment}{// <sigBits>\_}}
\DoxyCodeLine{600                         ASSERT(0 <= wordPos \&\& wordPos < \mbox{\hyperlink{Decoder_8h_a05a74e73e6c734fcad194efbca053ed5}{CodeBufferLen}});}
\DoxyCodeLine{601                         refLen = \mbox{\hyperlink{BitStream_8h_aec0f6865df9443d08000c0fe4d446031}{NumberOfWords}}(sigLen);}
\DoxyCodeLine{602 }
\DoxyCodeLine{603                         \textcolor{keywordflow}{for} (UINT32 k=0; k < refLen; k++) \{}
\DoxyCodeLine{604                                 \mbox{\hyperlink{classCEncoder_1_1CMacroBlock_a527667f1e0529ff577dcbe7f0aa38d77}{m\_codeBuffer}}[wordPos++] = sigBits[k];}
\DoxyCodeLine{605                         \}}
\DoxyCodeLine{606                         \mbox{\hyperlink{classCEncoder_1_1CMacroBlock_a6e15685fcab5aa06f0f5ed17312774c7}{m\_codePos}} = wordPos << \mbox{\hyperlink{PGFplatform_8h_a5e75d7d14aaea5860c612758ef77b687}{WordWidthLog}};}
\DoxyCodeLine{607                 \}}
\DoxyCodeLine{608 }
\DoxyCodeLine{609                 \textcolor{comment}{// append refinement bitset (aligned to word boundary)}}
\DoxyCodeLine{610                 \textcolor{comment}{// \_<refBits>}}
\DoxyCodeLine{611                 wordPos = \mbox{\hyperlink{BitStream_8h_aec0f6865df9443d08000c0fe4d446031}{NumberOfWords}}(\mbox{\hyperlink{classCEncoder_1_1CMacroBlock_a6e15685fcab5aa06f0f5ed17312774c7}{m\_codePos}});}
\DoxyCodeLine{612                 ASSERT(0 <= wordPos \&\& wordPos < \mbox{\hyperlink{Decoder_8h_a05a74e73e6c734fcad194efbca053ed5}{CodeBufferLen}});}
\DoxyCodeLine{613                 refLen = \mbox{\hyperlink{BitStream_8h_aec0f6865df9443d08000c0fe4d446031}{NumberOfWords}}(bufferSize - sigLen);}
\DoxyCodeLine{614 }
\DoxyCodeLine{615                 \textcolor{keywordflow}{for} (UINT32 k=0; k < refLen; k++) \{}
\DoxyCodeLine{616                         \mbox{\hyperlink{classCEncoder_1_1CMacroBlock_a527667f1e0529ff577dcbe7f0aa38d77}{m\_codeBuffer}}[wordPos++] = refBits[k];}
\DoxyCodeLine{617                 \}}
\DoxyCodeLine{618                 \mbox{\hyperlink{classCEncoder_1_1CMacroBlock_a6e15685fcab5aa06f0f5ed17312774c7}{m\_codePos}} = wordPos << \mbox{\hyperlink{PGFplatform_8h_a5e75d7d14aaea5860c612758ef77b687}{WordWidthLog}};}
\DoxyCodeLine{619                 planeMask >>= 1;}
\DoxyCodeLine{620         \}}
\DoxyCodeLine{621         ASSERT(0 <= \mbox{\hyperlink{classCEncoder_1_1CMacroBlock_a6e15685fcab5aa06f0f5ed17312774c7}{m\_codePos}} \&\& \mbox{\hyperlink{classCEncoder_1_1CMacroBlock_a6e15685fcab5aa06f0f5ed17312774c7}{m\_codePos}} <= \mbox{\hyperlink{Encoder_8cpp_abc1529b42b4ec49f6674b24b5b0d0a45}{CodeBufferBitLen}});}
\DoxyCodeLine{622 \}}

\end{DoxyCode}
\mbox{\Hypertarget{classCEncoder_1_1CMacroBlock_a171a6f1d0d6297823542acc3cb43338a}\label{classCEncoder_1_1CMacroBlock_a171a6f1d0d6297823542acc3cb43338a}} 
\index{CEncoder::CMacroBlock@{CEncoder::CMacroBlock}!DecomposeBitplane@{DecomposeBitplane}}
\index{DecomposeBitplane@{DecomposeBitplane}!CEncoder::CMacroBlock@{CEncoder::CMacroBlock}}
\subsubsection{\texorpdfstring{DecomposeBitplane()}{DecomposeBitplane()}}
{\footnotesize\ttfamily U\+I\+N\+T32 C\+Encoder\+::\+C\+Macro\+Block\+::\+Decompose\+Bitplane (\begin{DoxyParamCaption}\item[{U\+I\+N\+T32}]{buffer\+Size,  }\item[{U\+I\+N\+T32}]{plane\+Mask,  }\item[{U\+I\+N\+T32}]{code\+Pos,  }\item[{U\+I\+N\+T32 $\ast$}]{sig\+Bits,  }\item[{U\+I\+N\+T32 $\ast$}]{ref\+Bits,  }\item[{U\+I\+N\+T32 $\ast$}]{sign\+Bits,  }\item[{U\+I\+N\+T32 \&}]{sign\+Len,  }\item[{U\+I\+N\+T32 \&}]{code\+Len }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [private]}}



Definition at line 634 of file Encoder.\+cpp.


\begin{DoxyCode}{0}
\DoxyCodeLine{634                                                                                                                                                                                        \{}
\DoxyCodeLine{635         ASSERT(sigBits);}
\DoxyCodeLine{636         ASSERT(refBits);}
\DoxyCodeLine{637         ASSERT(signBits);}
\DoxyCodeLine{638         ASSERT(codePos < \mbox{\hyperlink{Encoder_8cpp_abc1529b42b4ec49f6674b24b5b0d0a45}{CodeBufferBitLen}});}
\DoxyCodeLine{639 }
\DoxyCodeLine{640         UINT32 sigPos = 0;}
\DoxyCodeLine{641         UINT32 valuePos = 0, valueEnd;}
\DoxyCodeLine{642         UINT32 refPos = 0;}
\DoxyCodeLine{643 }
\DoxyCodeLine{644         \textcolor{comment}{// set output value}}
\DoxyCodeLine{645         signLen = 0;}
\DoxyCodeLine{646 }
\DoxyCodeLine{647         \textcolor{comment}{// prepare RLE of Sigs and Signs}}
\DoxyCodeLine{648         \textcolor{keyword}{const} UINT32 outStartPos = codePos;}
\DoxyCodeLine{649         UINT32 k = 3;}
\DoxyCodeLine{650         UINT32 runlen = 1 << k; \textcolor{comment}{// = 2\string^k}}
\DoxyCodeLine{651         UINT32 count = 0;}
\DoxyCodeLine{652 }
\DoxyCodeLine{653         \textcolor{keywordflow}{while} (valuePos < bufferSize) \{}
\DoxyCodeLine{654                 \textcolor{comment}{// search next 1 in m\_sigFlagVector using searching with sentinel}}
\DoxyCodeLine{655                 valueEnd = valuePos;}
\DoxyCodeLine{656                 \textcolor{keywordflow}{while}(!\mbox{\hyperlink{classCEncoder_1_1CMacroBlock_a7acaa42598512b958d5e16b8bcded13b}{m\_sigFlagVector}}[valueEnd]) \{ valueEnd++; \}}
\DoxyCodeLine{657 }
\DoxyCodeLine{658                 \textcolor{comment}{// search 1's in m\_value[plane][valuePos..valueEnd)}}
\DoxyCodeLine{659                 \textcolor{comment}{// these 1's are significant bits}}
\DoxyCodeLine{660                 \textcolor{keywordflow}{while} (valuePos < valueEnd) \{}
\DoxyCodeLine{661                         \textcolor{keywordflow}{if} (\mbox{\hyperlink{classCEncoder_1_1CMacroBlock_a84aa40ee75fb9d993c0cec207b4092e3}{GetBitAtPos}}(valuePos, planeMask)) \{}
\DoxyCodeLine{662                                 \textcolor{comment}{// RLE encoding}}
\DoxyCodeLine{663                                 \textcolor{comment}{// encode run of count 0's followed by a 1}}
\DoxyCodeLine{664                                 \textcolor{comment}{// with codeword: 1<count>(signBits[signPos])}}
\DoxyCodeLine{665                                 \mbox{\hyperlink{BitStream_8h_a0cfbc258d5f10464b6046e700e2311a1}{SetBit}}(\mbox{\hyperlink{classCEncoder_1_1CMacroBlock_a527667f1e0529ff577dcbe7f0aa38d77}{m\_codeBuffer}}, codePos++); }
\DoxyCodeLine{666                                 \textcolor{keywordflow}{if} (k > 0) \{}
\DoxyCodeLine{667                                         \mbox{\hyperlink{BitStream_8h_a0e3b853e6738b0af470d485c46a8be5e}{SetValueBlock}}(\mbox{\hyperlink{classCEncoder_1_1CMacroBlock_a527667f1e0529ff577dcbe7f0aa38d77}{m\_codeBuffer}}, codePos, count, k);}
\DoxyCodeLine{668                                         codePos += k;}
\DoxyCodeLine{669 }
\DoxyCodeLine{670                                         \textcolor{comment}{// adapt k (half the zero run-length)}}
\DoxyCodeLine{671                                         k--; }
\DoxyCodeLine{672                                         runlen >>= 1;}
\DoxyCodeLine{673                                 \}}
\DoxyCodeLine{674 }
\DoxyCodeLine{675                                 \textcolor{comment}{// copy and write sign bit}}
\DoxyCodeLine{676                                 \textcolor{keywordflow}{if} (\mbox{\hyperlink{classCEncoder_1_1CMacroBlock_a139b60f3f0d76b9158573e4d897423d6}{m\_value}}[valuePos] < 0) \{}
\DoxyCodeLine{677                                         \mbox{\hyperlink{BitStream_8h_a0cfbc258d5f10464b6046e700e2311a1}{SetBit}}(signBits, signLen++);}
\DoxyCodeLine{678                                         \mbox{\hyperlink{BitStream_8h_a0cfbc258d5f10464b6046e700e2311a1}{SetBit}}(\mbox{\hyperlink{classCEncoder_1_1CMacroBlock_a527667f1e0529ff577dcbe7f0aa38d77}{m\_codeBuffer}}, codePos++);}
\DoxyCodeLine{679                                 \} \textcolor{keywordflow}{else} \{}
\DoxyCodeLine{680                                         \mbox{\hyperlink{BitStream_8h_a3f00211230dd7a9469f3b9062567d4f7}{ClearBit}}(signBits, signLen++);}
\DoxyCodeLine{681                                         \mbox{\hyperlink{BitStream_8h_a3f00211230dd7a9469f3b9062567d4f7}{ClearBit}}(\mbox{\hyperlink{classCEncoder_1_1CMacroBlock_a527667f1e0529ff577dcbe7f0aa38d77}{m\_codeBuffer}}, codePos++);}
\DoxyCodeLine{682                                 \}}
\DoxyCodeLine{683 }
\DoxyCodeLine{684                                 \textcolor{comment}{// write a 1 to sigBits}}
\DoxyCodeLine{685                                 \mbox{\hyperlink{BitStream_8h_a0cfbc258d5f10464b6046e700e2311a1}{SetBit}}(sigBits, sigPos++); }
\DoxyCodeLine{686 }
\DoxyCodeLine{687                                 \textcolor{comment}{// update m\_sigFlagVector}}
\DoxyCodeLine{688                                 \mbox{\hyperlink{classCEncoder_1_1CMacroBlock_a7acaa42598512b958d5e16b8bcded13b}{m\_sigFlagVector}}[valuePos] = \textcolor{keyword}{true};}
\DoxyCodeLine{689 }
\DoxyCodeLine{690                                 \textcolor{comment}{// prepare for next run}}
\DoxyCodeLine{691                                 count = 0;}
\DoxyCodeLine{692                         \} \textcolor{keywordflow}{else} \{}
\DoxyCodeLine{693                                 \textcolor{comment}{// RLE encoding}}
\DoxyCodeLine{694                                 count++;}
\DoxyCodeLine{695                                 \textcolor{keywordflow}{if} (count == runlen) \{}
\DoxyCodeLine{696                                         \textcolor{comment}{// encode run of 2\string^k zeros by a single 0}}
\DoxyCodeLine{697                                         \mbox{\hyperlink{BitStream_8h_a3f00211230dd7a9469f3b9062567d4f7}{ClearBit}}(\mbox{\hyperlink{classCEncoder_1_1CMacroBlock_a527667f1e0529ff577dcbe7f0aa38d77}{m\_codeBuffer}}, codePos++);}
\DoxyCodeLine{698                                         \textcolor{comment}{// adapt k (double the zero run-length)}}
\DoxyCodeLine{699                                         \textcolor{keywordflow}{if} (k < \mbox{\hyperlink{PGFplatform_8h_abeb69f096b599bae58cbc58ba48250a5}{WordWidth}}) \{}
\DoxyCodeLine{700                                                 k++;}
\DoxyCodeLine{701                                                 runlen <<= 1;}
\DoxyCodeLine{702                                         \}}
\DoxyCodeLine{703 }
\DoxyCodeLine{704                                         \textcolor{comment}{// prepare for next run}}
\DoxyCodeLine{705                                         count = 0;}
\DoxyCodeLine{706                                 \}}
\DoxyCodeLine{707 }
\DoxyCodeLine{708                                 \textcolor{comment}{// write 0 to sigBits}}
\DoxyCodeLine{709                                 sigPos++;}
\DoxyCodeLine{710                         \}}
\DoxyCodeLine{711                         valuePos++;}
\DoxyCodeLine{712                 \}}
\DoxyCodeLine{713                 \textcolor{comment}{// refinement bit}}
\DoxyCodeLine{714                 \textcolor{keywordflow}{if} (valuePos < bufferSize) \{}
\DoxyCodeLine{715                         \textcolor{comment}{// write one refinement bit}}
\DoxyCodeLine{716                         \textcolor{keywordflow}{if} (\mbox{\hyperlink{classCEncoder_1_1CMacroBlock_a84aa40ee75fb9d993c0cec207b4092e3}{GetBitAtPos}}(valuePos++, planeMask)) \{}
\DoxyCodeLine{717                                 \mbox{\hyperlink{BitStream_8h_a0cfbc258d5f10464b6046e700e2311a1}{SetBit}}(refBits, refPos);}
\DoxyCodeLine{718                         \} \textcolor{keywordflow}{else} \{}
\DoxyCodeLine{719                                 \mbox{\hyperlink{BitStream_8h_a3f00211230dd7a9469f3b9062567d4f7}{ClearBit}}(refBits, refPos);}
\DoxyCodeLine{720                         \}}
\DoxyCodeLine{721                         refPos++;}
\DoxyCodeLine{722                 \}}
\DoxyCodeLine{723         \}}
\DoxyCodeLine{724         \textcolor{comment}{// RLE encoding of the rest of the plane}}
\DoxyCodeLine{725         \textcolor{comment}{// encode run of count 0's followed by a 1}}
\DoxyCodeLine{726         \textcolor{comment}{// with codeword: 1<count>(signBits[signPos])}}
\DoxyCodeLine{727         \mbox{\hyperlink{BitStream_8h_a0cfbc258d5f10464b6046e700e2311a1}{SetBit}}(\mbox{\hyperlink{classCEncoder_1_1CMacroBlock_a527667f1e0529ff577dcbe7f0aa38d77}{m\_codeBuffer}}, codePos++); }
\DoxyCodeLine{728         \textcolor{keywordflow}{if} (k > 0) \{}
\DoxyCodeLine{729                 \mbox{\hyperlink{BitStream_8h_a0e3b853e6738b0af470d485c46a8be5e}{SetValueBlock}}(\mbox{\hyperlink{classCEncoder_1_1CMacroBlock_a527667f1e0529ff577dcbe7f0aa38d77}{m\_codeBuffer}}, codePos, count, k);}
\DoxyCodeLine{730                 codePos += k;}
\DoxyCodeLine{731         \}}
\DoxyCodeLine{732         \textcolor{comment}{// write dmmy sign bit}}
\DoxyCodeLine{733         \mbox{\hyperlink{BitStream_8h_a0cfbc258d5f10464b6046e700e2311a1}{SetBit}}(\mbox{\hyperlink{classCEncoder_1_1CMacroBlock_a527667f1e0529ff577dcbe7f0aa38d77}{m\_codeBuffer}}, codePos++);}
\DoxyCodeLine{734 }
\DoxyCodeLine{735         \textcolor{comment}{// write word filler zeros}}
\DoxyCodeLine{736 }
\DoxyCodeLine{737         ASSERT(sigPos <= bufferSize);}
\DoxyCodeLine{738         ASSERT(refPos <= bufferSize);}
\DoxyCodeLine{739         ASSERT(signLen <= bufferSize);}
\DoxyCodeLine{740         ASSERT(valuePos == bufferSize);}
\DoxyCodeLine{741         ASSERT(codePos >= outStartPos \&\& codePos < \mbox{\hyperlink{Encoder_8cpp_abc1529b42b4ec49f6674b24b5b0d0a45}{CodeBufferBitLen}});}
\DoxyCodeLine{742         codeLen = codePos - outStartPos;}
\DoxyCodeLine{743 }
\DoxyCodeLine{744         \textcolor{keywordflow}{return} sigPos;}
\DoxyCodeLine{745 \}}

\end{DoxyCode}
\mbox{\Hypertarget{classCEncoder_1_1CMacroBlock_a84aa40ee75fb9d993c0cec207b4092e3}\label{classCEncoder_1_1CMacroBlock_a84aa40ee75fb9d993c0cec207b4092e3}} 
\index{CEncoder::CMacroBlock@{CEncoder::CMacroBlock}!GetBitAtPos@{GetBitAtPos}}
\index{GetBitAtPos@{GetBitAtPos}!CEncoder::CMacroBlock@{CEncoder::CMacroBlock}}
\subsubsection{\texorpdfstring{GetBitAtPos()}{GetBitAtPos()}}
{\footnotesize\ttfamily bool C\+Encoder\+::\+C\+Macro\+Block\+::\+Get\+Bit\+At\+Pos (\begin{DoxyParamCaption}\item[{U\+I\+N\+T32}]{pos,  }\item[{U\+I\+N\+T32}]{plane\+Mask }\end{DoxyParamCaption}) const\hspace{0.3cm}{\ttfamily [inline]}, {\ttfamily [private]}}



Definition at line 96 of file Encoder.\+h.


\begin{DoxyCode}{0}
\DoxyCodeLine{96 \{ \textcolor{keywordflow}{return} (abs(\mbox{\hyperlink{classCEncoder_1_1CMacroBlock_a139b60f3f0d76b9158573e4d897423d6}{m\_value}}[pos]) \& planeMask) > 0; \}  }

\end{DoxyCode}
\mbox{\Hypertarget{classCEncoder_1_1CMacroBlock_af3ecc039cc0e3000b394c15265107b38}\label{classCEncoder_1_1CMacroBlock_af3ecc039cc0e3000b394c15265107b38}} 
\index{CEncoder::CMacroBlock@{CEncoder::CMacroBlock}!Init@{Init}}
\index{Init@{Init}!CEncoder::CMacroBlock@{CEncoder::CMacroBlock}}
\subsubsection{\texorpdfstring{Init()}{Init()}}
{\footnotesize\ttfamily void C\+Encoder\+::\+C\+Macro\+Block\+::\+Init (\begin{DoxyParamCaption}\item[{int}]{last\+Level\+Index }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [inline]}}

Reinitialzes this macro block (allows reusage). 
\begin{DoxyParams}{Parameters}
{\em last\+Level\+Index} & Level length directory index of last encoded level\+: \mbox{[}0, n\+Levels) \\
\hline
\end{DoxyParams}


Definition at line 71 of file Encoder.\+h.


\begin{DoxyCode}{0}
\DoxyCodeLine{71                                               \{                         \textcolor{comment}{// initialize for reusage}}
\DoxyCodeLine{72                         \mbox{\hyperlink{classCEncoder_1_1CMacroBlock_a7ab47e29ad9e3397869fdfb50b53e035}{m\_valuePos}} = 0;}
\DoxyCodeLine{73                         \mbox{\hyperlink{classCEncoder_1_1CMacroBlock_a865f294ffa568a165224c2105bf1bb01}{m\_maxAbsValue}} = 0;}
\DoxyCodeLine{74                         \mbox{\hyperlink{classCEncoder_1_1CMacroBlock_a6e15685fcab5aa06f0f5ed17312774c7}{m\_codePos}} = 0;}
\DoxyCodeLine{75                         \mbox{\hyperlink{classCEncoder_1_1CMacroBlock_a68163a823248889d9d407f4b0331245d}{m\_lastLevelIndex}} = lastLevelIndex;}
\DoxyCodeLine{76                 \}}

\end{DoxyCode}
\mbox{\Hypertarget{classCEncoder_1_1CMacroBlock_a152834c140a4fcf478a2295eb247f4d4}\label{classCEncoder_1_1CMacroBlock_a152834c140a4fcf478a2295eb247f4d4}} 
\index{CEncoder::CMacroBlock@{CEncoder::CMacroBlock}!NumberOfBitplanes@{NumberOfBitplanes}}
\index{NumberOfBitplanes@{NumberOfBitplanes}!CEncoder::CMacroBlock@{CEncoder::CMacroBlock}}
\subsubsection{\texorpdfstring{NumberOfBitplanes()}{NumberOfBitplanes()}}
{\footnotesize\ttfamily U\+I\+N\+T8 C\+Encoder\+::\+C\+Macro\+Block\+::\+Number\+Of\+Bitplanes (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [private]}}



Definition at line 750 of file Encoder.\+cpp.


\begin{DoxyCode}{0}
\DoxyCodeLine{750                                              \{}
\DoxyCodeLine{751         UINT8 cnt = 0;}
\DoxyCodeLine{752 }
\DoxyCodeLine{753         \textcolor{comment}{// determine number of bitplanes for max value}}
\DoxyCodeLine{754         \textcolor{keywordflow}{if} (\mbox{\hyperlink{classCEncoder_1_1CMacroBlock_a865f294ffa568a165224c2105bf1bb01}{m\_maxAbsValue}} > 0) \{}
\DoxyCodeLine{755                 \textcolor{keywordflow}{while} (\mbox{\hyperlink{classCEncoder_1_1CMacroBlock_a865f294ffa568a165224c2105bf1bb01}{m\_maxAbsValue}} > 0) \{}
\DoxyCodeLine{756                         \mbox{\hyperlink{classCEncoder_1_1CMacroBlock_a865f294ffa568a165224c2105bf1bb01}{m\_maxAbsValue}} >>= 1; cnt++;}
\DoxyCodeLine{757                 \}}
\DoxyCodeLine{758                 \textcolor{keywordflow}{if} (cnt == \mbox{\hyperlink{PGFtypes_8h_ae0625b6a0d1a8187599a680c6b559860}{MaxBitPlanes}} + 1) cnt = 0;}
\DoxyCodeLine{759                 \textcolor{comment}{// end cs}}
\DoxyCodeLine{760                 ASSERT(cnt <= \mbox{\hyperlink{PGFtypes_8h_ae0625b6a0d1a8187599a680c6b559860}{MaxBitPlanes}});}
\DoxyCodeLine{761                 ASSERT((cnt >> \mbox{\hyperlink{PGFtypes_8h_a0acbc7f581c1eceef6a70713308987d5}{MaxBitPlanesLog}}) == 0);}
\DoxyCodeLine{762                 \textcolor{keywordflow}{return} cnt;}
\DoxyCodeLine{763         \} \textcolor{keywordflow}{else} \{}
\DoxyCodeLine{764                 \textcolor{keywordflow}{return} 1;}
\DoxyCodeLine{765         \}}
\DoxyCodeLine{766 \}}

\end{DoxyCode}
\mbox{\Hypertarget{classCEncoder_1_1CMacroBlock_a50637f0c6ccc3d29b10063204a55253b}\label{classCEncoder_1_1CMacroBlock_a50637f0c6ccc3d29b10063204a55253b}} 
\index{CEncoder::CMacroBlock@{CEncoder::CMacroBlock}!RLESigns@{RLESigns}}
\index{RLESigns@{RLESigns}!CEncoder::CMacroBlock@{CEncoder::CMacroBlock}}
\subsubsection{\texorpdfstring{RLESigns()}{RLESigns()}}
{\footnotesize\ttfamily U\+I\+N\+T32 C\+Encoder\+::\+C\+Macro\+Block\+::\+R\+L\+E\+Signs (\begin{DoxyParamCaption}\item[{U\+I\+N\+T32}]{code\+Pos,  }\item[{U\+I\+N\+T32 $\ast$}]{sign\+Bits,  }\item[{U\+I\+N\+T32}]{sign\+Len }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [private]}}



Definition at line 774 of file Encoder.\+cpp.


\begin{DoxyCode}{0}
\DoxyCodeLine{774                                                                                      \{}
\DoxyCodeLine{775         ASSERT(signBits);}
\DoxyCodeLine{776         ASSERT(0 <= codePos \&\& codePos < \mbox{\hyperlink{Encoder_8cpp_abc1529b42b4ec49f6674b24b5b0d0a45}{CodeBufferBitLen}});}
\DoxyCodeLine{777         ASSERT(0 < signLen \&\& signLen <= \mbox{\hyperlink{PGFtypes_8h_aa362edf6db9662acf6ef958a6db19c35}{BufferSize}});}
\DoxyCodeLine{778         }
\DoxyCodeLine{779         \textcolor{keyword}{const} UINT32  outStartPos = codePos;}
\DoxyCodeLine{780         UINT32 k = 0;}
\DoxyCodeLine{781         UINT32 runlen = 1 << k; \textcolor{comment}{// = 2\string^k}}
\DoxyCodeLine{782         UINT32 count = 0;}
\DoxyCodeLine{783         UINT32 signPos = 0;}
\DoxyCodeLine{784 }
\DoxyCodeLine{785         \textcolor{keywordflow}{while} (signPos < signLen) \{}
\DoxyCodeLine{786                 \textcolor{comment}{// search next 0 in signBits starting at position signPos}}
\DoxyCodeLine{787                 count = \mbox{\hyperlink{BitStream_8h_ac122c22b2c0f08c3caeeb19ffb57478e}{SeekBit1Range}}(signBits, signPos, \mbox{\hyperlink{PGFplatform_8h_ad6d0138bf7e2cdaabeedc3fea40767ad}{\_\_min}}(runlen, signLen - signPos));}
\DoxyCodeLine{788                 \textcolor{comment}{// count 1's found}}
\DoxyCodeLine{789                 \textcolor{keywordflow}{if} (count == runlen) \{}
\DoxyCodeLine{790                         \textcolor{comment}{// encode run of 2\string^k ones by a single 1}}
\DoxyCodeLine{791                         signPos += count; }
\DoxyCodeLine{792                         \mbox{\hyperlink{BitStream_8h_a0cfbc258d5f10464b6046e700e2311a1}{SetBit}}(\mbox{\hyperlink{classCEncoder_1_1CMacroBlock_a527667f1e0529ff577dcbe7f0aa38d77}{m\_codeBuffer}}, codePos++);}
\DoxyCodeLine{793                         \textcolor{comment}{// adapt k (double the 1's run-length)}}
\DoxyCodeLine{794                         \textcolor{keywordflow}{if} (k < \mbox{\hyperlink{PGFplatform_8h_abeb69f096b599bae58cbc58ba48250a5}{WordWidth}}) \{}
\DoxyCodeLine{795                                 k++; }
\DoxyCodeLine{796                                 runlen <<= 1;}
\DoxyCodeLine{797                         \}}
\DoxyCodeLine{798                 \} \textcolor{keywordflow}{else} \{}
\DoxyCodeLine{799                         \textcolor{comment}{// encode run of count 1's followed by a 0}}
\DoxyCodeLine{800                         \textcolor{comment}{// with codeword: 0(count)}}
\DoxyCodeLine{801                         signPos += count + 1;}
\DoxyCodeLine{802                         \mbox{\hyperlink{BitStream_8h_a3f00211230dd7a9469f3b9062567d4f7}{ClearBit}}(\mbox{\hyperlink{classCEncoder_1_1CMacroBlock_a527667f1e0529ff577dcbe7f0aa38d77}{m\_codeBuffer}}, codePos++);}
\DoxyCodeLine{803                         \textcolor{keywordflow}{if} (k > 0) \{}
\DoxyCodeLine{804                                 \mbox{\hyperlink{BitStream_8h_a0e3b853e6738b0af470d485c46a8be5e}{SetValueBlock}}(\mbox{\hyperlink{classCEncoder_1_1CMacroBlock_a527667f1e0529ff577dcbe7f0aa38d77}{m\_codeBuffer}}, codePos, count, k);}
\DoxyCodeLine{805                                 codePos += k;}
\DoxyCodeLine{806                         \}}
\DoxyCodeLine{807                         \textcolor{comment}{// adapt k (half the 1's run-length)}}
\DoxyCodeLine{808                         \textcolor{keywordflow}{if} (k > 0) \{}
\DoxyCodeLine{809                                 k--; }
\DoxyCodeLine{810                                 runlen >>= 1;}
\DoxyCodeLine{811                         \}}
\DoxyCodeLine{812                 \}}
\DoxyCodeLine{813         \}}
\DoxyCodeLine{814         ASSERT(signPos == signLen || signPos == signLen + 1);}
\DoxyCodeLine{815         ASSERT(codePos >= outStartPos \&\& codePos < \mbox{\hyperlink{Encoder_8cpp_abc1529b42b4ec49f6674b24b5b0d0a45}{CodeBufferBitLen}});}
\DoxyCodeLine{816         \textcolor{keywordflow}{return} codePos - outStartPos;}
\DoxyCodeLine{817 \}}

\end{DoxyCode}


\subsection{Member Data Documentation}
\mbox{\Hypertarget{classCEncoder_1_1CMacroBlock_a527667f1e0529ff577dcbe7f0aa38d77}\label{classCEncoder_1_1CMacroBlock_a527667f1e0529ff577dcbe7f0aa38d77}} 
\index{CEncoder::CMacroBlock@{CEncoder::CMacroBlock}!m\_codeBuffer@{m\_codeBuffer}}
\index{m\_codeBuffer@{m\_codeBuffer}!CEncoder::CMacroBlock@{CEncoder::CMacroBlock}}
\subsubsection{\texorpdfstring{m\_codeBuffer}{m\_codeBuffer}}
{\footnotesize\ttfamily U\+I\+N\+T32 C\+Encoder\+::\+C\+Macro\+Block\+::m\+\_\+code\+Buffer\mbox{[}\mbox{\hyperlink{Encoder_8h_a05a74e73e6c734fcad194efbca053ed5}{Code\+Buffer\+Len}}\mbox{]}}



output buffer for encoded bitstream 



Definition at line 85 of file Encoder.\+h.

\mbox{\Hypertarget{classCEncoder_1_1CMacroBlock_a6e15685fcab5aa06f0f5ed17312774c7}\label{classCEncoder_1_1CMacroBlock_a6e15685fcab5aa06f0f5ed17312774c7}} 
\index{CEncoder::CMacroBlock@{CEncoder::CMacroBlock}!m\_codePos@{m\_codePos}}
\index{m\_codePos@{m\_codePos}!CEncoder::CMacroBlock@{CEncoder::CMacroBlock}}
\subsubsection{\texorpdfstring{m\_codePos}{m\_codePos}}
{\footnotesize\ttfamily U\+I\+N\+T32 C\+Encoder\+::\+C\+Macro\+Block\+::m\+\_\+code\+Pos}



current position in encoded bitstream 



Definition at line 89 of file Encoder.\+h.

\mbox{\Hypertarget{classCEncoder_1_1CMacroBlock_adf5e8e4952216e6fdd189224618edd50}\label{classCEncoder_1_1CMacroBlock_adf5e8e4952216e6fdd189224618edd50}} 
\index{CEncoder::CMacroBlock@{CEncoder::CMacroBlock}!m\_encoder@{m\_encoder}}
\index{m\_encoder@{m\_encoder}!CEncoder::CMacroBlock@{CEncoder::CMacroBlock}}
\subsubsection{\texorpdfstring{m\_encoder}{m\_encoder}}
{\footnotesize\ttfamily \mbox{\hyperlink{classCEncoder}{C\+Encoder}}$\ast$ C\+Encoder\+::\+C\+Macro\+Block\+::m\+\_\+encoder\hspace{0.3cm}{\ttfamily [private]}}



Definition at line 98 of file Encoder.\+h.

\mbox{\Hypertarget{classCEncoder_1_1CMacroBlock_aa5abc7cc9df3402a233367f0087168f8}\label{classCEncoder_1_1CMacroBlock_aa5abc7cc9df3402a233367f0087168f8}} 
\index{CEncoder::CMacroBlock@{CEncoder::CMacroBlock}!m\_header@{m\_header}}
\index{m\_header@{m\_header}!CEncoder::CMacroBlock@{CEncoder::CMacroBlock}}
\subsubsection{\texorpdfstring{m\_header}{m\_header}}
{\footnotesize\ttfamily \mbox{\hyperlink{unionROIBlockHeader}{R\+O\+I\+Block\+Header}} C\+Encoder\+::\+C\+Macro\+Block\+::m\+\_\+header}



block header 



Definition at line 86 of file Encoder.\+h.

\mbox{\Hypertarget{classCEncoder_1_1CMacroBlock_a68163a823248889d9d407f4b0331245d}\label{classCEncoder_1_1CMacroBlock_a68163a823248889d9d407f4b0331245d}} 
\index{CEncoder::CMacroBlock@{CEncoder::CMacroBlock}!m\_lastLevelIndex@{m\_lastLevelIndex}}
\index{m\_lastLevelIndex@{m\_lastLevelIndex}!CEncoder::CMacroBlock@{CEncoder::CMacroBlock}}
\subsubsection{\texorpdfstring{m\_lastLevelIndex}{m\_lastLevelIndex}}
{\footnotesize\ttfamily int C\+Encoder\+::\+C\+Macro\+Block\+::m\+\_\+last\+Level\+Index}



index of last encoded level\+: \mbox{[}0, n\+Levels); used because a level-\/end can occur before a buffer is full 



Definition at line 90 of file Encoder.\+h.

\mbox{\Hypertarget{classCEncoder_1_1CMacroBlock_a865f294ffa568a165224c2105bf1bb01}\label{classCEncoder_1_1CMacroBlock_a865f294ffa568a165224c2105bf1bb01}} 
\index{CEncoder::CMacroBlock@{CEncoder::CMacroBlock}!m\_maxAbsValue@{m\_maxAbsValue}}
\index{m\_maxAbsValue@{m\_maxAbsValue}!CEncoder::CMacroBlock@{CEncoder::CMacroBlock}}
\subsubsection{\texorpdfstring{m\_maxAbsValue}{m\_maxAbsValue}}
{\footnotesize\ttfamily U\+I\+N\+T32 C\+Encoder\+::\+C\+Macro\+Block\+::m\+\_\+max\+Abs\+Value}



maximum absolute coefficient in each buffer 



Definition at line 88 of file Encoder.\+h.

\mbox{\Hypertarget{classCEncoder_1_1CMacroBlock_a7acaa42598512b958d5e16b8bcded13b}\label{classCEncoder_1_1CMacroBlock_a7acaa42598512b958d5e16b8bcded13b}} 
\index{CEncoder::CMacroBlock@{CEncoder::CMacroBlock}!m\_sigFlagVector@{m\_sigFlagVector}}
\index{m\_sigFlagVector@{m\_sigFlagVector}!CEncoder::CMacroBlock@{CEncoder::CMacroBlock}}
\subsubsection{\texorpdfstring{m\_sigFlagVector}{m\_sigFlagVector}}
{\footnotesize\ttfamily bool C\+Encoder\+::\+C\+Macro\+Block\+::m\+\_\+sig\+Flag\+Vector\mbox{[}\mbox{\hyperlink{PGFtypes_8h_aa362edf6db9662acf6ef958a6db19c35}{Buffer\+Size}}+1\mbox{]}\hspace{0.3cm}{\ttfamily [private]}}



Definition at line 99 of file Encoder.\+h.

\mbox{\Hypertarget{classCEncoder_1_1CMacroBlock_a139b60f3f0d76b9158573e4d897423d6}\label{classCEncoder_1_1CMacroBlock_a139b60f3f0d76b9158573e4d897423d6}} 
\index{CEncoder::CMacroBlock@{CEncoder::CMacroBlock}!m\_value@{m\_value}}
\index{m\_value@{m\_value}!CEncoder::CMacroBlock@{CEncoder::CMacroBlock}}
\subsubsection{\texorpdfstring{m\_value}{m\_value}}
{\footnotesize\ttfamily \mbox{\hyperlink{PGFtypes_8h_acb1ee3f52ccfad782dcaa0abd79e5d05}{DataT}} C\+Encoder\+::\+C\+Macro\+Block\+::m\+\_\+value\mbox{[}\mbox{\hyperlink{PGFtypes_8h_aa362edf6db9662acf6ef958a6db19c35}{Buffer\+Size}}\mbox{]}}



input buffer of values with index m\+\_\+value\+Pos 



Definition at line 84 of file Encoder.\+h.

\mbox{\Hypertarget{classCEncoder_1_1CMacroBlock_a7ab47e29ad9e3397869fdfb50b53e035}\label{classCEncoder_1_1CMacroBlock_a7ab47e29ad9e3397869fdfb50b53e035}} 
\index{CEncoder::CMacroBlock@{CEncoder::CMacroBlock}!m\_valuePos@{m\_valuePos}}
\index{m\_valuePos@{m\_valuePos}!CEncoder::CMacroBlock@{CEncoder::CMacroBlock}}
\subsubsection{\texorpdfstring{m\_valuePos}{m\_valuePos}}
{\footnotesize\ttfamily U\+I\+N\+T32 C\+Encoder\+::\+C\+Macro\+Block\+::m\+\_\+value\+Pos}



current buffer position 



Definition at line 87 of file Encoder.\+h.



The documentation for this class was generated from the following files\+:\begin{DoxyCompactItemize}
\item 
\mbox{\hyperlink{Encoder_8h}{Encoder.\+h}}\item 
\mbox{\hyperlink{Encoder_8cpp}{Encoder.\+cpp}}\end{DoxyCompactItemize}
