Name | Description | |
---|---|---|
MQCoder Constructor | Instantiates a new MQ-coder, with the specified number of contexts and initial states. The compressed bytestream is written to the 'oStream' object. |
The following tables list the members exposed by MQCoder.
Name | Description | |
---|---|---|
MQCoder Constructor | Instantiates a new MQ-coder, with the specified number of contexts and initial states. The compressed bytestream is written to the 'oStream' object. |
Name | Description | |
---|---|---|
LENGTH_LAZY | Identifier for the lazy length calculation. The lazy length calculation is not optimal but is extremely simple. | |
LENGTH_LAZY_GOOD | Identifier for a very simple length calculation. This provides better results than the 'LENGTH_LAZY' computation. This is the old length calculation that was implemented in this class. | |
LENGTH_NEAR_OPT | Identifier for the near optimal length calculation. This calculation is more complex than the lazy one but provides an almost optimal length calculation. | |
TERM_EASY | The identifier for the easy termination that is simpler than the 'TERM_NEAR_OPT' one but slightly less efficient. | |
TERM_FULL | The identifier fort the termination that uses a full flush. This is the less efficient termination. | |
TERM_NEAR_OPT | The identifier for the termination that uses the near optimal length calculation to terminate the arithmetic codewrod | |
TERM_PRED_ER | The identifier for the predictable termination policy for error resilience. This is the same as the 'TERM_EASY' one but an special sequence of bits is embodied in the spare bits for error resilience purposes. |
Name | Description | |
---|---|---|
LenCalcType | Set the length calculation type to the specified type. | |
NumCodedBytes | Returns the number of bytes that are necessary from the compressed output stream to decode all the symbols that have been coded this far. The number of returned bytes does not include anything coded previous to the last time the 'terminate()' or 'reset()' methods where called.
The values returned by this method are then to be used in finishing the length calculation with the 'finishLengthCalculation()' method, after compensation of the offset in the number of bytes due to previous terminated segments. This method should not be called if the current coding pass is to be terminated. The 'terminate()' method should be called instead. The calculation is done based on the type of length calculation specified at the constructor. | |
NumCtxts | Returns the number of contexts in the arithmetic coder. | |
TermType | Set termination type to the specified type. |
Name | Description | |
---|---|---|
codeSymbol | This function performs the arithmetic encoding of one symbol. The function receives a bit that is to be encoded and a context with which to encode it.
Each context has a current MPS and an index describing what the current probability is for the LPS. Each bit is encoded and if the probability of the LPS exceeds .5, the MPS and LPS are switched. | |
codeSymbols | This function performs the arithmetic encoding of several symbols together. The function receives an array of symbols that are to be encoded and an array containing the contexts with which to encode them.
The advantage of using this function is that the cost of the method call is amortized by the number of coded symbols per method call. Each context has a current MPS and an index describing what the current probability is for the LPS. Each bit is encoded and if the probability of the LPS exceeds .5, the MPS and LPS are switched. | |
fastCodeSymbols | ||
finishLengthCalculation | Terminates the calculation of the required length for each coding pass. This method must be called just after the 'terminate()' one has been called for each terminated MQ segment.
The values in 'rates' must have been compensated for any offset due to previous terminated segments, so that the correct index to the stored coded data is used. | |
reset | Reinitializes the MQ coder and the underlying 'ByteOutputBuffer' buffer as if a new object was instantaited. All the data in the 'ByteOutputBuffer' buffer is erased and the state and contexts of the MQ coder are reinitialized). Additionally any saved MQ states are discarded. | |
resetCtxt | Resets a context to the original probability distribution, and sets its more probable symbol to 0. | |
resetCtxts | Resets all contexts to their original probability distribution and sets all more probable symbols to 0. | |
terminate | This function flushes the remaining encoded bits and makes sure that enough information is written to the bit stream to be able to finish decoding, and then it reinitializes the internal state of the MQ coder but without modifying the context states.
After calling this method the 'finishLengthCalculation()' method should be called, after compensating the returned length for the length of previous coded segments, so that the length calculation is finalized. The type of termination used depends on the one specified at the constructor. |