utl::ArithmeticEncoder Class Reference
[Data Compression]

DCC95 arithmetic coder. More...

#include <ArithmeticEncoder.h>

Inheritance diagram for utl::ArithmeticEncoder:

Inheritance graph
[legend]

List of all members.

Public Member Functions

 ArithmeticEncoder (uint_t mode, Stream *stream=NULL, bool owner=true, ArithContext *ctx=NULL, bool eob=false)
 Constructor.
virtual uint_t decode (byte_t *block, uint_t num)
 Decode data from the associated stream.
uint_t decode (ArithContext *ctx)
 Decode a symbol with the given context.
virtual uint_t encode (const byte_t *block, uint_t num)
 Encode data to the associated stream.
void encode (uint_t symbol, ArithContext *ctx)
 Encode a symbol with the given context.
void setContext (ArithContext *ctx)
 Set the default context.
void start (uint_t mode, Stream *stream, bool owner=true, ArithContext *ctx=NULL, bool eob=false)
 Initialize for encoding or decoding.

Protected Member Functions

virtual void clear ()
 Revert to initial state.
virtual void finishEncoding ()
 Perform any necessary clean-up when encoding is finished.


Detailed Description

DCC95 arithmetic coder.

This implementation is really due to Alistair Moffat. All I have really done here is "UTL-ify" it.

See Alistair's home page at: http://www.cs.mu.oz.au/~alistair/

Attributes

Author:
Alistair Moffat, Adam McKee

Definition at line 138 of file ArithmeticEncoder.h.


Constructor & Destructor Documentation

utl::ArithmeticEncoder::ArithmeticEncoder ( uint_t  mode,
Stream stream = NULL,
bool  owner = true,
ArithContext ctx = NULL,
bool  eob = false 
) [inline]

Constructor.

Parameters:
mode io_rd to decode, io_wr to encode (see io_t)
stream (optional) associated stream
owner (optional : true) owner flag for stream
ctx (optional) default context
eob (optional : false) encode end-of-block?

Definition at line 150 of file ArithmeticEncoder.h.


Member Function Documentation

virtual uint_t utl::ArithmeticEncoder::decode ( byte_t block,
uint_t  num 
) [virtual]

Decode data from the associated stream.

Returns:
number of bytes decoded
Parameters:
block block to decode into
num size of block

Implements utl::Encoder.

uint_t utl::ArithmeticEncoder::decode ( ArithContext ctx  )  [inline]

Decode a symbol with the given context.

Returns:
symbol
Parameters:
ctx context

Definition at line 274 of file ArithmeticEncoder.h.

References utl::Stream::getBit(), utl::ArithContext::interval(), utl::min(), utl::ArithContext::symbol(), utl::ArithContext::totFreq(), and utl::ArithContext::update().

virtual uint_t utl::ArithmeticEncoder::encode ( const byte_t block,
uint_t  num 
) [virtual]

Encode data to the associated stream.

Returns:
number of bytes encoded
Parameters:
block block to encode
num size of block

Implements utl::Encoder.

void utl::ArithmeticEncoder::encode ( uint_t  symbol,
ArithContext ctx 
) [inline]

Encode a symbol with the given context.

Parameters:
symbol symbol to encode
ctx context

Definition at line 227 of file ArithmeticEncoder.h.

References utl::ArithContext::interval(), utl::ArithContext::totFreq(), and utl::ArithContext::update().

void utl::ArithmeticEncoder::setContext ( ArithContext ctx  )  [inline]

Set the default context.

Definition at line 177 of file ArithmeticEncoder.h.

void utl::ArithmeticEncoder::start ( uint_t  mode,
Stream stream,
bool  owner = true,
ArithContext ctx = NULL,
bool  eob = false 
)

Initialize for encoding or decoding.

Parameters:
mode io_rd to encode, io_wr to decode (see io_t)
stream (optional) associated stream
owner (optional : true) owner flag for stream
ctx (optional) default context
eob (optional : false) encode end-of-block?

virtual void utl::ArithmeticEncoder::clear (  )  [protected, virtual]

Revert to initial state.

Reimplemented from utl::Encoder.

virtual void utl::ArithmeticEncoder::finishEncoding (  )  [protected, virtual]

Perform any necessary clean-up when encoding is finished.

Reimplemented from utl::Encoder.


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

Generated on Tue May 26 16:53:23 2009 for libUTL++ by  doxygen 1.5.6