wvBitstream(3) USC Math Department
Back to wvlib encoding function index
wvBitstream(3)

Name

wvBitstreamEncode, wvBitstreamDecode, wvDestroyBitstream - bistream (for regular bases) functions

Synopsis

#include <wv/enc_bitstream.h>

WVbitstream *wvBitstreamEncode(const WVbasisMatrix *matrix);

WVbasis wvBitstreamDecode(const WVbitstream *bitstream, const WVindexVector *size);

void wvDestroyBitstream(WVbitstream *bitstream);

Description

wvBitstreamEncode returns a bitstream representation of the (regular) basis.

wvBitstreamDecode returns the (regular) basis, represented by bitstream, for a matrix of size. The size is not stored in the bitstream, since often the application already knows the size. When this is not the case, the application can store the size explicitly in conjunction with the bitstream.

wvDestroyBitstream frees the memory used by bitstream. It is the application programmer's responsibility to free this memory (by calling this function).

A pair of utility functions are provided to read and write (regular) basis directly to or from an open stream (file) in bitstream format: wvFWriteBasisToBitstream() and wvFReadBasisFromBitstream().

The process of creating a bitstream from a basis and then reconstructing a basis from that bitstream is completely lossless if the coefficients are integers. This is normally accomplished by quantizing the basis, or performing a similar operation. Representing the original basis (before quantizing) isn't useful in any event, since most of the coefficients, although small, may not be zero.

The bitstream structure is defined in <wv/enc_bitstream.h> as follows:

typedef struct _WVbitstream {
    WVcoefArray *coef;
    WVbitArray *sign;
    WVbitArray *spatial_hi;
    WVbitArray *spatial_lo;
    WVbitArray *freq;
} WVbitstream;

See Also

wvBasisApplyThreshold(3), wvBuildBasis(3), wvFReadBasisFromBitstream(3), wvFWriteBasisToBitstream(3)

Diagnostics

A NULL pointer is returned if the request cannot be completed (usually indicating that the process has run out of memory).

Back to wvlib encoding function index Last Updated: 20 August 1998