Dirac Video Codec

# Dirac - A Video Codec

Created by the British Broadcasting Corporation.

# dirac::ArithCodecBase Class Reference

`#include <arith_codec.h>`

Inheritance diagram for dirac::ArithCodecBase:
[legend]
Collaboration diagram for dirac::ArithCodecBase:
[legend]

List of all members.

## Public Member Functions

- ArithCodecBase (ByteIO *p_byteio, size_t number_of_contexts)
    Constructor.
- virtual ~ArithCodecBase ()
    Destructor.

## Protected Member Functions

- void InitEncoder ()
    Initialises the Encoder.
- void EncodeSymbol (const bool symbol, const int context_num)
    encodes a symbol and writes to output
- void EncodeUInt (const unsigned int value, const int bin1, const int max_bin)
- void EncodeSInt (const int value, const int bin1, const int max_bin)
- void FlushEncoder ()
    flushes the output of the encoder.
- int ByteCount () const
- void InitDecoder (int num_bytes)
    Initialise the Decoder.
- bool DecodeSymbol (int context_num)
    Decodes a symbol given a context number.
- unsigned int DecodeUInt (const int bin1, const int max_bin)
- int DecodeSInt (const int bin1, const int max_bin)

## Protected Attributes

- std::vector< Context > m_context_list
    List of contexts.

## Private Member Functions

- ArithCodecBase (const ArithCodecBase &cpy)
    private, bodyless copy constructor: class should not be copied
- ArithCodecBase & operator= (const ArithCodecBase &rhs)
    private, bodyless copy operator=: class should not be assigned
- void ReadAllData (int num_bytes)
    Read all the data in.
- bool InputBit ()
    Read in a bit of data.

## Private Attributes

- unsigned int m_scount
- unsigned int m_low_code
    Start of the current code range.
- unsigned int m_range
    Length of the current code range.
- ByteIO * m_byteio
    Input/output stream of Dirac-format bytes.
- int m_underflow
    Number of underflow bits.
- char * m_decode_data_ptr
    A pointer to the data for reading in.
- char * m_data_ptr
    A point to the byte currently being read.
- int m_input_bits_left
    The index of the bit of the byte being read.
- unsigned int m_code
    The present input code.

## Constructor & Destructor Documentation

dirac::ArithCodecBase::ArithCodecBase | ( | ByteIO * | p_byteio,
|  | size_t | number_of_contexts |
| ) |  |  |

Creates an ArithCodec object to decode input based on a set of parameters.

Parameters:

  | p_byteio | input/output for encoded bits
  | number_of_contexts | the number of contexts used

virtual dirac::ArithCodecBase::~ArithCodecBase | ( |  | ) | `[virtual]`

Destructor is virtual as this class is abstract.

dirac::ArithCodecBase::ArithCodecBase | ( | const ArithCodecBase & | cpy | ) | `[private]`

## Member Function Documentation

void dirac::ArithCodecBase::InitEncoder | ( |  | ) | `[protected]`

Referenced by dirac::ArithCodec< T >::Compress().

void dirac::ArithCodecBase::EncodeSymbol | ( | const bool | symbol,
|  | const int | context_num |
| ) |  |  | `[inline, protected]`

References dirac::Context::GetScaledProb0(), m_byteio, m_context_list, m_low_code, m_range, m_underflow, dirac::Context::Update(), and dirac::ByteIO::WriteBit().

Referenced by EncodeSInt(), and EncodeUInt().

void dirac::ArithCodecBase::EncodeUInt | ( | const unsigned int | value,
|  | const int | bin1,
|  | const int | max_bin |
| ) |  |  | `[inline, protected]`

References EncodeSymbol().

Referenced by EncodeSInt().

void dirac::ArithCodecBase::EncodeSInt | ( | const int | value,
|  | const int | bin1,
|  | const int | max_bin |
| ) |  |  | `[inline, protected]`

References EncodeSymbol(), and EncodeUInt().

void dirac::ArithCodecBase::FlushEncoder | ( |  | ) | `[protected]`

Referenced by dirac::ArithCodec< T >::Compress().

int dirac::ArithCodecBase::ByteCount | ( |  | ) | const`[protected]`

Referenced by dirac::ArithCodec< T >::Compress().

void dirac::ArithCodecBase::InitDecoder | ( | int | num_bytes | ) | `[protected]`

Referenced by dirac::ArithCodec< T >::Decompress().

bool dirac::ArithCodecBase::DecodeSymbol | ( | int | context_num | ) | `[inline, protected]`

References dirac::Context::GetScaledProb0(), InputBit(), m_code, m_context_list, m_low_code, m_range, and dirac::Context::Update().

Referenced by DecodeSInt(), and DecodeUInt().

unsigned int dirac::ArithCodecBase::DecodeUInt | ( | const int | bin1,
|  | const int | max_bin |
| ) |  |  | `[inline, protected]`

References DecodeSymbol().

Referenced by DecodeSInt().

int dirac::ArithCodecBase::DecodeSInt | ( | const int | bin1,
|  | const int | max_bin |
| ) |  |  | `[inline, protected]`

References DecodeSymbol(), and DecodeUInt().

ArithCodecBase& dirac::ArithCodecBase::operator= | ( | const ArithCodecBase & | rhs | ) | `[private]`

void dirac::ArithCodecBase::ReadAllData | ( | int | num_bytes | ) | `[private]`

bool dirac::ArithCodecBase::InputBit | ( |  | ) | `[inline, private]`

References m_data_ptr, and m_input_bits_left.

Referenced by DecodeSymbol().

## Member Data Documentation

std::vector<Context> dirac::ArithCodecBase::m_context_list`[protected]`

Referenced by DecodeSymbol(), and EncodeSymbol().

unsigned int dirac::ArithCodecBase::m_scount`[private]`

unsigned int dirac::ArithCodecBase::m_low_code`[private]`

Referenced by DecodeSymbol(), and EncodeSymbol().

unsigned int dirac::ArithCodecBase::m_range`[private]`

Referenced by DecodeSymbol(), and EncodeSymbol().

ByteIO* dirac::ArithCodecBase::m_byteio`[private]`

Referenced by EncodeSymbol().

int dirac::ArithCodecBase::m_underflow`[private]`

Referenced by EncodeSymbol().

char* dirac::ArithCodecBase::m_decode_data_ptr`[private]`

char* dirac::ArithCodecBase::m_data_ptr`[private]`

Referenced by InputBit().

int dirac::ArithCodecBase::m_input_bits_left`[private]`

Referenced by InputBit().

unsigned int dirac::ArithCodecBase::m_code`[private]`

Referenced by DecodeSymbol().

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

- arith_codec.h

© 2004 British Broadcasting Corporation. Dirac code licensed under the Mozilla Public License (MPL) Version 1.1.
HTML documentation generated by Dimitri van Heesch's excellent Doxygen tool.