\section{th\_\-quant\_\-info Struct Reference}
\label{structth__quant__info}\index{th\_\-quant\_\-info@{th\_\-quant\_\-info}}


A complete set of quantization parameters.  


{\ttfamily \#include $<$codec.h$>$}\subsection*{Data Fields}
\begin{DoxyCompactItemize}
\item 
ogg\_\-uint16\_\-t {\bf dc\_\-scale} [64]
\begin{DoxyCompactList}\small\item\em The DC scaling factors. \item\end{DoxyCompactList}\item 
ogg\_\-uint16\_\-t {\bf ac\_\-scale} [64]
\begin{DoxyCompactList}\small\item\em The AC scaling factors. \item\end{DoxyCompactList}\item 
unsigned char {\bf loop\_\-filter\_\-limits} [64]
\begin{DoxyCompactList}\small\item\em The loop filter limit values. \item\end{DoxyCompactList}\item 
{\bf th\_\-quant\_\-ranges} {\bf qi\_\-ranges} [2][3]
\begin{DoxyCompactList}\small\item\em The {\itshape qi\/} ranges for each {\itshape ci\/} and {\itshape pli\/}. \item\end{DoxyCompactList}\end{DoxyCompactItemize}


\subsection{Detailed Description}
A complete set of quantization parameters. The quantizer for each coefficient is calculated as: 
\begin{DoxyCode}
    Q=MAX(MIN(qmin[qti][ci!=0],scale[ci!=0][qi]*base[qti][pli][qi][ci]/100),
     1024).
\end{DoxyCode}


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

Minimum quantizers are constant, and are given by: 
\begin{DoxyCode}
   qmin[2][2]={{4,2},{8,4}}.
\end{DoxyCode}


Parameters that can be stored in the bitstream are as follows:
\begin{DoxyItemize}
\item The two scale matrices ac\_\-scale and dc\_\-scale. 
\begin{DoxyCode}
      scale[2][64]={dc_scale,ac_scale}.
\end{DoxyCode}

\item The base matrices for each {\itshape qi\/}, {\itshape qti\/} and {\itshape 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 {\itshape qti\/} and {\itshape pli\/}, a series of {\itshape n\/} {\itshape qi\/} ranges is defined. The size of each {\itshape qi\/} range can vary arbitrarily, but they must sum to 63. Then, {\ttfamily n+1} matrices are specified, one for each endpoint of the ranges. For interpolation purposes, each range's endpoints are the first {\itshape qi\/} value it contains and one past the last {\itshape qi\/} value it contains. Fractional values are rounded to the nearest integer, with ties rounded away from zero.
\end{DoxyItemize}

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{DoxyItemize}
\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{DoxyItemize}

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

\subsection{Field Documentation}
\index{th\_\-quant\_\-info@{th\_\-quant\_\-info}!ac\_\-scale@{ac\_\-scale}}
\index{ac\_\-scale@{ac\_\-scale}!th_quant_info@{th\_\-quant\_\-info}}
\subsubsection[{ac\_\-scale}]{\setlength{\rightskip}{0pt plus 5cm}ogg\_\-uint16\_\-t {\bf th\_\-quant\_\-info::ac\_\-scale}[64]}\label{structth__quant__info_a102f079c8f4a135dc0895c10768aeb06}


The AC scaling factors. \index{th\_\-quant\_\-info@{th\_\-quant\_\-info}!dc\_\-scale@{dc\_\-scale}}
\index{dc\_\-scale@{dc\_\-scale}!th_quant_info@{th\_\-quant\_\-info}}
\subsubsection[{dc\_\-scale}]{\setlength{\rightskip}{0pt plus 5cm}ogg\_\-uint16\_\-t {\bf th\_\-quant\_\-info::dc\_\-scale}[64]}\label{structth__quant__info_ad5c1c0d1aa4127fcf864ae747d732ed9}


The DC scaling factors. \index{th\_\-quant\_\-info@{th\_\-quant\_\-info}!loop\_\-filter\_\-limits@{loop\_\-filter\_\-limits}}
\index{loop\_\-filter\_\-limits@{loop\_\-filter\_\-limits}!th_quant_info@{th\_\-quant\_\-info}}
\subsubsection[{loop\_\-filter\_\-limits}]{\setlength{\rightskip}{0pt plus 5cm}unsigned char {\bf th\_\-quant\_\-info::loop\_\-filter\_\-limits}[64]}\label{structth__quant__info_a4ac56bf0a45b5743b36daf85d5cd9e33}


The loop filter limit values. \index{th\_\-quant\_\-info@{th\_\-quant\_\-info}!qi\_\-ranges@{qi\_\-ranges}}
\index{qi\_\-ranges@{qi\_\-ranges}!th_quant_info@{th\_\-quant\_\-info}}
\subsubsection[{qi\_\-ranges}]{\setlength{\rightskip}{0pt plus 5cm}{\bf th\_\-quant\_\-ranges} {\bf th\_\-quant\_\-info::qi\_\-ranges}[2][3]}\label{structth__quant__info_a6feacf4b365e305a7df7b93d87ee7bb8}


The {\itshape qi\/} ranges for each {\itshape ci\/} and {\itshape pli\/}. 

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