BPack

Functions

BPack

~BPack

void

InitWrite

void

InitRead

void

Put

int

Get

int

NumBytes

void

SetCanReallocate

int

GetStatus

void

SwapBytes

Detailed Description

class BPack

The BPack class is very similar to BByteStream, but without the restrictions on bits_per_sample. BPack supports anything in the range of 2-31. I haven’t done the benchmarks to determine which is faster for the values of bits_per_sample that both classes support (9,10,12). I suspect that the answer to that question would be platform-dependent, but I have no hard data to back that up.

This class is based on a subset of the functions in BVarStream. Unlike BVarStream, however, this class is meant to encode samples of fixed length.

Public Functions

inline BPack()
inline ~BPack()
inline void InitWrite(int size, void *pointer)

We already have a buffer that we would like to use varstream to fill w/ data. matching this call with a vsfree is unnecessary (but would do no harm). pointer must be 4-byte aligned.

inline void InitRead(int size, void const *pointer)

We have a buffer that we would like to use varstream to read from. matching this call with a vsfree is unnecessary (but would do no harm). pointer must be 4-byte aligned.

inline void Put(int numbits, int val)
inline int Get(int numbits)
inline int NumBytes() const
inline void SetCanReallocate(int val)
inline int GetStatus() const
inline void SwapBytes()

Account for big endian systems. Call after the last Put() or before the first Get()