★ PROGRAMMER'S GUIDE ★ Compression / decompression library




in: Input buffer start address. Align with 4-byte boundaries. out: Output buffer start address. Align with 4-byte boundaries. bufsize: Output buffer size. An integer multiple of the number of processing unit bytes.
Figure 1.5 Module configuration
#include "cmplib.h"
/ * Compressed by the compressed data run length method,
Convert to compressed file data with binary text converter * /
char comdata [] = {
0x10, 0x01, 0x04, ・ ・ ・ ・ ・ ・ ・ ・
::
::
::
}
/ * Decompressed data buffer (make sure that the size is not smaller than the size before compression.) * /
char outputbuf [4096];
::
::
::
−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−–
main ()
{
/ * Decompressed data pointer * /
char * buf;
/ * Set at the beginning of the decompressed data buffer * /
bufp = outputbuf;
/ * Run-length dictionary extension * /
CMP_DecRunlen (cmpdata, & bufp, sizeof (outputbuf));
/ * Use of decompression data * /
::
::
::
}
#include "sega_gfs.h"
#include "cmplib.h"
/ * File read buffer * /
Uint8 readbuf [READ_SIZE]
/ * Decompressed data buffer * /
Uint8 outputbuf [4096]
−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−–
main ()
{
GfsFid fid; / * File size identifier * /
Sint32 fsize; / * File size * /
char * bufp;
fid = 5; / * Specify compressed data file identifier * /
/ * Bulk reading of files * /
fsize = GFS_Load (fid, 0, readbuf, READBUF_SIZE);
/ * Set at the beginning of the decompressed data buffer * /
bufp = outputbuf;
/ * Run-length extension * /
CMP_DecRanlen (readbuf, & bufp, sizeof (outoutbuf));
/ * Use of decompression data * /
::
::
::
}
★ PROGRAMMER'S GUIDE ★ Compression / decompression library