mirror of
https://github.com/Xevion/easy7zip.git
synced 2025-12-07 11:14:58 -06:00
Update to 7-Zip 17.01 Beta from Igor Pavlov
- Minor speed optimization for LZMA2 (xz and 7z) multi-threading compression.
7-Zip now uses additional memory buffers for multi-block LZMA2 compression.
CPU utilization was slightly improved.
- 7-zip now creates multi-block xz archives by default. Block size can be
specified with -ms[Size]{m|g} switch.
- xz decoder now can unpack random block from multi-block xz archives. 7-Zip
File Manager now can open nested multi-block xz archives (for example,
image.iso.xz) without full unpacking of xz archive.
- 7-Zip now can create zip archives from stdin to stdout.
- 7-Zip command line: @listfile now doesn't work after -- switch. Use
-i@listfile before -- switch instead.
fixed bugs:
- 7-Zip could add unrequired alternate file streams to WIM archives, for
commands that contain filename wildcards and -sns switch.
- 7-Zip 17.00 beta crashed for commands that write anti-item to 7z archive.
- 7-Zip 17.00 beta ignored "Use large memory pages" option.
This commit is contained in:
@@ -80,6 +80,9 @@ using namespace NDir;
|
||||
|
||||
static const unsigned kHistorySize = 20;
|
||||
|
||||
static const UInt32 kNoSolidBlockSize = 0;
|
||||
static const UInt32 kSolidBlockSize = 64;
|
||||
|
||||
static LPCSTR const kExeExt = ".exe";
|
||||
|
||||
#define k7zFormat "7z"
|
||||
@@ -292,7 +295,7 @@ static const CFormatInfo g_Formats[] =
|
||||
"xz",
|
||||
(1 << 1) | (1 << 3) | (1 << 5) | (1 << 7) | (1 << 9),
|
||||
METHODS_PAIR(g_XzMethods),
|
||||
false, false, true, false, false, false
|
||||
false, true, true, false, false, false
|
||||
},
|
||||
{
|
||||
"zstd", /* 6 */
|
||||
@@ -838,10 +841,17 @@ void CCompressDialog::OnOK()
|
||||
Info.OrderMode = GetOrderMode();
|
||||
Info.NumThreads = GetNumThreadsSpec();
|
||||
|
||||
UInt32 solidLogSize = GetBlockSizeSpec();
|
||||
Info.SolidBlockSize = 0;
|
||||
if (solidLogSize > 0 && solidLogSize != (UInt32)(Int32)-1)
|
||||
Info.SolidBlockSize = (solidLogSize >= 64) ? (UInt64)(Int64)-1 : ((UInt64)1 << solidLogSize);
|
||||
{
|
||||
// Info.SolidIsSpecified = g_Formats[GetStaticFormatIndex()].Solid;
|
||||
UInt32 solidLogSize = GetBlockSizeSpec();
|
||||
Info.SolidBlockSize = 0;
|
||||
if (solidLogSize == (UInt32)(Int32)-1)
|
||||
Info.SolidIsSpecified = false;
|
||||
else if (solidLogSize > 0)
|
||||
Info.SolidBlockSize = (solidLogSize >= 64) ?
|
||||
(UInt64)(Int64)-1 :
|
||||
((UInt64)1 << solidLogSize);
|
||||
}
|
||||
|
||||
Info.Method = GetMethodSpec();
|
||||
Info.EncryptionMethod = GetEncryptionMethodSpec();
|
||||
@@ -949,6 +959,7 @@ bool CCompressDialog::OnCommand(int code, int itemID, LPARAM lParam)
|
||||
*/
|
||||
return true;
|
||||
}
|
||||
|
||||
case IDC_COMPRESS_FORMAT:
|
||||
{
|
||||
bool isSFX = IsSFX();
|
||||
@@ -963,6 +974,7 @@ bool CCompressDialog::OnCommand(int code, int itemID, LPARAM lParam)
|
||||
SetMemoryUsage();
|
||||
return true;
|
||||
}
|
||||
|
||||
case IDC_COMPRESS_LEVEL:
|
||||
{
|
||||
SetMethod(GetMethodID());
|
||||
@@ -972,6 +984,7 @@ bool CCompressDialog::OnCommand(int code, int itemID, LPARAM lParam)
|
||||
SetMemoryUsage();
|
||||
return true;
|
||||
}
|
||||
|
||||
case IDC_COMPRESS_METHOD:
|
||||
{
|
||||
SetLevel();
|
||||
@@ -983,13 +996,34 @@ bool CCompressDialog::OnCommand(int code, int itemID, LPARAM lParam)
|
||||
SetMemoryUsage();
|
||||
return true;
|
||||
}
|
||||
|
||||
case IDC_COMPRESS_DICTIONARY:
|
||||
case IDC_COMPRESS_ORDER:
|
||||
{
|
||||
SetSolidBlockSize();
|
||||
UInt32 blockSizeLog = GetBlockSizeSpec();
|
||||
if (blockSizeLog != (UInt32)(Int32)-1
|
||||
&& blockSizeLog != kNoSolidBlockSize
|
||||
&& blockSizeLog != kSolidBlockSize)
|
||||
{
|
||||
const CArcInfoEx &ai = (*ArcFormats)[GetFormatIndex()];
|
||||
int index = FindRegistryFormatAlways(ai.Name);
|
||||
NCompression::CFormatOptions &fo = m_RegistryInfo.Formats[index];
|
||||
fo.Reset_BlockLogSize();
|
||||
SetSolidBlockSize(true);
|
||||
}
|
||||
|
||||
SetMemoryUsage();
|
||||
return true;
|
||||
}
|
||||
|
||||
case IDC_COMPRESS_ORDER:
|
||||
return true;
|
||||
|
||||
case IDC_COMPRESS_SOLID:
|
||||
{
|
||||
SetMemoryUsage();
|
||||
return true;
|
||||
}
|
||||
|
||||
case IDC_COMPRESS_THREADS:
|
||||
{
|
||||
SetMemoryUsage();
|
||||
@@ -1282,6 +1316,12 @@ bool CCompressDialog::IsZipFormat()
|
||||
return ai.Name.IsEqualTo_Ascii_NoCase("zip");
|
||||
}
|
||||
|
||||
bool CCompressDialog::IsXzFormat()
|
||||
{
|
||||
const CArcInfoEx &ai = (*ArcFormats)[GetFormatIndex()];
|
||||
return ai.Name.IsEqualTo_Ascii_NoCase("xz");
|
||||
}
|
||||
|
||||
void CCompressDialog::SetEncryptionMethod()
|
||||
{
|
||||
_encryptionMethod.ResetContent();
|
||||
@@ -1647,10 +1687,8 @@ bool CCompressDialog::GetOrderMode()
|
||||
return false;
|
||||
}
|
||||
|
||||
static const UInt32 kNoSolidBlockSize = 0;
|
||||
static const UInt32 kSolidBlockSize = 64;
|
||||
|
||||
void CCompressDialog::SetSolidBlockSize()
|
||||
void CCompressDialog::SetSolidBlockSize(bool useDictionary)
|
||||
{
|
||||
m_Solid.ResetContent();
|
||||
const CFormatInfo &fi = g_Formats[GetStaticFormatIndex()];
|
||||
@@ -1668,6 +1706,10 @@ void CCompressDialog::SetSolidBlockSize()
|
||||
UInt32 defaultBlockSize = (UInt32)(Int32)-1;
|
||||
|
||||
const CArcInfoEx &ai = (*ArcFormats)[GetFormatIndex()];
|
||||
|
||||
if (useDictionary)
|
||||
defaultBlockSize = GetBlockSizeSpec();
|
||||
else
|
||||
{
|
||||
int index = FindRegistryFormat(ai.Name);
|
||||
if (index >= 0)
|
||||
@@ -1678,23 +1720,54 @@ void CCompressDialog::SetSolidBlockSize()
|
||||
}
|
||||
}
|
||||
|
||||
bool is7z = ai.Name.IsEqualTo_Ascii_NoCase("7z");
|
||||
|
||||
{
|
||||
int index = (int)m_Solid.AddString(LangString(IDS_COMPRESS_NON_SOLID));
|
||||
UString s ('-');
|
||||
if (is7z)
|
||||
LangString(IDS_COMPRESS_NON_SOLID, s);
|
||||
int index = (int)m_Solid.AddString(s);
|
||||
m_Solid.SetItemData(index, (UInt32)kNoSolidBlockSize);
|
||||
m_Solid.SetCurSel(0);
|
||||
if (defaultBlockSize == kNoSolidBlockSize)
|
||||
m_Solid.SetCurSel(0);
|
||||
}
|
||||
|
||||
UInt64 blockSize;
|
||||
|
||||
bool needSet = (defaultBlockSize == (UInt32)(Int32)-1);
|
||||
|
||||
if (is7z)
|
||||
{
|
||||
blockSize = (UInt64)dict << 7;
|
||||
const UInt32 kMinSize = (UInt32)1 << 24;
|
||||
const UInt64 kMaxSize = (UInt64)1 << 32;
|
||||
if (blockSize < kMinSize) blockSize = kMinSize;
|
||||
if (blockSize > kMaxSize) blockSize = kMaxSize;
|
||||
}
|
||||
else
|
||||
{
|
||||
blockSize = (UInt64)dict << 2;
|
||||
const UInt32 kMinSize = (UInt32)1 << 20;
|
||||
const UInt32 kMaxSize = (UInt32)1 << 28;
|
||||
if (blockSize < kMinSize) blockSize = kMinSize;
|
||||
if (blockSize > kMaxSize) blockSize = kMaxSize;
|
||||
if (blockSize < dict) blockSize = dict;
|
||||
}
|
||||
|
||||
for (unsigned i = 20; i <= 36; i++)
|
||||
{
|
||||
if (needSet && dict >= (((UInt64)1 << (i - 7))) && i <= 32)
|
||||
if (defaultBlockSize == (UInt32)(Int32)-1 && ((UInt64)1 << i) >= blockSize)
|
||||
defaultBlockSize = i;
|
||||
|
||||
TCHAR s[40];
|
||||
char post;
|
||||
ConvertUInt32ToString(1 << (i % 10), s);
|
||||
if (i < 30) lstrcat(s, TEXT(" M"));
|
||||
else lstrcat(s, TEXT(" G"));
|
||||
lstrcat(s, TEXT("B"));
|
||||
if (i < 20) post = 'K';
|
||||
else if (i < 30) post = 'M';
|
||||
else post = 'G';
|
||||
unsigned pos = (unsigned)lstrlen(s);
|
||||
s[pos++] = ' ';
|
||||
s[pos++] = post;
|
||||
s[pos++] = 'B';
|
||||
s[pos] = 0;
|
||||
int index = (int)m_Solid.AddString(s);
|
||||
m_Solid.SetItemData(index, (UInt32)i);
|
||||
}
|
||||
@@ -1815,20 +1888,42 @@ UInt64 CCompressDialog::GetMemoryUsage(UInt32 dict, UInt64 &decompressMemory)
|
||||
size1 += (2 << 20) + (4 << 20);
|
||||
numThreads1 = 2;
|
||||
}
|
||||
|
||||
|
||||
UInt32 numBlockThreads = numThreads / numThreads1;
|
||||
|
||||
UInt64 chunkSize = 0;
|
||||
|
||||
if (methidId == kLZMA || numBlockThreads == 1)
|
||||
size1 += (UInt64)dict * 3 / 2;
|
||||
else
|
||||
if (methidId != kLZMA && numBlockThreads != 1)
|
||||
{
|
||||
UInt64 chunkSize = (UInt64)dict << 2;
|
||||
chunkSize = (UInt64)dict << 2;
|
||||
chunkSize = MyMax(chunkSize, (UInt64)(1 << 20));
|
||||
chunkSize = MyMin(chunkSize, (UInt64)(1 << 28));
|
||||
chunkSize = MyMax(chunkSize, (UInt64)dict);
|
||||
size1 += chunkSize * 2;
|
||||
|
||||
if (IsXzFormat())
|
||||
{
|
||||
UInt32 blockSizeLog = GetBlockSizeSpec();
|
||||
if (blockSizeLog != (UInt32)(Int32)-1)
|
||||
{
|
||||
if (blockSizeLog == kSolidBlockSize)
|
||||
{
|
||||
numBlockThreads = 1;
|
||||
chunkSize = 0;
|
||||
}
|
||||
else if (blockSizeLog != kNoSolidBlockSize)
|
||||
chunkSize = (UInt64)1 << blockSizeLog;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (chunkSize == 0)
|
||||
size += numBlockThreads * (size1 + (UInt64)dict * 3 / 2);
|
||||
else
|
||||
{
|
||||
size += numBlockThreads * (size1 + chunkSize);
|
||||
UInt64 numPackChunks = numBlockThreads + (numBlockThreads / 4) + 2;
|
||||
size += numPackChunks * chunkSize;
|
||||
}
|
||||
size += size1 * numBlockThreads;
|
||||
|
||||
decompressMemory = dict + (2 << 20);
|
||||
return size;
|
||||
@@ -1843,9 +1938,11 @@ UInt64 CCompressDialog::GetMemoryUsage(UInt32 dict, UInt64 &decompressMemory)
|
||||
case kDeflate:
|
||||
case kDeflate64:
|
||||
{
|
||||
/*
|
||||
UInt32 order = GetOrder();
|
||||
if (order == (UInt32)(Int32)-1)
|
||||
order = 32;
|
||||
*/
|
||||
if (level >= 7)
|
||||
size += (1 << 20);
|
||||
size += 3 << 20;
|
||||
|
||||
Reference in New Issue
Block a user