M-ary arithmetic encoder class. More...
#include <arithCoder.hpp>
Public Member Functions | |
MultiArithEncoder (int maxContexts, OutputBitStream *out=nullptr) | |
Create an encoder with the specified number of contexts that sends output to the given bit stream. More... | |
~MultiArithEncoder () | |
Destroy an encoder. More... | |
OutputBitStream * | getOutput () |
Get the bit stream used for output. More... | |
void | setOutput (OutputBitStream *out) |
Set the bit stream used for output. More... | |
SPL_ArithCoder_ulong | getSymCount () const |
Get the number of symbols encoded so far. More... | |
SPL_ArithCoder_ulong | getBitCount () const |
Get the number of bits of output generated so far including bits awaiting output. More... | |
int | getMaxContexts () const |
Get the maximum number of contexts. More... | |
void | setContext (int contextId, int numSyms) |
Set the specified context to have the given number of symbols which are initially equiprobable. More... | |
void | setContext (int contextId, const std::vector< ArithCoder::Freq > &symFreqs, bool adaptive) |
Set the specified context to have symbols with the given frequencies and the given adaptivity. More... | |
int | start () |
Start a code word. More... | |
int | terminate () |
Terminate the code word. More... | |
int | encodeRegular (int contextId, int sym) |
Encode the given symbol in the specified context. More... | |
int | encodeBypass (int numSyms, int sym) |
Encode the given symbol in bypass mode (i.e., a fixed probablity distribution where all symbols are equiprobable). More... | |
void | dump (std::ostream &out) const |
Dump the internal state of the encoder to the specified stream for debugging purposes. More... | |
Static Public Member Functions | |
static void | setDebugLevel (int debugLevel) |
Set the debug level. More... | |
static void | setDebugStream (std::ostream &out) |
Set the stream for debugging output. More... | |
static std::ostream & | getDebugStream () |
Get the stream for debugging output. More... | |
M-ary arithmetic encoder class.
SPL::MultiArithEncoder::MultiArithEncoder | ( | int | maxContexts, |
OutputBitStream * | out = nullptr |
||
) |
Create an encoder with the specified number of contexts that sends output to the given bit stream.
SPL::MultiArithEncoder::~MultiArithEncoder | ( | ) |
Destroy an encoder.
void SPL::MultiArithEncoder::dump | ( | std::ostream & | out | ) | const |
Dump the internal state of the encoder to the specified stream for debugging purposes.
int SPL::MultiArithEncoder::encodeBypass | ( | int | numSyms, |
int | sym | ||
) |
Encode the given symbol in bypass mode (i.e., a fixed probablity distribution where all symbols are equiprobable).
int SPL::MultiArithEncoder::encodeRegular | ( | int | contextId, |
int | sym | ||
) |
Encode the given symbol in the specified context.
void SPL::MultiArithEncoder::setContext | ( | int | contextId, |
int | numSyms | ||
) |
Set the specified context to have the given number of symbols which are initially equiprobable.
void SPL::MultiArithEncoder::setContext | ( | int | contextId, |
const std::vector< ArithCoder::Freq > & | symFreqs, | ||
bool | adaptive | ||
) |
Set the specified context to have symbols with the given frequencies and the given adaptivity.
int SPL::MultiArithEncoder::start | ( | ) |
Start a code word.
This function must be called before attempting to encode any symbols.
int SPL::MultiArithEncoder::terminate | ( | ) |
Terminate the code word.