update libchdr
[pcsx_rearmed.git] / deps / libchdr / deps / lzma-22.01 / 7zC.txt
CommitLineData
9e052883 17z ANSI-C Decoder 9.35\r
2----------------------\r
3\r
47z ANSI-C provides 7z/LZMA decoding.\r
57z ANSI-C version is simplified version ported from C++ code.\r
6\r
7LZMA is default and general compression method of 7z format\r
8in 7-Zip compression program (www.7-zip.org). LZMA provides high \r
9compression ratio and very fast decompression.\r
10\r
11\r
12LICENSE\r
13-------\r
14\r
157z ANSI-C Decoder is part of the LZMA SDK.\r
16LZMA SDK is written and placed in the public domain by Igor Pavlov.\r
17\r
18Files\r
19---------------------\r
20\r
217zDecode.* - Low level 7z decoding\r
227zExtract.* - High level 7z decoding\r
237zHeader.* - .7z format constants\r
247zIn.* - .7z archive opening\r
257zItem.* - .7z structures\r
267zMain.c - Test application\r
27\r
28\r
29How To Use\r
30----------\r
31\r
32You can create .7z archive with 7z.exe, 7za.exe or 7zr.exe:\r
33\r
34 7z.exe a archive.7z *.htm -r -mx -m0fb=255\r
35\r
36If you have big number of files in archive, and you need fast extracting, \r
37you can use partly-solid archives:\r
38 \r
39 7za.exe a archive.7z *.htm -ms=512K -r -mx -m0fb=255 -m0d=512K\r
40\r
41In that example 7-Zip will use 512KB solid blocks. So it needs to decompress only \r
42512KB for extracting one file from such archive.\r
43\r
44\r
45Limitations of current version of 7z ANSI-C Decoder\r
46---------------------------------------------------\r
47\r
48 - It reads only "FileName", "Size", "LastWriteTime" and "CRC" information for each file in archive.\r
49 - It supports only LZMA and Copy (no compression) methods with BCJ or BCJ2 filters.\r
50 - It converts original UTF-16 Unicode file names to UTF-8 Unicode file names.\r
51 \r
52These limitations will be fixed in future versions.\r
53\r
54\r
55Using 7z ANSI-C Decoder Test application:\r
56-----------------------------------------\r
57\r
58Usage: 7zDec <command> <archive_name>\r
59\r
60<Command>:\r
61 e: Extract files from archive\r
62 l: List contents of archive\r
63 t: Test integrity of archive\r
64\r
65Example: \r
66\r
67 7zDec l archive.7z\r
68\r
69lists contents of archive.7z\r
70\r
71 7zDec e archive.7z\r
72\r
73extracts files from archive.7z to current folder.\r
74\r
75\r
76How to use .7z Decoder\r
77----------------------\r
78\r
79Memory allocation\r
80~~~~~~~~~~~~~~~~~\r
81\r
827z Decoder uses two memory pools:\r
831) Temporary pool\r
842) Main pool\r
85Such scheme can allow you to avoid fragmentation of allocated blocks.\r
86\r
87\r
88Steps for using 7z decoder\r
89--------------------------\r
90\r
91Use code at 7zMain.c as example.\r
92\r
931) Declare variables:\r
94 inStream /* implements ILookInStream interface */\r
95 CSzArEx db; /* 7z archive database structure */\r
96 ISzAlloc allocImp; /* memory functions for main pool */\r
97 ISzAlloc allocTempImp; /* memory functions for temporary pool */\r
98\r
992) call CrcGenerateTable(); function to initialize CRC structures.\r
100\r
1013) call SzArEx_Init(&db); function to initialize db structures.\r
102\r
1034) call SzArEx_Open(&db, inStream, &allocMain, &allocTemp) to open archive\r
104\r
105This function opens archive "inStream" and reads headers to "db".\r
106All items in "db" will be allocated with "allocMain" functions.\r
107SzArEx_Open function allocates and frees temporary structures by "allocTemp" functions.\r
108\r
1095) List items or Extract items\r
110\r
111 Listing code:\r
112 ~~~~~~~~~~~~~\r
113\r
114 Use SzArEx_GetFileNameUtf16 function. Look example code in C\Util\7z\7zMain.c file. \r
115 \r
116\r
117 Extracting code:\r
118 ~~~~~~~~~~~~~~~~\r
119\r
120 SZ_RESULT SzAr_Extract(\r
121 CArchiveDatabaseEx *db,\r
122 ILookInStream *inStream, \r
123 UInt32 fileIndex, /* index of file */\r
124 UInt32 *blockIndex, /* index of solid block */\r
125 Byte **outBuffer, /* pointer to pointer to output buffer (allocated with allocMain) */\r
126 size_t *outBufferSize, /* buffer size for output buffer */\r
127 size_t *offset, /* offset of stream for required file in *outBuffer */\r
128 size_t *outSizeProcessed, /* size of file in *outBuffer */\r
129 ISzAlloc *allocMain,\r
130 ISzAlloc *allocTemp);\r
131\r
132 If you need to decompress more than one file, you can send these values from previous call:\r
133 blockIndex, \r
134 outBuffer, \r
135 outBufferSize,\r
136 You can consider "outBuffer" as cache of solid block. If your archive is solid, \r
137 it will increase decompression speed.\r
138\r
139 After decompressing you must free "outBuffer":\r
140 allocImp.Free(outBuffer);\r
141\r
1426) call SzArEx_Free(&db, allocImp.Free) to free allocated items in "db".\r
143\r
144\r
145\r
146\r
147Memory requirements for .7z decoding \r
148------------------------------------\r
149\r
150Memory usage for Archive opening:\r
151 - Temporary pool:\r
152 - Memory for uncompressed .7z headers\r
153 - some other temporary blocks\r
154 - Main pool:\r
155 - Memory for database: \r
156 Estimated size of one file structures in solid archive:\r
157 - Size (4 or 8 Bytes)\r
158 - CRC32 (4 bytes)\r
159 - LastWriteTime (8 bytes)\r
160 - Some file information (4 bytes)\r
161 - File Name (variable length) + pointer + allocation structures\r
162\r
163Memory usage for archive Decompressing:\r
164 - Temporary pool:\r
165 - Memory for LZMA decompressing structures\r
166 - Main pool:\r
167 - Memory for decompressed solid block\r
168 - Memory for temprorary buffers, if BCJ2 fileter is used. Usually these \r
169 temprorary buffers can be about 15% of solid block size. \r
170 \r
171\r
1727z Decoder doesn't allocate memory for compressed blocks. \r
173Instead of this, you must allocate buffer with desired \r
174size before calling 7z Decoder. Use 7zMain.c as example.\r
175\r
176\r
177Defines\r
178-------\r
179\r
180_SZ_ALLOC_DEBUG - define it if you want to debug alloc/free operations to stderr.\r
181\r
182\r
183---\r
184\r
185http://www.7-zip.org\r
186http://www.7-zip.org/sdk.html\r
187http://www.7-zip.org/support.html\r