GCGlib  0.04.228
GCG Graphics Engine
General Run-Length Encoding

Functions

unsigned int gcgPackRLE8 (unsigned int fullsize, unsigned char *srcdata, unsigned char *RLEdata)
 Packs a 8 bit sequence as a Run-Lenght Encoded block. More...
 
unsigned int gcgUnpackRLE8 (unsigned char *RLEdata, unsigned char *dstdata)
 Decompress a 8 bit Run-Length Encoded data coded with gcgPackRLE8(). More...
 
unsigned int gcgPackRLE32 (unsigned int fullsize, unsigned char *srcdata, unsigned char *RLEdata)
 Packs a 32 bit sequence as a Run-Lenght Encoded block. The parameter srcdata MUST be 4 aligned <=> fullsize MUST be multiple of 4. More...
 
unsigned int gcgUnpackRLE32 (unsigned char *RLEdata, unsigned char *dstdata)
 Decompress a 32 bit Run-Length Encoded data coded with gcgPackRLE32(). More...
 

Detailed Description

Run Length Encoding is a simple technique used for data compression. GCGlib provides functions for 8 bits and 32 bits encoding/decoding using RLE.

Function Documentation

◆ gcgPackRLE32()

unsigned int gcgPackRLE32 ( unsigned int  fullsize,
unsigned char *  srcdata,
unsigned char *  RLEdata 
)

Packs a 32 bit sequence as a Run-Lenght Encoded block. The parameter srcdata MUST be 4 aligned <=> fullsize MUST be multiple of 4.

Parameters
[in]fullsizesize in bytes of the data stored in srcdata. It must be multiple of 4.
[in]srcdatapointer to the first byte of the 32bit sequence.
[out]RLEdatapointer to a buffer that has, at least, the same size of the source data fullsize. This buffer receives the compressed data if the compressed version is smaller than fullsize bytes. It might be changed even if the original data is smaller than the compressed version. First 4 bytes (unsigned int) of RLEdata receives its original size. Remaining bytes are the encoded data. It must be 4 aligned.
Returns
the size in bytes of the compressed block or 0, if the compressed version is greather than original data.
See also
gcgUnpackRLE32
Since
0.01.6

◆ gcgPackRLE8()

unsigned int gcgPackRLE8 ( unsigned int  fullsize,
unsigned char *  srcdata,
unsigned char *  RLEdata 
)

Packs a 8 bit sequence as a Run-Lenght Encoded block.

Parameters
[in]fullsizesize in bytes of the data stored in srcdata.
[in]srcdatapointer to the first byte of data.
[out]RLEdatapointer to a buffer that has, at least, the same size of the source data fullsize. This buffer receives the compressed data if the compressed version is smaller than fullsize bytes. It might be changed even if the original data is smaller than the compressed version. First 4 bytes (unsigned int) of RLEdata receives its original size. Remaining bytes are the encoded data.
Returns
the size in bytes of the compressed block or 0, if the compressed version is greather than original data.
See also
gcgUnpackRLE8
Since
0.01.6

◆ gcgUnpackRLE32()

unsigned int gcgUnpackRLE32 ( unsigned char *  RLEdata,
unsigned char *  dstdata 
)

Decompress a 32 bit Run-Length Encoded data coded with gcgPackRLE32().

Parameters
[in]RLEdatapointer to the first byte of the data, compressed using gcgPackRLE8(). Its First 4 bytes (unsigned int) indicates the original size in bytes.
[out]dstdatapointer to a buffer that has, at least, the same size in bytes of the original data as indicated by the first 4 bytes (unsigned int) of RLEdata.
Returns
the size in bytes of the uncompressed data or 0, if an error occurs during the decompression.
See also
gcgPackRLE32
Since
0.01.6

◆ gcgUnpackRLE8()

unsigned int gcgUnpackRLE8 ( unsigned char *  RLEdata,
unsigned char *  dstdata 
)

Decompress a 8 bit Run-Length Encoded data coded with gcgPackRLE8().

Parameters
[in]RLEdatapointer to the first byte of the data, compressed using gcgPackRLE8(). Its First 4 bytes (unsigned int) indicates the original size in bytes.
[out]dstdatapointer to a buffer that has, at least, the same size in bytes of the original data as indicated by the first 4 bytes (unsigned int) of RLEdata.
Returns
the size in bytes of the uncompressed data or 0, if an error occurs during the decompression.
See also
gcgPackRLE8
Since
0.01.6