From: Yann Collet Date: Sun, 17 Jul 2016 14:21:37 +0000 (+0200) Subject: minor compression level corrections X-Git-Tag: v0.8.0^2~83 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e557fd5e922d4bcf5e3775eb84530c737de1196d;p=thirdparty%2Fzstd.git minor compression level corrections --- diff --git a/NEWS b/NEWS index 2c318462b..dc9099a3f 100644 --- a/NEWS +++ b/NEWS @@ -1,5 +1,6 @@ v0.7.5 Fixed : premature end of frame when zero-sized raw block, reported by Eric Biggers +Update : specification, to v0.1.2 : max huffman depth at 11 bits v0.7.4 Added : homebrew for Mac diff --git a/lib/common/huf.h b/lib/common/huf.h index 3b837f101..29bab4b76 100644 --- a/lib/common/huf.h +++ b/lib/common/huf.h @@ -100,7 +100,7 @@ size_t HUF_compress2 (void* dst, size_t dstSize, const void* src, size_t srcSize /* *** Constants *** */ #define HUF_TABLELOG_ABSOLUTEMAX 16 /* absolute limit of HUF_MAX_TABLELOG. Beyond that value, code does not work */ #define HUF_TABLELOG_MAX 12 /* max configured tableLog (for static allocation); can be modified up to HUF_ABSOLUTEMAX_TABLELOG */ -#define HUF_TABLELOG_DEFAULT HUF_TABLELOG_MAX /* tableLog by default, when not specified */ +#define HUF_TABLELOG_DEFAULT 11 /* tableLog by default, when not specified */ #define HUF_SYMBOLVALUE_MAX 255 #if (HUF_TABLELOG_MAX > HUF_TABLELOG_ABSOLUTEMAX) # error "HUF_TABLELOG_MAX is too large !" diff --git a/lib/compress/zstd_compress.c b/lib/compress/zstd_compress.c index 26b6d6e33..51980d550 100644 --- a/lib/compress/zstd_compress.c +++ b/lib/compress/zstd_compress.c @@ -3016,7 +3016,7 @@ static const ZSTD_compressionParameters ZSTD_defaultCParameters[4][ZSTD_MAX_CLEV { /* for srcSize <= 16 KB */ /* W, C, H, S, L, T, strat */ { 14, 12, 12, 1, 7, 6, ZSTD_fast }, /* level 0 - not used */ - { 14, 14, 14, 1, 7, 6, ZSTD_fast }, /* level 1 */ + { 14, 14, 14, 1, 6, 6, ZSTD_fast }, /* level 1 */ { 14, 14, 14, 1, 4, 6, ZSTD_fast }, /* level 2 */ { 14, 14, 14, 1, 4, 6, ZSTD_dfast }, /* level 3.*/ { 14, 14, 14, 4, 4, 6, ZSTD_greedy }, /* level 4.*/ diff --git a/lib/dictBuilder/zdict.c b/lib/dictBuilder/zdict.c index c8c8ae301..d3d4bec7e 100644 --- a/lib/dictBuilder/zdict.c +++ b/lib/dictBuilder/zdict.c @@ -689,7 +689,7 @@ static size_t ZDICT_analyzeEntropy(void* dstBuffer, size_t maxDstSize, offsetCount_t bestRepOffset[ZSTD_REP_NUM+1]; EStats_ress_t esr; ZSTD_parameters params; - U32 u, huffLog = 12, Offlog = OffFSELog, mlLog = MLFSELog, llLog = LLFSELog, total; + U32 u, huffLog = 11, Offlog = OffFSELog, mlLog = MLFSELog, llLog = LLFSELog, total; size_t pos = 0, errorCode; size_t eSize = 0; size_t const totalSrcSize = ZDICT_totalSampleSize(fileSizes, nbFiles); diff --git a/zstd_compression_format.md b/zstd_compression_format.md index 13c4ace18..3a4ba4c01 100644 --- a/zstd_compression_format.md +++ b/zstd_compression_format.md @@ -16,7 +16,7 @@ Distribution of this document is unlimited. ### Version -0.1.1 (15/07/16) +0.1.2 (15/07/16) Introduction @@ -518,11 +518,8 @@ using the fewest bits of any possible prefix codes for that alphabet. Prefix code must not exceed a maximum code length. More bits improve accuracy but cost more header size, -and require more memory for decoding operations. - -The current format limits the maximum depth to 15 bits. -The reference decoder goes further, by limiting it to 12 bits. -It is recommended to remain compatible with reference decoder. +and require more memory or more complex decoding operations. +This specification limits maximum code length to 11 bits. ##### Representation @@ -1168,5 +1165,6 @@ __Content__ : Where the actual dictionary content is. Version changes --------------- -- 0.1.1 reserved dictID ranges -- 0.1.0 initial release +- 0.1.2 : limit huffman tree depth to 11 bits +- 0.1.1 : reserved dictID ranges +- 0.1.0 : initial release