Run-length encoding is a simple compression scheme. RLE replaces repeated elements, or "runs," with a single element and a count of how many times the element was repeated.
The RLE module is used by Tex to decode textures after reading them from the Memory Stick.
void rleDecode(const unsigned char *inBytes, unsigned inSize, unsigned char **outBytes, unsigned *outSize, unsigned elementSize)
Decodes the run-length encoded data in inBytes. The element size, specified by elementSize, must match the element size used to encode the data.
The decoded data is stored in outBytes, which will be allocated for you with malloc. The size of the decoded data is stored in outSize.
If an error occurs, outBytes is set to NULL.
void rleEncode(const unsigned char *inBytes, unsigned inSize, unsigned char **outBytes, unsigned *outSize, unsigned elementSize)
Encodes inBytes using RLE. The size of an element in bytes is specified by elementSize. The size of the input data, specified by inSize, must be divisible by elementSize.
The encoded data is stored in outBytes, which will be allocated for you with malloc. The size of the encoded data is stored in outSize.
If an error occurs, outBytes is set to NULL.