#include <arith_codec.h>
Public Member Functions | |
ArithCodec (BasicOutputManager *bits_out, size_t number_of_contexts) | |
Constructor for encoding. | |
ArithCodec (BitInputManager *bits_in, size_t number_of_contexts) | |
Constructor for decoding. | |
virtual | ~ArithCodec () |
Destructor. | |
int | Compress (T &in_data) |
Compresses the input and returns the number of bits written. | |
void | Decompress (T &out_data, int num_bits) |
Decompresses the bitstream and writes into the output. | |
Protected Types | |
typedef uint16_t | code_t |
typedef uint32_t | calc_t |
Protected Member Functions | |
virtual void | InitContexts ()=0 |
The method by which the contexts are initialised. | |
virtual void | Update (const bool symbol, const int context_num)=0 |
The method by which the counts are updated. | |
virtual void | Resize (const int context_num)=0 |
The method by which the counts are resized. | |
virtual void | ResetAll ()=0 |
The method by which _all_ the counts are resized. | |
virtual int | ChooseContext (const T &data, const int bin_number) const =0 |
Choose the context based on previous data. | |
virtual int | ChooseContext (const T &data) const =0 |
Choose the context based on previous data. | |
virtual void | DoWorkCode (T &in_data)=0 |
Does the work of actually coding the data. | |
void | InitEncoder () |
Initialises the Encoder. | |
void | EncodeTriple (const Triple &c) |
encodes a triple and writes to output | |
void | EncodeSymbol (const bool symbol, const int context_num) |
encodes a symbol and writes to output | |
void | FlushEncoder () |
flushes the output of the encoder. | |
void | FlushDecoder () |
flushes the input of the encoder by reading all the remaining bits | |
virtual void | DoWorkDecode (T &out_data, int num_bits)=0 |
virtual decode-only functions | |
void | InitDecoder () |
Initialise the Decoder. | |
void | RemFromStream (const Triple &c) |
Remove the symbol from the coded input stream. | |
void | SetCurrentCount (const int context_num) |
Rescales the interval midpoint according to the context. | |
void | DecodeSymbol (bool &symbol, int context_num) |
Decodes a symbol given a context number. | |
Protected Attributes | |
std::vector< Context > | m_context_list |
List of contexts. | |
Static Protected Attributes | |
static const code_t | CODE_MAX = 0xffff |
static const code_t | CODE_MSB = ((0xffff + 1) >> 1) |
static const code_t | CODE_2ND_MSB = ((0xffff + 1) >> 2) |
Classes | |
class | Context |
A class for binary contexts. More... | |
class | Triple |
A class for encapsulating interval fractions for use in arithmetic coding. More... |
This is an abtract binary arithmetic encoding class, used as the base for concrete classes that encode motion vectors and subband residues.
T | a container (most probably, or array) type |
Definition at line 73 of file arith_codec.h.
|
Constructor for encoding. Creates an ArithCodec object to decode input based on a set of parameters.
Definition at line 457 of file arith_codec.h. Referenced by dirac::ArithCodec< T >::Context::GetSymbol(). |
|
Constructor for decoding. Creates an ArithCodec object to decode input based on a set of parameters.
Definition at line 447 of file arith_codec.h. |
|
Destructor. Destructor is virtual as this class is abstract. Definition at line 466 of file arith_codec.h. |
|
Compresses the input and returns the number of bits written. Compress takes a type T object (a container or array) and compresses it using the abstract function DoWorkCode() which is overridden in subclasses. It returns the number of bits written.
Definition at line 472 of file arith_codec.h. References dirac::ArithCodec< T >::DoWorkCode(), dirac::ArithCodec< T >::FlushEncoder(), and dirac::ArithCodec< T >::InitEncoder(). Referenced by dirac::FrameCompressor::Compress(), and dirac::CompCompressor::Compress(). |
|
Decompresses the bitstream and writes into the output. Decompresses the bitstream, up to the number of bits specified and writes into the output subclasses.
Definition at line 481 of file arith_codec.h. References dirac::ArithCodec< T >::DoWorkDecode(), dirac::ArithCodec< T >::FlushDecoder(), dirac::BitInputManager::FlushInput(), and dirac::ArithCodec< T >::InitDecoder(). Referenced by dirac::CompDecompressor::Decompress(). |