%Copyright (C) 2007-2015  Brian Langenberger
%This work is licensed under the
%Creative Commons Attribution-Share Alike 3.0 United States License.
%To view a copy of this license, visit
%http://creativecommons.org/licenses/by-sa/3.0/us/ or send a letter to
%Creative Commons,
%171 Second Street, Suite 300,
%San Francisco, California, 94105, USA.

\subsection{Decoding Entropy Variables}
\label{wavpack:read_entropy_variables}
\input{wavpack/algorithms/read_entropy}

\begin{figure}[h]
  \includegraphics{wavpack/figures/entropy_vars.pdf}
\end{figure}

\clearpage

\subsubsection{Reading Entropy Variables Example}
Given a 2 channel block containing the subframe:
\begin{figure}[h]
\includegraphics{wavpack/figures/entropy_vars_parse.pdf}
\end{figure}
\begin{center}
{\relsize{-1}
\renewcommand{\arraystretch}{1.25}
\begin{tabular}{r|>{$}r<{$}|>{$}r<{$}}
$i$ & \text{entropy}_{0~i} & \text{entropy}_{1~i} \\
\hline
0 &
\lfloor \EXP(2018 \bmod{256}) \div 2 ^ {9 - \lfloor 2018 \div 2 ^ 8 \rfloor} \rfloor = 118 &
\lfloor \EXP(2018 \bmod{256}) \div 2 ^ {9 - \lfloor 2018 \div 2 ^ 8 \rfloor} \rfloor = 118 \\
1 &
\lfloor \EXP(2203 \bmod{256}) \div 2 ^ {9 - \lfloor 2203 \div 2 ^ 8 \rfloor} \rfloor = 194 &
\lfloor \EXP(2166 \bmod{256}) \div 2 ^ {9 - \lfloor 2166 \div 2 ^ 8 \rfloor} \rfloor = 176 \\
2 &
\EXP(2389 \bmod{256}) \times 2 ^ {\lfloor 2389 \div 2 ^ 8 \rfloor - 9} = 322 &
\lfloor \EXP(2234 \bmod{256}) \div 2 ^ {9 - \lfloor 2234 \div 2 ^ 8 \rfloor} \rfloor = 212 \\
\end{tabular}
\renewcommand{\arraystretch}{1.0}
}
\end{center}
