PureBriefLZ library

Overview

BriefLZ is a small and fast open source implementation of a Lempel-Ziv style compression algorithm. The main focus is on speed, but the ratios achieved are quite good compared to similar algorithms.

The compression code by default uses 1 mb (32-bit) of work memory during compression. The decompression code does not use any additional memory.

Libraries :
- PureBriefLZ_O : original C static library (v1.4)
- PureBriefLZ_W : purebasic wrapper library

Functions

BriefLZ_WorkMemSize(InputSize.l)

Computes the required size of the WorkMem buffer used by BriefLZ_Pack() for compressing InputSize bytes of data.

Returns the required size of the work buffer.
BriefLZ_MaxPackedSize(InputSize.l)

Computes the maximum possible compressed size possible  when compressing InputSize bytes of incompressible data.

Returns the maximum possible size of the compressed data.
BriefLZ_Pack(*Source, *Destination, Length.l, *WorkMem)

Compresses Length bytes of data from *Source into *Destination, using *WorkMem buffer for temporary storage.

Returns the length of the compressed data, or -1 on error. 

The *Destination buffer should be large enough to hold BriefLZ_MaxPackedSize(Length) bytes.
The *WorkMem buffer should be BriefLZ_WorkMemSize(Length) bytes large.
BriefLZ_Depack(*Source, *Destination, DepackedSize.l)

Decompresses the compressed data from *Source into *Destination.

Returns the length of the decompressed data, or -1 on error. 

The *Destination buffer must be large enough to hold the decompressed data.
The DepackedSize parameter is the size of the original uncompressed data.
BriefLZ_Crc32(*Source, Length.l, InitialCrc32.l)

Computes the CRC32 value of Length bytes of data from *Source.

Returns the CRC32 value. 

InitialCrc32 is used as the starting crc value, allowing the function to be used to checksum multiple blocks of memory as if they were one large block. Pass zero on the first call, and the current result on the following calls.