From f10d4e313cf72c22ef03cd63f71000a0381ef78a Mon Sep 17 00:00:00 2001 From: Bimba Shrestha Date: Thu, 11 Jun 2020 13:33:52 -0700 Subject: [PATCH] adding ZSTD_dedicatedDictSearch_defaultCParameters variable --- lib/compress/zstd_compress.c | 108 ++++++++++++++++++++++++++ lib/compress/zstd_compress_internal.h | 6 ++ 2 files changed, 114 insertions(+) diff --git a/lib/compress/zstd_compress.c b/lib/compress/zstd_compress.c index 0e3eb9e2..dac2bf5d 100644 --- a/lib/compress/zstd_compress.c +++ b/lib/compress/zstd_compress.c @@ -4248,6 +4248,114 @@ static const ZSTD_compressionParameters ZSTD_defaultCParameters[4][ZSTD_MAX_CLEV }, }; +static const ZSTD_compressionParameters +ZSTD_dedicatedDictSearch_defaultCParameters[4][ZSTD_MAX_CLEVEL+1] = { +{ /* "default" - for any dictSize > 256 KB */ + /* W, C, H, S, L, TL, strat */ + { 0, 0, 0, 0, 0, 0, 0 }, /* base (not adjusted) */ + { 0, 0, 0, 0, 0, 0, 0 }, /* level 1 (not adjusted) */ + { 0, 0, 0, 0, 0, 0, 0 }, /* level 2 (not adjusted) */ + { 0, 0, 0, 0, 0, 0, 0 }, /* level 3 (not adjusted) */ + { 0, 0, 0, 0, 0, 0, 0 }, /* level 4 (not adjusted) */ + { 21, 18, 19 + DD_BLOG, 2, 5, 2, ZSTD_greedy }, /* level 5 */ + { 21, 19, 19 + DD_BLOG, 3, 5, 4, ZSTD_greedy }, /* level 6 */ + { 21, 19, 19 + DD_BLOG, 3, 5, 8, ZSTD_lazy }, /* level 7 */ + { 21, 19, 19 + DD_BLOG, 3, 5, 16, ZSTD_lazy2 }, /* level 8 */ + { 21, 19, 20 + DD_BLOG, 4, 5, 16, ZSTD_lazy2 }, /* level 9 */ + { 22, 20, 21 + DD_BLOG, 4, 5, 16, ZSTD_lazy2 }, /* level 10 */ + { 22, 21, 22 + DD_BLOG, 4, 5, 16, ZSTD_lazy2 }, /* level 11 */ + { 22, 21, 22 + DD_BLOG, 5, 5, 16, ZSTD_lazy2 }, /* level 12 */ + { 0, 0, 0, 0, 0, 0, 0 }, /* level 13 (not adjusted) */ + { 0, 0, 0, 0, 0, 0, 0 }, /* level 14 (not adjusted) */ + { 0, 0, 0, 0, 0, 0, 0 }, /* level 15 (not adjusted) */ + { 0, 0, 0, 0, 0, 0, 0 }, /* level 16 (not adjusted) */ + { 0, 0, 0, 0, 0, 0, 0 }, /* level 17 (not adjusted) */ + { 0, 0, 0, 0, 0, 0, 0 }, /* level 18 (not adjusted) */ + { 0, 0, 0, 0, 0, 0, 0 }, /* level 19 (not adjusted) */ + { 0, 0, 0, 0, 0, 0, 0 }, /* level 20 (not adjusted) */ + { 0, 0, 0, 0, 0, 0, 0 }, /* level 21 (not adjusted) */ + { 0, 0, 0, 0, 0, 0, 0 } /* level 22 (not adjusted) */ +}, +{ /* for dictSize <= 256 KB */ + /* W, C, H, S, L, T, strat */ + { 0, 0, 0, 0, 0, 0, 0 }, /* base (not adjusted) */ + { 0, 0, 0, 0, 0, 0, 0 }, /* level 1 (not adjusted) */ + { 0, 0, 0, 0, 0, 0, 0 }, /* level 2 (not adjusted) */ + { 0, 0, 0, 0, 0, 0, 0 }, /* level 3 (not adjusted) */ + { 18, 16, 17 + DD_BLOG, 2, 5, 2, ZSTD_greedy }, /* level 4 */ + { 18, 18, 18 + DD_BLOG, 3, 5, 2, ZSTD_greedy }, /* level 5 */ + { 18, 18, 19 + DD_BLOG, 3, 5, 4, ZSTD_lazy }, /* level 6 */ + { 18, 18, 19 + DD_BLOG, 4, 4, 4, ZSTD_lazy }, /* level 7 */ + { 18, 18, 19 + DD_BLOG, 4, 4, 8, ZSTD_lazy2 }, /* level 8 */ + { 18, 18, 19 + DD_BLOG, 5, 4, 8, ZSTD_lazy2 }, /* level 9 */ + { 18, 18, 19 + DD_BLOG, 6, 4, 8, ZSTD_lazy2 }, /* level 10 */ + { 0, 0, 0, 0, 0, 0, 0 }, /* level 11 (not adjusted) */ + { 0, 0, 0, 0, 0, 0, 0 }, /* level 12 (not adjusted) */ + { 0, 0, 0, 0, 0, 0, 0 }, /* level 13 (not adjusted) */ + { 0, 0, 0, 0, 0, 0, 0 }, /* level 14 (not adjusted) */ + { 0, 0, 0, 0, 0, 0, 0 }, /* level 15 (not adjusted) */ + { 0, 0, 0, 0, 0, 0, 0 }, /* level 16 (not adjusted) */ + { 0, 0, 0, 0, 0, 0, 0 }, /* level 17 (not adjusted) */ + { 0, 0, 0, 0, 0, 0, 0 }, /* level 18 (not adjusted) */ + { 0, 0, 0, 0, 0, 0, 0 }, /* level 19 (not adjusted) */ + { 0, 0, 0, 0, 0, 0, 0 }, /* level 20 (not adjusted) */ + { 0, 0, 0, 0, 0, 0, 0 }, /* level 21 (not adjusted) */ + { 0, 0, 0, 0, 0, 0, 0 } /* level 22 (not adjusted) */ +}, +{ /* for dictSize <= 128 KB */ + /* W, C, H, S, L, T, strat */ + { 0, 0, 0, 0, 0, 0, 0 }, /* base (not adjusted) */ + { 0, 0, 0, 0, 0, 0, 0 }, /* level 1 (not adjusted) */ + { 0, 0, 0, 0, 0, 0, 0 }, /* level 2 (not adjusted) */ + { 0, 0, 0, 0, 0, 0, 0 }, /* level 3 (not adjusted) */ + { 0, 0, 0, 0, 0, 0, 0 }, /* level 4 (not adjusted) */ + { 17, 16, 17 + DD_BLOG, 3, 4, 2, ZSTD_greedy }, /* level 5 */ + { 17, 17, 17 + DD_BLOG, 3, 4, 4, ZSTD_lazy }, /* level 6 */ + { 17, 17, 17 + DD_BLOG, 3, 4, 8, ZSTD_lazy2 }, /* level 7 */ + { 17, 17, 17 + DD_BLOG, 4, 4, 8, ZSTD_lazy2 }, /* level 8 */ + { 17, 17, 17 + DD_BLOG, 5, 4, 8, ZSTD_lazy2 }, /* level 9 */ + { 17, 17, 17 + DD_BLOG, 6, 4, 8, ZSTD_lazy2 }, /* level 10 */ + { 0, 0, 0, 0, 0, 0, 0 }, /* level 11 (not adjusted) */ + { 0, 0, 0, 0, 0, 0, 0 }, /* level 12 (not adjusted) */ + { 0, 0, 0, 0, 0, 0, 0 }, /* level 13 (not adjusted) */ + { 0, 0, 0, 0, 0, 0, 0 }, /* level 14 (not adjusted) */ + { 0, 0, 0, 0, 0, 0, 0 }, /* level 15 (not adjusted) */ + { 0, 0, 0, 0, 0, 0, 0 }, /* level 16 (not adjusted) */ + { 0, 0, 0, 0, 0, 0, 0 }, /* level 17 (not adjusted) */ + { 0, 0, 0, 0, 0, 0, 0 }, /* level 18 (not adjusted) */ + { 0, 0, 0, 0, 0, 0, 0 }, /* level 19 (not adjusted) */ + { 0, 0, 0, 0, 0, 0, 0 }, /* level 20 (not adjusted) */ + { 0, 0, 0, 0, 0, 0, 0 }, /* level 21 (not adjusted) */ + { 0, 0, 0, 0, 0, 0, 0 } /* level 22 (not adjusted) */ +}, +{ /* for dictSize <= 16 KB */ + /* W, C, H, S, L, T, strat */ + { 0, 0, 0, 0, 0, 0, 0 }, /* base (not adjusted) */ + { 0, 0, 0, 0, 0, 0, 0 }, /* level 1 (not adjusted) */ + { 0, 0, 0, 0, 0, 0, 0 }, /* level 2 (not adjusted) */ + { 0, 0, 0, 0, 0, 0, 0 }, /* level 3 (not adjusted) */ + { 14, 14, 14 + DD_BLOG, 4, 4, 2, ZSTD_greedy }, /* level 4 */ + { 14, 14, 14 + DD_BLOG, 3, 4, 4, ZSTD_lazy }, /* level 5 */ + { 14, 14, 14 + DD_BLOG, 4, 4, 8, ZSTD_lazy2 }, /* level 6 */ + { 14, 14, 14 + DD_BLOG, 6, 4, 8, ZSTD_lazy2 }, /* level 7 */ + { 14, 14, 14 + DD_BLOG, 8, 4, 8, ZSTD_lazy2 }, /* level 8 */ + { 0, 0, 0, 0, 0, 0, 0 }, /* level 9 (not adjusted) */ + { 0, 0, 0, 0, 0, 0, 0 }, /* level 10 (not adjusted) */ + { 0, 0, 0, 0, 0, 0, 0 }, /* level 11 (not adjusted) */ + { 0, 0, 0, 0, 0, 0, 0 }, /* level 12 (not adjusted) */ + { 0, 0, 0, 0, 0, 0, 0 }, /* level 13 (not adjusted) */ + { 0, 0, 0, 0, 0, 0, 0 }, /* level 14 (not adjusted) */ + { 0, 0, 0, 0, 0, 0, 0 }, /* level 15 (not adjusted) */ + { 0, 0, 0, 0, 0, 0, 0 }, /* level 16 (not adjusted) */ + { 0, 0, 0, 0, 0, 0, 0 }, /* level 17 (not adjusted) */ + { 0, 0, 0, 0, 0, 0, 0 }, /* level 18 (not adjusted) */ + { 0, 0, 0, 0, 0, 0, 0 }, /* level 19 (not adjusted) */ + { 0, 0, 0, 0, 0, 0, 0 }, /* level 20 (not adjusted) */ + { 0, 0, 0, 0, 0, 0, 0 }, /* level 21 (not adjusted) */ + { 0, 0, 0, 0, 0, 0, 0 } /* level 22 (not adjusted) */ +}, +}; + /*! ZSTD_getCParams_internal() : * @return ZSTD_compressionParameters structure for a selected compression level, srcSize and dictSize. * Note: srcSizeHint 0 means 0, use ZSTD_CONTENTSIZE_UNKNOWN for unknown. diff --git a/lib/compress/zstd_compress_internal.h b/lib/compress/zstd_compress_internal.h index b8e7496c..fe5b0f2d 100644 --- a/lib/compress/zstd_compress_internal.h +++ b/lib/compress/zstd_compress_internal.h @@ -29,6 +29,12 @@ extern "C" { #endif +/* Dedicated dict search bucket log: + * --------------------------------- + * This determines the additional space we need for the hash table. + * We will have 2^DD_BLOG slots in our bucket. */ +#define DD_BLOG 2 + /*-************************************* * Constants ***************************************/