Overview
LZMA SDK features:- License: Public domain (no restrictions)
- Languages: C, C++, C#, Java
- Algorithms: LZMA, LZMA2
- Size: ~50 KB compiled
- Speed: Very fast decompression
- Ratio: Excellent compression
LZMA SDK is written and placed in the public domain by Igor Pavlov. You can use it freely without any restrictions.
Download
The LZMA SDK is available at:- 7-zip.org/sdk.html
- Included in 7-Zip source:
C/directory
Core Files
LZMA Encoder
LZMA Decoder
Common Files
LZMA Encoder API
Encoder Properties
FromLzmaEnc.h (lines 20-34):
Initialization
Compression Example
LZMA Decoder API
Decoder State
FromLzmaDec.h (lines 70-85):
Decompression Example
Simplified API
LzmaLib - Single Function Interface
FromLzmaLib.h:
Simple Compression Example
Simple Decompression Example
LZMA2 API
LZMA2 Encoder
LZMA2 Decoder
Memory Allocation
Custom Allocator
Default Allocators
FromAlloc.c:
Compression Parameters
Dictionary Size
Literal Context Bits (lc)
- Default:
3 - Range:
0-8 - Higher = better compression for text, more memory
Literal Position Bits (lp)
- Default:
0 - Range:
0-4 - For aligned data (executables):
2
Position Bits (pb)
- Default:
2 - Range:
0-4 - For aligned data:
2
Fast Bytes (fb)
- Default:
32 - Range:
5-273 - Higher = better compression, slower encoding
- Recommended:
64or273for maximum compression
Error Codes
From7zTypes.h: