Octane v1.01.20 - The Open Compression Toolkit for C++ http://octane.sourceforge.net/
Homepage | Main | Modules | Class Hierarchy | Compound List | File List | Compound Members | Related Pages

SampleCoder Class Reference
[Coders]

#include <samplecoder.hpp>

Inheritance diagram for SampleCoder:

OctaneCoder OctaneClass List of all members.

Detailed Description

The Sample Coder is useful only as an example of how coders work.

It simply outputs the symbol number as the binary contents of a c int type (4 byes), ignoring any information about modeler probabilities.

Definition at line 32 of file samplecoder.hpp.

Public Member Functions

 SampleCoder ()
 constructor

virtual ~SampleCoder ()
 destructor

virtual std::string GetName ()
 provide a unique name for the coder, used in some cases to automatically register the object with a manager

virtual std::string GetDescription ()
 optionally provide a longer (maybe 20-60 characters) description

virtual std::string GetHelpInformation ()
 optionally provide more information about the object on request for help

virtual void ShowDebuggingInfo ()
 show any debugging info on request (used by various derived classes) [optional]

virtual unsigned int GetMemoryUsed ()
 Report actual current memory usage (in bytes).

virtual bool WriteSymbolBits (int symbolnum, bitwriter &bw)
 write bits for symbol number

virtual bool DecodeSymbolFromInput (int &symbolnum, bitreader &br)
 Decode the next symbol from the input.

virtual bool IsReadyToCode ()
 Are we ready to actually code and decode?

virtual void ReceiveNotification_ModelChange_AllSymbolWeights (OctaneModeler *modelerp)
 Notify coder that all probabilities are being updated.


Member Function Documentation

virtual std::string SampleCoder::GetName  )  [inline, virtual]
 

provide a unique name for the coder, used in some cases to automatically register the object with a manager

Returns:
a short *unique* name

Reimplemented from OctaneCoder.

Definition at line 42 of file samplecoder.hpp.

00042 {return "SampleCoder";}

virtual std::string SampleCoder::GetDescription  )  [inline, virtual]
 

optionally provide a longer (maybe 20-60 characters) description

Returns:
a one line description

Reimplemented from OctaneCoder.

Definition at line 43 of file samplecoder.hpp.

00043 {return "Sample Coder";}

virtual std::string SampleCoder::GetHelpInformation  )  [inline, virtual]
 

optionally provide more information about the object on request for help

Returns:
a long string (can be multiple
newlines)

Reimplemented from OctaneCoder.

Definition at line 44 of file samplecoder.hpp.

00044 { return ""; }

bool SampleCoder::WriteSymbolBits int  symbolnum,
bitwriter bw
[virtual]
 

write bits for symbol number

Returns:
true on success

Implements OctaneCoder.

Definition at line 19 of file samplecoder.cpp.

References bitwriter::put().

00020 {
00021         // write compressed output for symbol specified
00022         // return true on success
00023         
00024         // for our sample coder, we will just write the raw binary data in an int
00025         bw.put(symbolnum);
00026         
00027         // return success
00028         return true;
00029 }

bool SampleCoder::DecodeSymbolFromInput int &  symbolnum,
bitreader br
[virtual]
 

Decode the next symbol from the input.

Returns:
true on success, false when there are no more symbols to read.

Implements OctaneCoder.

Definition at line 31 of file samplecoder.cpp.

References bitreader::empty(), and bitreader::get().

00032 {
00033         // decode a symbol from the input
00034         // return false on no symbols left in stream (or error)
00035 
00036         // input is empty yet?
00037         if (br.empty())
00038                 return false;
00039 
00040         // for our sample coder, we just read the binary data for an int
00041         br.get(symbolnum);
00042 
00043         // return success
00044         return true;
00045 }

virtual bool SampleCoder::IsReadyToCode  )  [inline, virtual]
 

Are we ready to actually code and decode?

Returns:
true on success

Reimplemented from OctaneCoder.

Definition at line 61 of file samplecoder.hpp.

00061 {return true;};

virtual void SampleCoder::ReceiveNotification_ModelChange_AllSymbolWeights OctaneModeler modelerp  )  [inline, virtual]
 

Notify coder that all probabilities are being updated.

We can be informed by a model when the underlying probabilities are changing this part of the API exists so that we can flexibly and efficiently handle different kinds of situations where the coder needs to be synchronized with the model probabilities. in some cases, a coder may ignore these messages and simply rebuild its internal datastructure on each coding event in other cases, it will want to incrementally update as model changes. Two kinds of notifications are supported, depending on how the model updates itself during processing, whether it updates one symbol per iteration, or modifies all symbols at once.

See also:
OctaneCoder::ReceiveNotification_ModelChange_SingleSymbolWeight

Reimplemented from OctaneCoder.

Definition at line 66 of file samplecoder.hpp.

00066 {;};


The documentation for this class was generated from the following files:  
Generated on 20 May 2004 by doxygen 1.3.3