%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{Reading Decorrelation Weights}
\label{wavpack:read_decorrelation_weights}
{\relsize{-1}
  \input{wavpack/algorithms/read_decorrelation_weights}
}
\begin{figure}[h]
  \includegraphics{wavpack/figures/decorr_weights.pdf}
\end{figure}

\clearpage

\subsubsection{Reading Decorrelation Weights Example}
Given a 2 channel block containing 5 decorrelation terms:
\begin{figure}[h]
\includegraphics{wavpack/figures/decorr_weights_parse.pdf}
\end{figure}
\begin{center}
{\renewcommand{\arraystretch}{1.25}
\begin{tabular}{r|r|>{$}r<{$}}
$i$ & $\text{value}_i$ & \text{weight value}_i \\
\hline
0 & 6 & 6 \times 2 ^ 3 + \lfloor(6 \times 2 ^ 3 + 2 ^ 6) \div 2 ^ 7\rfloor = 48 \\
1 & 6 & 6 \times 2 ^ 3 + \lfloor(6 \times 2 ^ 3 + 2 ^ 6) \div 2 ^ 7\rfloor = 48 \\
2 & 6 & 6 \times 2 ^ 3 + \lfloor(6 \times 2 ^ 3 + 2 ^ 6) \div 2 ^ 7\rfloor = 48 \\
3 & 6 & 6 \times 2 ^ 3 + \lfloor(6 \times 2 ^ 3 + 2 ^ 6) \div 2 ^ 7\rfloor = 48 \\
4 & 4 & 4 \times 2 ^ 3 + \lfloor(4 \times 2 ^ 3 + 2 ^ 6) \div 2 ^ 7\rfloor = 32 \\
5 & 4 & 4 \times 2 ^ 3 + \lfloor(4 \times 2 ^ 3 + 2 ^ 6) \div 2 ^ 7\rfloor = 32 \\
6 & 6 & 6 \times 2 ^ 3 + \lfloor(6 \times 2 ^ 3 + 2 ^ 6) \div 2 ^ 7\rfloor = 48 \\
7 & 6 & 6 \times 2 ^ 3 + \lfloor(6 \times 2 ^ 3 + 2 ^ 6) \div 2 ^ 7\rfloor = 48 \\
8 & 2 & 2 \times 2 ^ 3 + \lfloor(2 \times 2 ^ 3 + 2 ^ 6) \div 2 ^ 7\rfloor = 16 \\
9 & 3 & 3 \times 2 ^ 3 + \lfloor(3 \times 2 ^ 3 + 2 ^ 6) \div 2 ^ 7\rfloor = 24 \\
\end{tabular}
\renewcommand{\arraystretch}{1.0}
}
\end{center}
\begin{center}
\begin{tabular}{>{$}r<{$}||>{$}r<{$}}
\text{weight}_{4~0} = \text{weight value}_0 = 48 &
\text{weight}_{4~1} = \text{weight value}_1 = 48 \\
\text{weight}_{3~0} = \text{weight value}_2 = 48 &
\text{weight}_{3~1} = \text{weight value}_3 = 48 \\
\text{weight}_{2~0} = \text{weight value}_4 = 32 &
\text{weight}_{2~1} = \text{weight value}_5 = 32 \\
\text{weight}_{1~0} = \text{weight value}_6 = 48 &
\text{weight}_{1~1} = \text{weight value}_7 = 48 \\
\text{weight}_{0~0} = \text{weight value}_8 = 16 &
\text{weight}_{0~1} = \text{weight value}_9 = 24 \\
\end{tabular}
\end{center}
