1370b324cSopenharmony_ciLZMA SDK 23.01
2370b324cSopenharmony_ci--------------
3370b324cSopenharmony_ci
4370b324cSopenharmony_ciLZMA SDK provides the documentation, samples, header files,
5370b324cSopenharmony_cilibraries, and tools you need to develop applications that 
6370b324cSopenharmony_ciuse 7z / LZMA / LZMA2 / XZ compression.
7370b324cSopenharmony_ci
8370b324cSopenharmony_ciLZMA is an improved version of famous LZ77 compression algorithm. 
9370b324cSopenharmony_ciIt was improved in way of maximum increasing of compression ratio,
10370b324cSopenharmony_cikeeping high decompression speed and low memory requirements for 
11370b324cSopenharmony_cidecompressing.
12370b324cSopenharmony_ci
13370b324cSopenharmony_ciLZMA2 is a LZMA based compression method. LZMA2 provides better 
14370b324cSopenharmony_cimultithreading support for compression than LZMA and some other improvements.
15370b324cSopenharmony_ci
16370b324cSopenharmony_ci7z is a file format for data compression and file archiving.
17370b324cSopenharmony_ci7z is a main file format for 7-Zip compression program (www.7-zip.org).
18370b324cSopenharmony_ci7z format supports different compression methods: LZMA, LZMA2 and others.
19370b324cSopenharmony_ci7z also supports AES-256 based encryption.
20370b324cSopenharmony_ci
21370b324cSopenharmony_ciXZ is a file format for data compression that uses LZMA2 compression.
22370b324cSopenharmony_ciXZ format provides additional features: SHA/CRC check, filters for 
23370b324cSopenharmony_ciimproved compression ratio, splitting to blocks and streams,
24370b324cSopenharmony_ci
25370b324cSopenharmony_ci
26370b324cSopenharmony_ci
27370b324cSopenharmony_ciLICENSE
28370b324cSopenharmony_ci-------
29370b324cSopenharmony_ci
30370b324cSopenharmony_ciLZMA SDK is written and placed in the public domain by Igor Pavlov.
31370b324cSopenharmony_ci
32370b324cSopenharmony_ciSome code in LZMA SDK is based on public domain code from another developers:
33370b324cSopenharmony_ci  1) PPMd var.H (2001): Dmitry Shkarin
34370b324cSopenharmony_ci  2) SHA-256: Wei Dai (Crypto++ library)
35370b324cSopenharmony_ci
36370b324cSopenharmony_ciAnyone is free to copy, modify, publish, use, compile, sell, or distribute the 
37370b324cSopenharmony_cioriginal LZMA SDK code, either in source code form or as a compiled binary, for 
38370b324cSopenharmony_ciany purpose, commercial or non-commercial, and by any means.
39370b324cSopenharmony_ci
40370b324cSopenharmony_ciLZMA SDK code is compatible with open source licenses, for example, you can 
41370b324cSopenharmony_ciinclude it to GNU GPL or GNU LGPL code.
42370b324cSopenharmony_ci
43370b324cSopenharmony_ci
44370b324cSopenharmony_ciLZMA SDK Contents
45370b324cSopenharmony_ci-----------------
46370b324cSopenharmony_ci
47370b324cSopenharmony_ci  Source code:
48370b324cSopenharmony_ci
49370b324cSopenharmony_ci    - C / C++ / C# / Java   - LZMA compression and decompression
50370b324cSopenharmony_ci    - C / C++               - LZMA2 compression and decompression
51370b324cSopenharmony_ci    - C / C++               - XZ compression and decompression
52370b324cSopenharmony_ci    - C                     - 7z decompression
53370b324cSopenharmony_ci    -     C++               - 7z compression and decompression
54370b324cSopenharmony_ci    - C                     - small SFXs for installers (7z decompression)
55370b324cSopenharmony_ci    -     C++               - SFXs and SFXs for installers (7z decompression)
56370b324cSopenharmony_ci
57370b324cSopenharmony_ci  Precomiled binaries:
58370b324cSopenharmony_ci
59370b324cSopenharmony_ci    - console programs for lzma / 7z / xz compression and decompression
60370b324cSopenharmony_ci    - SFX modules for installers.
61370b324cSopenharmony_ci
62370b324cSopenharmony_ci
63370b324cSopenharmony_ciUNIX/Linux version 
64370b324cSopenharmony_ci------------------
65370b324cSopenharmony_ciThere are several otpions to compile 7-Zip with different compilers: gcc and clang.
66370b324cSopenharmony_ciAlso 7-Zip code contains two versions for some critical parts of code: in C and in Assembeler.
67370b324cSopenharmony_ciSo if you compile the version with Assembeler code, you will get faster 7-Zip binary.
68370b324cSopenharmony_ci
69370b324cSopenharmony_ci7-Zip's assembler code uses the following syntax for different platforms:
70370b324cSopenharmony_ci
71370b324cSopenharmony_ci1) x86 and x86-64 (AMD64): MASM syntax. 
72370b324cSopenharmony_ci   There are 2 programs that supports MASM syntax in Linux.
73370b324cSopenharmony_ci'    'Asmc Macro Assembler and JWasm. But JWasm now doesn't support some 
74370b324cSopenharmony_ci      cpu instructions used in 7-Zip.
75370b324cSopenharmony_ci   So you must install Asmc Macro Assembler in Linux, if you want to compile fastest version
76370b324cSopenharmony_ci   of 7-Zip  x86 and x86-64:
77370b324cSopenharmony_ci     https://github.com/nidud/asmc
78370b324cSopenharmony_ci
79370b324cSopenharmony_ci2) arm64: GNU assembler for ARM64 with preprocessor. 
80370b324cSopenharmony_ci   That systax of that arm64 assembler code in 7-Zip is supported by GCC and CLANG for ARM64.
81370b324cSopenharmony_ci
82370b324cSopenharmony_ciThere are different binaries that can be compiled from 7-Zip source.
83370b324cSopenharmony_ciThere are 2 main files in folder for compiling:
84370b324cSopenharmony_ci  makefile        - that can be used for compiling Windows version of 7-Zip with nmake command
85370b324cSopenharmony_ci  makefile.gcc    - that can be used for compiling Linux/macOS versions of 7-Zip with make command
86370b324cSopenharmony_ci
87370b324cSopenharmony_ciAt first you must change the current folder to folder that contains `makefile.gcc`:
88370b324cSopenharmony_ci
89370b324cSopenharmony_ci  cd CPP/7zip/Bundles/Alone7z
90370b324cSopenharmony_ci
91370b324cSopenharmony_ciThen you can compile `makefile.gcc` with the command:
92370b324cSopenharmony_ci
93370b324cSopenharmony_ci  make -j -f makefile.gcc
94370b324cSopenharmony_ci
95370b324cSopenharmony_ciAlso there are additional "*.mak" files in folder "CPP/7zip/" that can be used to compile 
96370b324cSopenharmony_ci7-Zip binaries with optimized code and optimzing options.
97370b324cSopenharmony_ci
98370b324cSopenharmony_ciTo compile with GCC without assembler:
99370b324cSopenharmony_ci  cd CPP/7zip/Bundles/Alone7z
100370b324cSopenharmony_ci  make -j -f ../../cmpl_gcc.mak
101370b324cSopenharmony_ci
102370b324cSopenharmony_ciTo compile with CLANG without assembler:
103370b324cSopenharmony_ci  make -j -f ../../cmpl_clang.mak
104370b324cSopenharmony_ci
105370b324cSopenharmony_ciTo compile 7-Zip for x86-64 with asmc assembler:
106370b324cSopenharmony_ci  make -j -f ../../cmpl_gcc_x64.mak
107370b324cSopenharmony_ci
108370b324cSopenharmony_ciTo compile 7-Zip for arm64 with assembler:
109370b324cSopenharmony_ci  make -j -f ../../cmpl_gcc_arm64.mak
110370b324cSopenharmony_ci
111370b324cSopenharmony_ciTo compile 7-Zip for arm64 for macOS:
112370b324cSopenharmony_ci  make -j -f ../../cmpl_mac_arm64.mak
113370b324cSopenharmony_ci
114370b324cSopenharmony_ciAlso you can change some compiler options in the mak files:
115370b324cSopenharmony_ci  cmpl_gcc.mak
116370b324cSopenharmony_ci  var_gcc.mak
117370b324cSopenharmony_ci  warn_gcc.mak
118370b324cSopenharmony_ci
119370b324cSopenharmony_ci
120370b324cSopenharmony_ci
121370b324cSopenharmony_ciAlso you can use p7zip (port of 7-Zip for POSIX systems like Unix or Linux):
122370b324cSopenharmony_ci  
123370b324cSopenharmony_ci  http://p7zip.sourceforge.net/
124370b324cSopenharmony_ci
125370b324cSopenharmony_ci
126370b324cSopenharmony_ciFiles
127370b324cSopenharmony_ci-----
128370b324cSopenharmony_ci
129370b324cSopenharmony_ciDOC/7zC.txt          - 7z ANSI-C Decoder description
130370b324cSopenharmony_ciDOC/7zFormat.txt     - 7z Format description
131370b324cSopenharmony_ciDOC/installer.txt    - information about 7-Zip for installers
132370b324cSopenharmony_ciDOC/lzma.txt         - LZMA compression description
133370b324cSopenharmony_ciDOC/lzma-sdk.txt     - LZMA SDK description (this file)
134370b324cSopenharmony_ciDOC/lzma-history.txt - history of LZMA SDK
135370b324cSopenharmony_ciDOC/lzma-specification.txt - Specification of LZMA
136370b324cSopenharmony_ciDOC/Methods.txt      - Compression method IDs for .7z
137370b324cSopenharmony_ci
138370b324cSopenharmony_cibin/installer/   - example script to create installer that uses SFX module,
139370b324cSopenharmony_ci
140370b324cSopenharmony_cibin/7zdec.exe    - simplified 7z archive decoder
141370b324cSopenharmony_cibin/7zr.exe      - 7-Zip console program (reduced version)
142370b324cSopenharmony_cibin/x64/7zr.exe  - 7-Zip console program (reduced version) (x64 version)
143370b324cSopenharmony_cibin/lzma.exe     - file->file LZMA encoder/decoder for Windows
144370b324cSopenharmony_cibin/7zS2.sfx     - small SFX module for installers (GUI version)
145370b324cSopenharmony_cibin/7zS2con.sfx  - small SFX module for installers (Console version)
146370b324cSopenharmony_cibin/7zSD.sfx     - SFX module for installers.
147370b324cSopenharmony_ci
148370b324cSopenharmony_ci
149370b324cSopenharmony_ci7zDec.exe
150370b324cSopenharmony_ci---------
151370b324cSopenharmony_ci7zDec.exe is simplified 7z archive decoder.
152370b324cSopenharmony_ciIt supports only LZMA, LZMA2, and PPMd methods.
153370b324cSopenharmony_ci7zDec decodes whole solid block from 7z archive to RAM.
154370b324cSopenharmony_ciThe RAM consumption can be high.
155370b324cSopenharmony_ci
156370b324cSopenharmony_ci
157370b324cSopenharmony_ci
158370b324cSopenharmony_ci
159370b324cSopenharmony_ciSource code structure
160370b324cSopenharmony_ci---------------------
161370b324cSopenharmony_ci
162370b324cSopenharmony_ci
163370b324cSopenharmony_ciAsm/ - asm files (optimized code for CRC calculation and Intel-AES encryption)
164370b324cSopenharmony_ci
165370b324cSopenharmony_ciC/  - C files (compression / decompression and other)
166370b324cSopenharmony_ci  Util/
167370b324cSopenharmony_ci    7z       - 7z decoder program (decoding 7z files)
168370b324cSopenharmony_ci    Lzma     - LZMA program (file->file LZMA encoder/decoder).
169370b324cSopenharmony_ci    LzmaLib  - LZMA library (.DLL for Windows)
170370b324cSopenharmony_ci    SfxSetup - small SFX module for installers 
171370b324cSopenharmony_ci
172370b324cSopenharmony_ciCPP/ -- CPP files
173370b324cSopenharmony_ci
174370b324cSopenharmony_ci  Common  - common files for C++ projects
175370b324cSopenharmony_ci  Windows - common files for Windows related code
176370b324cSopenharmony_ci
177370b324cSopenharmony_ci  7zip    - files related to 7-Zip
178370b324cSopenharmony_ci
179370b324cSopenharmony_ci    Archive - files related to archiving
180370b324cSopenharmony_ci
181370b324cSopenharmony_ci      Common   - common files for archive handling
182370b324cSopenharmony_ci      7z       - 7z C++ Encoder/Decoder
183370b324cSopenharmony_ci
184370b324cSopenharmony_ci    Bundles  - Modules that are bundles of other modules (files)
185370b324cSopenharmony_ci  
186370b324cSopenharmony_ci      Alone7z       - 7zr.exe: Standalone 7-Zip console program (reduced version)
187370b324cSopenharmony_ci      Format7zExtractR  - 7zxr.dll: Reduced version of 7z DLL: extracting from 7z/LZMA/BCJ/BCJ2.
188370b324cSopenharmony_ci      Format7zR         - 7zr.dll:  Reduced version of 7z DLL: extracting/compressing to 7z/LZMA/BCJ/BCJ2
189370b324cSopenharmony_ci      LzmaCon       - lzma.exe: LZMA compression/decompression
190370b324cSopenharmony_ci      LzmaSpec      - example code for LZMA Specification
191370b324cSopenharmony_ci      SFXCon        - 7zCon.sfx: Console 7z SFX module
192370b324cSopenharmony_ci      SFXSetup      - 7zS.sfx: 7z SFX module for installers
193370b324cSopenharmony_ci      SFXWin        - 7z.sfx: GUI 7z SFX module
194370b324cSopenharmony_ci
195370b324cSopenharmony_ci    Common   - common files for 7-Zip
196370b324cSopenharmony_ci
197370b324cSopenharmony_ci    Compress - files for compression/decompression
198370b324cSopenharmony_ci
199370b324cSopenharmony_ci    Crypto   - files for encryption / decompression
200370b324cSopenharmony_ci
201370b324cSopenharmony_ci    UI       - User Interface files
202370b324cSopenharmony_ci         
203370b324cSopenharmony_ci      Client7z - Test application for 7za.dll, 7zr.dll, 7zxr.dll
204370b324cSopenharmony_ci      Common   - Common UI files
205370b324cSopenharmony_ci      Console  - Code for console program (7z.exe)
206370b324cSopenharmony_ci      Explorer    - Some code from 7-Zip Shell extension
207370b324cSopenharmony_ci      FileManager - Some GUI code from 7-Zip File Manager
208370b324cSopenharmony_ci      GUI         - Some GUI code from 7-Zip
209370b324cSopenharmony_ci
210370b324cSopenharmony_ci
211370b324cSopenharmony_ciCS/ - C# files
212370b324cSopenharmony_ci  7zip
213370b324cSopenharmony_ci    Common   - some common files for 7-Zip
214370b324cSopenharmony_ci    Compress - files related to compression/decompression
215370b324cSopenharmony_ci      LZ     - files related to LZ (Lempel-Ziv) compression algorithm
216370b324cSopenharmony_ci      LZMA         - LZMA compression/decompression
217370b324cSopenharmony_ci      LzmaAlone    - file->file LZMA compression/decompression
218370b324cSopenharmony_ci      RangeCoder   - Range Coder (special code of compression/decompression)
219370b324cSopenharmony_ci
220370b324cSopenharmony_ciJava/  - Java files
221370b324cSopenharmony_ci  SevenZip
222370b324cSopenharmony_ci    Compression    - files related to compression/decompression
223370b324cSopenharmony_ci      LZ           - files related to LZ (Lempel-Ziv) compression algorithm
224370b324cSopenharmony_ci      LZMA         - LZMA compression/decompression
225370b324cSopenharmony_ci      RangeCoder   - Range Coder (special code of compression/decompression)
226370b324cSopenharmony_ci
227370b324cSopenharmony_ci
228370b324cSopenharmony_ciNote: 
229370b324cSopenharmony_ci  Asm / C / C++ source code of LZMA SDK is part of 7-Zip's source code.
230370b324cSopenharmony_ci  7-Zip's source code can be downloaded from 7-Zip's SourceForge page:
231370b324cSopenharmony_ci
232370b324cSopenharmony_ci  http://sourceforge.net/projects/sevenzip/
233370b324cSopenharmony_ci
234370b324cSopenharmony_ci
235370b324cSopenharmony_ci
236370b324cSopenharmony_ciLZMA features
237370b324cSopenharmony_ci-------------
238370b324cSopenharmony_ci  - Variable dictionary size (up to 1 GB)
239370b324cSopenharmony_ci  - Estimated compressing speed: about 2 MB/s on 2 GHz CPU
240370b324cSopenharmony_ci  - Estimated decompressing speed: 
241370b324cSopenharmony_ci      - 20-30 MB/s on modern 2 GHz cpu
242370b324cSopenharmony_ci      - 1-2 MB/s on 200 MHz simple RISC cpu: (ARM, MIPS, PowerPC)
243370b324cSopenharmony_ci  - Small memory requirements for decompressing (16 KB + DictionarySize)
244370b324cSopenharmony_ci  - Small code size for decompressing: 5-8 KB
245370b324cSopenharmony_ci
246370b324cSopenharmony_ciLZMA decoder uses only integer operations and can be 
247370b324cSopenharmony_ciimplemented in any modern 32-bit CPU (or on 16-bit CPU with some conditions).
248370b324cSopenharmony_ci
249370b324cSopenharmony_ciSome critical operations that affect the speed of LZMA decompression:
250370b324cSopenharmony_ci  1) 32*16 bit integer multiply
251370b324cSopenharmony_ci  2) Mispredicted branches (penalty mostly depends from pipeline length)
252370b324cSopenharmony_ci  3) 32-bit shift and arithmetic operations
253370b324cSopenharmony_ci
254370b324cSopenharmony_ciThe speed of LZMA decompressing mostly depends from CPU speed.
255370b324cSopenharmony_ciMemory speed has no big meaning. But if your CPU has small data cache, 
256370b324cSopenharmony_cioverall weight of memory speed will slightly increase.
257370b324cSopenharmony_ci
258370b324cSopenharmony_ci
259370b324cSopenharmony_ciHow To Use
260370b324cSopenharmony_ci----------
261370b324cSopenharmony_ci
262370b324cSopenharmony_ciUsing LZMA encoder/decoder executable
263370b324cSopenharmony_ci--------------------------------------
264370b324cSopenharmony_ci
265370b324cSopenharmony_ciUsage:  LZMA <e|d> inputFile outputFile [<switches>...]
266370b324cSopenharmony_ci
267370b324cSopenharmony_ci  e: encode file
268370b324cSopenharmony_ci
269370b324cSopenharmony_ci  d: decode file
270370b324cSopenharmony_ci
271370b324cSopenharmony_ci  b: Benchmark. There are two tests: compressing and decompressing 
272370b324cSopenharmony_ci     with LZMA method. Benchmark shows rating in MIPS (million 
273370b324cSopenharmony_ci     instructions per second). Rating value is calculated from 
274370b324cSopenharmony_ci     measured speed and it is normalized with Intel's Core 2 results.
275370b324cSopenharmony_ci     Also Benchmark checks possible hardware errors (RAM 
276370b324cSopenharmony_ci     errors in most cases). Benchmark uses these settings:
277370b324cSopenharmony_ci     (-a1, -d21, -fb32, -mfbt4). You can change only -d parameter. 
278370b324cSopenharmony_ci     Also you can change the number of iterations. Example for 30 iterations:
279370b324cSopenharmony_ci       LZMA b 30
280370b324cSopenharmony_ci     Default number of iterations is 10.
281370b324cSopenharmony_ci
282370b324cSopenharmony_ci<Switches>
283370b324cSopenharmony_ci  
284370b324cSopenharmony_ci
285370b324cSopenharmony_ci  -a{N}:  set compression mode 0 = fast, 1 = normal
286370b324cSopenharmony_ci          default: 1 (normal)
287370b324cSopenharmony_ci
288370b324cSopenharmony_ci  d{N}:   Sets Dictionary size - [0, 30], default: 23 (8MB)
289370b324cSopenharmony_ci          The maximum value for dictionary size is 1 GB = 2^30 bytes.
290370b324cSopenharmony_ci          Dictionary size is calculated as DictionarySize = 2^N bytes. 
291370b324cSopenharmony_ci          For decompressing file compressed by LZMA method with dictionary 
292370b324cSopenharmony_ci          size D = 2^N you need about D bytes of memory (RAM).
293370b324cSopenharmony_ci
294370b324cSopenharmony_ci  -fb{N}: set number of fast bytes - [5, 273], default: 128
295370b324cSopenharmony_ci          Usually big number gives a little bit better compression ratio 
296370b324cSopenharmony_ci          and slower compression process.
297370b324cSopenharmony_ci
298370b324cSopenharmony_ci  -lc{N}: set number of literal context bits - [0, 8], default: 3
299370b324cSopenharmony_ci          Sometimes lc=4 gives gain for big files.
300370b324cSopenharmony_ci
301370b324cSopenharmony_ci  -lp{N}: set number of literal pos bits - [0, 4], default: 0
302370b324cSopenharmony_ci          lp switch is intended for periodical data when period is 
303370b324cSopenharmony_ci          equal 2^N. For example, for 32-bit (4 bytes) 
304370b324cSopenharmony_ci          periodical data you can use lp=2. Often it's better to set lc0, 
305370b324cSopenharmony_ci          if you change lp switch.
306370b324cSopenharmony_ci
307370b324cSopenharmony_ci  -pb{N}: set number of pos bits - [0, 4], default: 2
308370b324cSopenharmony_ci          pb switch is intended for periodical data 
309370b324cSopenharmony_ci          when period is equal 2^N.
310370b324cSopenharmony_ci
311370b324cSopenharmony_ci  -mf{MF_ID}: set Match Finder. Default: bt4. 
312370b324cSopenharmony_ci              Algorithms from hc* group doesn't provide good compression 
313370b324cSopenharmony_ci              ratio, but they often works pretty fast in combination with 
314370b324cSopenharmony_ci              fast mode (-a0).
315370b324cSopenharmony_ci
316370b324cSopenharmony_ci              Memory requirements depend from dictionary size 
317370b324cSopenharmony_ci              (parameter "d" in table below). 
318370b324cSopenharmony_ci
319370b324cSopenharmony_ci               MF_ID     Memory                   Description
320370b324cSopenharmony_ci
321370b324cSopenharmony_ci                bt2    d *  9.5 + 4MB  Binary Tree with 2 bytes hashing.
322370b324cSopenharmony_ci                bt3    d * 11.5 + 4MB  Binary Tree with 3 bytes hashing.
323370b324cSopenharmony_ci                bt4    d * 11.5 + 4MB  Binary Tree with 4 bytes hashing.
324370b324cSopenharmony_ci                hc4    d *  7.5 + 4MB  Hash Chain with 4 bytes hashing.
325370b324cSopenharmony_ci
326370b324cSopenharmony_ci  -eos:   write End Of Stream marker. By default LZMA doesn't write 
327370b324cSopenharmony_ci          eos marker, since LZMA decoder knows uncompressed size 
328370b324cSopenharmony_ci          stored in .lzma file header.
329370b324cSopenharmony_ci
330370b324cSopenharmony_ci  -si:    Read data from stdin (it will write End Of Stream marker).
331370b324cSopenharmony_ci  -so:    Write data to stdout
332370b324cSopenharmony_ci
333370b324cSopenharmony_ci
334370b324cSopenharmony_ciExamples:
335370b324cSopenharmony_ci
336370b324cSopenharmony_ci1) LZMA e file.bin file.lzma -d16 -lc0 
337370b324cSopenharmony_ci
338370b324cSopenharmony_cicompresses file.bin to file.lzma with 64 KB dictionary (2^16=64K)  
339370b324cSopenharmony_ciand 0 literal context bits. -lc0 allows to reduce memory requirements 
340370b324cSopenharmony_cifor decompression.
341370b324cSopenharmony_ci
342370b324cSopenharmony_ci
343370b324cSopenharmony_ci2) LZMA e file.bin file.lzma -lc0 -lp2
344370b324cSopenharmony_ci
345370b324cSopenharmony_cicompresses file.bin to file.lzma with settings suitable 
346370b324cSopenharmony_cifor 32-bit periodical data (for example, ARM or MIPS code).
347370b324cSopenharmony_ci
348370b324cSopenharmony_ci3) LZMA d file.lzma file.bin
349370b324cSopenharmony_ci
350370b324cSopenharmony_cidecompresses file.lzma to file.bin.
351370b324cSopenharmony_ci
352370b324cSopenharmony_ci
353370b324cSopenharmony_ciCompression ratio hints
354370b324cSopenharmony_ci-----------------------
355370b324cSopenharmony_ci
356370b324cSopenharmony_ciRecommendations
357370b324cSopenharmony_ci---------------
358370b324cSopenharmony_ci
359370b324cSopenharmony_ciTo increase the compression ratio for LZMA compressing it's desirable 
360370b324cSopenharmony_cito have aligned data (if it's possible) and also it's desirable to locate
361370b324cSopenharmony_cidata in such order, where code is grouped in one place and data is 
362370b324cSopenharmony_cigrouped in other place (it's better than such mixing: code, data, code,
363370b324cSopenharmony_cidata, ...).
364370b324cSopenharmony_ci
365370b324cSopenharmony_ci
366370b324cSopenharmony_ciFilters
367370b324cSopenharmony_ci-------
368370b324cSopenharmony_ciYou can increase the compression ratio for some data types, using
369370b324cSopenharmony_cispecial filters before compressing. For example, it's possible to 
370370b324cSopenharmony_ciincrease the compression ratio on 5-10% for code for those CPU ISAs: 
371370b324cSopenharmony_cix86, IA-64, ARM, ARM-Thumb, PowerPC, SPARC.
372370b324cSopenharmony_ci
373370b324cSopenharmony_ciYou can find C source code of such filters in C/Bra*.* files
374370b324cSopenharmony_ci
375370b324cSopenharmony_ciYou can check the compression ratio gain of these filters with such 
376370b324cSopenharmony_ci7-Zip commands (example for ARM code):
377370b324cSopenharmony_ciNo filter:
378370b324cSopenharmony_ci  7z a a1.7z a.bin -m0=lzma
379370b324cSopenharmony_ci
380370b324cSopenharmony_ciWith filter for little-endian ARM code:
381370b324cSopenharmony_ci  7z a a2.7z a.bin -m0=arm -m1=lzma        
382370b324cSopenharmony_ci
383370b324cSopenharmony_ciIt works in such manner:
384370b324cSopenharmony_ciCompressing    = Filter_encoding + LZMA_encoding
385370b324cSopenharmony_ciDecompressing  = LZMA_decoding + Filter_decoding
386370b324cSopenharmony_ci
387370b324cSopenharmony_ciCompressing and decompressing speed of such filters is very high,
388370b324cSopenharmony_ciso it will not increase decompressing time too much.
389370b324cSopenharmony_ciMoreover, it reduces decompression time for LZMA_decoding, 
390370b324cSopenharmony_cisince compression ratio with filtering is higher.
391370b324cSopenharmony_ci
392370b324cSopenharmony_ciThese filters convert CALL (calling procedure) instructions 
393370b324cSopenharmony_cifrom relative offsets to absolute addresses, so such data becomes more 
394370b324cSopenharmony_cicompressible.
395370b324cSopenharmony_ci
396370b324cSopenharmony_ciFor some ISAs (for example, for MIPS) it's impossible to get gain from such filter.
397370b324cSopenharmony_ci
398370b324cSopenharmony_ci
399370b324cSopenharmony_ci
400370b324cSopenharmony_ci---
401370b324cSopenharmony_ci
402370b324cSopenharmony_cihttp://www.7-zip.org
403370b324cSopenharmony_cihttp://www.7-zip.org/sdk.html
404370b324cSopenharmony_cihttp://www.7-zip.org/support.html
405