The Nebula Device 3: Util::RunLengthCodec Class Reference

The Nebula Device 3

Util::RunLengthCodec Class Reference

#include <runlengthcodec.h>


Detailed Description

A simple byte-based runlength encoder/decoder. Note that the encoded size may actually be bigger then the original size for random data!

(C) 2008 Radon Labs GmbH

Static Public Member Functions

static SizeT GetSafeRLEBufferSize (SizeT srcBufferSize)
 get a safe size for the destination buffer
static SizeT ComputeDecodedSize (const uchar *srcPtr, SizeT srcNumBytes)
 compute the decoded byte size from an RLE encoded stream
static SizeT Encode (const uchar *srcPtr, SizeT srcNumBytes, uchar *dstPtr, SizeT dstNumBytes)
 encode byte buffer to RLE stream, returns size of RLE stream
static SizeT Decode (const uchar *srcPtr, SizeT srcNumBytes, uchar *dstPtr, SizeT dstNumBytes)
 decode RLE stream to byte buffer

Member Function Documentation

SizeT Util::RunLengthCodec::GetSafeRLEBufferSize ( SizeT  srcBufferSize  )  [static]

get a safe size for the destination buffer

Get some safe destination buffer size for runlength-encoding. This actually can be up to twice as big as the source buffer for completely random data!