diff --git a/CPP/7zip/Bundles/Codec_zstd/StdAfx.cpp b/CPP/7zip/Bundles/Codec_zstd/StdAfx.cpp new file mode 100644 index 00000000..c6d3b1fa --- /dev/null +++ b/CPP/7zip/Bundles/Codec_zstd/StdAfx.cpp @@ -0,0 +1,3 @@ +// StdAfx.cpp + +#include "StdAfx.h" diff --git a/CPP/7zip/Bundles/Codec_zstd/StdAfx.h b/CPP/7zip/Bundles/Codec_zstd/StdAfx.h new file mode 100644 index 00000000..59d9ac15 --- /dev/null +++ b/CPP/7zip/Bundles/Codec_zstd/StdAfx.h @@ -0,0 +1,8 @@ +// StdAfx.h + +#ifndef __STDAFX_H +#define __STDAFX_H + +#include "../../../Common/Common.h" + +#endif diff --git a/CPP/7zip/Bundles/Codec_zstd/makefile b/CPP/7zip/Bundles/Codec_zstd/makefile new file mode 100644 index 00000000..8e2d3a24 --- /dev/null +++ b/CPP/7zip/Bundles/Codec_zstd/makefile @@ -0,0 +1,27 @@ +PROG = zstd.dll +DEF_FILE = ../../Compress/Codec.def +CFLAGS = $(CFLAGS) + +#EXPORTS +# CreateObject PRIVATE +# GetNumberOfMethods PRIVATE +# GetMethodProperty PRIVATE + +7ZIP_COMMON_OBJS = \ + $O\StreamUtils.obj \ + +COMPRESS_OBJS = \ + $O\CodecExports.obj \ + $O\DllExportsCompress.obj \ + +C_OBJS = \ + $O\Alloc.obj \ + +!include "../../zstd.mak" +ZSTD_OBJS = $(ZSTD_OBJS) \ + $O\fse_compress.obj \ + $O\huf_compress.obj \ + $O\zbuff_compress.obj \ + $O\zstd_compress.obj \ + +!include "../../7zip.mak" diff --git a/CPP/7zip/Bundles/Codec_zstd/resource.rc b/CPP/7zip/Bundles/Codec_zstd/resource.rc new file mode 100644 index 00000000..fd792eda --- /dev/null +++ b/CPP/7zip/Bundles/Codec_zstd/resource.rc @@ -0,0 +1,5 @@ +#include "../../MyVersionInfo.rc" + +MY_VERSION_INFO_DLL("7z ZStandard Plugin", "zstd") + +101 ICON "../../Archive/Icons/7z.ico" diff --git a/CPP/7zip/Compress/ZstdDecoder.cpp b/CPP/7zip/Compress/ZstdDecoder.cpp index ff72b85c..a553578a 100644 --- a/CPP/7zip/Compress/ZstdDecoder.cpp +++ b/CPP/7zip/Compress/ZstdDecoder.cpp @@ -31,8 +31,8 @@ CDecoder::CDecoder (): _inBufSizeAllocated (0), _outBufSizeAllocated (0), - _inBufSize (ZBUFF_recommendedDInSize()), - _outBufSize (ZBUFF_recommendedDOutSize()) + _inBufSize (ZBUFF_recommendedDInSize() * 30), + _outBufSize (ZBUFF_recommendedDOutSize()* 30) { _props.clear (); } diff --git a/CPP/7zip/Compress/ZstdEncoder.cpp b/CPP/7zip/Compress/ZstdEncoder.cpp index aac3b961..8dd83217 100644 --- a/CPP/7zip/Compress/ZstdEncoder.cpp +++ b/CPP/7zip/Compress/ZstdEncoder.cpp @@ -24,8 +24,8 @@ CEncoder::CEncoder(): _inSize (0), _inBufSizeAllocated (0), _outBufSizeAllocated (0), - _inBufSize (ZBUFF_recommendedCInSize()), - _outBufSize (ZBUFF_recommendedCOutSize()), + _inBufSize (ZBUFF_recommendedCInSize() * 30), + _outBufSize (ZBUFF_recommendedCOutSize() * 30), _inSizeProcessed (0), _outSizeProcessed (0) { diff --git a/CPP/7zip/Compress/ZstdRegister.cpp b/CPP/7zip/Compress/ZstdRegister.cpp index 555aa8f0..4f28599e 100644 --- a/CPP/7zip/Compress/ZstdRegister.cpp +++ b/CPP/7zip/Compress/ZstdRegister.cpp @@ -11,8 +11,22 @@ #include "ZstdEncoder.h" #endif +#ifndef EXTERNAL_CODEC REGISTER_CODEC_E( ZSTD, NCompress::NZSTD::CDecoder(), NCompress::NZSTD::CEncoder(), 0x4F71101, "ZSTD") +#else +static void *CreateCodecOut() { return (void *)(ICompressCoder *)(new NCompress::NZSTD::CEncoder); } +static void *CreateCodec() { return (void *)(ICompressCoder *)(new NCompress::NZSTD::CDecoder); } +static CCodecInfo g_CodecsInfo[1] = { + CreateCodec, + CreateCodecOut, + 0x4F71101, + "ZSTD", + 1, + false +}; +REGISTER_CODECS(ZSTD) +#endif diff --git a/CPP/build-x32.cmd b/CPP/build-x32.cmd index 78e1fe49..e234154c 100644 --- a/CPP/build-x32.cmd +++ b/CPP/build-x32.cmd @@ -39,6 +39,10 @@ cd %ROOT%\Bundles\SFXWin nmake %OPTS% copy O\7z.sfx %OUTDIR%\7z.sfx +cd %ROOT%\Bundles\Codec_zstd +nmake %OPTS% +copy O\zstd.dll %OUTDIR%\zstd-x32.dll + cd %ROOT%\..\..\C\Util\7zipInstall nmake %OPTS% copy O\7zipInstall.exe %OUTDIR%\Install-x32.exe diff --git a/CPP/build-x64.cmd b/CPP/build-x64.cmd index 4b5b6148..fefde737 100644 --- a/CPP/build-x64.cmd +++ b/CPP/build-x64.cmd @@ -39,6 +39,10 @@ cd %ROOT%\Bundles\SFXWin nmake %OPTS% copy AMD64\7z.sfx %OUTDIR%\7z.sfx +cd %ROOT%\Bundles\Codec_zstd +nmake %OPTS% +copy AMD64\zstd.dll %OUTDIR%\zstd-x64.dll + cd %ROOT%\..\..\C\Util\7zipInstall nmake %OPTS% copy AMD64\7zipInstall.exe %OUTDIR%\Install-x64.exe diff --git a/README.md b/README.md index e8c2e4e9..7a367ef4 100644 --- a/README.md +++ b/README.md @@ -1,11 +1,89 @@ -This is the Github Page of 7-Zip with support for **zstd**, short for Zstandard, which is a fast lossless compression algorithm, targeting real-time compression scenarios at zlib-level compression ratio. +This is the Github Page of 7-Zip with support for **zstd**, short for +Zstandard, which is a fast lossless compression algorithm, targeting +real-time compression scenarios at zlib-level compression ratio. +You can install it in two ways: +1. A full setup with ZStandard additions within the GUI and an modified + Explorer context menu +2. just the codec plugin, which goes to your existing 7-Zip installation + + +![Compression Speed vs Ratio](https://mcmilk.de/projects/7-Zip-zstd/dl/compr-074-usb2.png "Compression Speed vs Ratio") +![Decompression Speed](https://mcmilk.de/projects/7-Zip-zstd/dl/decompr-074.png "Decompression Speed @ Windows 7 64Bit") + +# 7-Zip ZStandard Edition (full setup, with GUI and Explorer integration) + +## Installation + +1. download the setup from here https://mcmilk.de/projects/7-Zip-zstd/dl/ + - https://mcmilk.de/projects/7-Zip-zstd/dl/7z1602-zstd-x32.exe + - https://mcmilk.de/projects/7-Zip-zstd/dl/7z1602-zstd-x64.exe +2. install it + +## Usage + +![File Manager](https://mcmilk.de/projects/7-Zip-zstd/Fileman.png "File Manager with the Listing of an Archiv") +![Explorer inegration](https://mcmilk.de/projects/7-Zip-zstd/Add-To-Archive.png "Add to Archiv Dialog with ZSTD options") + +# ZStandard codec Plugin for 7-Zip + +## Installation + +1. download the codec archiv from https://mcmilk.de/projects/7-Zip-zstd/dl/Codecs.7z +2. create a new directory named "Codecs" +3. put in there the zstd-x32.dll or the zstd-x64.dll, depending on your 7-Zip installation + - normally, the x32 should go to: "C:\Program Files (x86)\7-Zip\Codecs" + - and the x64 version should go in here: "C:\Program Files\7-Zip\Codecs" +4. After this, you may check if the dll is correctly installed via this command: `7z.exe i` + +The output should look like this: +``` +Codecs: + 0 ED 40202 BZip2 + 0 4ED 303011B BCJ2 + 0 ED 3030103 BCJ + 0 ED 3030205 PPC + 0 ED 3030401 IA64 + 0 ED 3030501 ARM + 0 ED 3030701 ARMT + 0 ED 3030805 SPARC + 0 ED 20302 Swap2 + 0 ED 20304 Swap4 + 0 ED 0 Copy + 0 ED 40109 Deflate64 + 0 ED 40108 Deflate + 0 ED 3 Delta + 0 ED 21 LZMA2 + 0 ED 30101 LZMA + 0 ED 30401 PPMD + 0 ED 6F10701 7zAES + 0 ED 6F00181 AES256CBC + 1 D 40301 Rar1 + 1 D 40302 Rar2 + 1 D 40303 Rar3 + 1 D 40305 Rar5 + 1 ED 4F71101 ZSTD <-- NEW +``` + +## Usage + +- when compressing binaries (*.exe, *.dll), you have to explicitly disable + the bcj2 filter via `-m0=bcj` + +- so the usage should look like this: +``` +7z a archiv.7z -m0=bcj -m1=zstd -mx0 ...Fastest Mode, without BCJ preprocessor +7z a archiv.7z -m0=bcj -m1=zstd -mx1 ...Fast mode, with BCJ preprocessor on executables +7z a archiv.7z -m0=bcj -m1=zstd -mx.. ... +7z a archiv.7z -m0=bcj -m1=zstd -mx21 ...2nd Slowest Mode, with BCJ preprocessor on executables +7z a archiv.7z -m0=bcj -m1=zstd -mx22 ...Ultra Mode, with BCJ preprocessor on executables +``` + +# Links - ZStandard Homepage: https://github.com/Cyan4973/zstd -- 7-Zip ZStandard Homepage: https://mcmilk.de/projects/7-Zip-zstd/ +- 7-Zip ZStandard Homepage: https://mcmilk.de/projects/7-Zip-zstd/dl/ - Request for inclusion into the mainline 7-Zip: https://sourceforge.net/p/sevenzip/discussion/45797/thread/a7e4f3f3/ - result, will not be included :( -![File Manager](https://mcmilk.de/projects/7-Zip-zstd/Fileman.png "File Manager with the Listing of an Archiv") -![Compression Speed vs Ratio](https://mcmilk.de/projects/7-Zip-zstd/dl/compr-074-usb2.png "Compression Speed vs Ratio") -![Decompression Speed](https://mcmilk.de/projects/7-Zip-zstd/dl/decompr-074.png "Decompression Speed @ Windows 7 64Bit") +/TR 2016-08-15