\doxysection{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$>$}

\doxysubsubsection*{Data Fields}
\begin{DoxyCompactItemize}
\item 
ogg\+\_\+uint16\+\_\+t \textbf{ dc\+\_\+scale} [64]
\begin{DoxyCompactList}\small\item\em The DC scaling factors. \end{DoxyCompactList}\item 
ogg\+\_\+uint16\+\_\+t \textbf{ ac\+\_\+scale} [64]
\begin{DoxyCompactList}\small\item\em The AC scaling factors. \end{DoxyCompactList}\item 
unsigned char \textbf{ loop\+\_\+filter\+\_\+limits} [64]
\begin{DoxyCompactList}\small\item\em The loop filter limit values. \end{DoxyCompactList}\item 
\textbf{ th\+\_\+quant\+\_\+ranges} \textbf{ qi\+\_\+ranges} [2][3]
\begin{DoxyCompactList}\small\item\em The {\itshape qi} ranges for each {\itshape ci} and {\itshape pli}. \end{DoxyCompactList}\end{DoxyCompactItemize}


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

The quantizer for each coefficient is calculated as\+: 
\begin{DoxyCode}{0}
\DoxyCodeLine{Q=MAX(MIN(qmin[qti][ci!=0],scale[ci!=0][qi]*base[qti][pli][qi][ci]/100),}
\DoxyCodeLine{\ 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\textquotesingle{}, 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}{0}
\DoxyCodeLine{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}{0}
\DoxyCodeLine{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\textquotesingle{}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.

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.
\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. 

\label{doc-variable-members}
\doxysubsection{Field Documentation}
\index{th\_quant\_info@{th\_quant\_info}!ac\_scale@{ac\_scale}}
\index{ac\_scale@{ac\_scale}!th\_quant\_info@{th\_quant\_info}}
\doxysubsubsection{ac\_scale}
{\footnotesize\ttfamily \label{structth__quant__info_a102f079c8f4a135dc0895c10768aeb06} 
ogg\+\_\+uint16\+\_\+t th\+\_\+quant\+\_\+info\+::ac\+\_\+scale[64]}



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}}
\doxysubsubsection{dc\_scale}
{\footnotesize\ttfamily \label{structth__quant__info_ad5c1c0d1aa4127fcf864ae747d732ed9} 
ogg\+\_\+uint16\+\_\+t th\+\_\+quant\+\_\+info\+::dc\+\_\+scale[64]}



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}}
\doxysubsubsection{loop\_filter\_limits}
{\footnotesize\ttfamily \label{structth__quant__info_a4ac56bf0a45b5743b36daf85d5cd9e33} 
unsigned char th\+\_\+quant\+\_\+info\+::loop\+\_\+filter\+\_\+limits[64]}



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}}
\doxysubsubsection{qi\_ranges}
{\footnotesize\ttfamily \label{structth__quant__info_a6feacf4b365e305a7df7b93d87ee7bb8} 
\textbf{ th\+\_\+quant\+\_\+ranges} th\+\_\+quant\+\_\+info\+::qi\+\_\+ranges[2][3]}



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 
\textbf{ codec.\+h}\end{DoxyCompactItemize}
