Lines Matching +full:dynamic +full:- +full:range +full:- +full:compressor
5 * This source code is licensed under both the BSD-style license (found in the
8 * You may select, at your option, one of the above-listed licenses.
28 real-time compression scenarios at zlib-level and better compression ratios.
29 The zstd compression library provides in-memory compression and decompression
33 which is currently 22. Levels >= 20, labeled `--ultra`, should be used with
35 compression levels, which extend the range of speed vs. ratio preferences.
39 - a single step (described as Simple API)
40 - a single step, reusing a context (described as Explicit context)
41 - unbounded multiple steps (described as Streaming compression)
45 - a single step (described as Simple dictionary API)
46 - a single step, reusing a dictionary (described as Bulk-processing
52 Advanced experimental APIs should never be used with a dynamically-linked
57 /*------ Version ------*/
87 /* All magic numbers are supposed read/written to/from files/memory using little-endian convention …
123 * @return : - decompressed size of `src` frame content, if known
124 * - ZSTD_CONTENTSIZE_UNKNOWN if the size cannot be determined
125 …* - ZSTD_CONTENTSIZE_ERROR if an error occurred (e.g. invalid magic number, srcSize too…
133 …* note 3 : decompressed size is always present when compression is completed using single-pass f…
135 * note 4 : decompressed size can be very large (64-bits value),
142 #define ZSTD_CONTENTSIZE_UNKNOWN (0ULL - 1)
143 #define ZSTD_CONTENTSIZE_ERROR (0ULL - 2)
164 …ize) ((srcSize) + ((srcSize)>>8) + (((srcSize) < (128<<10)) ? (((128<<10) - (srcSize)) >> 11) /*…
165 …D_compressBound(size_t srcSize); /*!< maximum compressed size in worst case single-pass scenario */
178 * and re-use it for each successive compression operation.
180 * Note : re-using context is just a speed / resource optimization.
182 * Note 2 : In multi-threaded environments,
205 * and re-use it for each successive compression operation.
231 * __They do not apply to "simple" one-shot variants such as ZSTD_compressCCtx()__ .
260 * See ZSTD_CCtx_refCDict() for more info (superseded-by-cdict). */
261 … ZSTD_c_compressionLevel=100, /* Set compression parameters according to pre-defined cLevel table.
273 * In which case, these values are no longer dynamically selected by the compressor */
274 ZSTD_c_windowLog=101, /* Maximum allowed back-reference distance, expressed as power of 2.
288 ZSTD_c_chainLog=103, /* Size of the multi-probe search table, as a power of 2.
334 * default: windowlog - 7.
345 … * Must be clamped between 0 and (ZSTD_WINDOWLOG_MAX - ZSTD_HASHLOG_MIN).
346 … * Default is MAX(0, (windowLog - ldmHashLog)), optimizing hash table usage.
356 …ZSTD_c_checksumFlag=201, /* A 32-bits checksum of content is written at end of frame (default:0) */
359 /* multi-threading parameters */
360 …/* These parameters are only active if multi-threading is enabled (compiled with build macro ZSTD_…
361 … * Otherwise, trying to set any other value than default (0) will be a no-op and return an error.
362 * In a situation where it's unknown if the linked library supports multi-threading or not,
372 … * Default value is `0`, aka "single-threaded mode" : no worker is spawned,
384 * Possible values range from 0 to 9 :
385 … * - 0 means "default" : value will be determined by the library, depending on strategy
386 * - 1 means "no overlap"
387 * - 9 means "full overlap", using a full window size.
435 * - an error status field, which must be tested using ZSTD_isError()
436 * - lower and upper bounds, both inclusive
445 * Exception : when using multi-threading mode (nbWorkers >= 1),
478 * - The session : will stop compressing current frame, and make CCtx ready to start a new one.
484 * - The parameters : changes all parameters back to "default".
488 * - Both : similar to resetting the session, followed by resetting parameters.
496 …* - Compression parameters are pushed into CCtx before starting compression, using ZSTD_CCtx_set*…
497 * - The function is always blocking, returns when compression is completed.
524 …ameter is only useful in streaming mode, since no internal buffer is allocated in single-pass mode.
549 * - an error status field, which must be tested using ZSTD_isError()
550 * - both lower and upper bounds, inclusive
590 /*-***********************************************************************
591 * Streaming compression - HowTo
596 * It is recommended to re-use ZSTD_CStream since it will play nicer with system's memory, by re-us…
603 * it will re-use the same sticky parameters as previous compression session.
626 * using ZSTD_compressStream2() with ZSTD_e_flush. `output->pos` will be updated.
627 * Note that, if `output->size` is too small, a single invocation with ZSTD_e_flush might not be en…
673 …* - Compression parameters are pushed into CCtx before starting compression, using ZSTD_CCtx_set*…
674 …* - Compression parameters cannot be changed once compression is started (save a list of exceptio…
675 * - output->pos must be <= dstCapacity, input->pos must be <= srcSize
676 …* - output->pos and input->pos will be updated. They are guaranteed to remain below their respect…
677 * - endOp must be a valid directive
678 …* - When nbWorkers==0 (default), function is blocking : it completes its job before returning to …
679 …* - When nbWorkers>=1, function is non-blocking : it copies a portion of input, distributes jobs …
682 …* - Exception : if the first call requests a ZSTD_e_end directive and provides enough dstCapacity…
683 * - @return provides a minimum amount of data remaining to be flushed from internal buffers
688 * - after a ZSTD_e_end directive, if internal buffer is not fully flushed (@return != 0),
735 * the next read size (if non-zero and not an error). ZSTD_compressStream2()
736 * returns the minimum nb of bytes left to flush (if non-zero and not an error).
745 /*-***************************************************************************
746 * Streaming decompression - HowTo
750 * ZSTD_DStream objects can be re-used multiple times.
831 …Dict can be created once and shared by multiple threads concurrently, since its usage is read-only.
885 * It can still be loaded, but as a content-only dictionary. */
891 * Non-conformant dictionaries can still be loaded, but as content-only dictionaries. */
898 * - The frame does not require a dictionary to be decoded (most common case).
899 …* - The frame was built with dictID intentionally removed. Whatever dictionary is necessary is a …
900 * Note : this use case also happens when using a non-conformant dictionary.
901 …* - `srcSize` is too small, and as a result, the frame header could not be decoded (only possible…
902 * - This is not a Zstandard frame.
913 * ZSTD_reset_session_and_parameters. Prefixes are single-use.
921 * Special: Loading a NULL (or 0-size) dictionary invalidates previous dictionary,
922 * meaning "return to no-dictionary mode".
924 * To return to "no-dictionary" situation, load a NULL dictionary (or reset parameters).
926 * It's also a CPU consuming operation, with non-negligible impact on latency.
940 * The parameters ignored are labelled as "superseded-by-cdict" in the ZSTD_cParameter enum docs.
941 * The ignored parameters will be used again if the CCtx is returned to no-dictionary mode.
944 * Special : Referencing a NULL CDict means "return to no-dictionary mode".
951 * Reference a prefix (single-usage dictionary) for next compressed frame.
964 * It's a CPU consuming operation, with non-negligible impact on latency.
976 * Special : Adding a NULL (or 0-size) dictionary invalidates any previous dictionary,
977 * meaning "return to no-dictionary mode".
979 * which has a non-negligible impact on CPU usage and latency.
1001 * Special: referencing a NULL DDict means "return to no-dictionary mode".
1007 * Reference a prefix (single-usage dictionary) to decompress next frame.
1045 * They should never be used with a dynamic library, as prototypes may change in the future.
1078 #define ZSTD_SEARCHLOG_MAX (ZSTD_WINDOWLOG_MAX-1)
1095 …* The limit does not apply for one-pass decoders (such as ZSTD_decompress()), since no additional …
1106 #define ZSTD_LDM_HASHRATELOG_MAX (ZSTD_WINDOWLOG_MAX - ZSTD_HASHLOG_MIN)
1118 /* --- Advanced types --- */
1144 * rep == 1 --> offset == repeat_offset_1
1145 * rep == 2 --> offset == repeat_offset_2
1146 * rep == 3 --> offset == repeat_offset_3
1148 * rep == 1 --> offset == repeat_offset_2
1149 * rep == 2 --> offset == repeat_offset_3
1150 * rep == 3 --> offset == repeat_offset_1 - 1
1171 …int checksumFlag; /*< 1: generate a 32-bits checksum using XXH64 algorithm at end of frame, for…
1188 …ZSTD_dlm_byRef = 1 /*< Reference dictionary content -- the dictionary buffer must outlive its u…
1193 … ZSTD_f_zstd1_magicless = 1 /* Variant of zstd frame format, without initial 4-bytes magic number.
1212 * implementation details of the compressor. They are expected to continue
1218 * - The contents of the CDict can be copied into the working context. This
1221 * the compression faster per-byte of input. However, the initial copy of
1226 * - The CDict's tables can be used in-place. In this model, compression is
1227 * slower per input byte, because the compressor has to search two sets of
1228 * tables. However, this model incurs no start-up cost (as long as the
1232 * - The CDict's tables are not used at all, and instead we use the working
1267 * @return : - decompressed size of all data in all successive frames
1268 * - if the decompressed size cannot be determined: ZSTD_CONTENTSIZE_UNKNOWN
1269 * - if an error occurred: ZSTD_CONTENTSIZE_ERROR
1275 * note 3 : decompressed size can be very large (64-bits value),
1290 * @return : - upper-bound for the decompressed size of all data in all successive frames
1291 * - if an error occurred: ZSTD_CONTENTSIZE_ERROR
1294 …* note 2 : the upper-bound is exact when the decompressed size field is available in every ZSTD …
1296 …* note 3 : when the decompressed size field isn't available, the upper-bound for that frame is c…
1297 * upper-bound = # blocks * min(128 KB, Window_Size)
1362 …* - ZSTD_c_minMatch MUST be set as less than or equal to the smallest match generated by the ma…
1363 …* - ZSTD_c_compressionLevel accordingly adjusts the strength of the entropy coder, as it would …
1364 …* - ZSTD_c_windowLog affects offset validation: this function will return an error at higher de…
1367 …* Note: Repcodes are, as of now, always re-calculated within this function, so ZSTD_Sequence::rep …
1380 …* Skippable frames begin with a a 4-byte magic number. There are 16 possible choices of magic numb…
1386 …* with a 4-byte unsigned int, or if the parameter magicVariant is greater than 15 (and therefore i…
1406 * Therefore, the estimation is only guaranteed for single-shot compressions, not streaming.
1418 * Note 2 : only single-threaded compression is supported.
1431 …ams() can be used in tandem with ZSTD_CCtxParams_setParameter(). Only single-threaded compression …
1432 * Note : CStream size estimation is only correct for single-threaded compression.
1455 * Initialize an object using a pre-allocated fixed-size buffer.
1457 * Provided pointer *must be 8-bytes aligned*.
1472 * Limitation 2 : static cctx currently not compatible with multi-threading.
1566 * Non-conformant dictionaries can still be loaded, but as content-only dictionaries. */
1575 …* same as ZSTD_getCParams(), but @return a full `ZSTD_parameters` object instead of sub-component…
1580 * Ensure param values remain within authorized range.
1588 * cPar can be invalid : all parameters will be clamped within valid range in the @return struct.
1642 * NOTE 2: rsyncable performs poorly in combination with long range mode,
1656 /* Force back-reference distances to remain < windowSize,
1713 * structure for the dictionary that is read-optimized.
1733 * In general, you should expect compression to be faster--sometimes very much
1734 * so--and CDict creation to be slightly slower. Eventually, we will probably
1743 * Tells the compressor that the ZSTD_inBuffer will ALWAYS be the same
1745 * caller must not modify pos). This is checked by the compressor, and
1748 * is not used. The data in the ZSTD_inBuffer in the range [src, src + pos)
1761 * this flag is ALWAYS memory safe, and will never access out-of-bounds
1764 * WARNING: The data in the ZSTD_inBuffer in the range [dst, dst + pos) MUST
1776 * Tells he compressor that the ZSTD_outBuffer will not be resized between
1777 * calls. Specifically: (out.size - out.pos) will never grow. This gives the
1778 * compressor the freedom to say: If the compressed data doesn't fit in the
1787 * Zstd will check that (out.size - out.pos) never grows and return an error
1830 * - ZSTD_createCCtxParams() : Create a ZSTD_CCtx_params structure
1831 * - ZSTD_CCtxParams_setParameter() : Push parameters one by one into
1835 * - ZSTD_CCtx_setParametersUsingCCtxParams() : Apply parameters to
1839 * - ZSTD_compressStream2() : Do compression using the CCtx.
1840 * - ZSTD_freeCCtxParams() : Free the memory, accept NULL pointer.
1843 * for static allocation of CCtx for single-threaded compression.
1895 * This variant might be helpful for binders from dynamic languages
1945 …ameter is only useful in streaming mode, since no internal buffer is allocated in single-pass mode.
1973 * in the range [dst, dst + pos) MUST not be modified during decompression
1980 * If you need to avoid the input buffer allocation use the buffer-less
1984 * this flag is ALWAYS memory safe, and will never access out-of-bounds
1987 * WARNING: The data in the ZSTD_outBuffer in the range [dst, dst + pos) MUST
2032 * This instruction is mandatory to decode data without a fully-formed header,
2040 * This can be helpful for binders from dynamic languages
2095 * // Pseudocode: Set each zstd parameter and leave the rest as-is.
2126 * // Pseudocode: Set each zstd frame parameter and leave the rest as-is.
2150 * This is typically useful to skip dictionary loading stage, since it will re-use it in-place.
2174 * Note : (ingested - consumed) is amount of input data buffered internally, not yet compressed.
2224 * re-use decompression parameters from previous init; saves dictionary loading
2231 * Buffer-less and synchronous inner streaming functions
2239 Buffer-less streaming compression (synchronous mode)
2243 ZSTD_CCtx object can be re-used multiple times within successive compression operations.
2252 - ZSTD_compressContinue() has no internal buffer. It uses externally provided buffers only.
2253 - Interface is synchronous : input is consumed entirely and produces 1+ compressed blocks.
2254 …- Caller must ensure there is enough space in `dst` to store compressed data under worst case scen…
2257 …- ZSTD_compressContinue() presumes prior input ***is still accessible and unmodified*** (up to max…
2259 …- ZSTD_compressContinue() detects that prior input has been overwritten when `src` buffer overlaps.
2266 `ZSTD_CCtx` object can be re-used (ZSTD_compressBegin()) to compress again.
2269 /*===== Buffer-less streaming compression functions =====*/
2282 Buffer-less streaming decompression (synchronous mode)
2286 A ZSTD_DCtx object can be re-used multiple times.
2297 such as the dictionary ID, content size, or maximum back-reference distance (`windowSize`).
2299 As a consequence, check that values remain within valid application range.
2306 …if 2 blocks don't follow each other, make sure that either the compressor breaks contiguity at the…
2307 …or that previous contiguous segment is large enough to properly handle maximum back-reference dist…
2312 …which can @return an error code if required value is too large for current system (in 32-bits mode…
2322 as long as the encoder and decoder progress in "lock-step",
2344 Skippable frames allow integration of user-defined data into a flow of concatenated frames.
2347 a) Skippable frame ID - 4 Bytes, Little endian format, any value from 0x184D2A50 to 0x184D2A5F
2348 b) Frame Size - 4 Bytes, Little endian format, unsigned 32-bits
2349 c) Frame Content - any content (User Data) of length equal to Frame Size
2350 For skippable frames ZSTD_getFrameHeader() returns zfhPtr->frameType==ZSTD_skippableFrame.
2354 /*===== Buffer-less streaming decompression functions =====*/
2399 …Frame metadata cost is typically ~12 bytes, which can be non-negligible for very small blocks (< 1…
2403 - Compressing and decompressing require a context structure
2405 - It is necessary to init context before starting
2409 - Block size is limited, it must be <= ZSTD_getBlockSize() <= ZSTD_BLOCKSIZE_MAX == 128 KB
2413 …- When a block is considered not compressible enough, ZSTD_compressBlock() result will be 0 (zero)…
2428 …kSize); /*< insert uncompressed block into `dctx` history. Useful for multi-blocks decompression.…