Table of Contents

NAME

QccENTArithmeticGetContext - data type QccENTArithmeticGetContext for functions for retrieving the current context for symbols during arithmetic encoding and decoding

SYNOPSIS

#include "libQccPack.h"

typedef int (*QccENTArithmeticGetContext)(const int *symbol_stream, int current_symbol_index);

DESCRIPTION

For multiple-context arithmetic, the QccPack arithmetic encoding and decoding routines need the context of the current symbol in order to encode the symbol and update the relevant probability models. When an arithmetic-coder model (type QccENTArithmeticModel(3) ) is created via routines QccENTArithmeticEncodeStart(3) or QccENTArithmeticDecodeStart(3) , one specifies a function of type QccENTArithmeticGetContext that serves as a callback function. Within routines QccENTArithmeticEncode(3) or QccENTArithmeticDecode(3) , this callback function is called for the coding/decoding of each symbol in order to provide the context for the symbol.

In order to be a valid callback routine, functions to be used as such must have a prototype as shown in the "SYNOPSIS" section above. The callback routine must accept a pointer symbol_stream. This pointer is the same pointer passed as the symbol stream to QccENTArithmeticEncode(3) or QccENTArithmeticDecode(3) . Additionally, the callback function must accept an integer, current_symbol_index, which gives the index into symbol_stream of the current symbol. The callback routine can thus use symbol_stream and current_symbol_index to obtain a past history of the symbol stream relative to the current symbol, and use this information in determining the current context. For example, the previous symbol, symbol_stream[current_symbol_index - 1] could be used for an arithmetic coder that attempts to code at the first-order entropy, H(X[n] | X[n-1]), of the source. Of course, the callback routine could ignore this information, and use other means to determine the current context.

RETURN VALUE

The callback routine must return an integer which indicates the context of the current symbol. This context must be greater than or equal to 0, and less than num_contexts, the total number of contexts as setup initially when the arithmetic model was created via the call to QccENTArithmeticEncodeStart(3) or QccENTArithmeticDecodeStart(3) .

SEE ALSO

QccENTArithmeticModel(3) , QccENTArithmeticEncode(3) , QccENTArithmeticEncodeStart(3) , QccENTArithmeticEncodeEnd(3) , QccENTArithmeticDecode(3) , QccENTArithmeticDecodeStart(3) , QccENTArithmeticDecodeRestart(3) , QccPackENT(3) , QccPack(3)

I. H. Witten, R. M. Neal, and J. G. Cleary, "Arithmetic Coding for Data Compression," Communications of the ACM, vol. 30, no. 6, pp. 520-540, June 1987.

AUTHOR

Copyright (C) 1997-2021 James E. Fowler


Table of Contents



Get QccPack at SourceForge.net. Fast, secure and Free Open Source software downloads