From 4e049bca8cf110b69386423b8416be09eb0e069a Mon Sep 17 00:00:00 2001 From: Yann Collet Date: Mon, 2 Nov 2015 11:09:54 +0100 Subject: [PATCH 1/4] Fixed Visual Studio issue #60, reported by @mailagentrus --- lib/huff0.c | 32 +++++++++++++++++++++----------- 1 file changed, 21 insertions(+), 11 deletions(-) diff --git a/lib/huff0.c b/lib/huff0.c index 4ddd992cd90..a8798fd716f 100644 --- a/lib/huff0.c +++ b/lib/huff0.c @@ -362,7 +362,7 @@ size_t HUF_buildCTable (HUF_CElt* tree, const U32* count, U32 maxSymbolValue, U3 U16 min = 0; for (n=maxNbBits; n>0; n--) { - valPerRank[n] = min; // get starting value within each rank + valPerRank[n] = min; /* get starting value within each rank */ min += nbPerRank[n]; min >>= 1; } @@ -1027,18 +1027,23 @@ size_t HUF_readDTableX4 (U32* DTable, const void* src, size_t srcSize) U32 nextRankVal = 0; U32 w, consumed; const int rescale = (memLog-tableLog) - 1; /* tableLog <= memLog */ + U32* rankVal0 = rankVal[0]; for (w=1; w<=maxW; w++) { U32 current = nextRankVal; nextRankVal += rankStats[w] << (w+rescale); - rankVal[0][w] = current; + rankVal0[w] = current; + } + for (consumed = minBits; consumed <= memLog - minBits; consumed++) + { + U32* rankValPtr = rankVal[consumed]; + for (w = 1; w <= maxW; w++) + { + rankValPtr[w] = rankVal0[w] >> consumed; + } } - for (consumed=minBits; consumed <= memLog-minBits; consumed++) - for (w=1; w<=maxW; w++) - rankVal[consumed][w] = rankVal[0][w] >> consumed; } - HUF_fillDTableX4(dt, memLog, sortedSymbol, sizeOfSort, rankStart0, rankVal, maxW, @@ -1394,18 +1399,23 @@ size_t HUF_readDTableX6 (U32* DTable, const void* src, size_t srcSize) U32 nextRankVal = 0; U32 w, consumed; const int rescale = (memLog-tableLog) - 1; /* tableLog <= memLog */ + U32* rankVal0 = rankVal[0]; for (w=1; w<=maxW; w++) { U32 current = nextRankVal; nextRankVal += rankStats[w] << (w+rescale); - rankVal[0][w] = current; + rankVal0[w] = current; + } + for (consumed = minBits; consumed <= memLog - minBits; consumed++) + { + U32* rankValPtr = rankVal[consumed]; + for (w = 1; w <= maxW; w++) + { + rankValPtr[w] = rankVal0[w] >> consumed; + } } - for (consumed=minBits; consumed <= memLog-minBits; consumed++) - for (w=1; w<=maxW; w++) - rankVal[consumed][w] = rankVal[0][w] >> consumed; } - /* fill tables */ { HUF_DDescX6* DDescription = (HUF_DDescX6*)(DTable+1); From 154c25a6df25f2cde5ac1fad215b16d8bb1f2b89 Mon Sep 17 00:00:00 2001 From: cyan Date: Mon, 2 Nov 2015 11:43:27 +0100 Subject: [PATCH 2/4] fix Visual Studio projects in 32-bits release mode --- visual/2012/fullbench/fullbench.vcxproj | 2 +- visual/2012/fuzzer/fuzzer.vcxproj | 2 +- visual/2012/zstd/zstd.vcxproj | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/visual/2012/fullbench/fullbench.vcxproj b/visual/2012/fullbench/fullbench.vcxproj index c9a6e38dd71..5646f091ee6 100644 --- a/visual/2012/fullbench/fullbench.vcxproj +++ b/visual/2012/fullbench/fullbench.vcxproj @@ -78,7 +78,7 @@ false - $(SolutionDir)..\..\lib;$(VCInstallDir)include;$(VCInstallDir)atlmfc\include;$(WindowsSDK_IncludePath); + $(SolutionDir)..\..\lib\legacy;$(SolutionDir)..\..\lib;$(VCInstallDir)include;$(VCInstallDir)atlmfc\include;$(WindowsSDK_IncludePath); true diff --git a/visual/2012/fuzzer/fuzzer.vcxproj b/visual/2012/fuzzer/fuzzer.vcxproj index 22c8240a4f0..64bf8f9c431 100644 --- a/visual/2012/fuzzer/fuzzer.vcxproj +++ b/visual/2012/fuzzer/fuzzer.vcxproj @@ -78,7 +78,7 @@ false - $(SolutionDir)..\..\lib;$(VCInstallDir)include;$(VCInstallDir)atlmfc\include;$(WindowsSDK_IncludePath); + $(SolutionDir)..\..\lib\legacy;$(SolutionDir)..\..\lib;$(VCInstallDir)include;$(VCInstallDir)atlmfc\include;$(WindowsSDK_IncludePath); true diff --git a/visual/2012/zstd/zstd.vcxproj b/visual/2012/zstd/zstd.vcxproj index 3a707b27c92..030138917ac 100644 --- a/visual/2012/zstd/zstd.vcxproj +++ b/visual/2012/zstd/zstd.vcxproj @@ -109,7 +109,7 @@ false - $(SolutionDir)..\..\lib;$(VCInstallDir)include;$(VCInstallDir)atlmfc\include;$(WindowsSDK_IncludePath); + $(SolutionDir)..\..\programs\legacy;$(SolutionDir)..\..\lib\legacy;$(SolutionDir)..\..\lib;$(VCInstallDir)include;$(VCInstallDir)atlmfc\include;$(WindowsSDK_IncludePath); true From 7671f393beedcf391494d337a3b73f978109ed10 Mon Sep 17 00:00:00 2001 From: Yann Collet Date: Mon, 2 Nov 2015 12:17:39 +0100 Subject: [PATCH 3/4] v0.3.2 --- Makefile | 2 +- NEWS | 3 +++ README.md | 7 ++++--- lib/zstd.h | 2 +- lib/zstdhc_static.h | 8 ++++---- programs/Makefile | 2 +- 6 files changed, 14 insertions(+), 10 deletions(-) diff --git a/Makefile b/Makefile index 8d63928f133..7f90fd295f5 100644 --- a/Makefile +++ b/Makefile @@ -32,7 +32,7 @@ # ################################################################ # Version number -export VERSION := 0.3.1 +export VERSION := 0.3.2 PRGDIR = programs ZSTDDIR = lib diff --git a/NEWS b/NEWS index 7d67e028392..9693d779390 100644 --- a/NEWS +++ b/NEWS @@ -1,3 +1,6 @@ +v0.3.2 +Fixed Visual Studio + v0.3.1 : Small compression ratio improvement diff --git a/README.md b/README.md index d8766656f53..9615f37ba16 100644 --- a/README.md +++ b/README.md @@ -23,12 +23,13 @@ For a taste of its performance, here are a few benchmark numbers from a number o [zlib]:http://www.zlib.net/ [LZ4]:http://www.lz4.org/ -Zstd can also offer stronger compression ratio at the cost of compression speed. Compression speed is highly configurable, by small increment, to fit different situations. Note however that decompression speed is preserved and remain roughly the same at all settings, a property shared by most LZ compression algorithms, such as [zlib]. The following test is run on a Core i7-3930K CPU @ 4.5GHz, using [lzbench], an open-source in-memory benchmark by inikep. +Zstd can also offer stronger compression ratio at the cost of compression speed. Speed / Ratio trade-off is configurable by small increment, to fit different situations. Note however that decompression speed is preserved and remain roughly the same at all settings, a property shared by most LZ compression algorithms, such as [zlib]. The following test is run on a Core i7-3930K CPU @ 4.5GHz, using [lzbench], an open-source in-memory benchmark by inikep. [lzbench]:https://github.com/inikep/lzbench -Compression Ratio vs Speed | Decompression Speed + +Compression Speed vs Ratio | Decompression Speed ---------------------------|-------------------- -![Compression Ratio vs Speed](images/CSpeed.png "Compression Ratio vs Speed") | ![Decompression Speed](images/DSpeed.png "Decompression Speed") +![Compression Speed vs Ratio](images/CSpeed.png "Compression Speed vs Ratio") | ![Decompression Speed](images/DSpeed.png "Decompression Speed") Zstd entropy stage is provided by [Huff0 and FSE, from Finite State Entrop library](https://github.com/Cyan4973/FiniteStateEntropy). diff --git a/lib/zstd.h b/lib/zstd.h index 1f2d573871b..d17bc4a333f 100644 --- a/lib/zstd.h +++ b/lib/zstd.h @@ -48,7 +48,7 @@ extern "C" { ***************************************/ #define ZSTD_VERSION_MAJOR 0 /* for breaking interface changes */ #define ZSTD_VERSION_MINOR 3 /* for new (non-breaking) interface capabilities */ -#define ZSTD_VERSION_RELEASE 0 /* for tweaks, bug-fixes, or development */ +#define ZSTD_VERSION_RELEASE 2 /* for tweaks, bug-fixes, or development */ #define ZSTD_VERSION_NUMBER (ZSTD_VERSION_MAJOR *100*100 + ZSTD_VERSION_MINOR *100 + ZSTD_VERSION_RELEASE) unsigned ZSTD_versionNumber (void); diff --git a/lib/zstdhc_static.h b/lib/zstdhc_static.h index 9cf4d86bd1a..cbc9385403b 100644 --- a/lib/zstdhc_static.h +++ b/lib/zstdhc_static.h @@ -105,21 +105,21 @@ static const ZSTD_HC_parameters ZSTD_HC_defaultParameters[ZSTD_HC_MAX_CLEVEL+1] { 21, 19, 20, 4, 5, ZSTD_HC_lazy }, /* level 8 */ { 21, 19, 20, 5, 5, ZSTD_HC_lazy }, /* level 9 */ { 21, 20, 20, 5, 5, ZSTD_HC_lazy }, /* level 10 */ - { 21, 20, 20, 5, 5, ZSTD_HC_lazy }, /* level 11 */ + { 21, 21, 20, 5, 5, ZSTD_HC_lazy }, /* level 11 */ { 22, 20, 22, 6, 5, ZSTD_HC_lazy }, /* level 12 */ { 22, 21, 22, 6, 5, ZSTD_HC_lazy }, /* level 13 */ { 23, 21, 22, 6, 5, ZSTD_HC_lazy }, /* level 14 */ { 23, 21, 23, 7, 5, ZSTD_HC_lazy }, /* level 15 */ { 23, 22, 22, 6, 5, ZSTD_HC_lazy }, /* level 16 */ { 23, 22, 22, 7, 5, ZSTD_HC_lazy }, /* level 17 */ - { 23, 22, 23, 7, 5, ZSTD_HC_lazy }, /* level 18 */ + { 23, 23, 22, 7, 5, ZSTD_HC_lazy }, /* level 18 */ { 23, 22, 23, 8, 5, ZSTD_HC_lazy }, /* level 19 */ { 23, 23, 23, 8, 5, ZSTD_HC_lazy }, /* level 20 */ { 23, 23, 23, 8, 5, ZSTD_HC_lazy }, /* level 21 */ - { 24, 23, 23, 8, 5, ZSTD_HC_lazy }, /* level 22 */ + { 24, 24, 24, 8, 5, ZSTD_HC_lazy }, /* level 22 */ { 24, 23, 23, 9, 5, ZSTD_HC_lazy }, /* level 23 */ { 24, 24, 24, 9, 5, ZSTD_HC_lazy }, /* level 24 */ - { 24, 24, 24, 10, 5, ZSTD_HC_lazy }, /* level 25 */ + { 24, 24, 24, 9, 5, ZSTD_HC_lazy }, /* level 25 */ { 24, 24, 24, 10, 5, ZSTD_HC_lazy }, /* level 26 */ /* ZSTD_HC_MAX_CLEVEL */ }; diff --git a/programs/Makefile b/programs/Makefile index 8332871bbc7..82125c9941f 100644 --- a/programs/Makefile +++ b/programs/Makefile @@ -30,7 +30,7 @@ # fullbench32: Same as fullbench, but forced to compile in 32-bits mode # ########################################################################## -VERSION?= 0.3.1 +VERSION?= 0.3.2 DESTDIR?= PREFIX ?= /usr/local From ee34cdf33d61d7291785ff0a0fb225588c9e1695 Mon Sep 17 00:00:00 2001 From: Yann Collet Date: Mon, 2 Nov 2015 12:45:31 +0100 Subject: [PATCH 4/4] Added Silesia corpus link --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 9615f37ba16..54fc53bf4d7 100644 --- a/README.md +++ b/README.md @@ -23,7 +23,7 @@ For a taste of its performance, here are a few benchmark numbers from a number o [zlib]:http://www.zlib.net/ [LZ4]:http://www.lz4.org/ -Zstd can also offer stronger compression ratio at the cost of compression speed. Speed / Ratio trade-off is configurable by small increment, to fit different situations. Note however that decompression speed is preserved and remain roughly the same at all settings, a property shared by most LZ compression algorithms, such as [zlib]. The following test is run on a Core i7-3930K CPU @ 4.5GHz, using [lzbench], an open-source in-memory benchmark by inikep. +Zstd can also offer stronger compression ratio at the cost of compression speed. Speed / Ratio trade-off is configurable by small increment, to fit different situations. Note however that decompression speed is preserved and remain roughly the same at all settings, a property shared by most LZ compression algorithms, such as [zlib]. The following test is run on a Core i7-3930K CPU @ 4.5GHz, using [lzbench], an open-source in-memory benchmark by inikep, on the [Silesia compression corpus](http://sun.aei.polsl.pl/~sdeor/index.php?page=silesia) [lzbench]:https://github.com/inikep/lzbench