Blob Blame History Raw
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<title>libtheora: th_quant_info Struct Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="doxygen.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<!-- Generated by Doxygen 1.6.1 -->
<div class="navigation" id="top">
  <div class="tabs">
    <ul>
      <li><a href="index.html"><span>Main&nbsp;Page</span></a></li>
      <li><a href="modules.html"><span>Modules</span></a></li>
      <li class="current"><a href="annotated.html"><span>Data&nbsp;Structures</span></a></li>
      <li><a href="files.html"><span>Files</span></a></li>
    </ul>
  </div>
  <div class="tabs">
    <ul>
      <li><a href="annotated.html"><span>Data&nbsp;Structures</span></a></li>
      <li><a href="functions.html"><span>Data&nbsp;Fields</span></a></li>
    </ul>
  </div>
</div>
<div class="contents">
<h1>th_quant_info Struct Reference</h1><!-- doxytag: class="th_quant_info" -->
<p>A complete set of quantization parameters.  
<a href="#_details">More...</a></p>

<p><code>#include &lt;<a class="el" href="codec_8h_source.html">codec.h</a>&gt;</code></p>
<table border="0" cellpadding="0" cellspacing="0">
<tr><td colspan="2"><h2>Data Fields</h2></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">ogg_uint16_t&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="structth__quant__info.html#ad5c1c0d1aa4127fcf864ae747d732ed9">dc_scale</a> [64]</td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">The DC scaling factors.  <a href="#ad5c1c0d1aa4127fcf864ae747d732ed9"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">ogg_uint16_t&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="structth__quant__info.html#a102f079c8f4a135dc0895c10768aeb06">ac_scale</a> [64]</td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">The AC scaling factors.  <a href="#a102f079c8f4a135dc0895c10768aeb06"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">unsigned char&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="structth__quant__info.html#a4ac56bf0a45b5743b36daf85d5cd9e33">loop_filter_limits</a> [64]</td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">The loop filter limit values.  <a href="#a4ac56bf0a45b5743b36daf85d5cd9e33"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="el" href="structth__quant__ranges.html">th_quant_ranges</a>&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="structth__quant__info.html#a6feacf4b365e305a7df7b93d87ee7bb8">qi_ranges</a> [2][3]</td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">The <em>qi</em> ranges for each <em>ci</em> and <em>pli</em>.  <a href="#a6feacf4b365e305a7df7b93d87ee7bb8"></a><br/></td></tr>
</table>
<hr/><a name="_details"></a><h2>Detailed Description</h2>
<p>A complete set of quantization parameters. </p>
<p>The quantizer for each coefficient is calculated as: </p>
<div class="fragment"><pre class="fragment">    Q=MAX(MIN(qmin[qti][ci!=0],scale[ci!=0][qi]*base[qti][pli][qi][ci]/100),
     1024).
</pre></div><p><em>qti</em> is the quantization type index: 0 for intra, 1 for inter. <code>ci!=0</code> is 0 for the DC coefficient and 1 for AC coefficients. <em>qi</em> is the quality index, ranging between 0 (low quality) and 63 (high quality). <em>pli</em> is the color plane index: 0 for Y', 1 for Cb, 2 for Cr. <em>ci</em> is the DCT coefficient index. Coefficient indices correspond to the normal 2D DCT block ordering--row-major with low frequencies first--<em>not</em> zig-zag order.</p>
<p>Minimum quantizers are constant, and are given by: </p>
<div class="fragment"><pre class="fragment">   qmin[2][2]={{4,2},{8,4}}.
</pre></div><p>Parameters that can be stored in the bitstream are as follows:</p>
<ul>
<li>The two scale matrices ac_scale and dc_scale. <div class="fragment"><pre class="fragment">      scale[2][64]={<a class="code" href="structth__quant__info.html#ad5c1c0d1aa4127fcf864ae747d732ed9" title="The DC scaling factors.">dc_scale</a>,<a class="code" href="structth__quant__info.html#a102f079c8f4a135dc0895c10768aeb06" title="The AC scaling factors.">ac_scale</a>}.
</pre></div></li>
<li>The base matrices for each <em>qi</em>, <em>qti</em> and <em>pli</em> (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</em> and <em>pli</em>, a series of <em>n</em> <em>qi</em> ranges is defined. The size of each <em>qi</em> range can vary arbitrarily, but they must sum to 63. Then, <code>n+1</code> matrices are specified, one for each endpoint of the ranges. For interpolation purposes, each range's endpoints are the first <em>qi</em> value it contains and one past the last <em>qi</em> value it contains. Fractional values are rounded to the nearest integer, with ties rounded away from zero.</li>
</ul>
<p>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.</p>
<ul>
<li>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.</li>
</ul>
<p>For the current encoder, <code>scale[ci!=0][qi]</code> must be no greater than <code>scale[ci!=0][qi-1]</code> and <code>base[qti][pli][qi][ci]</code> must be no greater than <code>base[qti][pli][qi-1][ci]</code>. These two conditions ensure that the actual quantizer for a given <em>qti</em>, <em>pli</em>, and <em>ci</em> does not increase as <em>qi</em> increases. This is not required by the decoder. </p>
<hr/><h2>Field Documentation</h2>
<a class="anchor" id="a102f079c8f4a135dc0895c10768aeb06"></a><!-- doxytag: member="th_quant_info::ac_scale" ref="a102f079c8f4a135dc0895c10768aeb06" args="[64]" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">ogg_uint16_t <a class="el" href="structth__quant__info.html#a102f079c8f4a135dc0895c10768aeb06">th_quant_info::ac_scale</a>[64]</td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>The AC scaling factors. </p>

</div>
</div>
<a class="anchor" id="ad5c1c0d1aa4127fcf864ae747d732ed9"></a><!-- doxytag: member="th_quant_info::dc_scale" ref="ad5c1c0d1aa4127fcf864ae747d732ed9" args="[64]" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">ogg_uint16_t <a class="el" href="structth__quant__info.html#ad5c1c0d1aa4127fcf864ae747d732ed9">th_quant_info::dc_scale</a>[64]</td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>The DC scaling factors. </p>

</div>
</div>
<a class="anchor" id="a4ac56bf0a45b5743b36daf85d5cd9e33"></a><!-- doxytag: member="th_quant_info::loop_filter_limits" ref="a4ac56bf0a45b5743b36daf85d5cd9e33" args="[64]" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">unsigned char <a class="el" href="structth__quant__info.html#a4ac56bf0a45b5743b36daf85d5cd9e33">th_quant_info::loop_filter_limits</a>[64]</td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>The loop filter limit values. </p>

</div>
</div>
<a class="anchor" id="a6feacf4b365e305a7df7b93d87ee7bb8"></a><!-- doxytag: member="th_quant_info::qi_ranges" ref="a6feacf4b365e305a7df7b93d87ee7bb8" args="[2][3]" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="structth__quant__ranges.html">th_quant_ranges</a> <a class="el" href="structth__quant__info.html#a6feacf4b365e305a7df7b93d87ee7bb8">th_quant_info::qi_ranges</a>[2][3]</td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>The <em>qi</em> ranges for each <em>ci</em> and <em>pli</em>. </p>

</div>
</div>
<hr/>The documentation for this struct was generated from the following file:<ul>
<li><a class="el" href="codec_8h_source.html">codec.h</a></li>
</ul>
</div>
<hr size="1"/><address style="text-align: right;"><small>Generated on 28 Sep 2009 for libtheora by&nbsp;
<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.6.1 </small></address>
</body>
</html>