Most decompressors require RAM again amply, up to 256kB, reached not even 20 percent the data over the Huffman-table to decompress or the pack council about for example.
The LZFG-decompressor module requires exactly 4kB RAM once, that become dynamically allocate in term. Furthermore the code is very compact and the packer reaches amazing 40 ..55 percent with the pile of an application.
As transfer parameters, the here introduced decompressor requires the address of the packed record, the length of this record as well as two pointers for address decompressed record, becomes dynamically allocated internally, and length of the same.
It is tested within the moduls whether it is about a compatible LZFG-datastream and whether the length and the CRC16 of the decompressed data are identically the values deposited in the LZFG-datastream.
User-Functions:
LZFG-Decompressor: | |
LZFG_Decomp | decompress the datafield |
Error-Codes:
Name | Decimal_Value | Description |
LZFG_SUCCESS | 0 | decompress successfully |
LZFG_noLZFG | 130 | Data are not in the necessary format |
LZFG_lenERR | 131 | length error |
LZFG_crcERR | 132 | CRC error |
LZFG_memERR | 133 | error in allocation of the window or destination memory |
pC/LZFG - Decompressor
LZFG_Decomp
Decompress the handed over record examination of the expansions CRC-16 and length of the original after the LZFG-Mode inclusive.
Parameters
*source | pointer to compressed data |
source_l | lenght of compressed data |
**dest_pp | pointer to get the position of decompressed data |
*dest_l | pointer to get the lenght of decompressed data |
Return Value
LZFG_SUCCESS | decompress successfully |
LZFG_noLZFG | Data are not in the necessary format |
LZFG_lenERR | Longitudinal mistakes |
LZFG_crcERR | CRC error |
LZFG_memERR | Mistakes in allocation of the window or destination memory |
Example