Table of Contents

NAME

QccENTExponentialGolombEncode, QccENTExponentialGolombDecode, QccENTExponentialGolombEncodeSymbol, QccENTExponentialGolombDecodeSymbol - exponential-Golomb encoding and decoding

SYNOPSIS

#include "libQccPack.h"

int QccENTExponentialGolombEncode(QccBitBuffer *output_buffer, const int *symbols, int num_symbols, int signed_symbols);
int QccENTExponentialGolombDecode(QccBitBuffer *input_buffer, int *symbols, int num_symbols, int signed_symbols);

int QccENTExponentialGolombEncodeSymbol(QccBitBuffer *output_buffer, int symbol, int signed_symbol);
int QccENTExponentialGolombDecodeSymbol(QccBitBuffer *input_buffer, int *symbol, int signed_symbol);

DESCRIPTION

QccENTExponentialGolombEncode() performs exponential-Golomb coding of the symbol stream in symbols, outputting the binary codewords to output_buffer. num_symbols indicates how many symbols are in the symbol stream (which can be as short as one symbol). signed_symbols indicates whether the symbols in the symbol stream are signed integers (signed_symbols = 1) or unsigned integers (signed_symbols = 0). output_buffer must be a QccBitBuffer(3) that has been opened for writing prior to calling QccENTExponentialGolombEncode(). After calling QccENTExponentialGolombEncode(), QccBitBufferFlush(3) must be called to ensure that the last few bits of the bitstream are actually written to the output file.

QccENTExponentialGolombDecode() performs exponential-Golomb decoding of the bits in the bitstream input_buffer, producing an output stream of symbols that are stored in symbols. The symbols array must be allocated with space sufficient for holding num_symbols integers; this allocation must be done prior to calling QccENTExponentialGolombDecode(). Additionally, input_buffer must be opened for reading prior to calling QccENTExponentialGolombDecode().

QccENTExponentialGolombEncodeSymbol() and QccENTExponentialGolombDecodeSymbol() encode and decode a single symbol. QccENTExponentialGolombEncode() and QccENTExponentialGolombDecode() are implemented simply as repeated calls to QccENTExponentialGolombEncodeSymbol() and QccENTExponentialGolombDecodeSymbol(), respectively.

NOTES

Golomb coding was originally proposed by Golomb in 1966, and a special case of Golomb coding with the Golomb-coding parameter constrained to be a power of 2 was proposed independently by Rice in 1979, with these latter codes often called Rice codes or Golomb-Rice codes. Exponential-Golomb codes were proposed by Teuhola as another variant of Golomb codes similar to Rice codes with the property that the number of codes with a given length grows exponentially with the length. The implementation of exponential-Golomb coding follows that described in the H.264 standard (Sec. 9.1). Although the codeword lengths produced by this implementation are exactly the same as in H.264, the actual codewords are somewhat different.

RETURN VALUE

These routines return 0 on success, and 1 on failure.

SEE ALSO

QccBitBuffer(3) , QccPackENT(3) , QccPack(3)

S. W. Golomb, "Run-Length Encodings," IEEE Transactions on Information Theory, vol. 12, pp. 399-401, July 1966.

R. F. Rice, "Some Practical Universal Noiseless Coding Techniques," Tech. Rep. JPL-79-22, Jet Propulsion Laboratory, Pasadena, CA, March 1979.

J. Teuhola, "A Compression Method for Clustered Bit-Vectors," Information Processing Letters, vol. 7, pp. 308-311, October 1978.

ITU-T, Advanced Video Coding for Generic Audiovisual Services, May 2003, ITU-T Recommendation H.264.

AUTHOR

Copyright (C) 1997-2021 James E. Fowler


Table of Contents



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