# CSJ2K.j2k.quantization.quantizer.Quantizer

## Content

<div class="doc-site-dotnet-api-container">



  <h1 id="CSJ2K_j2k_quantization_quantizer_Quantizer" data-uid="CSJ2K.j2k.quantization.quantizer.Quantizer" class="text-break">Quantizer Class
</h1>
  <div class="markdown level0 summary"><p>This abstract class provides the general interface for quantizers. The
input of a quantizer is the output of a wavelet transform. The output of
the quantizer is the set of quantized wavelet coefficients represented in
sign-magnitude notation (see below).</p>
<pre><code>       &lt;p&gt;This class provides default implementation for most of the methods
       (wherever it makes sense), under the assumption that the image, component
       dimensions, and the tiles, are not modifed by the quantizer. If it is not
       the case for a particular implementation, then the methods should be
       overriden.&lt;/p&gt;&lt;p&gt;Sign magnitude representation is used (instead of two's complement) for
       the output data. The most significant bit is used for the sign (0 if
       positive, 1 if negative). Then the magnitude of the quantized coefficient
       is stored in the next M most significat bits. The rest of the bits (least
       significant bits) can contain a fractional value of the quantized
       coefficient. This fractional value is not to be coded by the entropy
       coder. However, it can be used to compute rate-distortion measures with
       greater precision.&lt;/p&gt;&lt;p&gt;The value of M is determined for each subband as the sum of the number
       of guard bits G and the nominal range of quantized wavelet coefficients in
       the corresponding subband (Rq), minus 1:&lt;/p&gt;&lt;p&gt;M = G + Rq -1&lt;/p&gt;&lt;p&gt;The value of G should be the same for all subbands. The value of Rq
       depends on the quantization step size, the nominal range of the component
       before the wavelet transform and the analysis gain of the subband (see
       Subband).&lt;/p&gt;&lt;p&gt;The blocks of data that are requested should not cross subband
       boundaries.&lt;/p&gt;&lt;p&gt;NOTE: At the moment only quantizers that implement the
       'CBlkQuantDataSrcEnc' interface are supported.&lt;/p&gt;
</code></pre>
</div>
  <div class="markdown level0 conceptual"></div>
  <div class="inheritance">
    <h5>Inheritance</h5>
    <div class="level0"><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.object">object</a></div>
    <div class="level1"><a class="xref" href="CSJ2K.j2k.image.ImgDataAdapter.html">ImgDataAdapter</a></div>
    <div class="level2"><span class="xref">Quantizer</span></div>
      <div class="level3"><a class="xref" href="CSJ2K.j2k.quantization.quantizer.StdQuantizer.html">StdQuantizer</a></div>
  </div>
  <div class="implements">
    <h5>Implements</h5>
    <div><a class="xref" href="CSJ2K.j2k.quantization.quantizer.CBlkQuantDataSrcEnc.html">CBlkQuantDataSrcEnc</a></div>
    <div><a class="xref" href="CSJ2K.j2k.wavelet.analysis.ForwWTDataProps.html">ForwWTDataProps</a></div>
    <div><a class="xref" href="CSJ2K.j2k.image.ImgData.html">ImgData</a></div>
  </div>
  <h6><strong>Namespace</strong>: <a class="xref" href="CSJ2K.j2k.quantization.quantizer.html">CSJ2K.j2k.quantization.quantizer</a></h6>
  <h6><strong>Assembly</strong>: C1.WPF.ReportViewer.4.6.2.dll</h6>
  <h5 id="CSJ2K_j2k_quantization_quantizer_Quantizer_syntax">Syntax</h5>
  <div class="codewrapper">
    <pre><code class="lang-csharp hljs">public abstract class Quantizer : ImgDataAdapter, CBlkQuantDataSrcEnc, ForwWTDataProps, ImgData</code></pre>
  </div>
  <div class="codewrapper">
    <pre><code class="lang-vbnet hljs">Public MustInherit Class Quantizer
    Inherits ImgDataAdapter
    Implements CBlkQuantDataSrcEnc, ForwWTDataProps, ImgData</code></pre>
  </div>
  <h3 id="constructors">Constructors
</h3>
  <table class="table table-bordered table-condensed">
    <thead>
      <tr>
        <th>Name</th>
        <th>Description</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td id="CSJ2K_j2k_quantization_quantizer_Quantizer__ctor_CSJ2K_j2k_wavelet_analysis_CBlkWTDataSrc_" data-uid="CSJ2K.j2k.quantization.quantizer.Quantizer.#ctor(CSJ2K.j2k.wavelet.analysis.CBlkWTDataSrc)">
          <a class="xref" href="CSJ2K.j2k.quantization.quantizer.Quantizer.-ctor.html#CSJ2K_j2k_quantization_quantizer_Quantizer__ctor_CSJ2K_j2k_wavelet_analysis_CBlkWTDataSrc_">Quantizer(CBlkWTDataSrc)</a>
        </td>
        <td class="markdown level1 summary"><p>Initializes the source of wavelet transform coefficients.</p>
</td>
      </tr>
    </tbody>
  </table>
  <h3 id="fields">Fields
</h3>
  <table class="table table-bordered table-condensed">
    <thead>
      <tr>
        <th>Name</th>
        <th>Description</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td id="CSJ2K_j2k_quantization_quantizer_Quantizer_OPT_PREFIX" data-uid="CSJ2K.j2k.quantization.quantizer.Quantizer.OPT_PREFIX">
          <a class="xref" href="CSJ2K.j2k.quantization.quantizer.Quantizer.OPT_PREFIX.html">OPT_PREFIX</a>
        </td>
        <td class="markdown level1 summary"><p>The prefix for quantizer options: 'Q'</p>
</td>
      </tr>
      <tr>
        <td id="CSJ2K_j2k_quantization_quantizer_Quantizer_src" data-uid="CSJ2K.j2k.quantization.quantizer.Quantizer.src">
          <a class="xref" href="CSJ2K.j2k.quantization.quantizer.Quantizer.src.html">src</a>
        </td>
        <td class="markdown level1 summary"><p>The source of wavelet transform coefficients</p>
</td>
      </tr>
    </tbody>
  </table>
  <h3 id="properties">Properties
</h3>
  <table class="table table-bordered table-condensed">
    <thead>
      <tr>
        <th>Name</th>
        <th>Description</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td id="CSJ2K_j2k_quantization_quantizer_Quantizer_CbULX" data-uid="CSJ2K.j2k.quantization.quantizer.Quantizer.CbULX">
          <a class="xref" href="CSJ2K.j2k.quantization.quantizer.Quantizer.CbULX.html#CSJ2K_j2k_quantization_quantizer_Quantizer_CbULX">CbULX</a>
        </td>
        <td class="markdown level1 summary"><p>Returns the horizontal offset of the code-block partition. Allowable
values are 0 and 1, nothing else.</p>
</td>
      </tr>
      <tr>
        <td id="CSJ2K_j2k_quantization_quantizer_Quantizer_CbULY" data-uid="CSJ2K.j2k.quantization.quantizer.Quantizer.CbULY">
          <a class="xref" href="CSJ2K.j2k.quantization.quantizer.Quantizer.CbULY.html#CSJ2K_j2k_quantization_quantizer_Quantizer_CbULY">CbULY</a>
        </td>
        <td class="markdown level1 summary"><p>Returns the vertical offset of the code-block partition. Allowable
values are 0 and 1, nothing else.</p>
</td>
      </tr>
      <tr>
        <td id="CSJ2K_j2k_quantization_quantizer_Quantizer_ParameterInfo" data-uid="CSJ2K.j2k.quantization.quantizer.Quantizer.ParameterInfo">
          <a class="xref" href="CSJ2K.j2k.quantization.quantizer.Quantizer.ParameterInfo.html#CSJ2K_j2k_quantization_quantizer_Quantizer_ParameterInfo">ParameterInfo</a>
        </td>
        <td class="markdown level1 summary"><p>Returns the parameters that are used in this class and implementing
classes. It returns a 2D String array. Each of the 1D arrays is for a
different option, and they have 3 elements. The first element is the
option name, the second one is the synopsis, the third one is a long
description of what the parameter is and the fourth is its default
value. The synopsis or description may be 'null', in which case it is
assumed that there is no synopsis or description of the option,
respectively. Null may be returned if no options are supported.</p>
</td>
      </tr>
    </tbody>
  </table>
  <h3 id="methods">Methods
</h3>
  <table class="table table-bordered table-condensed">
    <thead>
      <tr>
        <th>Name</th>
        <th>Description</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td id="CSJ2K_j2k_quantization_quantizer_Quantizer_calcSbParams_CSJ2K_j2k_wavelet_analysis_SubbandAn_System_Int32_" data-uid="CSJ2K.j2k.quantization.quantizer.Quantizer.calcSbParams(CSJ2K.j2k.wavelet.analysis.SubbandAn,System.Int32)">
          <a class="xref" href="CSJ2K.j2k.quantization.quantizer.Quantizer.calcSbParams.html#CSJ2K_j2k_quantization_quantizer_Quantizer_calcSbParams_CSJ2K_j2k_wavelet_analysis_SubbandAn_System_Int32_">calcSbParams(SubbandAn, int)</a>
        </td>
        <td class="markdown level1 summary"><p>Calculates the parameters of the SubbandAn objects that depend on the
Quantizer. The 'stepWMSE' field is calculated for each subband which is
a leaf in the tree rooted at 'sb', for the specified component. The
subband tree 'sb' must be the one for the component 'n'.</p>
</td>
      </tr>
      <tr>
        <td id="CSJ2K_j2k_quantization_quantizer_Quantizer_createInstance_CSJ2K_j2k_wavelet_analysis_CBlkWTDataSrc_CSJ2K_j2k_encoder_EncoderSpecs_" data-uid="CSJ2K.j2k.quantization.quantizer.Quantizer.createInstance(CSJ2K.j2k.wavelet.analysis.CBlkWTDataSrc,CSJ2K.j2k.encoder.EncoderSpecs)">
          <a class="xref" href="CSJ2K.j2k.quantization.quantizer.Quantizer.createInstance.html#CSJ2K_j2k_quantization_quantizer_Quantizer_createInstance_CSJ2K_j2k_wavelet_analysis_CBlkWTDataSrc_CSJ2K_j2k_encoder_EncoderSpecs_">createInstance(CBlkWTDataSrc, EncoderSpecs)</a>
        </td>
        <td class="markdown level1 summary"><p>Creates a Quantizer object for the appropriate type of quantization
specified in the options in the parameter list 'pl', and having 'src'
as the source of data to be quantized. The 'rev' flag indicates if the
quantization should be reversible.</p>
<pre><code>       NOTE: At the moment only sources of wavelet data that implement the
       'CBlkWTDataSrc' interface are supported.
</code></pre>
</td>
      </tr>
      <tr>
        <td id="CSJ2K_j2k_quantization_quantizer_Quantizer_getAnSubbandTree_System_Int32_System_Int32_" data-uid="CSJ2K.j2k.quantization.quantizer.Quantizer.getAnSubbandTree(System.Int32,System.Int32)">
          <a class="xref" href="CSJ2K.j2k.quantization.quantizer.Quantizer.getAnSubbandTree.html#CSJ2K_j2k_quantization_quantizer_Quantizer_getAnSubbandTree_System_Int32_System_Int32_">getAnSubbandTree(int, int)</a>
        </td>
        <td class="markdown level1 summary"><p>Returns a reference to the root of subband tree structure representing
the subband decomposition for the specified tile-component.</p>
</td>
      </tr>
      <tr>
        <td id="CSJ2K_j2k_quantization_quantizer_Quantizer_getMaxMagBits_System_Int32_" data-uid="CSJ2K.j2k.quantization.quantizer.Quantizer.getMaxMagBits(System.Int32)">
          <a class="xref" href="CSJ2K.j2k.quantization.quantizer.Quantizer.getMaxMagBits.html#CSJ2K_j2k_quantization_quantizer_Quantizer_getMaxMagBits_System_Int32_">getMaxMagBits(int)</a>
        </td>
        <td class="markdown level1 summary"><p>Returns the maximum number of magnitude bits in any subband in the
current tile.</p>
</td>
      </tr>
      <tr>
        <td id="CSJ2K_j2k_quantization_quantizer_Quantizer_getNextCodeBlock_System_Int32_CSJ2K_j2k_wavelet_analysis_CBlkWTData_" data-uid="CSJ2K.j2k.quantization.quantizer.Quantizer.getNextCodeBlock(System.Int32,CSJ2K.j2k.wavelet.analysis.CBlkWTData)">
          <a class="xref" href="CSJ2K.j2k.quantization.quantizer.Quantizer.getNextCodeBlock.html#CSJ2K_j2k_quantization_quantizer_Quantizer_getNextCodeBlock_System_Int32_CSJ2K_j2k_wavelet_analysis_CBlkWTData_">getNextCodeBlock(int, CBlkWTData)</a>
        </td>
        <td class="markdown level1 summary"><p>Returns the next code-block in the current tile for the specified
component, as a copy (see below). The order in which code-blocks are
returned is not specified. However each code-block is returned only
once and all code-blocks will be returned if the method is called 'N'
times, where 'N' is the number of code-blocks in the tile. After all
the code-blocks have been returned for the current tile calls to this
method will return 'null'.</p>
<pre><code>       &lt;p&gt;When changing the current tile (through 'setTile()' or 'nextTile()')
       this method will always return the first code-block, as if this method
       was never called before for the new current tile.&lt;/p&gt;&lt;p&gt;The data returned by this method is always a copy of the internal
       data of this object, if any, and it can be modified &quot;in place&quot; without
       any problems after being returned. The 'offset' of the returned data is
       0, and the 'scanw' is the same as the code-block width. See the
       'CBlkWTData' class.&lt;/p&gt;&lt;p&gt;The 'ulx' and 'uly' members of the returned 'CBlkWTData' object
       contain the coordinates of the top-left corner of the block, with
       respect to the tile, not the subband.&lt;/p&gt;
</code></pre>
</td>
      </tr>
      <tr>
        <td id="CSJ2K_j2k_quantization_quantizer_Quantizer_getNextInternCodeBlock_System_Int32_CSJ2K_j2k_wavelet_analysis_CBlkWTData_" data-uid="CSJ2K.j2k.quantization.quantizer.Quantizer.getNextInternCodeBlock(System.Int32,CSJ2K.j2k.wavelet.analysis.CBlkWTData)">
          <a class="xref" href="CSJ2K.j2k.quantization.quantizer.Quantizer.getNextInternCodeBlock.html#CSJ2K_j2k_quantization_quantizer_Quantizer_getNextInternCodeBlock_System_Int32_CSJ2K_j2k_wavelet_analysis_CBlkWTData_">getNextInternCodeBlock(int, CBlkWTData)</a>
        </td>
        <td class="markdown level1 summary"><p>Returns the next code-block in the current tile for the specified
component. The order in which code-blocks are returned is not
specified. However each code-block is returned only once and all
code-blocks will be returned if the method is called 'N' times, where
'N' is the number of code-blocks in the tile. After all the code-blocks
have been returned for the current tile calls to this method will
return 'null'.</p>
<pre><code>       &lt;p&gt;When changing the current tile (through 'setTile()' or 'nextTile()')
       this method will always return the first code-block, as if this method
       was never called before for the new current tile.&lt;/p&gt;&lt;p&gt;The data returned by this method can be the data in the internal
       buffer of this object, if any, and thus can not be modified by the
       caller. The 'offset' and 'scanw' of the returned data can be
       arbitrary. See the 'CBlkWTData' class.&lt;/p&gt;&lt;p&gt;The 'ulx' and 'uly' members of the returned 'CBlkWTData' object
       contain the coordinates of the top-left corner of the block, with
       respect to the tile, not the subband.&lt;/p&gt;
</code></pre>
</td>
      </tr>
      <tr>
        <td id="CSJ2K_j2k_quantization_quantizer_Quantizer_getNumGuardBits_System_Int32_System_Int32_" data-uid="CSJ2K.j2k.quantization.quantizer.Quantizer.getNumGuardBits(System.Int32,System.Int32)">
          <a class="xref" href="CSJ2K.j2k.quantization.quantizer.Quantizer.getNumGuardBits.html#CSJ2K_j2k_quantization_quantizer_Quantizer_getNumGuardBits_System_Int32_System_Int32_">getNumGuardBits(int, int)</a>
        </td>
        <td class="markdown level1 summary"><p>Returns the number of guard bits used by this quantizer in the
given tile-component.</p>
</td>
      </tr>
      <tr>
        <td id="CSJ2K_j2k_quantization_quantizer_Quantizer_isDerived_System_Int32_System_Int32_" data-uid="CSJ2K.j2k.quantization.quantizer.Quantizer.isDerived(System.Int32,System.Int32)">
          <a class="xref" href="CSJ2K.j2k.quantization.quantizer.Quantizer.isDerived.html#CSJ2K_j2k_quantization_quantizer_Quantizer_isDerived_System_Int32_System_Int32_">isDerived(int, int)</a>
        </td>
        <td class="markdown level1 summary"><p>Returns true if the quantizer of given tile-component uses derived
quantization step sizes.</p>
</td>
      </tr>
      <tr>
        <td id="CSJ2K_j2k_quantization_quantizer_Quantizer_isReversible_System_Int32_System_Int32_" data-uid="CSJ2K.j2k.quantization.quantizer.Quantizer.isReversible(System.Int32,System.Int32)">
          <a class="xref" href="CSJ2K.j2k.quantization.quantizer.Quantizer.isReversible.html#CSJ2K_j2k_quantization_quantizer_Quantizer_isReversible_System_Int32_System_Int32_">isReversible(int, int)</a>
        </td>
        <td class="markdown level1 summary"><p>Returns the reversibility of the given tile-component. Data is
reversible when it is suitable for lossless and lossy-to-lossless
compression.</p>
</td>
      </tr>
    </tbody>
  </table>
  <h3 id="seealso">See Also</h3>
  <div class="seealso">
      <div><a class="xref" href="CSJ2K.j2k.wavelet.Subband.html">Subband</a></div>
  </div>

</div>
