Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(461)

Side by Side Diff: third_party/lzma_sdk/LzmaLib.h

Issue 10025017: [OTS] Add lzma_sdk (Closed) Base URL: http://ots.googlecode.com/svn/trunk/
Patch Set: Created 8 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « third_party/lzma_sdk/LzmaEnc.cc ('k') | third_party/lzma_sdk/LzmaLib.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Property Changes:
Added: svn:eol-style
+ LF
OLDNEW
(Empty)
1 /* LzmaLib.h -- LZMA library interface
2 2009-04-07 : Igor Pavlov : Public domain */
3
4 #ifndef __LZMA_LIB_H
5 #define __LZMA_LIB_H
6
7 #include "Types.h"
8
9 namespace ots {
10 namespace lzma {
11
12 #define MY_STDAPI int MY_STD_CALL
13
14 #define LZMA_PROPS_SIZE 5
15
16 /*
17 RAM requirements for LZMA:
18 for compression: (dictSize * 11.5 + 6 MB) + state_size
19 for decompression: dictSize + state_size
20 state_size = (4 + (1.5 << (lc + lp))) KB
21 by default (lc=3, lp=0), state_size = 16 KB.
22
23 LZMA properties (5 bytes) format
24 Offset Size Description
25 0 1 lc, lp and pb in encoded form.
26 1 4 dictSize (little endian).
27 */
28
29 /*
30 LzmaCompress
31 ------------
32
33 outPropsSize -
34 In: the pointer to the size of outProps buffer; *outPropsSize = LZMA_PROPS _SIZE = 5.
35 Out: the pointer to the size of written properties in outProps buffer; *out PropsSize = LZMA_PROPS_SIZE = 5.
36
37 LZMA Encoder will use defult values for any parameter, if it is
38 -1 for any from: level, loc, lp, pb, fb, numThreads
39 0 for dictSize
40
41 level - compression level: 0 <= level <= 9;
42
43 level dictSize algo fb
44 0: 16 KB 0 32
45 1: 64 KB 0 32
46 2: 256 KB 0 32
47 3: 1 MB 0 32
48 4: 4 MB 0 32
49 5: 16 MB 1 32
50 6: 32 MB 1 32
51 7+: 64 MB 1 64
52
53 The default value for "level" is 5.
54
55 algo = 0 means fast method
56 algo = 1 means normal method
57
58 dictSize - The dictionary size in bytes. The maximum value is
59 128 MB = (1 << 27) bytes for 32-bit version
60 1 GB = (1 << 30) bytes for 64-bit version
61 The default value is 16 MB = (1 << 24) bytes.
62 It's recommended to use the dictionary that is larger than 4 KB and
63 that can be calculated as (1 << N) or (3 << N) sizes.
64
65 lc - The number of literal context bits (high bits of previous literal).
66 It can be in the range from 0 to 8. The default value is 3.
67 Sometimes lc=4 gives the gain for big files.
68
69 lp - The number of literal pos bits (low bits of current position for literals).
70 It can be in the range from 0 to 4. The default value is 0.
71 The lp switch is intended for periodical data when the period is equal to 2 ^lp.
72 For example, for 32-bit (4 bytes) periodical data you can use lp=2. Often i t's
73 better to set lc=0, if you change lp switch.
74
75 pb - The number of pos bits (low bits of current position).
76 It can be in the range from 0 to 4. The default value is 2.
77 The pb switch is intended for periodical data when the period is equal 2^pb .
78
79 fb - Word size (the number of fast bytes).
80 It can be in the range from 5 to 273. The default value is 32.
81 Usually, a big number gives a little bit better compression ratio and
82 slower compression process.
83
84 numThreads - The number of thereads. 1 or 2. The default value is 2.
85 Fast mode (algo = 0) can use only 1 thread.
86
87 Out:
88 destLen - processed output size
89 Returns:
90 SZ_OK - OK
91 SZ_ERROR_MEM - Memory allocation error
92 SZ_ERROR_PARAM - Incorrect paramater
93 SZ_ERROR_OUTPUT_EOF - output buffer overflow
94 SZ_ERROR_THREAD - errors in multithreading functions (only for Mt version)
95 */
96
97 MY_STDAPI LzmaCompress(unsigned char *dest, size_t *destLen, const unsigned char *src, size_t srcLen,
98 unsigned char *outProps, size_t *outPropsSize, /* *outPropsSize must be = 5 */
99 int level, /* 0 <= level <= 9, default = 5 */
100 unsigned dictSize, /* default = (1 << 24) */
101 int lc, /* 0 <= lc <= 8, default = 3 */
102 int lp, /* 0 <= lp <= 4, default = 0 */
103 int pb, /* 0 <= pb <= 4, default = 2 */
104 int fb, /* 5 <= fb <= 273, default = 32 */
105 int numThreads /* 1 or 2, default = 2 */
106 );
107
108 /*
109 LzmaUncompress
110 --------------
111 In:
112 dest - output data
113 destLen - output data size
114 src - input data
115 srcLen - input data size
116 Out:
117 destLen - processed output size
118 srcLen - processed input size
119 Returns:
120 SZ_OK - OK
121 SZ_ERROR_DATA - Data error
122 SZ_ERROR_MEM - Memory allocation arror
123 SZ_ERROR_UNSUPPORTED - Unsupported properties
124 SZ_ERROR_INPUT_EOF - it needs more bytes in input buffer (src)
125 */
126
127 MY_STDAPI LzmaUncompress(unsigned char *dest, size_t *destLen, const unsigned ch ar *src, SizeT *srcLen,
128 const unsigned char *props, size_t propsSize);
129
130 } // namespace lzma
131 } // namespace ots
132
133 #endif
OLDNEW
« no previous file with comments | « third_party/lzma_sdk/LzmaEnc.cc ('k') | third_party/lzma_sdk/LzmaLib.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698