# CSJ2K.j2k.entropy.encoder.MQCoder.codeSymbol

## Content

<div class="doc-site-dotnet-api-container">



<h1 id="CSJ2K_j2k_entropy_encoder_MQCoder_codeSymbol_" data-uid="CSJ2K.j2k.entropy.encoder.MQCoder.codeSymbol*">codeSymbol Method
</h1>
<div class="markdown level0 summary"></div>
<div class="markdown level0 conceptual"></div>



<a id="CSJ2K_j2k_entropy_encoder_MQCoder_codeSymbol_" data-uid="CSJ2K.j2k.entropy.encoder.MQCoder.codeSymbol*"></a>
<h4 id="CSJ2K_j2k_entropy_encoder_MQCoder_codeSymbol_System_Int32_System_Int32_" data-uid="CSJ2K.j2k.entropy.encoder.MQCoder.codeSymbol(System.Int32,System.Int32)">codeSymbol(int, int)</h4>
<div class="markdown level1 summary"><p>This function performs the arithmetic encoding of one symbol. The
function receives a bit that is to be encoded and a context with which
to encode it.</p>
<pre><code>       &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 codeSymbol(int bit, int context)</code></pre>
</div>
<div class="codewrapper">
  <pre><code class="lang-vbnet hljs">Public Sub codeSymbol(bit As Integer, context 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">bit</span></td>
      <td><p>The symbol to be encoded, must be 0 or 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">context</span></td>
      <td><p>the context with which to encode the symbol.</p>
</td>
    </tr>
  </tbody>
</table>
</div>
