Japanese
PROGRAMMER'S GUIDECompression/decompression library
BackForward
Compression/decompression library/2. reference

2.2 Function list

The following table lists the functions of the decompression library.

Table 2.3 List of functions of data decompression library
 function
 function name
 number
 run length extension
 CMP_DecRunlen
 1
 Run length extension/BYTE unit
 CMP_DecRunlenByte
 1.1
 Run length extension/WORD unit
 CMP_DecRunlenWord
 1.2
 Run length extension/DWORD unit
 CMP_DecRunlenDword
 1.3 

2.3 Function specifications


 one
View
table
 Title

function specification

 Function

run length extension

 Function name

CMP_DecRunlen

 No

1

Format
Sint32 CMP_DecRunlen(void *in, void **out, Sint32 size)
argument
 in (input)
 : Compressed data input buffer pointer.
 out (input)
 : Address of decompressed data output buffer pointer.
  (output)
 : Pointer to the end of decompressed data output.
 bufsize(input)
 :Output buffer size [BYTE].
Return value
Processing result
 CMP_DEC_OK ( 0)
 :normal termination. The input data has been expanded to the end.
 CMP_DEC_STOP ( 1)
 : Decompression processing interrupted. Extended by the output buffer size.
 CMP_DEC_ERR (-1)
 :abnormal termination. Input data is abnormal.
 CMP_DEC_ERR_H_ALGO(-2)
 :abnormal termination. This is an unsupported algorithm.
 CMP_DEC_ERR_H_UNIT(-3)
 :abnormal termination. This is an unsupported processing unit.
function
Decompress compressed data.
Processes compressed data using the system's run-length compression tool CMPRUN.EXE.
This function interprets the headers of the input data and invokes a decompression function that matches the compression parameters.

Read compressed data from in.
Write the decompressed data to *out. *out is post-incremented every time a byte is written.
The user can find out the size of the expanded data from the difference between the *out value set before startup and the *out value after startup.
If the decompressed data exceeds bufsze [byte], processing will be interrupted at that point. Even if the process is interrupted, the correct decompressed data for the buffer size is written to the output buffer.

Note
Both input and output buffers are allocated by the user. The start address of each buffer must match the start address of a 4-byte boundary. The output buffer must be large enough to accommodate the decompressed data and must be an integer multiple of the number of bytes processed.
remarks
Figure 2.1 Explanation of stretch function arguments
In (input) 
↓ 
─┬─┬─┬─┬─┬─ ─ ─ ─┬─┬─┬─┬─ 
Input buffer │■│■│■│■│・・・・・・・・・│■│■│■│ 
─┴─┴─┴─┴─┴─ ─ ─ ─┴─┴─┴─┴── 
 
│←──────────────bufsize────────────────→│ 
─┬─┬─┬─┬─┬─ ─ ─ ─┬─┬─┬─┬─┬─┬─┬──┬─┬─┬─┬─ 
Output buffer │□│□│□│□│・・・・・・・│□│□│□│□│□│ │・・・│ │ │ │ 
─┴─┴─┴─┴─┴─ ─ ─ ─┴─┴─┴─┴─┴─┴─┴───┴─┴─┴─┴─ 
↑ ↑ 
*out (input) out (output) 

 one
View
table
 Title

function specification

 Function

Run length extension/BYTE unit

 Function name

CMP_DecRunlenByte

 No

1.1

Format
Sint32 CMP_DecRunlenByte(void *in, void **out, Sint32 size)
argument
 in (input)
 : Compressed data input buffer pointer.
 out (input)
 : Address of decompressed data output buffer pointer.
  (output)
 : Pointer to the end of decompressed data output.
 bufsize(input)
 :Output buffer size [BYTE].
Return value
Processing result
 CMP_DEC_OK( 0)
 :normal termination. The input data has been expanded to the end.
 CMP_DEC_STOP( 1)
 : Decompression processing interrupted. Extended by the output buffer size.
 CMP_DEC_ERR(-1)
 :abnormal termination. Input data is abnormal.
 CMP_DEC_ERR_H_ALGO(-2)
 :abnormal termination. This is an unsupported algorithm.
 CMP_DEC_ERR_H_UNIT(-3)
 :abnormal termination. This is an unsupported processing unit.
function
Decompress compressed data.
Run length, processing unit Processes compressed data in BYTE.
Read compressed data from in.
Write the decompressed data to *out. *out is post-incremented every time a byte is written. The user can know the size of the expanded data from the difference between the *out value set before startup and the *out value after startup.
If the decompressed data exceeds bufsze [byte], processing will be interrupted at that point. Even if the process is interrupted, the correct decompressed data for the buffer size is written to the output buffer.
Note
Both input and output buffers are allocated by the user. The start address of each buffer must match the start address of a 4-byte boundary.
The output buffer must be large enough to accommodate the decompressed data and must be an integer multiple of the number of bytes processed.
remarks
The function interface is the same as CMP_DecRunlen() . See Figure 2.1 .

 one
View
table
 Title

function specification

 Function

Run length extension/WORD unit

 Function name

CMP_DecRunlenWord

 No

1.2

Format
Sint32 CMP_DecRunlenWord(void *in, void **out, Sint32 size)
argument
 in (input)
 : Compressed data input buffer pointer.
 out (input)
 : Address of decompressed data output buffer pointer.
 (output)
 : Pointer to the end of decompressed data output.
 bufsize(input)
 :Output buffer size [BYTE].
Return value
Processing result
 CMP_DEC_OK( 0)
 :normal termination. The input data has been expanded to the end.
 CMP_DEC_STOP( 1)
 : Decompression processing interrupted. Extended by the output buffer size.
 CMP_DEC_ERR(-1)
 :abnormal termination. Input data is abnormal.
 CMP_DEC_ERR_H_ALGO(-2)
 :abnormal termination. This is an unsupported algorithm.
 CMP_DEC_ERR_H_UNIT(-3)
 :abnormal termination. This is an unsupported processing unit.
function
Decompress compressed data.
Processes data compressed by run length, processing unit WORD.
Read compressed data from in.
Write the decompressed data to *out. *out is post-incremented every time a byte is written.
The user can find out the size of the expanded data from the difference between the *out value set before startup and the *out value after startup.
If the decompressed data exceeds bufsze [byte], processing will be interrupted at that point.
Even if the process is interrupted, the correct decompressed data for the buffer size is written to the output buffer.
Note
Both input and output buffers are allocated by the user.
The start address of each buffer must match the start address of a 4-byte boundary.
The output buffer must be large enough to accommodate the decompressed data and must be an integer multiple of the number of bytes processed.
remarks
The function interface is the same as CMP_DecRunlen() . See Figure 2.1 .

 one
View
table
 Title

function specification

 Function

Run length extension/DWORD unit

 Function name

CMP_DecRunlenDword

 No

1.3

Format
Sint32 CMP_DecRunlenDword(void *in, void **out, Sint32 size)
argument
in (input): Compressed data input buffer pointer.
out (input): Address of decompressed data output buffer pointer.
       (Output): Decompressed data output end pointer.
bufsize(input): Output buffer size [BYTE].
Return value (processing result)
CMP_DEC_OK(0): Normal end. The input data has been expanded to the end.
CMP_DEC_STOP( 1): Stops decompression processing. Extended by the output buffer size.
CMP_DEC_ERR(-1): Abnormal termination. Input data is abnormal.
CMP_DEC_ERR_H_ALGO(-2): Abnormal termination. This is an unsupported algorithm.
CMP_DEC_ERR_H_UNIT(-3): Abnormal termination. This is an unsupported processing unit.
function
Decompress compressed data.
Processes data compressed by run length, processing unit DWORD.
Read compressed data from in.
Write the decompressed data to *out. *out is post-incremented every time a byte is written. The user can find out the size of the expanded data from the difference between the *out value set before startup and the *out value after startup.
If the decompressed data exceeds bufsze [byte], processing will be interrupted at that point. Even if the process is interrupted, the correct decompressed data for the buffer size is written to the output buffer.
Note
Both input and output buffers are allocated by the user. The start address of each buffer must match the start address of a 4-byte boundary.
The output buffer must be large enough to accommodate the decompressed data and must be an integer multiple of the number of bytes processed.
remarks
The function interface is the same as CMP_DecRunlen() . See Figure 2.1 .

BackForward
PROGRAMMER'S GUIDECompression/decompression library
Copyright SEGA ENTERPRISES, LTD., 1997