From f97c2dbd395e64bb4d58948622f15961181307c0 Mon Sep 17 00:00:00 2001 From: Yann Collet Date: Thu, 21 Sep 2017 16:07:29 -0700 Subject: [PATCH] created ZSTD_format declaration --- NEWS | 3 ++- lib/zstd.h | 19 ++++++++++++++++--- 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/NEWS b/NEWS index bb7eaaca..cddc8fc1 100644 --- a/NEWS +++ b/NEWS @@ -3,7 +3,8 @@ new : long range mode, using --long command, by Stella Lau (@stellamplau) license : changed /examples license to BSD + GPLv2 license : fix a few header files to reflect new license (#825) fix : multi-threading compression works with custom allocators -fix : a rare compression bug when compression generates very large distances (only possible at --ultra -22) +fix : ZSTD_sizeof_CStream() was over-evaluating memory usage +fix : a rare compression bug when compression generates very large distances and bunch of other conditions (only possible at --ultra -22) fix : 32-bits build can now decode large offsets (levels 21+) cli : new : can split input file for dictionary training, using command -B# cli : fix : do not change /dev/null permissions when using command -t with root access, reported by @mike155 (#851) diff --git a/lib/zstd.h b/lib/zstd.h index ddb28429..ca699dae 100644 --- a/lib/zstd.h +++ b/lib/zstd.h @@ -927,14 +927,27 @@ ZSTDLIB_API ZSTD_nextInputType_e ZSTD_nextInputType(ZSTD_DCtx* dctx); * The main driver is that it identifies more clearly the target object type. * It feels clearer in light of potential variants : * ZSTD_CDict_setParameter() (rather than ZSTD_setCDictParameter()) - * ZSTD_DCtx_setParameter() (rather than ZSTD_setDCtxParameter() ) - * Left variant feels easier to distinguish. + * ZSTD_CCtxParams_setParameter() (rather than ZSTD_setCCtxParamsParameter() ) */ /* note on enum design : * All enum will be manually set to explicit values before reaching "stable API" status */ typedef enum { + ZSTD_f_zstd1, /* Normal (default) zstd frame format, as specified in zstd_compression_format.md */ + ZSTD_f_zstd1_magicLess, /* Almost zstd frame format, but without initial 4-bytes magic number */ + ZSTD_f_zstd1_headerless, /* Almost zstd frame format, but without any frame header; + * Other metadata, like block size or frame checksum, are still generated */ + ZSTD_f_zstd_block /* Pure zstd compressed block, without any metadata. + * Note that size of uncompressed block must be <= ZSTD_getBlockSize() <= ZSTD_BLOCKSIZE_MAX == 128 KB. + * See ZSTD_compressBlock() for more details. */ +} ZSTD_format; + +typedef enum { + /* compression format */ + ZSTD_p_format = 10, /* See ZSTD_format enum definition. + * Cast selected strategy as unsigned for ZSTD_CCtx_setParameter() compatibility. */ + /* compression parameters */ ZSTD_p_compressionLevel=100, /* Update all compression parameters according to pre-defined cLevel table * Default level is ZSTD_CLEVEL_DEFAULT==3. @@ -1216,7 +1229,7 @@ ZSTDLIB_API size_t ZSTD_CCtx_setParametersUsingCCtxParams( + compression : any ZSTD_compressBegin*() variant, including with dictionary + decompression : any ZSTD_decompressBegin*() variant, including with dictionary + copyCCtx() and copyDCtx() can be used too - - Block size is limited, it must be <= ZSTD_getBlockSize() <= ZSTD_BLOCKSIZE_MAX + - Block size is limited, it must be <= ZSTD_getBlockSize() <= ZSTD_BLOCKSIZE_MAX == 128 KB + If input is larger than a block size, it's necessary to split input data into multiple blocks + For inputs larger than a single block size, consider using the regular ZSTD_compress() instead. Frame metadata is not that costly, and quickly becomes negligible as source size grows larger.