--------------\r
\r
LZMA SDK provides the documentation, samples, header files,\r
-libraries, and tools you need to develop applications that \r
+libraries, and tools you need to develop applications that\r
use 7z / LZMA / LZMA2 / XZ compression.\r
\r
-LZMA is an improved version of famous LZ77 compression algorithm. \r
+LZMA is an improved version of famous LZ77 compression algorithm.\r
It was improved in way of maximum increasing of compression ratio,\r
-keeping high decompression speed and low memory requirements for \r
+keeping high decompression speed and low memory requirements for\r
decompressing.\r
\r
-LZMA2 is a LZMA based compression method. LZMA2 provides better \r
+LZMA2 is a LZMA based compression method. LZMA2 provides better\r
multithreading support for compression than LZMA and some other improvements.\r
\r
7z is a file format for data compression and file archiving.\r
7z also supports AES-256 based encryption.\r
\r
XZ is a file format for data compression that uses LZMA2 compression.\r
-XZ format provides additional features: SHA/CRC check, filters for \r
+XZ format provides additional features: SHA/CRC check, filters for\r
improved compression ratio, splitting to blocks and streams,\r
\r
\r
1) PPMd var.H (2001): Dmitry Shkarin\r
2) SHA-256: Wei Dai (Crypto++ library)\r
\r
-Anyone is free to copy, modify, publish, use, compile, sell, or distribute the \r
-original LZMA SDK code, either in source code form or as a compiled binary, for \r
+Anyone is free to copy, modify, publish, use, compile, sell, or distribute the\r
+original LZMA SDK code, either in source code form or as a compiled binary, for\r
any purpose, commercial or non-commercial, and by any means.\r
\r
-LZMA SDK code is compatible with open source licenses, for example, you can \r
+LZMA SDK code is compatible with open source licenses, for example, you can\r
include it to GNU GPL or GNU LGPL code.\r
\r
\r
- SFX modules for installers.\r
\r
\r
-UNIX/Linux version \r
+UNIX/Linux version\r
------------------\r
To compile C++ version of file->file LZMA encoding, go to directory\r
CPP/7zip/Bundles/LzmaCon\r
make -f makefile.gcc clean all\r
\r
In some UNIX/Linux versions you must compile LZMA with static libraries.\r
-To compile with static libraries, you can use \r
+To compile with static libraries, you can use\r
LIB = -lm -static\r
\r
Also you can use p7zip (port of 7-Zip for POSIX systems like Unix or Linux):\r
- \r
+\r
http://p7zip.sourceforge.net/\r
\r
\r
7z - 7z decoder program (decoding 7z files)\r
Lzma - LZMA program (file->file LZMA encoder/decoder).\r
LzmaLib - LZMA library (.DLL for Windows)\r
- SfxSetup - small SFX module for installers \r
+ SfxSetup - small SFX module for installers\r
\r
CPP/ -- CPP files\r
\r
7z - 7z C++ Encoder/Decoder\r
\r
Bundles - Modules that are bundles of other modules (files)\r
- \r
+\r
Alone7z - 7zr.exe: Standalone 7-Zip console program (reduced version)\r
Format7zExtractR - 7zxr.dll: Reduced version of 7z DLL: extracting from 7z/LZMA/BCJ/BCJ2.\r
Format7zR - 7zr.dll: Reduced version of 7z DLL: extracting/compressing to 7z/LZMA/BCJ/BCJ2\r
Crypto - files for encryption / decompression\r
\r
UI - User Interface files\r
- \r
+\r
Client7z - Test application for 7za.dll, 7zr.dll, 7zxr.dll\r
Common - Common UI files\r
Console - Code for console program (7z.exe)\r
RangeCoder - Range Coder (special code of compression/decompression)\r
\r
\r
-Note: \r
+Note:\r
Asm / C / C++ source code of LZMA SDK is part of 7-Zip's source code.\r
7-Zip's source code can be downloaded from 7-Zip's SourceForge page:\r
\r
-------------\r
- Variable dictionary size (up to 1 GB)\r
- Estimated compressing speed: about 2 MB/s on 2 GHz CPU\r
- - Estimated decompressing speed: \r
+ - Estimated decompressing speed:\r
- 20-30 MB/s on modern 2 GHz cpu\r
- 1-2 MB/s on 200 MHz simple RISC cpu: (ARM, MIPS, PowerPC)\r
- Small memory requirements for decompressing (16 KB + DictionarySize)\r
- Small code size for decompressing: 5-8 KB\r
\r
-LZMA decoder uses only integer operations and can be \r
+LZMA decoder uses only integer operations and can be\r
implemented in any modern 32-bit CPU (or on 16-bit CPU with some conditions).\r
\r
Some critical operations that affect the speed of LZMA decompression:\r
3) 32-bit shift and arithmetic operations\r
\r
The speed of LZMA decompressing mostly depends from CPU speed.\r
-Memory speed has no big meaning. But if your CPU has small data cache, \r
+Memory speed has no big meaning. But if your CPU has small data cache,\r
overall weight of memory speed will slightly increase.\r
\r
\r
\r
d: decode file\r
\r
- b: Benchmark. There are two tests: compressing and decompressing \r
- with LZMA method. Benchmark shows rating in MIPS (million \r
- instructions per second). Rating value is calculated from \r
+ b: Benchmark. There are two tests: compressing and decompressing\r
+ with LZMA method. Benchmark shows rating in MIPS (million\r
+ instructions per second). Rating value is calculated from\r
measured speed and it is normalized with Intel's Core 2 results.\r
- Also Benchmark checks possible hardware errors (RAM \r
+ Also Benchmark checks possible hardware errors (RAM\r
errors in most cases). Benchmark uses these settings:\r
- (-a1, -d21, -fb32, -mfbt4). You can change only -d parameter. \r
+ (-a1, -d21, -fb32, -mfbt4). You can change only -d parameter.\r
Also you can change the number of iterations. Example for 30 iterations:\r
LZMA b 30\r
Default number of iterations is 10.\r
\r
<Switches>\r
- \r
+\r
\r
-a{N}: set compression mode 0 = fast, 1 = normal\r
default: 1 (normal)\r
\r
d{N}: Sets Dictionary size - [0, 30], default: 23 (8MB)\r
The maximum value for dictionary size is 1 GB = 2^30 bytes.\r
- Dictionary size is calculated as DictionarySize = 2^N bytes. \r
- For decompressing file compressed by LZMA method with dictionary \r
+ Dictionary size is calculated as DictionarySize = 2^N bytes.\r
+ For decompressing file compressed by LZMA method with dictionary\r
size D = 2^N you need about D bytes of memory (RAM).\r
\r
-fb{N}: set number of fast bytes - [5, 273], default: 128\r
- Usually big number gives a little bit better compression ratio \r
+ Usually big number gives a little bit better compression ratio\r
and slower compression process.\r
\r
-lc{N}: set number of literal context bits - [0, 8], default: 3\r
Sometimes lc=4 gives gain for big files.\r
\r
-lp{N}: set number of literal pos bits - [0, 4], default: 0\r
- lp switch is intended for periodical data when period is \r
- equal 2^N. For example, for 32-bit (4 bytes) \r
- periodical data you can use lp=2. Often it's better to set lc0, \r
+ lp switch is intended for periodical data when period is\r
+ equal 2^N. For example, for 32-bit (4 bytes)\r
+ periodical data you can use lp=2. Often it's better to set lc0,\r
if you change lp switch.\r
\r
-pb{N}: set number of pos bits - [0, 4], default: 2\r
- pb switch is intended for periodical data \r
+ pb switch is intended for periodical data\r
when period is equal 2^N.\r
\r
- -mf{MF_ID}: set Match Finder. Default: bt4. \r
- Algorithms from hc* group doesn't provide good compression \r
- ratio, but they often works pretty fast in combination with \r
+ -mf{MF_ID}: set Match Finder. Default: bt4.\r
+ Algorithms from hc* group doesn't provide good compression\r
+ ratio, but they often works pretty fast in combination with\r
fast mode (-a0).\r
\r
- Memory requirements depend from dictionary size \r
- (parameter "d" in table below). \r
+ Memory requirements depend from dictionary size\r
+ (parameter "d" in table below).\r
\r
MF_ID Memory Description\r
\r
bt4 d * 11.5 + 4MB Binary Tree with 4 bytes hashing.\r
hc4 d * 7.5 + 4MB Hash Chain with 4 bytes hashing.\r
\r
- -eos: write End Of Stream marker. By default LZMA doesn't write \r
- eos marker, since LZMA decoder knows uncompressed size \r
+ -eos: write End Of Stream marker. By default LZMA doesn't write\r
+ eos marker, since LZMA decoder knows uncompressed size\r
stored in .lzma file header.\r
\r
-si: Read data from stdin (it will write End Of Stream marker).\r
\r
Examples:\r
\r
-1) LZMA e file.bin file.lzma -d16 -lc0 \r
+1) LZMA e file.bin file.lzma -d16 -lc0\r
\r
-compresses file.bin to file.lzma with 64 KB dictionary (2^16=64K) \r
-and 0 literal context bits. -lc0 allows to reduce memory requirements \r
+compresses file.bin to file.lzma with 64 KB dictionary (2^16=64K)\r
+and 0 literal context bits. -lc0 allows to reduce memory requirements\r
for decompression.\r
\r
\r
2) LZMA e file.bin file.lzma -lc0 -lp2\r
\r
-compresses file.bin to file.lzma with settings suitable \r
+compresses file.bin to file.lzma with settings suitable\r
for 32-bit periodical data (for example, ARM or MIPS code).\r
\r
3) LZMA d file.lzma file.bin\r
Recommendations\r
---------------\r
\r
-To increase the compression ratio for LZMA compressing it's desirable \r
+To increase the compression ratio for LZMA compressing it's desirable\r
to have aligned data (if it's possible) and also it's desirable to locate\r
-data in such order, where code is grouped in one place and data is \r
+data in such order, where code is grouped in one place and data is\r
grouped in other place (it's better than such mixing: code, data, code,\r
data, ...).\r
\r
Filters\r
-------\r
You can increase the compression ratio for some data types, using\r
-special filters before compressing. For example, it's possible to \r
-increase the compression ratio on 5-10% for code for those CPU ISAs: \r
+special filters before compressing. For example, it's possible to\r
+increase the compression ratio on 5-10% for code for those CPU ISAs:\r
x86, IA-64, ARM, ARM-Thumb, PowerPC, SPARC.\r
\r
You can find C source code of such filters in C/Bra*.* files\r
\r
-You can check the compression ratio gain of these filters with such \r
+You can check the compression ratio gain of these filters with such\r
7-Zip commands (example for ARM code):\r
No filter:\r
7z a a1.7z a.bin -m0=lzma\r
\r
With filter for little-endian ARM code:\r
- 7z a a2.7z a.bin -m0=arm -m1=lzma \r
+ 7z a a2.7z a.bin -m0=arm -m1=lzma\r
\r
It works in such manner:\r
Compressing = Filter_encoding + LZMA_encoding\r
\r
Compressing and decompressing speed of such filters is very high,\r
so it will not increase decompressing time too much.\r
-Moreover, it reduces decompression time for LZMA_decoding, \r
+Moreover, it reduces decompression time for LZMA_decoding,\r
since compression ratio with filtering is higher.\r
\r
-These filters convert CALL (calling procedure) instructions \r
-from relative offsets to absolute addresses, so such data becomes more \r
+These filters convert CALL (calling procedure) instructions\r
+from relative offsets to absolute addresses, so such data becomes more\r
compressible.\r
\r
For some ISAs (for example, for MIPS) it's impossible to get gain from such filter.\r