NVBIO
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Classes | Macros | Typedefs | Enumerations | Functions
lz4.c File Reference
#include <stdlib.h>
#include <string.h>
#include "lz4.h"

Go to the source code of this file.

Classes

struct  LZ4_stream_t_internal
 
struct  LZ4_streamDecode_t_internal
 

Macros

#define HEAPMODE   0
 
#define LZ4_UNALIGNED_ACCESS   0
 
#define restrict   /* Disable restrict */
 
#define FORCE_INLINE   static
 
#define GCC_VERSION   (__GNUC__ * 100 + __GNUC_MINOR__)
 
#define expect(expr, value)   (expr)
 
#define likely(expr)   expect((expr) != 0, 1)
 
#define unlikely(expr)   expect((expr) != 0, 0)
 
#define ALLOCATOR(n, s)   calloc(n,s)
 
#define FREEMEM   free
 
#define MEM_INIT   memset
 
#define STEPSIZE   sizeof(size_t)
 
#define MINMATCH   4
 
#define COPYLENGTH   8
 
#define LASTLITERALS   5
 
#define MFLIMIT   (COPYLENGTH+MINMATCH)
 
#define KB   *(1 <<10)
 
#define MB   *(1 <<20)
 
#define GB   *(1U<<30)
 
#define MAXD_LOG   16
 
#define MAX_DISTANCE   ((1 << MAXD_LOG) - 1)
 
#define ML_BITS   4
 
#define ML_MASK   ((1U<<ML_BITS)-1)
 
#define RUN_BITS   (8-ML_BITS)
 
#define RUN_MASK   ((1U<<RUN_BITS)-1)
 
#define LZ4_STATIC_ASSERT(c)   { enum { LZ4_static_assert = 1/(int)(!!(c)) }; } /* use only *after* variable declarations */
 
#define LZ4_HASHLOG   (LZ4_MEMORY_USAGE-2)
 
#define HASHTABLESIZE   (1 << LZ4_MEMORY_USAGE)
 
#define HASH_SIZE_U32   (1 << LZ4_HASHLOG) /* required as macro for static allocation */
 

Typedefs

typedef unsigned char BYTE
 
typedef unsigned short U16
 
typedef unsigned int U32
 
typedef signed int S32
 
typedef unsigned long long U64
 

Enumerations

enum  limitedOutput_directive { notLimited = 0, limitedOutput = 1, noLimit = 0, limitedOutput = 1 }
 
enum  tableType_t { byPtr, byU32, byU16 }
 
enum  dict_directive { noDict = 0, withPrefix64k, usingExtDict }
 
enum  dictIssue_directive { noDictIssue = 0, dictSmall }
 
enum  endCondition_directive { endOnOutputSize = 0, endOnInputSize = 1 }
 
enum  earlyEnd_directive { full = 0, partial = 1 }
 

Functions

int LZ4_versionNumber (void)
 
int LZ4_compressBound (int isize)
 
int LZ4_compress (const char *source, char *dest, int inputSize)
 
int LZ4_compress_limitedOutput (const char *source, char *dest, int inputSize, int maxOutputSize)
 
void LZ4_resetStream (LZ4_stream_t *LZ4_stream)
 
LZ4_stream_tLZ4_createStream (void)
 
int LZ4_freeStream (LZ4_stream_t *LZ4_stream)
 
int LZ4_loadDict (LZ4_stream_t *LZ4_dict, const char *dictionary, int dictSize)
 
FORCE_INLINE int LZ4_compress_continue_generic (void *LZ4_stream, const char *source, char *dest, int inputSize, int maxOutputSize, limitedOutput_directive limit)
 
int LZ4_compress_continue (LZ4_stream_t *LZ4_stream, const char *source, char *dest, int inputSize)
 
int LZ4_compress_limitedOutput_continue (LZ4_stream_t *LZ4_stream, const char *source, char *dest, int inputSize, int maxOutputSize)
 
int LZ4_compress_forceExtDict (LZ4_stream_t *LZ4_dict, const char *source, char *dest, int inputSize)
 
int LZ4_saveDict (LZ4_stream_t *LZ4_dict, char *safeBuffer, int dictSize)
 
FORCE_INLINE int LZ4_decompress_generic (const char *const source, char *const dest, int inputSize, int outputSize, int endOnInput, int partialDecoding, int targetOutputSize, int dict, const BYTE *const lowPrefix, const BYTE *const dictStart, const size_t dictSize)
 
int LZ4_decompress_safe (const char *source, char *dest, int compressedSize, int maxDecompressedSize)
 
int LZ4_decompress_safe_partial (const char *source, char *dest, int compressedSize, int targetOutputSize, int maxDecompressedSize)
 
int LZ4_decompress_fast (const char *source, char *dest, int originalSize)
 
LZ4_streamDecode_tLZ4_createStreamDecode (void)
 
int LZ4_freeStreamDecode (LZ4_streamDecode_t *LZ4_stream)
 
int LZ4_setStreamDecode (LZ4_streamDecode_t *LZ4_streamDecode, const char *dictionary, int dictSize)
 
int LZ4_decompress_safe_continue (LZ4_streamDecode_t *LZ4_streamDecode, const char *source, char *dest, int compressedSize, int maxOutputSize)
 
int LZ4_decompress_fast_continue (LZ4_streamDecode_t *LZ4_streamDecode, const char *source, char *dest, int originalSize)
 
FORCE_INLINE int LZ4_decompress_usingDict_generic (const char *source, char *dest, int compressedSize, int maxOutputSize, int safe, const char *dictStart, int dictSize)
 
int LZ4_decompress_safe_usingDict (const char *source, char *dest, int compressedSize, int maxOutputSize, const char *dictStart, int dictSize)
 
int LZ4_decompress_fast_usingDict (const char *source, char *dest, int originalSize, const char *dictStart, int dictSize)
 
int LZ4_decompress_safe_forceExtDict (const char *source, char *dest, int compressedSize, int maxOutputSize, const char *dictStart, int dictSize)
 
int LZ4_uncompress (const char *source, char *dest, int outputSize)
 
int LZ4_uncompress_unknownOutputSize (const char *source, char *dest, int isize, int maxOutputSize)
 
int LZ4_sizeofStreamState ()
 
int LZ4_resetStreamState (void *state, const char *inputBuffer)
 
void * LZ4_create (const char *inputBuffer)
 
char * LZ4_slideInputBuffer (void *LZ4_Data)
 
int LZ4_sizeofState ()
 
int LZ4_compress_withState (void *state, const char *source, char *dest, int inputSize)
 
int LZ4_compress_limitedOutput_withState (void *state, const char *source, char *dest, int inputSize, int maxOutputSize)
 
int LZ4_decompress_safe_withPrefix64k (const char *source, char *dest, int compressedSize, int maxOutputSize)
 
int LZ4_decompress_fast_withPrefix64k (const char *source, char *dest, int originalSize)
 

Macro Definition Documentation

#define ALLOCATOR (   n,
 
)    calloc(n,s)

Definition at line 142 of file lz4.c.

#define COPYLENGTH   8

Definition at line 300 of file lz4.c.

#define expect (   expr,
  value 
)    (expr)

Definition at line 131 of file lz4.c.

#define FORCE_INLINE   static

Definition at line 122 of file lz4.c.

#define FREEMEM   free

Definition at line 143 of file lz4.c.

#define GB   *(1U<<30)

Definition at line 307 of file lz4.c.

#define GCC_VERSION   (__GNUC__ * 100 + __GNUC_MINOR__)

Definition at line 126 of file lz4.c.

#define HASH_SIZE_U32   (1 << LZ4_HASHLOG) /* required as macro for static allocation */

Definition at line 419 of file lz4.c.

#define HASHTABLESIZE   (1 << LZ4_MEMORY_USAGE)

Definition at line 418 of file lz4.c.

#define HEAPMODE   0

Definition at line 44 of file lz4.c.

#define KB   *(1 <<10)

Definition at line 305 of file lz4.c.

#define LASTLITERALS   5

Definition at line 301 of file lz4.c.

#define likely (   expr)    expect((expr) != 0, 1)

Definition at line 134 of file lz4.c.

#define LZ4_HASHLOG   (LZ4_MEMORY_USAGE-2)

Definition at line 417 of file lz4.c.

#define LZ4_STATIC_ASSERT (   c)    { enum { LZ4_static_assert = 1/(int)(!!(c)) }; } /* use only *after* variable declarations */

Definition at line 321 of file lz4.c.

#define LZ4_UNALIGNED_ACCESS   0

Definition at line 88 of file lz4.c.

#define MAX_DISTANCE   ((1 << MAXD_LOG) - 1)

Definition at line 310 of file lz4.c.

#define MAXD_LOG   16

Definition at line 309 of file lz4.c.

#define MB   *(1 <<20)

Definition at line 306 of file lz4.c.

#define MEM_INIT   memset

Definition at line 145 of file lz4.c.

#define MFLIMIT   (COPYLENGTH+MINMATCH)

Definition at line 302 of file lz4.c.

#define MINMATCH   4

Definition at line 298 of file lz4.c.

#define ML_BITS   4

Definition at line 312 of file lz4.c.

#define ML_MASK   ((1U<<ML_BITS)-1)

Definition at line 313 of file lz4.c.

#define restrict   /* Disable restrict */

Definition at line 106 of file lz4.c.

#define RUN_BITS   (8-ML_BITS)

Definition at line 314 of file lz4.c.

#define RUN_MASK   ((1U<<RUN_BITS)-1)

Definition at line 315 of file lz4.c.

#define STEPSIZE   sizeof(size_t)

Definition at line 176 of file lz4.c.

#define unlikely (   expr)    expect((expr) != 0, 0)

Definition at line 135 of file lz4.c.

Typedef Documentation

typedef unsigned char BYTE

Definition at line 165 of file lz4.c.

typedef signed int S32

Definition at line 168 of file lz4.c.

typedef unsigned short U16

Definition at line 166 of file lz4.c.

typedef unsigned int U32

Definition at line 167 of file lz4.c.

typedef unsigned long long U64

Definition at line 169 of file lz4.c.

Enumeration Type Documentation

Enumerator
noDict 
withPrefix64k 
usingExtDict 

Definition at line 447 of file lz4.c.

Enumerator
noDictIssue 
dictSmall 

Definition at line 448 of file lz4.c.

Enumerator
full 
partial 

Definition at line 451 of file lz4.c.

Enumerator
endOnOutputSize 
endOnInputSize 

Definition at line 450 of file lz4.c.

Enumerator
notLimited 
limitedOutput 
noLimit 
limitedOutput 

Definition at line 444 of file lz4.c.

Enumerator
byPtr 
byU32 
byU16 

Definition at line 445 of file lz4.c.

Function Documentation

int LZ4_compress ( const char *  source,
char *  dest,
int  inputSize 
)

Definition at line 710 of file lz4.c.

int LZ4_compress_continue ( LZ4_stream_t LZ4_stream,
const char *  source,
char *  dest,
int  inputSize 
)

Definition at line 883 of file lz4.c.

FORCE_INLINE int LZ4_compress_continue_generic ( void *  LZ4_stream,
const char *  source,
char *  dest,
int  inputSize,
int  maxOutputSize,
limitedOutput_directive  limit 
)

Definition at line 833 of file lz4.c.

int LZ4_compress_forceExtDict ( LZ4_stream_t LZ4_dict,
const char *  source,
char *  dest,
int  inputSize 
)

Definition at line 895 of file lz4.c.

int LZ4_compress_limitedOutput ( const char *  source,
char *  dest,
int  inputSize,
int  maxOutputSize 
)

Definition at line 730 of file lz4.c.

int LZ4_compress_limitedOutput_continue ( LZ4_stream_t LZ4_stream,
const char *  source,
char *  dest,
int  inputSize,
int  maxOutputSize 
)

Definition at line 888 of file lz4.c.

int LZ4_compress_limitedOutput_withState ( void *  state,
const char *  source,
char *  dest,
int  inputSize,
int  maxOutputSize 
)

Definition at line 1343 of file lz4.c.

int LZ4_compress_withState ( void *  state,
const char *  source,
char *  dest,
int  inputSize 
)

Definition at line 1332 of file lz4.c.

int LZ4_compressBound ( int  isize)

Definition at line 429 of file lz4.c.

void* LZ4_create ( const char *  inputBuffer)

Definition at line 1314 of file lz4.c.

LZ4_stream_t* LZ4_createStream ( void  )

Definition at line 765 of file lz4.c.

LZ4_streamDecode_t* LZ4_createStreamDecode ( void  )

Definition at line 1152 of file lz4.c.

int LZ4_decompress_fast ( const char *  source,
char *  dest,
int  originalSize 
)

Definition at line 1131 of file lz4.c.

int LZ4_decompress_fast_continue ( LZ4_streamDecode_t LZ4_streamDecode,
const char *  source,
char *  dest,
int  originalSize 
)

Definition at line 1217 of file lz4.c.

int LZ4_decompress_fast_usingDict ( const char *  source,
char *  dest,
int  originalSize,
const char *  dictStart,
int  dictSize 
)

Definition at line 1272 of file lz4.c.

int LZ4_decompress_fast_withPrefix64k ( const char *  source,
char *  dest,
int  originalSize 
)

Definition at line 1361 of file lz4.c.

FORCE_INLINE int LZ4_decompress_generic ( const char *const  source,
char *const  dest,
int  inputSize,
int  outputSize,
int  endOnInput,
int  partialDecoding,
int  targetOutputSize,
int  dict,
const BYTE *const  lowPrefix,
const BYTE *const  dictStart,
const size_t  dictSize 
)

Definition at line 942 of file lz4.c.

int LZ4_decompress_safe ( const char *  source,
char *  dest,
int  compressedSize,
int  maxDecompressedSize 
)

Definition at line 1121 of file lz4.c.

int LZ4_decompress_safe_continue ( LZ4_streamDecode_t LZ4_streamDecode,
const char *  source,
char *  dest,
int  compressedSize,
int  maxOutputSize 
)

Definition at line 1188 of file lz4.c.

int LZ4_decompress_safe_forceExtDict ( const char *  source,
char *  dest,
int  compressedSize,
int  maxOutputSize,
const char *  dictStart,
int  dictSize 
)

Definition at line 1278 of file lz4.c.

int LZ4_decompress_safe_partial ( const char *  source,
char *  dest,
int  compressedSize,
int  targetOutputSize,
int  maxDecompressedSize 
)

Definition at line 1126 of file lz4.c.

int LZ4_decompress_safe_usingDict ( const char *  source,
char *  dest,
int  compressedSize,
int  maxOutputSize,
const char *  dictStart,
int  dictSize 
)

Definition at line 1267 of file lz4.c.

int LZ4_decompress_safe_withPrefix64k ( const char *  source,
char *  dest,
int  compressedSize,
int  maxOutputSize 
)

Definition at line 1356 of file lz4.c.

FORCE_INLINE int LZ4_decompress_usingDict_generic ( const char *  source,
char *  dest,
int  compressedSize,
int  maxOutputSize,
int  safe,
const char *  dictStart,
int  dictSize 
)

Definition at line 1254 of file lz4.c.

int LZ4_freeStream ( LZ4_stream_t LZ4_stream)

Definition at line 773 of file lz4.c.

int LZ4_freeStreamDecode ( LZ4_streamDecode_t LZ4_stream)

Definition at line 1158 of file lz4.c.

int LZ4_loadDict ( LZ4_stream_t LZ4_dict,
const char *  dictionary,
int  dictSize 
)

Definition at line 780 of file lz4.c.

void LZ4_resetStream ( LZ4_stream_t LZ4_stream)

Definition at line 760 of file lz4.c.

int LZ4_resetStreamState ( void *  state,
const char *  inputBuffer 
)

Definition at line 1307 of file lz4.c.

int LZ4_saveDict ( LZ4_stream_t LZ4_dict,
char *  safeBuffer,
int  dictSize 
)

Definition at line 915 of file lz4.c.

int LZ4_setStreamDecode ( LZ4_streamDecode_t LZ4_streamDecode,
const char *  dictionary,
int  dictSize 
)

Definition at line 1171 of file lz4.c.

int LZ4_sizeofState ( void  )

Definition at line 1330 of file lz4.c.

int LZ4_sizeofStreamState ( void  )

Definition at line 1299 of file lz4.c.

char* LZ4_slideInputBuffer ( void *  LZ4_Data)

Definition at line 1321 of file lz4.c.

int LZ4_uncompress ( const char *  source,
char *  dest,
int  outputSize 
)

Definition at line 1293 of file lz4.c.

int LZ4_uncompress_unknownOutputSize ( const char *  source,
char *  dest,
int  isize,
int  maxOutputSize 
)

Definition at line 1294 of file lz4.c.

int LZ4_versionNumber ( void  )

Definition at line 428 of file lz4.c.