LZ4 API Guide  1.00.01.00
lz4.h
Go to the documentation of this file.
1 #ifndef LZ4_H_
2 #define LZ4_H_
3 
4 //******************************************************************************
5 //
8 //
9 //******************************************************************************
10 
11 //*****************************************************************************
12 //
13 // If building with a C++ compiler, make all of the definitions in this header
14 // have a C binding.
15 //
16 //*****************************************************************************
17 #ifdef __cplusplus
18 extern "C"
19 {
20 #endif
21 
22 #include <stdint.h>
23 #include <stdbool.h>
24 
25 //******************************************************************************
26 //
29 //
30 //******************************************************************************
31 #define LZ4_COMPRESS_MAX_SIZE(n) ((size_t)((n * 101) / 100) + 27)
32 
33 //******************************************************************************
34 //
36 //
37 //******************************************************************************
38 typedef enum {
51 } LZ4_status;
52 
53 //******************************************************************************
54 //
56 //
57 //******************************************************************************
58 typedef struct LZ4_compressParams {
60  const void *src;
62  void *dst;
64  uint32_t length;
66  void *hashTable;
68  uint16_t hashLog2Size;
85 
86 //******************************************************************************
87 //
89 //
90 //******************************************************************************
91 typedef struct LZ4_compressBlockParams {
93  const void *src;
95  void *dst;
97  uint32_t length;
99  void *hashTable;
101  uint16_t hashLog2Size;
108 
109 //******************************************************************************
110 //
112 //
113 //******************************************************************************
114 typedef struct LZ4_decompressParams {
116  const void *src;
118  void *dst;
120  uint32_t dstLength;
130 
131 //******************************************************************************
132 //
134 //
135 //******************************************************************************
138  const void *src;
140  void *dst;
142  uint32_t dstLength;
148 
149 //******************************************************************************
150 //
166 //
167 //******************************************************************************
168 extern uint32_t LZ4_compress(const LZ4_compressParams *params, LZ4_status *status);
169 
170 //******************************************************************************
171 //
185 //
186 //******************************************************************************
187 extern uint32_t LZ4_compressBlock(const LZ4_compressBlockParams *params, LZ4_status *status);
188 
189 //******************************************************************************
190 //
206 //
207 //******************************************************************************
208 extern uint32_t LZ4_decompress(const LZ4_decompressParams *params, LZ4_status *status);
209 
210 //******************************************************************************
211 //
224 //
225 //******************************************************************************
226 extern uint32_t LZ4_decompressBlock(const LZ4_decompressBlockParams *params, LZ4_status *status);
227 
228 //******************************************************************************
229 //
241 //
242 //******************************************************************************
243 extern uint32_t LZ4_getContentSize(const uint8_t *src, LZ4_status *status);
244 
245 //*****************************************************************************
246 //
247 // Mark the end of the C bindings section for C++ compilers.
248 //
249 //*****************************************************************************
250 #ifdef __cplusplus
251 }
252 #endif
253 
254 //******************************************************************************
255 //
256 // Close the Doxygen group.
258 //
259 //******************************************************************************
260 
261 #endif /* LZ4_H_ */
Incorrect block checksum.
Definition: lz4.h:48
bool verifyContentChecksum
Definition: lz4.h:128
const void * src
Pointer to the source data buffer to compress.
Definition: lz4.h:60
const void * src
Pointer to the source data buffer to decompress.
Definition: lz4.h:138
bool verifyBlockChecksum
Definition: lz4.h:124
void * dst
Pointer to the destination data buffer to store compressed data.
Definition: lz4.h:62
uint32_t LZ4_decompressBlock(const LZ4_decompressBlockParams *params, LZ4_status *status)
Decompress a single LZ4 block without framing to a block of data.
Definition: lz4.c:361
const void * src
Pointer to the source data buffer to compress.
Definition: lz4.h:93
struct LZ4_decompressBlockParams LZ4_decompressBlockParams
Decompression parameters for a single LZ4 block.
Decompression parameters for a LZ4 frame.
Definition: lz4.h:114
Incorrect content checksum.
Definition: lz4.h:50
Data was partially decompressed due to insufficient space.
Definition: lz4.h:42
uint32_t dstLength
Length of the destination data buffer.
Definition: lz4.h:120
Compression parameters for a LZ4 frame.
Definition: lz4.h:58
uint16_t hashLog2Size
Power of two used to determine the hash table size.
Definition: lz4.h:68
const void * src
Pointer to the source data buffer to decompress.
Definition: lz4.h:116
void * dst
Pointer to the destination data buffer to store compressed data.
Definition: lz4.h:140
uint32_t LZ4_compress(const LZ4_compressParams *params, LZ4_status *status)
Compress a block of data to a LZ4 frame.
Definition: lz4.c:10
void * dst
Pointer to the destination data buffer to store compressed data.
Definition: lz4.h:118
uint32_t length
Length of source data buffer.
Definition: lz4.h:97
LZ4_status
LZ4 status return types.
Definition: lz4.h:38
struct LZ4_compressParams LZ4_compressParams
Compression parameters for a LZ4 frame.
Error in frame header.
Definition: lz4.h:46
Successful operation.
Definition: lz4.h:40
Decompression parameters for a single LZ4 block.
Definition: lz4.h:136
uint32_t LZ4_getContentSize(const uint8_t *src, LZ4_status *status)
Get the content size of a compressed LZ4 frame.
Definition: lz4.c:478
uint32_t LZ4_compressBlock(const LZ4_compressBlockParams *params, LZ4_status *status)
Compress a block of data to a single LZ4 block without framing.
Definition: lz4.c:99
struct LZ4_decompressParams LZ4_decompressParams
Decompression parameters for a LZ4 frame.
bool addContentChecksum
Definition: lz4.h:78
bool verifyBlockChecksum
Definition: lz4.h:146
void * hashTable
Pointer to memory block with pow2(hashLog2Size) bytes allocated.
Definition: lz4.h:99
bool addBlockChecksum
Definition: lz4.h:106
void * hashTable
Pointer to memory block with pow2(hashLog2Size) bytes allocated.
Definition: lz4.h:66
Compression parameters for a single LZ4 block.
Definition: lz4.h:91
Content size is not present in LZ4 frame header.
Definition: lz4.h:44
bool addBlockChecksum
Definition: lz4.h:73
struct LZ4_compressBlockParams LZ4_compressBlockParams
Compression parameters for a single LZ4 block.
bool addContentSize
Definition: lz4.h:83
uint16_t hashLog2Size
Power of two used to determine the hash table size.
Definition: lz4.h:101
void * dst
Pointer to the destination data buffer to store compressed data.
Definition: lz4.h:95
uint32_t dstLength
Length of the destination data buffer.
Definition: lz4.h:142
uint32_t length
Length of source data buffer.
Definition: lz4.h:64
uint32_t LZ4_decompress(const LZ4_decompressParams *params, LZ4_status *status)
Decompress a LZ4 frame to a block of data.
Definition: lz4.c:262
© Copyright 1995-2019, Texas Instruments Incorporated. All rights reserved.
Trademarks | Privacy policy | Terms of use | Terms of sale