chd 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (109) hide show
  1. checksums.yaml +7 -0
  2. data/README.md +30 -0
  3. data/chd.gemspec +29 -0
  4. data/ext/chd.c +1008 -0
  5. data/ext/extconf.rb +60 -0
  6. data/lib/chd/cd.rb +272 -0
  7. data/lib/chd/metadata.rb +196 -0
  8. data/lib/chd/version.rb +4 -0
  9. data/lib/chd.rb +21 -0
  10. data/libchdr/CMakeLists.txt +104 -0
  11. data/libchdr/LICENSE.txt +24 -0
  12. data/libchdr/README.md +7 -0
  13. data/libchdr/deps/lzma-19.00/CMakeLists.txt +33 -0
  14. data/libchdr/deps/lzma-19.00/LICENSE +3 -0
  15. data/libchdr/deps/lzma-19.00/include/7zTypes.h +375 -0
  16. data/libchdr/deps/lzma-19.00/include/Alloc.h +51 -0
  17. data/libchdr/deps/lzma-19.00/include/Bra.h +64 -0
  18. data/libchdr/deps/lzma-19.00/include/Compiler.h +33 -0
  19. data/libchdr/deps/lzma-19.00/include/CpuArch.h +336 -0
  20. data/libchdr/deps/lzma-19.00/include/Delta.h +19 -0
  21. data/libchdr/deps/lzma-19.00/include/LzFind.h +121 -0
  22. data/libchdr/deps/lzma-19.00/include/LzHash.h +57 -0
  23. data/libchdr/deps/lzma-19.00/include/Lzma86.h +111 -0
  24. data/libchdr/deps/lzma-19.00/include/LzmaDec.h +234 -0
  25. data/libchdr/deps/lzma-19.00/include/LzmaEnc.h +76 -0
  26. data/libchdr/deps/lzma-19.00/include/LzmaLib.h +131 -0
  27. data/libchdr/deps/lzma-19.00/include/Precomp.h +10 -0
  28. data/libchdr/deps/lzma-19.00/include/Sort.h +18 -0
  29. data/libchdr/deps/lzma-19.00/lzma-history.txt +446 -0
  30. data/libchdr/deps/lzma-19.00/lzma.txt +328 -0
  31. data/libchdr/deps/lzma-19.00/lzma.vcxproj +543 -0
  32. data/libchdr/deps/lzma-19.00/lzma.vcxproj.filters +17 -0
  33. data/libchdr/deps/lzma-19.00/src/Alloc.c +455 -0
  34. data/libchdr/deps/lzma-19.00/src/Bra86.c +82 -0
  35. data/libchdr/deps/lzma-19.00/src/BraIA64.c +53 -0
  36. data/libchdr/deps/lzma-19.00/src/CpuArch.c +218 -0
  37. data/libchdr/deps/lzma-19.00/src/Delta.c +64 -0
  38. data/libchdr/deps/lzma-19.00/src/LzFind.c +1127 -0
  39. data/libchdr/deps/lzma-19.00/src/Lzma86Dec.c +54 -0
  40. data/libchdr/deps/lzma-19.00/src/LzmaDec.c +1185 -0
  41. data/libchdr/deps/lzma-19.00/src/LzmaEnc.c +1330 -0
  42. data/libchdr/deps/lzma-19.00/src/Sort.c +141 -0
  43. data/libchdr/deps/zlib-1.2.11/CMakeLists.txt +29 -0
  44. data/libchdr/deps/zlib-1.2.11/ChangeLog +1515 -0
  45. data/libchdr/deps/zlib-1.2.11/FAQ +368 -0
  46. data/libchdr/deps/zlib-1.2.11/INDEX +68 -0
  47. data/libchdr/deps/zlib-1.2.11/Makefile +5 -0
  48. data/libchdr/deps/zlib-1.2.11/Makefile.in +410 -0
  49. data/libchdr/deps/zlib-1.2.11/README +115 -0
  50. data/libchdr/deps/zlib-1.2.11/adler32.c +186 -0
  51. data/libchdr/deps/zlib-1.2.11/compress.c +86 -0
  52. data/libchdr/deps/zlib-1.2.11/configure +921 -0
  53. data/libchdr/deps/zlib-1.2.11/crc32.c +442 -0
  54. data/libchdr/deps/zlib-1.2.11/crc32.h +441 -0
  55. data/libchdr/deps/zlib-1.2.11/deflate.c +2163 -0
  56. data/libchdr/deps/zlib-1.2.11/deflate.h +349 -0
  57. data/libchdr/deps/zlib-1.2.11/doc/algorithm.txt +209 -0
  58. data/libchdr/deps/zlib-1.2.11/doc/rfc1950.txt +619 -0
  59. data/libchdr/deps/zlib-1.2.11/doc/rfc1951.txt +955 -0
  60. data/libchdr/deps/zlib-1.2.11/doc/rfc1952.txt +675 -0
  61. data/libchdr/deps/zlib-1.2.11/doc/txtvsbin.txt +107 -0
  62. data/libchdr/deps/zlib-1.2.11/gzclose.c +25 -0
  63. data/libchdr/deps/zlib-1.2.11/gzguts.h +218 -0
  64. data/libchdr/deps/zlib-1.2.11/gzlib.c +637 -0
  65. data/libchdr/deps/zlib-1.2.11/gzread.c +654 -0
  66. data/libchdr/deps/zlib-1.2.11/gzwrite.c +665 -0
  67. data/libchdr/deps/zlib-1.2.11/infback.c +640 -0
  68. data/libchdr/deps/zlib-1.2.11/inffast.c +323 -0
  69. data/libchdr/deps/zlib-1.2.11/inffast.h +11 -0
  70. data/libchdr/deps/zlib-1.2.11/inffixed.h +94 -0
  71. data/libchdr/deps/zlib-1.2.11/inflate.c +1561 -0
  72. data/libchdr/deps/zlib-1.2.11/inflate.h +125 -0
  73. data/libchdr/deps/zlib-1.2.11/inftrees.c +304 -0
  74. data/libchdr/deps/zlib-1.2.11/inftrees.h +62 -0
  75. data/libchdr/deps/zlib-1.2.11/make_vms.com +867 -0
  76. data/libchdr/deps/zlib-1.2.11/treebuild.xml +116 -0
  77. data/libchdr/deps/zlib-1.2.11/trees.c +1203 -0
  78. data/libchdr/deps/zlib-1.2.11/trees.h +128 -0
  79. data/libchdr/deps/zlib-1.2.11/uncompr.c +93 -0
  80. data/libchdr/deps/zlib-1.2.11/zconf.h +534 -0
  81. data/libchdr/deps/zlib-1.2.11/zconf.h.cmakein +536 -0
  82. data/libchdr/deps/zlib-1.2.11/zconf.h.in +534 -0
  83. data/libchdr/deps/zlib-1.2.11/zlib.3 +149 -0
  84. data/libchdr/deps/zlib-1.2.11/zlib.3.pdf +0 -0
  85. data/libchdr/deps/zlib-1.2.11/zlib.h +1912 -0
  86. data/libchdr/deps/zlib-1.2.11/zlib.map +94 -0
  87. data/libchdr/deps/zlib-1.2.11/zlib.pc.cmakein +13 -0
  88. data/libchdr/deps/zlib-1.2.11/zlib.pc.in +13 -0
  89. data/libchdr/deps/zlib-1.2.11/zlib2ansi +152 -0
  90. data/libchdr/deps/zlib-1.2.11/zutil.c +325 -0
  91. data/libchdr/deps/zlib-1.2.11/zutil.h +271 -0
  92. data/libchdr/include/dr_libs/dr_flac.h +12280 -0
  93. data/libchdr/include/libchdr/bitstream.h +43 -0
  94. data/libchdr/include/libchdr/cdrom.h +110 -0
  95. data/libchdr/include/libchdr/chd.h +427 -0
  96. data/libchdr/include/libchdr/chdconfig.h +10 -0
  97. data/libchdr/include/libchdr/coretypes.h +60 -0
  98. data/libchdr/include/libchdr/flac.h +50 -0
  99. data/libchdr/include/libchdr/huffman.h +90 -0
  100. data/libchdr/pkg-config.pc.in +10 -0
  101. data/libchdr/src/libchdr_bitstream.c +125 -0
  102. data/libchdr/src/libchdr_cdrom.c +415 -0
  103. data/libchdr/src/libchdr_chd.c +2744 -0
  104. data/libchdr/src/libchdr_flac.c +302 -0
  105. data/libchdr/src/libchdr_huffman.c +545 -0
  106. data/libchdr/src/link.T +5 -0
  107. data/libchdr/tests/CMakeLists.txt +2 -0
  108. data/libchdr/tests/benchmark.c +52 -0
  109. metadata +183 -0
@@ -0,0 +1,234 @@
1
+ /* LzmaDec.h -- LZMA Decoder
2
+ 2018-04-21 : Igor Pavlov : Public domain */
3
+
4
+ #ifndef __LZMA_DEC_H
5
+ #define __LZMA_DEC_H
6
+
7
+ #include "7zTypes.h"
8
+
9
+ EXTERN_C_BEGIN
10
+
11
+ /* #define _LZMA_PROB32 */
12
+ /* _LZMA_PROB32 can increase the speed on some CPUs,
13
+ but memory usage for CLzmaDec::probs will be doubled in that case */
14
+
15
+ typedef
16
+ #ifdef _LZMA_PROB32
17
+ UInt32
18
+ #else
19
+ UInt16
20
+ #endif
21
+ CLzmaProb;
22
+
23
+
24
+ /* ---------- LZMA Properties ---------- */
25
+
26
+ #define LZMA_PROPS_SIZE 5
27
+
28
+ typedef struct _CLzmaProps
29
+ {
30
+ Byte lc;
31
+ Byte lp;
32
+ Byte pb;
33
+ Byte _pad_;
34
+ UInt32 dicSize;
35
+ } CLzmaProps;
36
+
37
+ /* LzmaProps_Decode - decodes properties
38
+ Returns:
39
+ SZ_OK
40
+ SZ_ERROR_UNSUPPORTED - Unsupported properties
41
+ */
42
+
43
+ SRes LzmaProps_Decode(CLzmaProps *p, const Byte *data, unsigned size);
44
+
45
+
46
+ /* ---------- LZMA Decoder state ---------- */
47
+
48
+ /* LZMA_REQUIRED_INPUT_MAX = number of required input bytes for worst case.
49
+ Num bits = log2((2^11 / 31) ^ 22) + 26 < 134 + 26 = 160; */
50
+
51
+ #define LZMA_REQUIRED_INPUT_MAX 20
52
+
53
+ typedef struct
54
+ {
55
+ /* Don't change this structure. ASM code can use it. */
56
+ CLzmaProps prop;
57
+ CLzmaProb *probs;
58
+ CLzmaProb *probs_1664;
59
+ Byte *dic;
60
+ SizeT dicBufSize;
61
+ SizeT dicPos;
62
+ const Byte *buf;
63
+ UInt32 range;
64
+ UInt32 code;
65
+ UInt32 processedPos;
66
+ UInt32 checkDicSize;
67
+ UInt32 reps[4];
68
+ UInt32 state;
69
+ UInt32 remainLen;
70
+
71
+ UInt32 numProbs;
72
+ unsigned tempBufSize;
73
+ Byte tempBuf[LZMA_REQUIRED_INPUT_MAX];
74
+ } CLzmaDec;
75
+
76
+ #define LzmaDec_Construct(p) { (p)->dic = NULL; (p)->probs = NULL; }
77
+
78
+ void LzmaDec_Init(CLzmaDec *p);
79
+
80
+ /* There are two types of LZMA streams:
81
+ - Stream with end mark. That end mark adds about 6 bytes to compressed size.
82
+ - Stream without end mark. You must know exact uncompressed size to decompress such stream. */
83
+
84
+ typedef enum
85
+ {
86
+ LZMA_FINISH_ANY, /* finish at any point */
87
+ LZMA_FINISH_END /* block must be finished at the end */
88
+ } ELzmaFinishMode;
89
+
90
+ /* ELzmaFinishMode has meaning only if the decoding reaches output limit !!!
91
+
92
+ You must use LZMA_FINISH_END, when you know that current output buffer
93
+ covers last bytes of block. In other cases you must use LZMA_FINISH_ANY.
94
+
95
+ If LZMA decoder sees end marker before reaching output limit, it returns SZ_OK,
96
+ and output value of destLen will be less than output buffer size limit.
97
+ You can check status result also.
98
+
99
+ You can use multiple checks to test data integrity after full decompression:
100
+ 1) Check Result and "status" variable.
101
+ 2) Check that output(destLen) = uncompressedSize, if you know real uncompressedSize.
102
+ 3) Check that output(srcLen) = compressedSize, if you know real compressedSize.
103
+ You must use correct finish mode in that case. */
104
+
105
+ typedef enum
106
+ {
107
+ LZMA_STATUS_NOT_SPECIFIED, /* use main error code instead */
108
+ LZMA_STATUS_FINISHED_WITH_MARK, /* stream was finished with end mark. */
109
+ LZMA_STATUS_NOT_FINISHED, /* stream was not finished */
110
+ LZMA_STATUS_NEEDS_MORE_INPUT, /* you must provide more input bytes */
111
+ LZMA_STATUS_MAYBE_FINISHED_WITHOUT_MARK /* there is probability that stream was finished without end mark */
112
+ } ELzmaStatus;
113
+
114
+ /* ELzmaStatus is used only as output value for function call */
115
+
116
+
117
+ /* ---------- Interfaces ---------- */
118
+
119
+ /* There are 3 levels of interfaces:
120
+ 1) Dictionary Interface
121
+ 2) Buffer Interface
122
+ 3) One Call Interface
123
+ You can select any of these interfaces, but don't mix functions from different
124
+ groups for same object. */
125
+
126
+
127
+ /* There are two variants to allocate state for Dictionary Interface:
128
+ 1) LzmaDec_Allocate / LzmaDec_Free
129
+ 2) LzmaDec_AllocateProbs / LzmaDec_FreeProbs
130
+ You can use variant 2, if you set dictionary buffer manually.
131
+ For Buffer Interface you must always use variant 1.
132
+
133
+ LzmaDec_Allocate* can return:
134
+ SZ_OK
135
+ SZ_ERROR_MEM - Memory allocation error
136
+ SZ_ERROR_UNSUPPORTED - Unsupported properties
137
+ */
138
+
139
+ SRes LzmaDec_AllocateProbs(CLzmaDec *p, const Byte *props, unsigned propsSize, ISzAllocPtr alloc);
140
+ void LzmaDec_FreeProbs(CLzmaDec *p, ISzAllocPtr alloc);
141
+
142
+ SRes LzmaDec_Allocate(CLzmaDec *p, const Byte *props, unsigned propsSize, ISzAllocPtr alloc);
143
+ void LzmaDec_Free(CLzmaDec *p, ISzAllocPtr alloc);
144
+
145
+ /* ---------- Dictionary Interface ---------- */
146
+
147
+ /* You can use it, if you want to eliminate the overhead for data copying from
148
+ dictionary to some other external buffer.
149
+ You must work with CLzmaDec variables directly in this interface.
150
+
151
+ STEPS:
152
+ LzmaDec_Construct()
153
+ LzmaDec_Allocate()
154
+ for (each new stream)
155
+ {
156
+ LzmaDec_Init()
157
+ while (it needs more decompression)
158
+ {
159
+ LzmaDec_DecodeToDic()
160
+ use data from CLzmaDec::dic and update CLzmaDec::dicPos
161
+ }
162
+ }
163
+ LzmaDec_Free()
164
+ */
165
+
166
+ /* LzmaDec_DecodeToDic
167
+
168
+ The decoding to internal dictionary buffer (CLzmaDec::dic).
169
+ You must manually update CLzmaDec::dicPos, if it reaches CLzmaDec::dicBufSize !!!
170
+
171
+ finishMode:
172
+ It has meaning only if the decoding reaches output limit (dicLimit).
173
+ LZMA_FINISH_ANY - Decode just dicLimit bytes.
174
+ LZMA_FINISH_END - Stream must be finished after dicLimit.
175
+
176
+ Returns:
177
+ SZ_OK
178
+ status:
179
+ LZMA_STATUS_FINISHED_WITH_MARK
180
+ LZMA_STATUS_NOT_FINISHED
181
+ LZMA_STATUS_NEEDS_MORE_INPUT
182
+ LZMA_STATUS_MAYBE_FINISHED_WITHOUT_MARK
183
+ SZ_ERROR_DATA - Data error
184
+ */
185
+
186
+ SRes LzmaDec_DecodeToDic(CLzmaDec *p, SizeT dicLimit,
187
+ const Byte *src, SizeT *srcLen, ELzmaFinishMode finishMode, ELzmaStatus *status);
188
+
189
+
190
+ /* ---------- Buffer Interface ---------- */
191
+
192
+ /* It's zlib-like interface.
193
+ See LzmaDec_DecodeToDic description for information about STEPS and return results,
194
+ but you must use LzmaDec_DecodeToBuf instead of LzmaDec_DecodeToDic and you don't need
195
+ to work with CLzmaDec variables manually.
196
+
197
+ finishMode:
198
+ It has meaning only if the decoding reaches output limit (*destLen).
199
+ LZMA_FINISH_ANY - Decode just destLen bytes.
200
+ LZMA_FINISH_END - Stream must be finished after (*destLen).
201
+ */
202
+
203
+ SRes LzmaDec_DecodeToBuf(CLzmaDec *p, Byte *dest, SizeT *destLen,
204
+ const Byte *src, SizeT *srcLen, ELzmaFinishMode finishMode, ELzmaStatus *status);
205
+
206
+
207
+ /* ---------- One Call Interface ---------- */
208
+
209
+ /* LzmaDecode
210
+
211
+ finishMode:
212
+ It has meaning only if the decoding reaches output limit (*destLen).
213
+ LZMA_FINISH_ANY - Decode just destLen bytes.
214
+ LZMA_FINISH_END - Stream must be finished after (*destLen).
215
+
216
+ Returns:
217
+ SZ_OK
218
+ status:
219
+ LZMA_STATUS_FINISHED_WITH_MARK
220
+ LZMA_STATUS_NOT_FINISHED
221
+ LZMA_STATUS_MAYBE_FINISHED_WITHOUT_MARK
222
+ SZ_ERROR_DATA - Data error
223
+ SZ_ERROR_MEM - Memory allocation error
224
+ SZ_ERROR_UNSUPPORTED - Unsupported properties
225
+ SZ_ERROR_INPUT_EOF - It needs more bytes in input buffer (src).
226
+ */
227
+
228
+ SRes LzmaDecode(Byte *dest, SizeT *destLen, const Byte *src, SizeT *srcLen,
229
+ const Byte *propData, unsigned propSize, ELzmaFinishMode finishMode,
230
+ ELzmaStatus *status, ISzAllocPtr alloc);
231
+
232
+ EXTERN_C_END
233
+
234
+ #endif
@@ -0,0 +1,76 @@
1
+ /* LzmaEnc.h -- LZMA Encoder
2
+ 2017-07-27 : Igor Pavlov : Public domain */
3
+
4
+ #ifndef __LZMA_ENC_H
5
+ #define __LZMA_ENC_H
6
+
7
+ #include "7zTypes.h"
8
+
9
+ EXTERN_C_BEGIN
10
+
11
+ #define LZMA_PROPS_SIZE 5
12
+
13
+ typedef struct _CLzmaEncProps
14
+ {
15
+ int level; /* 0 <= level <= 9 */
16
+ UInt32 dictSize; /* (1 << 12) <= dictSize <= (1 << 27) for 32-bit version
17
+ (1 << 12) <= dictSize <= (3 << 29) for 64-bit version
18
+ default = (1 << 24) */
19
+ int lc; /* 0 <= lc <= 8, default = 3 */
20
+ int lp; /* 0 <= lp <= 4, default = 0 */
21
+ int pb; /* 0 <= pb <= 4, default = 2 */
22
+ int algo; /* 0 - fast, 1 - normal, default = 1 */
23
+ int fb; /* 5 <= fb <= 273, default = 32 */
24
+ int btMode; /* 0 - hashChain Mode, 1 - binTree mode - normal, default = 1 */
25
+ int numHashBytes; /* 2, 3 or 4, default = 4 */
26
+ UInt32 mc; /* 1 <= mc <= (1 << 30), default = 32 */
27
+ unsigned writeEndMark; /* 0 - do not write EOPM, 1 - write EOPM, default = 0 */
28
+ int numThreads; /* 1 or 2, default = 2 */
29
+
30
+ UInt64 reduceSize; /* estimated size of data that will be compressed. default = (UInt64)(Int64)-1.
31
+ Encoder uses this value to reduce dictionary size */
32
+ } CLzmaEncProps;
33
+
34
+ void LzmaEncProps_Init(CLzmaEncProps *p);
35
+ void LzmaEncProps_Normalize(CLzmaEncProps *p);
36
+ UInt32 LzmaEncProps_GetDictSize(const CLzmaEncProps *props2);
37
+
38
+
39
+ /* ---------- CLzmaEncHandle Interface ---------- */
40
+
41
+ /* LzmaEnc* functions can return the following exit codes:
42
+ SRes:
43
+ SZ_OK - OK
44
+ SZ_ERROR_MEM - Memory allocation error
45
+ SZ_ERROR_PARAM - Incorrect paramater in props
46
+ SZ_ERROR_WRITE - ISeqOutStream write callback error
47
+ SZ_ERROR_OUTPUT_EOF - output buffer overflow - version with (Byte *) output
48
+ SZ_ERROR_PROGRESS - some break from progress callback
49
+ SZ_ERROR_THREAD - error in multithreading functions (only for Mt version)
50
+ */
51
+
52
+ typedef void * CLzmaEncHandle;
53
+
54
+ CLzmaEncHandle LzmaEnc_Create(ISzAllocPtr alloc);
55
+ void LzmaEnc_Destroy(CLzmaEncHandle p, ISzAllocPtr alloc, ISzAllocPtr allocBig);
56
+
57
+ SRes LzmaEnc_SetProps(CLzmaEncHandle p, const CLzmaEncProps *props);
58
+ void LzmaEnc_SetDataSize(CLzmaEncHandle p, UInt64 expectedDataSiize);
59
+ SRes LzmaEnc_WriteProperties(CLzmaEncHandle p, Byte *properties, SizeT *size);
60
+ unsigned LzmaEnc_IsWriteEndMark(CLzmaEncHandle p);
61
+
62
+ SRes LzmaEnc_Encode(CLzmaEncHandle p, ISeqOutStream *outStream, ISeqInStream *inStream,
63
+ ICompressProgress *progress, ISzAllocPtr alloc, ISzAllocPtr allocBig);
64
+ SRes LzmaEnc_MemEncode(CLzmaEncHandle p, Byte *dest, SizeT *destLen, const Byte *src, SizeT srcLen,
65
+ int writeEndMark, ICompressProgress *progress, ISzAllocPtr alloc, ISzAllocPtr allocBig);
66
+
67
+
68
+ /* ---------- One Call Interface ---------- */
69
+
70
+ SRes LzmaEncode(Byte *dest, SizeT *destLen, const Byte *src, SizeT srcLen,
71
+ const CLzmaEncProps *props, Byte *propsEncoded, SizeT *propsSize, int writeEndMark,
72
+ ICompressProgress *progress, ISzAllocPtr alloc, ISzAllocPtr allocBig);
73
+
74
+ EXTERN_C_END
75
+
76
+ #endif
@@ -0,0 +1,131 @@
1
+ /* LzmaLib.h -- LZMA library interface
2
+ 2013-01-18 : Igor Pavlov : Public domain */
3
+
4
+ #ifndef __LZMA_LIB_H
5
+ #define __LZMA_LIB_H
6
+
7
+ #include "7zTypes.h"
8
+
9
+ EXTERN_C_BEGIN
10
+
11
+ #define MY_STDAPI int MY_STD_CALL
12
+
13
+ #define LZMA_PROPS_SIZE 5
14
+
15
+ /*
16
+ RAM requirements for LZMA:
17
+ for compression: (dictSize * 11.5 + 6 MB) + state_size
18
+ for decompression: dictSize + state_size
19
+ state_size = (4 + (1.5 << (lc + lp))) KB
20
+ by default (lc=3, lp=0), state_size = 16 KB.
21
+
22
+ LZMA properties (5 bytes) format
23
+ Offset Size Description
24
+ 0 1 lc, lp and pb in encoded form.
25
+ 1 4 dictSize (little endian).
26
+ */
27
+
28
+ /*
29
+ LzmaCompress
30
+ ------------
31
+
32
+ outPropsSize -
33
+ In: the pointer to the size of outProps buffer; *outPropsSize = LZMA_PROPS_SIZE = 5.
34
+ Out: the pointer to the size of written properties in outProps buffer; *outPropsSize = LZMA_PROPS_SIZE = 5.
35
+
36
+ LZMA Encoder will use defult values for any parameter, if it is
37
+ -1 for any from: level, loc, lp, pb, fb, numThreads
38
+ 0 for dictSize
39
+
40
+ level - compression level: 0 <= level <= 9;
41
+
42
+ level dictSize algo fb
43
+ 0: 16 KB 0 32
44
+ 1: 64 KB 0 32
45
+ 2: 256 KB 0 32
46
+ 3: 1 MB 0 32
47
+ 4: 4 MB 0 32
48
+ 5: 16 MB 1 32
49
+ 6: 32 MB 1 32
50
+ 7+: 64 MB 1 64
51
+
52
+ The default value for "level" is 5.
53
+
54
+ algo = 0 means fast method
55
+ algo = 1 means normal method
56
+
57
+ dictSize - The dictionary size in bytes. The maximum value is
58
+ 128 MB = (1 << 27) bytes for 32-bit version
59
+ 1 GB = (1 << 30) bytes for 64-bit version
60
+ The default value is 16 MB = (1 << 24) bytes.
61
+ It's recommended to use the dictionary that is larger than 4 KB and
62
+ that can be calculated as (1 << N) or (3 << N) sizes.
63
+
64
+ lc - The number of literal context bits (high bits of previous literal).
65
+ It can be in the range from 0 to 8. The default value is 3.
66
+ Sometimes lc=4 gives the gain for big files.
67
+
68
+ lp - The number of literal pos bits (low bits of current position for literals).
69
+ It can be in the range from 0 to 4. The default value is 0.
70
+ The lp switch is intended for periodical data when the period is equal to 2^lp.
71
+ For example, for 32-bit (4 bytes) periodical data you can use lp=2. Often it's
72
+ better to set lc=0, if you change lp switch.
73
+
74
+ pb - The number of pos bits (low bits of current position).
75
+ It can be in the range from 0 to 4. The default value is 2.
76
+ The pb switch is intended for periodical data when the period is equal 2^pb.
77
+
78
+ fb - Word size (the number of fast bytes).
79
+ It can be in the range from 5 to 273. The default value is 32.
80
+ Usually, a big number gives a little bit better compression ratio and
81
+ slower compression process.
82
+
83
+ numThreads - The number of thereads. 1 or 2. The default value is 2.
84
+ Fast mode (algo = 0) can use only 1 thread.
85
+
86
+ Out:
87
+ destLen - processed output size
88
+ Returns:
89
+ SZ_OK - OK
90
+ SZ_ERROR_MEM - Memory allocation error
91
+ SZ_ERROR_PARAM - Incorrect paramater
92
+ SZ_ERROR_OUTPUT_EOF - output buffer overflow
93
+ SZ_ERROR_THREAD - errors in multithreading functions (only for Mt version)
94
+ */
95
+
96
+ MY_STDAPI LzmaCompress(unsigned char *dest, size_t *destLen, const unsigned char *src, size_t srcLen,
97
+ unsigned char *outProps, size_t *outPropsSize, /* *outPropsSize must be = 5 */
98
+ int level, /* 0 <= level <= 9, default = 5 */
99
+ unsigned dictSize, /* default = (1 << 24) */
100
+ int lc, /* 0 <= lc <= 8, default = 3 */
101
+ int lp, /* 0 <= lp <= 4, default = 0 */
102
+ int pb, /* 0 <= pb <= 4, default = 2 */
103
+ int fb, /* 5 <= fb <= 273, default = 32 */
104
+ int numThreads /* 1 or 2, default = 2 */
105
+ );
106
+
107
+ /*
108
+ LzmaUncompress
109
+ --------------
110
+ In:
111
+ dest - output data
112
+ destLen - output data size
113
+ src - input data
114
+ srcLen - input data size
115
+ Out:
116
+ destLen - processed output size
117
+ srcLen - processed input size
118
+ Returns:
119
+ SZ_OK - OK
120
+ SZ_ERROR_DATA - Data error
121
+ SZ_ERROR_MEM - Memory allocation arror
122
+ SZ_ERROR_UNSUPPORTED - Unsupported properties
123
+ SZ_ERROR_INPUT_EOF - it needs more bytes in input buffer (src)
124
+ */
125
+
126
+ MY_STDAPI LzmaUncompress(unsigned char *dest, size_t *destLen, const unsigned char *src, SizeT *srcLen,
127
+ const unsigned char *props, size_t propsSize);
128
+
129
+ EXTERN_C_END
130
+
131
+ #endif
@@ -0,0 +1,10 @@
1
+ /* Precomp.h -- StdAfx
2
+ 2013-11-12 : Igor Pavlov : Public domain */
3
+
4
+ #ifndef __7Z_PRECOMP_H
5
+ #define __7Z_PRECOMP_H
6
+
7
+ #include "Compiler.h"
8
+ /* #include "7zTypes.h" */
9
+
10
+ #endif
@@ -0,0 +1,18 @@
1
+ /* Sort.h -- Sort functions
2
+ 2014-04-05 : Igor Pavlov : Public domain */
3
+
4
+ #ifndef __7Z_SORT_H
5
+ #define __7Z_SORT_H
6
+
7
+ #include "7zTypes.h"
8
+
9
+ EXTERN_C_BEGIN
10
+
11
+ void HeapSort(UInt32 *p, size_t size);
12
+ void HeapSort64(UInt64 *p, size_t size);
13
+
14
+ /* void HeapSortRef(UInt32 *p, UInt32 *vals, size_t size); */
15
+
16
+ EXTERN_C_END
17
+
18
+ #endif