# CSJ2K.j2k.entropy.encoder.MQCoder.codeSymbols

## Content

<div class="doc-site-dotnet-api-container">



<h1 id="CSJ2K_j2k_entropy_encoder_MQCoder_codeSymbols_" data-uid="CSJ2K.j2k.entropy.encoder.MQCoder.codeSymbols*">codeSymbols Method
</h1>
<div class="markdown level0 summary"></div>
<div class="markdown level0 conceptual"></div>



<a id="CSJ2K_j2k_entropy_encoder_MQCoder_codeSymbols_" data-uid="CSJ2K.j2k.entropy.encoder.MQCoder.codeSymbols*"></a>
<h4 id="CSJ2K_j2k_entropy_encoder_MQCoder_codeSymbols_System_Int32___System_Int32___System_Int32_" data-uid="CSJ2K.j2k.entropy.encoder.MQCoder.codeSymbols(System.Int32[],System.Int32[],System.Int32)">codeSymbols(int[], int[], int)</h4>
<div class="markdown level1 summary"><p>This function performs the arithmetic encoding of several symbols
together. The function receives an array of symbols that are to be
encoded and an array containing the contexts with which to encode them.</p>
<pre><code>       &lt;p&gt;The advantage of using this function is that the cost of the method
       call is amortized by the number of coded symbols per method call.&lt;/p&gt;&lt;p&gt;Each context has a current MPS and an index describing what the 
       current probability is for the LPS. Each bit is encoded and if the
       probability of the LPS exceeds .5, the MPS and LPS are switched.&lt;/p&gt;
</code></pre>
</div>
<div class="markdown level1 conceptual"></div>
<h5 class="declaration">Declaration</h5>
<div class="codewrapper">
  <pre><code class="lang-csharp hljs">public void codeSymbols(int[] bits, int[] cX, int n)</code></pre>
</div>
<div class="codewrapper">
  <pre><code class="lang-vbnet hljs">Public Sub codeSymbols(bits As Integer(), cX As Integer(), n As Integer)</code></pre>
</div>
<h5 class="parameters">Parameters</h5>
<table class="table table-bordered table-condensed">
  <thead>
    <tr>
      <th>Type</th>
      <th>Name</th>
      <th>Description</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.int32">int</a>[]</td>
      <td><span class="parametername">bits</span></td>
      <td><p>An array containing the symbols to be encoded. Valid
symbols are 0 and 1.</p>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.int32">int</a>[]</td>
      <td><span class="parametername">cX</span></td>
      <td><p>The context for each of the symbols to be encoded.</p>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.int32">int</a></td>
      <td><span class="parametername">n</span></td>
      <td><p>The number of symbols to encode.</p>
</td>
    </tr>
  </tbody>
</table>
</div>
