GenomicDataStream
A scalable interface between data and analysis
Loading...
Searching...
No Matches
zstd.h File Reference
#include <stddef.h>

Go to the source code of this file.

Classes

struct  ZSTD_inBuffer_s
struct  ZSTD_outBuffer_s

Macros

#define ZSTDLIB_API
#define ZSTD_VERSION_MAJOR   1
#define ZSTD_VERSION_MINOR   1
#define ZSTD_VERSION_RELEASE   0
#define ZSTD_LIB_VERSION   ZSTD_VERSION_MAJOR.ZSTD_VERSION_MINOR.ZSTD_VERSION_RELEASE
#define ZSTD_QUOTE(str)
#define ZSTD_EXPAND_AND_QUOTE(str)
#define ZSTD_VERSION_STRING   ZSTD_EXPAND_AND_QUOTE(ZSTD_LIB_VERSION)
#define ZSTD_VERSION_NUMBER   (ZSTD_VERSION_MAJOR *100*100 + ZSTD_VERSION_MINOR *100 + ZSTD_VERSION_RELEASE)

Typedefs

typedef struct ZSTD_CCtx_s ZSTD_CCtx
typedef struct ZSTD_DCtx_s ZSTD_DCtx
typedef struct ZSTD_CDict_s ZSTD_CDict
typedef struct ZSTD_DDict_s ZSTD_DDict
typedef struct ZSTD_inBuffer_s ZSTD_inBuffer
typedef struct ZSTD_outBuffer_s ZSTD_outBuffer
typedef struct ZSTD_CStream_s ZSTD_CStream
typedef struct ZSTD_DStream_s ZSTD_DStream

Functions

ZSTDLIB_API unsigned ZSTD_versionNumber (void)
ZSTDLIB_API size_t ZSTD_compress (void *dst, size_t dstCapacity, const void *src, size_t srcSize, int compressionLevel)
ZSTDLIB_API size_t ZSTD_decompress (void *dst, size_t dstCapacity, const void *src, size_t compressedSize)
ZSTDLIB_API unsigned long long ZSTD_getDecompressedSize (const void *src, size_t srcSize)
ZSTDLIB_API int ZSTD_maxCLevel (void)
ZSTDLIB_API size_t ZSTD_compressBound (size_t srcSize)
ZSTDLIB_API unsigned ZSTD_isError (size_t code)
ZSTDLIB_API const char * ZSTD_getErrorName (size_t code)
ZSTDLIB_API ZSTD_CCtxZSTD_createCCtx (void)
ZSTDLIB_API size_t ZSTD_freeCCtx (ZSTD_CCtx *cctx)
ZSTDLIB_API size_t ZSTD_compressCCtx (ZSTD_CCtx *ctx, void *dst, size_t dstCapacity, const void *src, size_t srcSize, int compressionLevel)
ZSTDLIB_API ZSTD_DCtxZSTD_createDCtx (void)
ZSTDLIB_API size_t ZSTD_freeDCtx (ZSTD_DCtx *dctx)
ZSTDLIB_API size_t ZSTD_decompressDCtx (ZSTD_DCtx *ctx, void *dst, size_t dstCapacity, const void *src, size_t srcSize)
ZSTDLIB_API size_t ZSTD_compress_usingDict (ZSTD_CCtx *ctx, void *dst, size_t dstCapacity, const void *src, size_t srcSize, const void *dict, size_t dictSize, int compressionLevel)
ZSTDLIB_API size_t ZSTD_decompress_usingDict (ZSTD_DCtx *dctx, void *dst, size_t dstCapacity, const void *src, size_t srcSize, const void *dict, size_t dictSize)
ZSTDLIB_API ZSTD_CDictZSTD_createCDict (const void *dict, size_t dictSize, int compressionLevel)
ZSTDLIB_API size_t ZSTD_freeCDict (ZSTD_CDict *CDict)
ZSTDLIB_API size_t ZSTD_compress_usingCDict (ZSTD_CCtx *cctx, void *dst, size_t dstCapacity, const void *src, size_t srcSize, const ZSTD_CDict *cdict)
ZSTDLIB_API ZSTD_DDictZSTD_createDDict (const void *dict, size_t dictSize)
ZSTDLIB_API size_t ZSTD_freeDDict (ZSTD_DDict *ddict)
ZSTDLIB_API size_t ZSTD_decompress_usingDDict (ZSTD_DCtx *dctx, void *dst, size_t dstCapacity, const void *src, size_t srcSize, const ZSTD_DDict *ddict)
ZSTDLIB_API ZSTD_CStreamZSTD_createCStream (void)
ZSTDLIB_API size_t ZSTD_freeCStream (ZSTD_CStream *zcs)
ZSTDLIB_API size_t ZSTD_CStreamInSize (void)
ZSTDLIB_API size_t ZSTD_CStreamOutSize (void)
ZSTDLIB_API size_t ZSTD_initCStream (ZSTD_CStream *zcs, int compressionLevel)
ZSTDLIB_API size_t ZSTD_compressStream (ZSTD_CStream *zcs, ZSTD_outBuffer *output, ZSTD_inBuffer *input)
ZSTDLIB_API size_t ZSTD_flushStream (ZSTD_CStream *zcs, ZSTD_outBuffer *output)
ZSTDLIB_API size_t ZSTD_endStream (ZSTD_CStream *zcs, ZSTD_outBuffer *output)
ZSTDLIB_API ZSTD_DStreamZSTD_createDStream (void)
ZSTDLIB_API size_t ZSTD_freeDStream (ZSTD_DStream *zds)
ZSTDLIB_API size_t ZSTD_DStreamInSize (void)
ZSTDLIB_API size_t ZSTD_DStreamOutSize (void)
ZSTDLIB_API size_t ZSTD_initDStream (ZSTD_DStream *zds)
ZSTDLIB_API size_t ZSTD_decompressStream (ZSTD_DStream *zds, ZSTD_outBuffer *output, ZSTD_inBuffer *input)

Macro Definition Documentation

◆ ZSTD_EXPAND_AND_QUOTE

#define ZSTD_EXPAND_AND_QUOTE ( str)
Value:
#define ZSTD_QUOTE(str)
Definition zstd.h:39

◆ ZSTD_LIB_VERSION

◆ ZSTD_QUOTE

#define ZSTD_QUOTE ( str)
Value:
#str

◆ ZSTD_VERSION_MAJOR

#define ZSTD_VERSION_MAJOR   1

◆ ZSTD_VERSION_MINOR

#define ZSTD_VERSION_MINOR   1

◆ ZSTD_VERSION_NUMBER

#define ZSTD_VERSION_NUMBER   (ZSTD_VERSION_MAJOR *100*100 + ZSTD_VERSION_MINOR *100 + ZSTD_VERSION_RELEASE)

◆ ZSTD_VERSION_RELEASE

#define ZSTD_VERSION_RELEASE   0

◆ ZSTD_VERSION_STRING

#define ZSTD_VERSION_STRING   ZSTD_EXPAND_AND_QUOTE(ZSTD_LIB_VERSION)

◆ ZSTDLIB_API

#define ZSTDLIB_API

Copyright (c) 2016-present, Yann Collet, Facebook, Inc. All rights reserved.

This source code is licensed under the BSD-style license found in the LICENSE file in the root directory of this source tree. An additional grant of patent rights can be found in the PATENTS file in the same directory.

ZSTD_DLL_EXPORT : Enable exporting of functions when building a Windows DLL

Typedef Documentation

◆ ZSTD_CCtx

typedef struct ZSTD_CCtx_s ZSTD_CCtx

Compression context

◆ ZSTD_CDict

typedef struct ZSTD_CDict_s ZSTD_CDict

ZSTD_createCDict() : Create a digested dictionary, ready to start compression operation without startup delay. dict can be released after ZSTD_CDict creation

◆ ZSTD_CStream

typedef struct ZSTD_CStream_s ZSTD_CStream

◆ ZSTD_DCtx

typedef struct ZSTD_DCtx_s ZSTD_DCtx

Decompression context

◆ ZSTD_DDict

typedef struct ZSTD_DDict_s ZSTD_DDict

ZSTD_createDDict() : Create a digested dictionary, ready to start decompression operation without startup delay. dict can be released after creation

◆ ZSTD_DStream

typedef struct ZSTD_DStream_s ZSTD_DStream

◆ ZSTD_inBuffer

◆ ZSTD_outBuffer

Function Documentation

◆ ZSTD_compress()

ZSTDLIB_API size_t ZSTD_compress ( void * dst,
size_t dstCapacity,
const void * src,
size_t srcSize,
int compressionLevel )

ZSTD_compress() : Compresses src content as a single zstd compressed frame into already allocated dst. Hint : compression runs faster if dstCapacity >= ZSTD_compressBound(srcSize).

Returns
: compressed size written into dst (<= `dstCapacity), or an error code if it fails (which can be tested using ZSTD_isError())

◆ ZSTD_compress_usingCDict()

ZSTDLIB_API size_t ZSTD_compress_usingCDict ( ZSTD_CCtx * cctx,
void * dst,
size_t dstCapacity,
const void * src,
size_t srcSize,
const ZSTD_CDict * cdict )

ZSTD_compress_usingCDict() : Compression using a digested Dictionary. Faster startup than ZSTD_compress_usingDict(), recommended when same dictionary is used multiple times. Note that compression level is decided during dictionary creation

◆ ZSTD_compress_usingDict()

ZSTDLIB_API size_t ZSTD_compress_usingDict ( ZSTD_CCtx * ctx,
void * dst,
size_t dstCapacity,
const void * src,
size_t srcSize,
const void * dict,
size_t dictSize,
int compressionLevel )

ZSTD_compress_usingDict() : Compression using a predefined Dictionary (see dictBuilder/zdict.h). Note : This function load the dictionary, resulting in significant startup delay.

◆ ZSTD_compressBound()

ZSTDLIB_API size_t ZSTD_compressBound ( size_t srcSize)

maximum compressed size in worst case scenario

◆ ZSTD_compressCCtx()

ZSTDLIB_API size_t ZSTD_compressCCtx ( ZSTD_CCtx * ctx,
void * dst,
size_t dstCapacity,
const void * src,
size_t srcSize,
int compressionLevel )

ZSTD_compressCCtx() : Same as ZSTD_compress(), requires an allocated ZSTD_CCtx (see ZSTD_createCCtx())

◆ ZSTD_compressStream()

ZSTDLIB_API size_t ZSTD_compressStream ( ZSTD_CStream * zcs,
ZSTD_outBuffer * output,
ZSTD_inBuffer * input )

◆ ZSTD_createCCtx()

ZSTDLIB_API ZSTD_CCtx * ZSTD_createCCtx ( void )

◆ ZSTD_createCDict()

ZSTDLIB_API ZSTD_CDict * ZSTD_createCDict ( const void * dict,
size_t dictSize,
int compressionLevel )

◆ ZSTD_createCStream()

ZSTDLIB_API ZSTD_CStream * ZSTD_createCStream ( void )

◆ ZSTD_createDCtx()

ZSTDLIB_API ZSTD_DCtx * ZSTD_createDCtx ( void )

◆ ZSTD_createDDict()

ZSTDLIB_API ZSTD_DDict * ZSTD_createDDict ( const void * dict,
size_t dictSize )

◆ ZSTD_createDStream()

ZSTDLIB_API ZSTD_DStream * ZSTD_createDStream ( void )

◆ ZSTD_CStreamInSize()

ZSTDLIB_API size_t ZSTD_CStreamInSize ( void )

recommended size for input buffer

◆ ZSTD_CStreamOutSize()

ZSTDLIB_API size_t ZSTD_CStreamOutSize ( void )

recommended size for output buffer. Guarantee to successfully flush at least one complete compressed block in all circumstances.

◆ ZSTD_decompress()

ZSTDLIB_API size_t ZSTD_decompress ( void * dst,
size_t dstCapacity,
const void * src,
size_t compressedSize )

ZSTD_decompress() : compressedSize : must be the exact size of a single compressed frame. dstCapacity is an upper bound of originalSize. If user cannot imply a maximum upper bound, it's better to use streaming mode to decompress data.

Returns
: the number of bytes decompressed into dst (<= dstCapacity), or an errorCode if it fails (which can be tested using ZSTD_isError())

◆ ZSTD_decompress_usingDDict()

ZSTDLIB_API size_t ZSTD_decompress_usingDDict ( ZSTD_DCtx * dctx,
void * dst,
size_t dstCapacity,
const void * src,
size_t srcSize,
const ZSTD_DDict * ddict )

ZSTD_decompress_usingDDict() : Decompression using a digested Dictionary Faster startup than ZSTD_decompress_usingDict(), recommended when same dictionary is used multiple times.

◆ ZSTD_decompress_usingDict()

ZSTDLIB_API size_t ZSTD_decompress_usingDict ( ZSTD_DCtx * dctx,
void * dst,
size_t dstCapacity,
const void * src,
size_t srcSize,
const void * dict,
size_t dictSize )

ZSTD_decompress_usingDict() : Decompression using a predefined Dictionary (see dictBuilder/zdict.h). Dictionary must be identical to the one used during compression. Note : This function load the dictionary, resulting in significant startup delay

◆ ZSTD_decompressDCtx()

ZSTDLIB_API size_t ZSTD_decompressDCtx ( ZSTD_DCtx * ctx,
void * dst,
size_t dstCapacity,
const void * src,
size_t srcSize )

ZSTD_decompressDCtx() : Same as ZSTD_decompress(), requires an allocated ZSTD_DCtx (see ZSTD_createDCtx())

◆ ZSTD_decompressStream()

ZSTDLIB_API size_t ZSTD_decompressStream ( ZSTD_DStream * zds,
ZSTD_outBuffer * output,
ZSTD_inBuffer * input )

◆ ZSTD_DStreamInSize()

ZSTDLIB_API size_t ZSTD_DStreamInSize ( void )

recommended size for input buffer

◆ ZSTD_DStreamOutSize()

ZSTDLIB_API size_t ZSTD_DStreamOutSize ( void )

recommended size for output buffer. Guarantee to successfully flush at least one complete block in all circumstances.

◆ ZSTD_endStream()

ZSTDLIB_API size_t ZSTD_endStream ( ZSTD_CStream * zcs,
ZSTD_outBuffer * output )

◆ ZSTD_flushStream()

ZSTDLIB_API size_t ZSTD_flushStream ( ZSTD_CStream * zcs,
ZSTD_outBuffer * output )

◆ ZSTD_freeCCtx()

ZSTDLIB_API size_t ZSTD_freeCCtx ( ZSTD_CCtx * cctx)

◆ ZSTD_freeCDict()

ZSTDLIB_API size_t ZSTD_freeCDict ( ZSTD_CDict * CDict)

◆ ZSTD_freeCStream()

ZSTDLIB_API size_t ZSTD_freeCStream ( ZSTD_CStream * zcs)

◆ ZSTD_freeDCtx()

ZSTDLIB_API size_t ZSTD_freeDCtx ( ZSTD_DCtx * dctx)

◆ ZSTD_freeDDict()

ZSTDLIB_API size_t ZSTD_freeDDict ( ZSTD_DDict * ddict)

◆ ZSTD_freeDStream()

ZSTDLIB_API size_t ZSTD_freeDStream ( ZSTD_DStream * zds)

◆ ZSTD_getDecompressedSize()

ZSTDLIB_API unsigned long long ZSTD_getDecompressedSize ( const void * src,
size_t srcSize )

ZSTD_getDecompressedSize() : 'src' is the start of a zstd compressed frame.

Returns
: content size to be decompressed, as a 64-bits value if known, 0 otherwise. note 1 : decompressed size is an optional field, that may not be present, especially in streaming mode. When return==0, data to decompress could be any size. In which case, it's necessary to use streaming mode to decompress data. Optionally, application can still use ZSTD_decompress() while relying on implied limits. (For example, data may be necessarily cut into blocks <= 16 KB). note 2 : decompressed size is always present when compression is done with ZSTD_compress() note 3 : decompressed size can be very large (64-bits value), potentially larger than what local system can handle as a single memory segment. In which case, it's necessary to use streaming mode to decompress data. note 4 : If source is untrusted, decompressed size could be wrong or intentionally modified. Always ensure result fits within application's authorized limits. Each application can set its own limits. note 5 : when return==0, if precise failure cause is needed, use ZSTD_getFrameParams() to know more.

◆ ZSTD_getErrorName()

ZSTDLIB_API const char * ZSTD_getErrorName ( size_t code)

provides readable string from an error code

◆ ZSTD_initCStream()

ZSTDLIB_API size_t ZSTD_initCStream ( ZSTD_CStream * zcs,
int compressionLevel )

◆ ZSTD_initDStream()

ZSTDLIB_API size_t ZSTD_initDStream ( ZSTD_DStream * zds)

◆ ZSTD_isError()

ZSTDLIB_API unsigned ZSTD_isError ( size_t code)

tells if a size_t function result is an error code

◆ ZSTD_maxCLevel()

ZSTDLIB_API int ZSTD_maxCLevel ( void )

maximum compression level available

◆ ZSTD_versionNumber()

ZSTDLIB_API unsigned ZSTD_versionNumber ( void )