- Main Page
- Namespaces
- Classes
- Files
- Directories

- Class List
- Class Hierarchy
- Class Members

# dirac::ArithCodec< T >::Context Class Reference

A class for binary contexts. More...

`#include <arith_codec.h>`

List of all members.

## Public Member Functions
| Context ()
| Default Constructor.
| Context (int cnt0, int cnt1)
| Constructor.
| Context (const Context &cpy)
| Copy constructor.
Context & | operator= (const Context &rhs)
| Assignment=.
| ~Context ()
| Destructor.
void | SetCounts (int cnt0, int cnt1)
| Sets the counts according to the input.
code_t | GetCount0 () const
| Returns the count of zeroes.
code_t | GetCount1 () const
| Returns the count of ones.
void | IncrCount (bool symbol, int amnt)
| Increment the count.
void | HalveCounts ()
| Divide the counts by 2, making sure neither ends up 0.
code_t | Weight () const
| Return the m_m_weight, equal to the count of 0 plus the count of 1.
const Triple & | GetTriple (const bool symbol) const
| Return the triple associated with Symbol.
bool | GetSymbol (const code_t num, Triple &trip_val) const
| Given a number, return the corresponding symbol and triple.

## Detailed Description

### template<class T>
class dirac::ArithCodec< T >::Context

A class for binary contexts.

A class for binary contexts. Stores probabilities for 0 and 1 in terms of counts of numbers of occurrences, and also as Triples partitioning the interval [0,1) into two parts [0,p) and [p,1).

Definition at line 202 of file arith_codec.h.

## Constructor & Destructor Documentation

template<class T>
dirac::ArithCodec< T >::Context::Context | ( |  | ) | `[inline]`

| Default Constructor. Default constructor initialises counts to 1 each of 0 and 1. Definition at line 209 of file arith_codec.h. References dirac::ArithCodec< T >::Context::SetCounts().

template<class T>
dirac::ArithCodec< T >::Context::Context | ( | int | cnt0,
|  | int | cnt1
| ) | `[inline]`

| Constructor. Constructor initialises the counts to those set. Definition at line 218 of file arith_codec.h. References dirac::ArithCodec< T >::Context::SetCounts().

## Member Function Documentation

template<class T>
bool dirac::ArithCodec< T >::Context::GetSymbol | ( | const code_t | num,
|  | Triple & | trip_val
| ) | const`[inline]`

| Given a number, return the corresponding symbol and triple. Given a number, which should be in the range [0,m_weight) return the corresponding symbol. The range [0,m_weight) is partitioned into portions [0,count0), [count0,m_weight) corresponding to 0 and 1. Definition at line 302 of file arith_codec.h. References dirac::ArithCodec< T >::ArithCodec(), dirac::ArithCodec< T >::ChooseContext(), dirac::ArithCodec< T >::DecodeSymbol(), dirac::ArithCodec< T >::DoWorkCode(), dirac::ArithCodec< T >::DoWorkDecode(), dirac::ArithCodec< T >::EncodeSymbol(), dirac::ArithCodec< T >::EncodeTriple(), dirac::ArithCodec< T >::FlushDecoder(), dirac::ArithCodec< T >::FlushEncoder(), dirac::ArithCodec< T >::InitContexts(), dirac::ArithCodec< T >::InitDecoder(), dirac::ArithCodec< T >::InitEncoder(), dirac::ArithCodec< T >::Context::operator=(), dirac::ArithCodec< T >::RemFromStream(), dirac::ArithCodec< T >::ResetAll(), dirac::ArithCodec< T >::Resize(), dirac::ArithCodec< T >::SetCurrentCount(), dirac::ArithCodec< T >::Triple::Start(), dirac::ArithCodec< T >::Triple::Stop(), dirac::ArithCodec< T >::Update(), and dirac::ArithCodec< T >::Triple::Weight().

template<class T>
void dirac::ArithCodec< T >::Context::IncrCount | ( | bool | symbol,
|  | int | amnt
| ) | `[inline]`

  | Increment the count. Increment the count of Symbol by amnt. Parameters:
  | symbol | the symbol whose count is to be incremented (false=0, true=1)
  | amnt | the amount to increment by
Definition at line 268 of file arith_codec.h.

template<class T>
void dirac::ArithCodec< T >::Context::SetCounts | ( | int | cnt0,
|  | int | cnt1
| ) | `[inline]`

| Sets the counts according to the input. Sets the counts, and then the triples to reflect the counts. Definition at line 248 of file arith_codec.h. Referenced by dirac::ArithCodec< T >::Context::Context().

The documentation for this class was generated from the following file:

- C:/guliverkli/src/filters/parser/diracsplitter/libdirac/libdirac_common/arith_codec.h