ReactOS 0.4.16-dev-340-g0540c21
|
#include <string.h>
#include "cpu.h"
#include "mem.h"
#include "fse.h"
#include "huf.h"
#include "zstd_internal.h"
#include "zstd_decompress_internal.h"
#include "zstd_ddict.h"
#include "zstd_decompress_block.h"
Go to the source code of this file.
Macros | |
#define | ZSTD_HEAPMODE 1 |
#define | ZSTD_LEGACY_SUPPORT 0 |
#define | ZSTD_MAXWINDOWSIZE_DEFAULT (((U32)1 << ZSTD_WINDOWLOG_LIMIT_DEFAULT) + 1) |
#define | ZSTD_NO_FORWARD_PROGRESS_MAX 16 |
#define | FSE_STATIC_LINKING_ONLY |
#define | HUF_STATIC_LINKING_ONLY |
#define | CHECK_DBOUNDS(p, v) |
Definition at line 1435 of file zstd_decompress.c.
#define FSE_STATIC_LINKING_ONLY |
Definition at line 61 of file zstd_decompress.c.
#define HUF_STATIC_LINKING_ONLY |
Definition at line 63 of file zstd_decompress.c.
#define ZSTD_HEAPMODE 1 |
HEAPMODE : Select how default decompression function ZSTD_decompress() allocates its context, on stack (0), or into heap (1, default; requires malloc()). Note that functions with explicit context such as ZSTD_decompressDCtx() are unaffected.
Definition at line 22 of file zstd_decompress.c.
#define ZSTD_LEGACY_SUPPORT 0 |
LEGACY_SUPPORT : if set to 1+, ZSTD_decompress() can decode older formats (v0.1+)
Definition at line 30 of file zstd_decompress.c.
MAXWINDOWSIZE_DEFAULT : maximum window size accepted by DStream by default. Frames requiring more memory will be rejected. It's possible to set a different limit using ZSTD_DCtx_setMaxWindowSize().
Definition at line 40 of file zstd_decompress.c.
#define ZSTD_NO_FORWARD_PROGRESS_MAX 16 |
NO_FORWARD_PROGRESS_MAX : maximum allowed nb of calls to ZSTD_decompressStream() without any forward progress (defined as: no byte read from input, and no byte flushed to output) before triggering an error.
Definition at line 51 of file zstd_decompress.c.
Definition at line 355 of file zstd_decompress.c.
Referenced by ZSTD_decompressMultiFrame(), ZSTD_findDecompressedSize(), and ZSTD_findFrameSizeInfo().
|
static |
Definition at line 1537 of file zstd_decompress.c.
Referenced by ZSTD_decompressStream().
Definition at line 153 of file zstd_decompress.c.
Referenced by ZSTD_DCtx_loadDictionary_advanced(), ZSTD_DCtx_refDDict(), ZSTD_DCtx_reset(), ZSTD_freeDCtx(), and ZSTD_getDDict().
Definition at line 179 of file zstd_decompress.c.
|
static |
Definition at line 578 of file zstd_decompress.c.
Referenced by ZSTD_decompressContinue(), and ZSTD_decompressFrame().
Definition at line 147 of file zstd_decompress.c.
Referenced by ZSTD_decompress().
ZSTD_DCtx * ZSTD_createDCtx_advanced | ( | ZSTD_customMem | customMem | ) |
Definition at line 135 of file zstd_decompress.c.
Referenced by ZSTD_createDCtx(), and ZSTD_createDStream_advanced().
ZSTD_DStream * ZSTD_createDStream | ( | void | ) |
Definition at line 1265 of file zstd_decompress.c.
ZSTD_DStream * ZSTD_createDStream_advanced | ( | ZSTD_customMem | customMem | ) |
Definition at line 1276 of file zstd_decompress.c.
Referenced by ZSTD_createDStream(), and zstd_decompress().
|
static |
Definition at line 1518 of file zstd_decompress.c.
Referenced by ZSTD_DCtx_updateOversizedDuration().
|
static |
Definition at line 1531 of file zstd_decompress.c.
Referenced by ZSTD_decompressStream().
ZSTD_DCtx_loadDictionary() : Create an internal DDict from dict buffer, to be used to decompress next frames. The dictionary remains valid for all future frames, until explicitly invalidated.
dict
content will be copied internally, so dict
can be released after loading. Use ZSTD_DCtx_loadDictionary_byReference() to reference dictionary content instead. Note 3 : Use ZSTD_DCtx_loadDictionary_advanced() to take control of how dictionary content is loaded and interpreted. Definition at line 1313 of file zstd_decompress.c.
Referenced by ZSTD_initDStream_usingDict().
size_t ZSTD_DCtx_loadDictionary_advanced | ( | ZSTD_DCtx * | dctx, |
const void * | dict, | ||
size_t | dictSize, | ||
ZSTD_dictLoadMethod_e | dictLoadMethod, | ||
ZSTD_dictContentType_e | dictContentType | ||
) |
Definition at line 1292 of file zstd_decompress.c.
Referenced by ZSTD_DCtx_loadDictionary(), ZSTD_DCtx_loadDictionary_byReference(), and ZSTD_DCtx_refPrefix_advanced().
size_t ZSTD_DCtx_loadDictionary_byReference | ( | ZSTD_DCtx * | dctx, |
const void * | dict, | ||
size_t | dictSize | ||
) |
Definition at line 1308 of file zstd_decompress.c.
size_t ZSTD_DCtx_refDDict | ( | ZSTD_DCtx * | dctx, |
const ZSTD_DDict * | ddict | ||
) |
ZSTD_DCtx_refDDict() : Reference a prepared dictionary, to be used to decompress next frames. The dictionary remains active for decompression of future frames using same DCtx.
Definition at line 1369 of file zstd_decompress.c.
Referenced by ZSTD_initDStream_usingDDict().
ZSTD_DCtx_refPrefix() : Reference a prefix (single-usage dictionary) to decompress next frame. This is the reverse operation of ZSTD_CCtx_refPrefix(), and must use the same prefix as the one used during compression. Prefix is only used once. Reference is discarded at end of frame. End of frame is reached when ZSTD_decompressStream() returns 0.
Definition at line 1325 of file zstd_decompress.c.
size_t ZSTD_DCtx_refPrefix_advanced | ( | ZSTD_DCtx * | dctx, |
const void * | prefix, | ||
size_t | prefixSize, | ||
ZSTD_dictContentType_e | dictContentType | ||
) |
Definition at line 1318 of file zstd_decompress.c.
Referenced by ZSTD_DCtx_refPrefix().
size_t ZSTD_DCtx_reset | ( | ZSTD_DCtx * | dctx, |
ZSTD_ResetDirective | reset | ||
) |
ZSTD_DCtx_reset() : Return a DCtx to clean state. Session and parameters can be reset jointly or separately. Parameters can only be reset when no active frame is being decompressed.
Definition at line 1461 of file zstd_decompress.c.
Referenced by ZSTD_initDStream_usingDDict(), ZSTD_initDStream_usingDict(), and ZSTD_resetDStream().
Definition at line 1395 of file zstd_decompress.c.
Definition at line 1383 of file zstd_decompress.c.
size_t ZSTD_DCtx_setParameter | ( | ZSTD_DCtx * | dctx, |
ZSTD_dParameter | param, | ||
int | value | ||
) |
ZSTD_DCtx_setParameter() : Set one compression parameter, selected by enum ZSTD_dParameter. All parameters have valid bounds. Bounds can be queried using ZSTD_dParam_getBounds(). Providing a value beyond bound will either clamp it, or trigger an error (depending on parameter). Setting a parameter is only possible during frame initialization (before starting decompression).
Definition at line 1439 of file zstd_decompress.c.
Referenced by ZSTD_DCtx_setFormat().
|
static |
Definition at line 1523 of file zstd_decompress.c.
Referenced by ZSTD_decompressStream().
|
static |
ZSTD_decodeFrameHeader() : headerSize
must be the size provided by ZSTD_frameHeaderSize().
Definition at line 437 of file zstd_decompress.c.
Referenced by ZSTD_decompressContinue(), ZSTD_decompressFrame(), and ZSTD_decompressStream().
size_t ZSTD_decodingBufferSize_min | ( | unsigned long long | windowSize, |
unsigned long long | frameContentSize | ||
) |
Definition at line 1484 of file zstd_decompress.c.
Referenced by ZSTD_decompressStream(), and ZSTD_estimateDStreamSize().
ZSTD_decompress() : compressedSize
: must be the exact size of some number of compressed and/or skippable frames. dstCapacity
is an upper bound of originalSize to regenerate. If user cannot imply a maximum upper bound, it's better to use streaming mode to decompress data.
dst
(<= dstCapacity
), or an errorCode if it fails (which can be tested using ZSTD_isError()). Definition at line 819 of file zstd_decompress.c.
|
static |
Definition at line 1137 of file zstd_decompress.c.
Referenced by ZSTD_decompressBegin_usingDict().
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 pre-digested Dictionary Use dictionary without significant overhead.
Definition at line 1249 of file zstd_decompress.c.
Referenced by ZSTD_decompressDCtx(), and ZSTD_decompressStream().
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 known Dictionary. Dictionary must be identical to the one used during compression. Note : This function loads the dictionary, resulting in significant startup delay. It's intended for a dictionary used only once. Note : When dict == NULL || dictSize < 8
no dictionary is used.
Definition at line 787 of file zstd_decompress.c.
Definition at line 1158 of file zstd_decompress.c.
Referenced by ZSTD_decompressBegin_usingDDict(), and ZSTD_decompressBegin_usingDict().
size_t ZSTD_decompressBegin_usingDDict | ( | ZSTD_DCtx * | dctx, |
const ZSTD_DDict * | ddict | ||
) |
Definition at line 1194 of file zstd_decompress.c.
Referenced by ZSTD_decompressMultiFrame(), and ZSTD_decompressStream().
Definition at line 1181 of file zstd_decompress.c.
Referenced by ZSTD_decompressMultiFrame().
ZSTD_decompressBound() : compatible with legacy mode src
must point to the start of a ZSTD frame or a skippeable frame srcSize
must be at least as large as the frame contained
Definition at line 544 of file zstd_decompress.c.
size_t ZSTD_decompressContinue | ( | ZSTD_DCtx * | dctx, |
void * | dst, | ||
size_t | dstCapacity, | ||
const void * | src, | ||
size_t | srcSize | ||
) |
ZSTD_decompressContinue() : srcSize : must be the exact nb of bytes expected (see ZSTD_nextSrcSizeToDecompress())
dst
(necessarily <= `dstCapacity) or an error code, which can be tested using ZSTD_isError() Definition at line 888 of file zstd_decompress.c.
Referenced by ZSTD_decompressContinueStream().
|
static |
Definition at line 1559 of file zstd_decompress.c.
Referenced by ZSTD_decompressStream().
size_t ZSTD_decompressDCtx | ( | ZSTD_DCtx * | dctx, |
void * | dst, | ||
size_t | dstCapacity, | ||
const void * | src, | ||
size_t | srcSize | ||
) |
ZSTD_decompressDCtx() : Same as ZSTD_decompress(), requires an allocated ZSTD_DCtx. Compatible with sticky parameters.
Definition at line 813 of file zstd_decompress.c.
Referenced by ZSTD_decompress().
|
static |
ZSTD_decompressFrame() : @dctx must be properly initialized will update *srcPtr and *srcSizePtr, to make *srcPtr progress by one frame.
Definition at line 609 of file zstd_decompress.c.
Referenced by ZSTD_decompressMultiFrame().
|
static |
Definition at line 694 of file zstd_decompress.c.
Referenced by ZSTD_decompress_usingDDict(), and ZSTD_decompress_usingDict().
size_t ZSTD_decompressStream | ( | ZSTD_DStream * | zds, |
ZSTD_outBuffer * | output, | ||
ZSTD_inBuffer * | input | ||
) |
Definition at line 1588 of file zstd_decompress.c.
Referenced by zstd_decompress(), and ZSTD_decompressStream_simpleArgs().
size_t ZSTD_decompressStream_simpleArgs | ( | ZSTD_DCtx * | dctx, |
void * | dst, | ||
size_t | dstCapacity, | ||
size_t * | dstPos, | ||
const void * | src, | ||
size_t | srcSize, | ||
size_t * | srcPos | ||
) |
Definition at line 1873 of file zstd_decompress.c.
ZSTD_bounds ZSTD_dParam_getBounds | ( | ZSTD_dParameter | dParam | ) |
ZSTD_dParam_getBounds() : All parameters must belong to an interval with lower and upper bounds, otherwise they will either trigger an error or be automatically clamped.
Definition at line 1400 of file zstd_decompress.c.
Referenced by ZSTD_DCtx_setMaxWindowSize(), and ZSTD_dParam_withinBounds().
|
static |
Definition at line 1426 of file zstd_decompress.c.
recommended size for output buffer. Guarantee to successfully flush at least one complete block in all circumstances.
Definition at line 1290 of file zstd_decompress.c.
|
static |
Definition at line 453 of file zstd_decompress.c.
Referenced by ZSTD_findFrameSizeInfo().
Definition at line 1495 of file zstd_decompress.c.
Referenced by ZSTD_estimateDStreamSize_fromFrame().
Definition at line 1503 of file zstd_decompress.c.
ZSTD_findDecompressedSize() : compatible with legacy mode srcSize
must be the exact length of some number of ZSTD compressed and/or skippable frames
Definition at line 377 of file zstd_decompress.c.
ZSTD_findFrameCompressedSize() : compatible with legacy mode src
must point to the start of a ZSTD frame, ZSTD legacy frame, or skippable frame srcSize
must be at least as large as the frame contained
src
Definition at line 532 of file zstd_decompress.c.
Referenced by ZSTD_decompressStream(), and ZSTD_findDecompressedSize().
|
static |
Definition at line 461 of file zstd_decompress.c.
Referenced by ZSTD_decompressBound(), and ZSTD_findFrameCompressedSize().
ZSTD_frameHeaderSize() : srcSize must be >= ZSTD_frameHeaderSize_prefix.
Definition at line 232 of file zstd_decompress.c.
|
static |
ZSTD_frameHeaderSize_internal() : srcSize must be large enough to reach header size fields. note : only works for formats ZSTD_f_zstd1 and ZSTD_f_zstd1_magicless.
Definition at line 213 of file zstd_decompress.c.
Referenced by ZSTD_decompressContinue(), ZSTD_decompressFrame(), ZSTD_frameHeaderSize(), and ZSTD_getFrameHeader_advanced().
Definition at line 161 of file zstd_decompress.c.
Referenced by ZSTD_decompress(), and ZSTD_freeDStream().
size_t ZSTD_freeDStream | ( | ZSTD_DStream * | zds | ) |
Definition at line 1281 of file zstd_decompress.c.
Referenced by zstd_decompress().
|
static |
Definition at line 796 of file zstd_decompress.c.
Referenced by ZSTD_decompressDCtx(), and ZSTD_decompressStream().
ZSTD_getDecompressedSize() : compatible with legacy mode
srcSize
too small) Definition at line 426 of file zstd_decompress.c.
ZSTD_getDictID_fromDict() : Provides the dictID stored within dictionary. if
Definition at line 1217 of file zstd_decompress.c.
Referenced by ZSTD_getDictID_fromDDict().
ZSTD_getDictID_fromFrame() : Provides the dictID required to decompress frame stored within src
. If
srcSize
is too small, and as a result, frame header could not be decoded. Note : possible if srcSize < ZSTD_FRAMEHEADERSIZE_MAX
.Definition at line 1237 of file zstd_decompress.c.
ZSTD_getFrameContentSize() : compatible with legacy mode
src
if known, otherwiseDefinition at line 337 of file zstd_decompress.c.
Referenced by ZSTD_findDecompressedSize(), and ZSTD_getDecompressedSize().
ZSTD_getFrameHeader() : decode Frame Header, or require larger srcSize
. note : this function does not consume input, it only reads it.
zfhPtr
is correctly filled, >0, srcSize
is too small, value is wanted srcSize
amount, or an error code, which can be tested using ZSTD_isError() Definition at line 326 of file zstd_decompress.c.
Referenced by ZSTD_estimateDStreamSize_fromFrame(), ZSTD_findFrameSizeInfo(), ZSTD_getDictID_fromFrame(), and ZSTD_getFrameContentSize().
size_t ZSTD_getFrameHeader_advanced | ( | ZSTD_frameHeader * | zfhPtr, |
const void * | src, | ||
size_t | srcSize, | ||
ZSTD_format_e | format | ||
) |
ZSTD_getFrameHeader_advanced() : decode Frame Header, or require larger srcSize
. note : only works for formats ZSTD_f_zstd1 and ZSTD_f_zstd1_magicless
zfhPtr
is correctly filled, >0, srcSize
is too small, value is wanted srcSize
amount, or an error code, which can be tested using ZSTD_isError() Definition at line 244 of file zstd_decompress.c.
Referenced by ZSTD_decodeFrameHeader(), ZSTD_decompressStream(), and ZSTD_getFrameHeader().
Definition at line 97 of file zstd_decompress.c.
Referenced by ZSTD_createDCtx_advanced(), ZSTD_decompress(), and ZSTD_initStaticDCtx().
size_t ZSTD_initDStream | ( | ZSTD_DStream * | zds | ) |
Definition at line 1343 of file zstd_decompress.c.
Referenced by zstd_decompress().
size_t ZSTD_initDStream_usingDDict | ( | ZSTD_DStream * | dctx, |
const ZSTD_DDict * | ddict | ||
) |
Definition at line 1352 of file zstd_decompress.c.
Referenced by ZSTD_initDStream().
size_t ZSTD_initDStream_usingDict | ( | ZSTD_DStream * | zds, |
const void * | dict, | ||
size_t | dictSize | ||
) |
Definition at line 1334 of file zstd_decompress.c.
Definition at line 122 of file zstd_decompress.c.
Referenced by ZSTD_initStaticDStream().
ZSTD_DStream * ZSTD_initStaticDStream | ( | void * | workspace, |
size_t | workspaceSize | ||
) |
Definition at line 1271 of file zstd_decompress.c.
ZSTD_insertBlock() : insert src
block into dctx
history. Useful to track uncompressed blocks.
Definition at line 569 of file zstd_decompress.c.
ZSTD_isFrame() : Tells if the content of buffer
starts with a valid Frame Identifier. Note : Frame Identifier is 4 bytes. If size < 4
,
Definition at line 195 of file zstd_decompress.c.
Definition at line 882 of file zstd_decompress.c.
Referenced by ZSTD_decompressContinueStream(), and ZSTD_decompressStream().
size_t ZSTD_loadDEntropy | ( | ZSTD_entropyDTables_t * | entropy, |
const void *const | dict, | ||
size_t const | dictSize | ||
) |
ZSTD_loadDEntropy() : dict : must point at beginning of a valid zstd dictionary.
Definition at line 1056 of file zstd_decompress.c.
Referenced by ZSTD_decompress_insertDictionary(), and ZSTD_loadEntropy_intoDDict().
ZSTD_nextInputType_e ZSTD_nextInputType | ( | ZSTD_DCtx * | dctx | ) |
Definition at line 860 of file zstd_decompress.c.
Referenced by ZSTD_decompressStream().
|
static |
Similar to ZSTD_nextSrcSizeToDecompress(), but when when a block input can be streamed, we allow taking a partial block as the input. Currently only raw uncompressed blocks can be streamed.
For blocks that can be streamed, this allows us to reduce the latency until we produce output, and avoid copying the input.
inputSize | - The total amount of input that the caller currently has. |
Definition at line 852 of file zstd_decompress.c.
Referenced by ZSTD_decompressContinue(), and ZSTD_decompressStream().
Definition at line 1039 of file zstd_decompress.c.
Referenced by ZSTD_decompress_insertDictionary().
size_t ZSTD_resetDStream | ( | ZSTD_DStream * | dctx | ) |
Definition at line 1362 of file zstd_decompress.c.
Definition at line 591 of file zstd_decompress.c.
Referenced by ZSTD_decompressContinue(), and ZSTD_decompressFrame().
Definition at line 78 of file zstd_decompress.c.
Referenced by ZSTD_sizeof_DStream().
size_t ZSTD_sizeof_DStream | ( | const ZSTD_DStream * | dctx | ) |
Definition at line 1479 of file zstd_decompress.c.
|
static |
Definition at line 89 of file zstd_decompress.c.
Referenced by ZSTD_decompressBegin(), ZSTD_decompressMultiFrame(), ZSTD_findDecompressedSize(), ZSTD_frameHeaderSize_internal(), ZSTD_getFrameHeader_advanced(), ZSTD_initDStream_usingDDict(), ZSTD_initDStream_usingDict(), and ZSTD_resetDStream().