VR-Vantage 2.7 API Documentation
Home
Modules
Namespaces
Classes
Files
Libraries
Examples
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Groups
Pages
include
lz4
lz4frame.h
Go to the documentation of this file.
1
/*
2
LZ4 auto-framing library
3
Header File
4
Copyright (C) 2011-2016, Yann Collet.
5
BSD 2-Clause License (http://www.opensource.org/licenses/bsd-license.php)
6
7
Redistribution and use in source and binary forms, with or without
8
modification, are permitted provided that the following conditions are
9
met:
10
11
* Redistributions of source code must retain the above copyright
12
notice, this list of conditions and the following disclaimer.
13
* Redistributions in binary form must reproduce the above
14
copyright notice, this list of conditions and the following disclaimer
15
in the documentation and/or other materials provided with the
16
distribution.
17
18
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
21
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
22
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
24
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29
30
You can contact the author at :
31
- LZ4 source repository : https://github.com/lz4/lz4
32
- LZ4 public forum : https://groups.google.com/forum/#!forum/lz4c
33
*/
34
35
/* LZ4F is a stand-alone API to create LZ4-compressed frames
36
* conformant with specification v1.5.1.
37
* It also offers streaming capabilities.
38
* lz4.h is not required when using lz4frame.h.
39
* */
40
41
#ifndef LZ4F_H_09782039843
42
#define LZ4F_H_09782039843
43
44
#if defined (__cplusplus)
45
extern
"C"
{
46
#endif
47
48
/* --- Dependency --- */
49
#include <stddef.h>
/* size_t */
50
51
60
/*^***************************************************************
61
* Compiler specifics
62
*****************************************************************/
63
/*
64
* LZ4_DLL_EXPORT :
65
* Enable exporting of functions when building a Windows DLL
66
*/
67
#if defined(LZ4_DLL_EXPORT) && (LZ4_DLL_EXPORT==1)
68
# define LZ4FLIB_API __declspec(dllexport)
69
#elif defined(LZ4_DLL_IMPORT) && (LZ4_DLL_IMPORT==1)
70
# define LZ4FLIB_API __declspec(dllimport)
71
#else
72
# define LZ4FLIB_API
73
#endif
74
75
#if defined(_MSC_VER)
76
# define LZ4F_DEPRECATE(x) x
/* __declspec(deprecated) x - only works with C++ */
77
#elif defined(__clang__) || (defined(__GNUC__) && (__GNUC__ >= 6))
78
# define LZ4F_DEPRECATE(x) x __attribute__((deprecated))
79
#else
80
# define LZ4F_DEPRECATE(x) x
/* no deprecation warning for this compiler */
81
#endif
82
83
84
/*-************************************
85
* Error management
86
**************************************/
87
typedef
size_t
LZ4F_errorCode_t
;
88
89
LZ4FLIB_API
unsigned
LZ4F_isError
(LZ4F_errorCode_t code);
90
LZ4FLIB_API
const
char
*
LZ4F_getErrorName
(LZ4F_errorCode_t code);
93
/*-************************************
94
* Frame compression types
95
**************************************/
96
/* #define LZ4F_DISABLE_OBSOLETE_ENUMS */
/* uncomment to disable obsolete enums */
97
#ifndef LZ4F_DISABLE_OBSOLETE_ENUMS
98
# define LZ4F_OBSOLETE_ENUM(x) , LZ4F_DEPRECATE(x) = LZ4F_##x
99
#else
100
# define LZ4F_OBSOLETE_ENUM(x)
101
#endif
102
103
typedef
enum
{
104
LZ4F_default
=0,
105
LZ4F_max64KB
=4,
106
LZ4F_max256KB
=5,
107
LZ4F_max1MB
=6,
108
LZ4F_max4MB
=7
109
LZ4F_OBSOLETE_ENUM
(max64KB)
110
LZ4F_OBSOLETE_ENUM
(max256KB)
111
LZ4F_OBSOLETE_ENUM
(max1MB)
112
LZ4F_OBSOLETE_ENUM
(max4MB)
113
}
LZ4F_blockSizeID_t
;
114
115
typedef enum {
116
LZ4F_blockLinked
=0,
117
LZ4F_blockIndependent
118
LZ4F_OBSOLETE_ENUM
(blockLinked)
119
LZ4F_OBSOLETE_ENUM
(blockIndependent)
120
}
LZ4F_blockMode_t
;
121
122
typedef enum {
123
LZ4F_noContentChecksum
=0,
124
LZ4F_contentChecksumEnabled
125
LZ4F_OBSOLETE_ENUM
(noContentChecksum)
126
LZ4F_OBSOLETE_ENUM
(contentChecksumEnabled)
127
}
LZ4F_contentChecksum_t
;
128
129
typedef enum {
130
LZ4F_frame
=0,
131
LZ4F_skippableFrame
132
LZ4F_OBSOLETE_ENUM
(skippableFrame)
133
}
LZ4F_frameType_t
;
134
135
#ifndef LZ4F_DISABLE_OBSOLETE_ENUMS
136
typedef
LZ4F_blockSizeID_t
blockSizeID_t
;
137
typedef
LZ4F_blockMode_t
blockMode_t
;
138
typedef
LZ4F_frameType_t
frameType_t
;
139
typedef
LZ4F_contentChecksum_t
contentChecksum_t
;
140
#endif
141
146
typedef
struct
{
147
LZ4F_blockSizeID_t
blockSizeID
;
/* max64KB, max256KB, max1MB, max4MB ; 0 == default */
148
LZ4F_blockMode_t
blockMode
;
/* blockLinked, blockIndependent ; 0 == default */
149
LZ4F_contentChecksum_t
contentChecksumFlag
;
/* noContentChecksum, contentChecksumEnabled ; 0 == default */
150
LZ4F_frameType_t
frameType
;
/* LZ4F_frame, skippableFrame ; 0 == default */
151
unsigned
long
long
contentSize
;
/* Size of uncompressed (original) content ; 0 == unknown */
152
unsigned
reserved[2];
/* must be zero for forward compatibility */
153
}
LZ4F_frameInfo_t
;
154
159
typedef
struct
{
160
LZ4F_frameInfo_t
frameInfo
;
161
int
compressionLevel
;
/* 0 == default (fast mode); values above 16 count as 16; values below 0 count as 0 */
162
unsigned
autoFlush
;
/* 1 == always flush (reduce usage of tmp buffer) */
163
unsigned
reserved[4];
/* must be zero for forward compatibility */
164
}
LZ4F_preferences_t
;
165
166
167
/*-*********************************
168
* Simple compression function
169
***********************************/
174
LZ4FLIB_API
size_t
LZ4F_compressFrameBound
(
size_t
srcSize,
const
LZ4F_preferences_t
* preferencesPtr);
175
185
LZ4FLIB_API
size_t
LZ4F_compressFrame
(
void
* dstBuffer,
size_t
dstCapacity,
const
void
* srcBuffer,
size_t
srcSize,
const
LZ4F_preferences_t
* preferencesPtr);
186
187
188
189
/*-***********************************
190
* Advanced compression functions
191
*************************************/
192
typedef
struct
LZ4F_cctx_s
LZ4F_cctx
;
/* incomplete type */
193
typedef
LZ4F_cctx
*
LZ4F_compressionContext_t
;
/* for compatibility with previous API version */
194
195
typedef
struct
{
196
unsigned
stableSrc
;
/* 1 == src content will remain present on future calls to LZ4F_compress(); skip copying src content within tmp buffer */
197
unsigned
reserved[3];
198
}
LZ4F_compressOptions_t
;
199
200
/* Resource Management */
201
202
#define LZ4F_VERSION 100
203
LZ4FLIB_API
unsigned
LZ4F_getVersion
(
void
);
212
LZ4FLIB_API
LZ4F_errorCode_t
LZ4F_createCompressionContext
(
LZ4F_cctx
** cctxPtr,
unsigned
version
);
213
LZ4FLIB_API
LZ4F_errorCode_t
LZ4F_freeCompressionContext
(
LZ4F_cctx
* cctx);
214
215
216
/* Compression */
217
218
#define LZ4F_HEADER_SIZE_MAX 15
219
226
LZ4FLIB_API
size_t
LZ4F_compressBegin
(
LZ4F_cctx
* cctx,
void
* dstBuffer,
size_t
dstCapacity,
const
LZ4F_preferences_t
* prefsPtr);
227
234
LZ4FLIB_API
size_t
LZ4F_compressBound
(
size_t
srcSize,
const
LZ4F_preferences_t
* prefsPtr);
235
246
LZ4FLIB_API
size_t
LZ4F_compressUpdate
(
LZ4F_cctx
* cctx,
void
* dstBuffer,
size_t
dstCapacity,
const
void
* srcBuffer,
size_t
srcSize,
const
LZ4F_compressOptions_t
* cOptPtr);
247
256
LZ4FLIB_API
size_t
LZ4F_flush
(
LZ4F_cctx
* cctx,
void
* dstBuffer,
size_t
dstCapacity,
const
LZ4F_compressOptions_t
* cOptPtr);
257
267
LZ4FLIB_API
size_t
LZ4F_compressEnd
(
LZ4F_cctx
* cctx,
void
* dstBuffer,
size_t
dstCapacity,
const
LZ4F_compressOptions_t
* cOptPtr);
268
269
270
/*-*********************************
271
* Decompression functions
272
***********************************/
273
typedef
struct
LZ4F_dctx_s
LZ4F_dctx
;
/* incomplete type */
274
typedef
LZ4F_dctx
*
LZ4F_decompressionContext_t
;
/* compatibility with previous API versions */
275
276
typedef
struct
{
277
unsigned
stableDst
;
/* guarantee that decompressed data will still be there on next function calls (avoid storage into tmp buffers) */
278
unsigned
reserved[3];
279
}
LZ4F_decompressOptions_t
;
280
281
282
/* Resource management */
283
293
LZ4FLIB_API
LZ4F_errorCode_t
LZ4F_createDecompressionContext
(
LZ4F_dctx
** dctxPtr,
unsigned
version
);
294
LZ4FLIB_API
LZ4F_errorCode_t
LZ4F_freeDecompressionContext
(
LZ4F_dctx
*
const
dctx);
295
296
297
/* ====== Decompression ======*/
298
311
LZ4FLIB_API
size_t
LZ4F_getFrameInfo
(
LZ4F_dctx
* dctx,
312
LZ4F_frameInfo_t
* frameInfoPtr,
313
const
void
* srcBuffer,
size_t
* srcSizePtr);
314
338
LZ4FLIB_API
size_t
LZ4F_decompress
(
LZ4F_dctx
* dctx,
339
void
* dstBuffer,
size_t
* dstSizePtr,
340
const
void
* srcBuffer,
size_t
* srcSizePtr,
341
const
LZ4F_decompressOptions_t
* dOptPtr);
342
343
344
345
#if defined (__cplusplus)
346
}
347
#endif
348
349
#endif
/* LZ4F_H_09782039843 */
Copyright © 2005-2021 MAK Technologies. All Rights Reserved (
www.mak.com
)