\section{th\_\-quant\_\-info Struct Reference}
\label{structth__quant__info}\index{th_quant_info@{th\_\-quant\_\-info}}
A complete set of quantization parameters.  


{\tt \#include $<$codec.h$>$}

\subsection*{Data Fields}
\begin{CompactItemize}
\item 
ogg\_\-uint16\_\-t {\bf dc\_\-scale} [64]\label{structth__quant__info_4ce05c9982b3e17974649157b1e928a0}

\begin{CompactList}\small\item\em The DC scaling factors. \item\end{CompactList}\item 
ogg\_\-uint16\_\-t {\bf ac\_\-scale} [64]\label{structth__quant__info_9ab4304dfc7dc8e7a81f439304553b6b}

\begin{CompactList}\small\item\em The AC scaling factors. \item\end{CompactList}\item 
unsigned char {\bf loop\_\-filter\_\-limits} [64]\label{structth__quant__info_c6b2d6362d99c8026e03f7f504c0767d}

\begin{CompactList}\small\item\em The loop filter limit values. \item\end{CompactList}\item 
{\bf th\_\-quant\_\-ranges} {\bf qi\_\-ranges} [2][3]\label{structth__quant__info_ddfbaaac78101aece7353fa72113c72f}

\begin{CompactList}\small\item\em The {\em qi\/} ranges for each {\em ci\/} and {\em pli\/}. \item\end{CompactList}\end{CompactItemize}


\subsection{Detailed Description}
A complete set of quantization parameters. 

The quantizer for each coefficient is calculated as: 

\begin{Code}\begin{verbatim}    Q=MAX(MIN(qmin[qti][ci!=0],scale[ci!=0][qi]*base[qti][pli][qi][ci]/100),
     1024).
\end{verbatim}\end{Code}



{\em qti\/} is the quantization type index: 0 for intra, 1 for inter. {\tt ci!=0} is 0 for the DC coefficient and 1 for AC coefficients. {\em qi\/} is the quality index, ranging between 0 (low quality) and 63 (high quality). {\em pli\/} is the color plane index: 0 for Y', 1 for Cb, 2 for Cr. {\em ci\/} is the DCT coefficient index. Coefficient indices correspond to the normal 2D DCT block ordering--row-major with low frequencies first--{\em not\/} zig-zag order.

Minimum quantizers are constant, and are given by: 

\begin{Code}\begin{verbatim}   qmin[2][2]={{4,2},{8,4}}.
\end{verbatim}\end{Code}



Parameters that can be stored in the bitstream are as follows:\begin{itemize}
\item The two scale matrices ac\_\-scale and dc\_\-scale. 

\begin{Code}\begin{verbatim}      scale[2][64]={dc_scale,ac_scale}.
\end{verbatim}\end{Code}

\item The base matrices for each {\em qi\/}, {\em qti\/} and {\em pli\/} (up to 384 in all). In order to avoid storing a full 384 base matrices, only a sparse set of matrices are stored, and the rest are linearly interpolated. This is done as follows. For each {\em qti\/} and {\em pli\/}, a series of {\em n\/} {\em qi\/} ranges is defined. The size of each {\em qi\/} range can vary arbitrarily, but they must sum to 63. Then, {\tt n+1} matrices are specified, one for each endpoint of the ranges. For interpolation purposes, each range's endpoints are the first {\em qi\/} value it contains and one past the last {\em qi\/} value it contains. Fractional values are rounded to the nearest integer, with ties rounded away from zero.\end{itemize}


Base matrices are stored by reference, so if the same matrices are used multiple times, they will only appear once in the bitstream. The bitstream is also capable of omitting an entire set of ranges and its associated matrices if they are the same as either the previous set (indexed in row-major order) or if the inter set is the same as the intra set.

\begin{itemize}
\item Loop filter limit values. The same limits are used for the loop filter in all color planes, despite potentially differing levels of quantization in each.\end{itemize}


For the current encoder, {\tt scale[ci!=0][qi]} must be no greater than {\tt scale[ci!=0][qi-1]} and {\tt base[qti][pli][qi][ci]} must be no greater than {\tt base[qti][pli][qi-1][ci]}. These two conditions ensure that the actual quantizer for a given {\em qti\/}, {\em pli\/}, and {\em ci\/} does not increase as {\em qi\/} increases. This is not required by the decoder. 



The documentation for this struct was generated from the following file:\begin{CompactItemize}
\item 
{\bf codec.h}\end{CompactItemize}
