in: Input buffer start address. Align to 4-byte boundaries. out: Output buffer start address. Align to 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"
/* Compress using the compressed data run-length method,
Convert to compressed file data with binary text converter */
char comdata[] = {
0x10, 0x01, 0x04, ・・・・・・・・・
:
:
:
}
/* Decompression data buffer (secure a size not smaller than the size before compression) */
char outputbuf[4096];
:
:
:
−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
main()
{
/* Decompression data pointer */
char *buf;
/* Set at the beginning of the decompressed data buffer */
bufp = outputbuf;
/* Run-length dictionary expansion */
CMP_DecRunlen(cmpdata, &bufp, sizeof(outputbuf));
/* Use decompressed data */
:
:
:
}
#include "sega_gfs.h"
#include "cmplib.h"
/* File reading buffer */
Uint8 readbuf[READ_SIZE]
/* Decompression data buffer */
Uint8 outputbuf[4096]
−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
main()
{
GfsFid fid; /* File size identifier */
Sint32 fsize; /* file size */
char *bufp;
fid = 5; /* Specify compressed data file identifier */
/* Batch loading 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 decompressed data */
:
:
:
}
★ PROGRAMMER'S GUIDE ★ Compression/decompression library


