QuickLZ 1.5.x | ||||||||||
Home | | | Changelog | | | Testimonials | | | Order | | | Contact |
Please read following before using QuickLZ. Version 1.5.x supports following settings:
QLZ_COMPRESSION_LEVEL | Set to 1, 2 or 3. Level 1 gives the fastest compression
speed while level 3 gives the fastest decompression speed. |
QLZ_STREAMING_BUFFER |
Because LZ compression is
based on finding repeated strings, compression ratio can degrade if a
data entity is being split into smaller packets (less than 10 - 50
Kbytes) that are compressed individually. Set to 0 to disable streaming mode or to 100000 or 1000000 (suggested values) to enable and make QuickLZ store a history buffer of QLZ_STREAMING_BUFFER bytes in size. When enabled, data must be decompressed in the same order as it was compressed. Further issues apply - see the manual for the C version. |
QLZ_MEMORY_SAFE | If enabled, decompression of corrupted data cannot crash, meaning that it's guaranteed to terminate and guaranteed not to make spurious memory access. Enabling decreases decompression speed in the order of 15-20%. |
Because of performance reasons these settings cannot be specified dynamically at runtime. For the C version, they must be specified in the beginning of the quicklz.h file whereafter the library must be compiled. For the DLL version one DLL file exists for each permutation of settings. The C# and Java versions only offer a single setting.
Data must be decompressed with the same setting of QLZ_COMPRESSION_LEVEL and QLZ_STREAMING_BUFFER as it was compressed.
Data is mutually compatible between the C, DLL, C# and Java versions and between all architectures.
Manual for the C version. Also useful when using the DLL files | manual.html |
QuickLZ C
Version | 1.5.0 - 08-Jan-2011 | |
Library | quicklz.h | |
quicklz.c | ||
Manual | manual.html | |
Sample code | compress_file.c | |
decompress_file.c | ||
stream_compress.c | ||
stream_decompress.c |
This is the original C version. It has been extensively tested and bounds checked on on many 32- and 64-bit architectures such as x86, x64, UltraSPARC, MIPS, Itanium, PA-RISC, Alpha, Cell, POWER, 68k, ARM and SH4/5.
Its only dependency is string.h from which it's using size_t, memset() and memcpy().
QuickLZ C#
Version | 1.5.0 - 08-Jan-2011 | |
Library | QuickLZ.cs | |
C# stream wrapper |
QuickLZCompressionStream.cs QuickLZDecompressionStream.cs |
This is a native C# port using no unsafe code. Performance is less than the C and DLL versions.
So far, only a subset of the library has been ported, namely the setting:
QLZ_COMPRESSION_LEVEL = 1
or 3
QLZ_STREAMING_BUFFER = 0
QLZ_MEMORY_SAFE = 0
Usage is so simple it hardly needs description. Just call the functions byte[] compress(byte[] src) and byte[] decompress(byte[] src).
Because QLZ_MEMORY_SAFE is disabled you can place decompression in a try...catch block instead.
QuickLZ Java
Version | 1.5.0 - 08-Jan-2011 |
Library | QuickLZ.java |
This is a native Java port. Its description is exactly the same as for the C# version above.
QuickLZ DLL
Version | 1.5.0 - 08-Jan-2011 |
DLL files | 150dll.zip |
C# demo | csharp.zip |
Visual Basic 6 demo | vb6.zip |
Manual | manual.html |
The DLL files are compiled with each their setting:
The filename prefix '32' or '64' tells if it's compiled for 32-bit x86 Windows or 64-bit x64 Windows. The 32-bit DLLs are using the stdcall calling convention. The 64-bit DLLs are using the new x64 convention which is the only convention existing.
The next filename prefix '1', '2' or '3' tells the compression level QLZ_COMPRESSION_LEVEL.
If the filename contains '1000000' then QLZ_STREAMING_BUFFER = 1000000 (streaming mode enabled), otherwise QLZ_STREAMING_BUFFER = 0 (streaming mode disabled).
If the filename contains 'safe', then QLZ_MEMORY_SAFE is enabled, otherwise it's disabled.
The C# and Visual Basic 6 demos above include wrapper classes for easy and simple usage:
The DLL files are raw compilations of the C source quicklz.c - they give direct access to the C API and perform no memory allocation, wrapping or other services. So reading the C manual may be useful, especially if you are developing a wrapper for another language. Especially note that the scratch buffer arguments must be initially zero'ed out if in streaming mode.