This commit is contained in:
Igor Pavlov
2010-03-24 00:00:00 +00:00
committed by Kornel Lesiński
parent 993daef9cb
commit 76b173af78
15 changed files with 153 additions and 142 deletions

View File

@@ -1,7 +1,7 @@
#define MY_VER_MAJOR 9
#define MY_VER_MINOR 11
#define MY_VER_MINOR 12
#define MY_VER_BUILD 0
#define MY_VERSION "9.11 beta"
#define MY_DATE "2010-03-15"
#define MY_VERSION "9.12 beta"
#define MY_DATE "2010-03-24"
#define MY_COPYRIGHT ": Igor Pavlov : Public domain"
#define MY_VERSION_COPYRIGHT_DATE MY_VERSION " " MY_COPYRIGHT " : " MY_DATE

View File

@@ -1,5 +1,5 @@
/* Lzma2Enc.c -- LZMA2 Encoder
2009-11-24 : Igor Pavlov : Public domain */
2010-03-24 : Igor Pavlov : Public domain */
/* #include <stdio.h> */
#include <string.h>
@@ -173,6 +173,65 @@ void Lzma2EncProps_Init(CLzma2EncProps *p)
p->blockSize = 0;
}
void Lzma2EncProps_Normalize(CLzma2EncProps *p)
{
int t1, t1n, t2, t3;
{
CLzmaEncProps lzmaProps = p->lzmaProps;
LzmaEncProps_Normalize(&lzmaProps);
t1n = lzmaProps.numThreads;
}
t1 = p->lzmaProps.numThreads;
t2 = p->numBlockThreads;
t3 = p->numTotalThreads;
if (t2 > NUM_MT_CODER_THREADS_MAX)
t2 = NUM_MT_CODER_THREADS_MAX;
if (t3 <= 0)
{
if (t2 <= 0)
t2 = 1;
t3 = t1n * t2;
}
else if (t2 <= 0)
{
t2 = t3 / t1n;
if (t2 == 0)
{
t1 = 1;
t2 = t3;
}
if (t2 > NUM_MT_CODER_THREADS_MAX)
t2 = NUM_MT_CODER_THREADS_MAX;
}
else if (t1 <= 0)
{
t1 = t3 / t2;
if (t1 == 0)
t1 = 1;
}
else
t3 = t1n * t2;
p->lzmaProps.numThreads = t1;
p->numBlockThreads = t2;
p->numTotalThreads = t3;
LzmaEncProps_Normalize(&p->lzmaProps);
if (p->blockSize == 0)
{
UInt32 dictSize = p->lzmaProps.dictSize;
UInt64 blockSize = (UInt64)dictSize << 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 < dictSize) blockSize = dictSize;
p->blockSize = (size_t)blockSize;
}
}
static SRes Progress(ICompressProgress *p, UInt64 inSize, UInt64 outSize)
{
@@ -351,70 +410,6 @@ void Lzma2Enc_Destroy(CLzma2EncHandle pp)
IAlloc_Free(p->alloc, pp);
}
void Lzma2EncProps_Normalize(CLzma2EncProps *p)
{
int t1, t1n, t2, t3;
CLzmaEncProps lzmaProps = p->lzmaProps;
LzmaEncProps_Normalize(&lzmaProps);
t1 = p->lzmaProps.numThreads;
t1n = lzmaProps.numThreads;
t2 = p->numBlockThreads;
t3 = p->numTotalThreads;
#ifndef _7ZIP_ST
if (t2 > NUM_MT_CODER_THREADS_MAX)
t2 = NUM_MT_CODER_THREADS_MAX;
#else
t2 = 1;
#endif
if (t3 <= 0)
{
if (t2 <= 0)
t2 = 1;
t3 = t1n * t2;
}
else
{
if (t2 <= 0)
{
t2 = t3 / t1n;
if (t2 == 0)
{
t1 = 1;
t2 = t3;
}
}
else if (t1 <= 0)
{
t1 = t3 / t2;
if (t1 == 0)
t1 = 1;
}
else
t3 = t1n * t2;
}
p->lzmaProps.numThreads = t1;
p->numBlockThreads = t2;
p->numTotalThreads = t3;
LzmaEncProps_Normalize(&p->lzmaProps);
if (p->blockSize == 0)
{
UInt64 blockSize = (UInt64)lzmaProps.dictSize << 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 < lzmaProps.dictSize)
blockSize = lzmaProps.dictSize;
p->blockSize = (size_t)blockSize;
}
}
SRes Lzma2Enc_SetProps(CLzma2EncHandle pp, const CLzma2EncProps *props)
{
CLzma2Enc *p = (CLzma2Enc *)pp;

View File

@@ -1,5 +1,5 @@
/* MtCoder.c -- Multi-thread Coder
2009-03-26 : Igor Pavlov : Public domain */
2010-03-24 : Igor Pavlov : Public domain */
#include <stdio.h>
@@ -306,7 +306,7 @@ SRes MtCoder_Code(CMtCoder *p)
for (i = 0; i < numThreads; i++)
{
CMtThread *t = &p->threads[i];
if (LoopThread_StartSubThread(&t->thread) != SZ_OK || i == 10)
if (LoopThread_StartSubThread(&t->thread) != SZ_OK)
{
res = SZ_ERROR_THREAD;
p->threads[0].stopReading = True;

View File

@@ -1,5 +1,5 @@
/* Ppmd8.c -- PPMdI codec
2010-03-15 : Igor Pavlov : Public domain
2010-03-24 : Igor Pavlov : Public domain
This code is based on PPMd var.I (2002): Dmitry Shkarin : Public domain */
#include <memory.h>
@@ -410,6 +410,10 @@ static void Refresh(CPpmd8 *p, CTX_PTR ctx, unsigned oldNU, unsigned scale)
unsigned i = ctx->NumStats, escFreq, sumFreq, flags;
CPpmd_State *s = (CPpmd_State *)ShrinkUnits(p, STATS(ctx), oldNU, (i + 2) >> 1);
ctx->Stats = REF(s);
#ifdef PPMD8_FREEZE_SUPPORT
/* fixed over Shkarin's code. Fixed code is not compatible with original code for some files in FREEZE mode. */
scale |= (ctx->SummFreq >= ((UInt32)1 << 15));
#endif
flags = (ctx->Flags & (0x10 + 0x04 * scale)) + 0x08 * (s->Symbol >= 0x40);
escFreq = ctx->SummFreq - s->Freq;
sumFreq = (s->Freq = (Byte)((s->Freq + scale) >> scale));

View File

@@ -1,5 +1,5 @@
/* Ppmd8.h -- PPMdI codec
2010-03-12 : Igor Pavlov : Public domain
2010-03-24 : Igor Pavlov : Public domain
This code is based on:
PPMd var.I (2002): Dmitry Shkarin : Public domain
Carryless rangecoder (1999): Dmitry Subbotin : Public domain */
@@ -35,8 +35,9 @@ typedef struct CPpmd8_Context_
#define Ppmd8Context_OneState(p) ((CPpmd_State *)&(p)->SummFreq)
/* There is some bug in FREEZE mode (including original code,
so we disable FREEZE mode support */
/* The BUG in Shkarin's code for FREEZE mode was fixed, but that fixed
code is not compatible with original code for some files compressed
in FREEZE mode. So we disable FREEZE mode support. */
enum
{

View File

@@ -450,6 +450,7 @@ struct CResItem
bool IsIcon() const { return Type == 3; }
bool IsString() const { return Type == 6; }
bool IsRcData() const { return Type == 10; }
bool IsRcDataOrUnknown() const { return IsRcData() || Type > 64; }
};
struct CStringItem
@@ -1410,7 +1411,7 @@ HRESULT CHandler::Open2(IInStream *stream, IArchiveOpenCallback *callback)
{
mixItem.ResourceIndex = j;
mixItem.StringIndex = -1;
if (item.IsRcData())
if (item.IsRcDataOrUnknown())
{
if (item.Size >= mainSize)
{

View File

@@ -244,14 +244,14 @@ HRESULT CAddCommon::Compress(
_compressEncoder = encoder;
NWindows::NCOM::CPropVariant props[] =
{
// _options.Algo,
_options.Algo,
_options.MemSize,
_options.Order
};
PROPID propIDs[] =
{
// NCoderPropID::kAlgorithm,
NCoderPropID::kAlgorithm,
NCoderPropID::kUsedMemorySize,
NCoderPropID::kOrder
};

View File

@@ -51,18 +51,6 @@ static const UInt32 kLzmaDicSizeX5 = 1 << 24;
static const UInt32 kLzmaDicSizeX7 = 1 << 25;
static const UInt32 kLzmaDicSizeX9 = 1 << 26;
static const UInt32 kPpmdMemSizeX1 = (1 << 20);
static const UInt32 kPpmdMemSizeX3 = (1 << 22);
static const UInt32 kPpmdMemSizeX5 = (1 << 24);
static const UInt32 kPpmdMemSizeX7 = (1 << 26);
static const UInt32 kPpmdMemSizeX9 = (1 << 27);
static const UInt32 kPpmdOrderX1 = 4;
static const UInt32 kPpmdOrderX3 = 6;
static const UInt32 kPpmdOrderX5 = 8;
static const UInt32 kPpmdOrderX7 = 10;
static const UInt32 kPpmdOrderX9 = 16;
static const UInt32 kBZip2NumPassesX1 = 1;
static const UInt32 kBZip2NumPassesX7 = 2;
static const UInt32 kBZip2NumPassesX9 = 7;
@@ -362,23 +350,18 @@ STDMETHODIMP CHandler::UpdateItems(ISequentialOutStream *outStream, UInt32 numIt
}
if (mainMethod == NFileHeader::NCompressionMethod::kPPMd)
{
int level2 = level;
if (level2 < 1) level2 = 1;
if (level2 > 9) level2 = 9;
if (options.MemSize == 0xFFFFFFFF)
options.MemSize =
(level >= 9 ? kPpmdMemSizeX9 :
(level >= 7 ? kPpmdMemSizeX7 :
(level >= 5 ? kPpmdMemSizeX5 :
(level >= 3 ? kPpmdMemSizeX3 :
kPpmdMemSizeX1))));
options.MemSize = (1 << (19 + (level2 > 8 ? 8 : level2)));
if (options.Order == 0xFFFFFFFF)
options.Order =
(level >= 9 ? kPpmdOrderX9 :
(level >= 7 ? kPpmdOrderX7 :
(level >= 5 ? kPpmdOrderX5 :
(level >= 3 ? kPpmdOrderX3 :
kPpmdOrderX1))));
options.Order = 3 + level2;
options.Algo = 0;
if (options.Algo == 0xFFFFFFFF)
options.Algo = (level2 >= 7 ? 1 : 0);
}
return Update(
@@ -482,13 +465,13 @@ STDMETHODIMP CHandler::SetProperties(const wchar_t **names, const PROPVARIANT *v
}
else if (name.Left(3) == L"MEM")
{
UInt32 memSize = kPpmdMemSizeX5;
UInt32 memSize = 1 << 24;
RINOK(ParsePropDictionaryValue(name.Mid(3), prop, memSize));
m_MemSize = memSize;
}
else if (name[0] == L'O')
{
UInt32 order = kPpmdOrderX5;
UInt32 order = 8;
RINOK(ParsePropValue(name.Mid(1), prop, order));
m_Order = order;
}

View File

@@ -1,5 +1,5 @@
// PpmdZip.cpp
// 2010-03-11 : Igor Pavlov : Public domain
// 2010-03-24 : Igor Pavlov : Public domain
#include "StdAfx.h"

View File

@@ -1,8 +1,8 @@
#define MY_VER_MAJOR 9
#define MY_VER_MINOR 11
#define MY_VER_MINOR 12
#define MY_VER_BUILD 0
#define MY_VERSION "9.11 beta"
#define MY_7ZIP_VERSION "7-Zip 9.11 beta"
#define MY_DATE "2010-03-15"
#define MY_VERSION "9.12 beta"
#define MY_7ZIP_VERSION "7-Zip 9.12 beta"
#define MY_DATE "2010-03-24"
#define MY_COPYRIGHT "Copyright (c) 1999-2010 Igor Pavlov"
#define MY_VERSION_COPYRIGHT_DATE MY_VERSION " " MY_COPYRIGHT " " MY_DATE

View File

@@ -114,7 +114,8 @@ enum EMethodID
kPPMd,
kBZip2,
kDeflate,
kDeflate64
kDeflate64,
kPPMdZip,
};
static const LPCWSTR kMethodsNames[] =
@@ -125,7 +126,8 @@ static const LPCWSTR kMethodsNames[] =
L"PPMd",
L"BZip2",
L"Deflate",
L"Deflate64"
L"Deflate64",
L"PPMd"
};
static const EMethodID g_7zMethods[] =
@@ -149,7 +151,8 @@ static EMethodID g_ZipMethods[] =
kDeflate,
kDeflate64,
kBZip2,
kLZMA
kLZMA,
kPPMdZip
};
static EMethodID g_GZipMethods[] =
@@ -849,6 +852,7 @@ void CCompressDialog::SetMethod(int keepMethodId)
continue;
const LPCWSTR method = kMethodsNames[methodID];
int itemIndex = (int)m_Method.AddString(GetSystemString(method));
m_Method.SetItemData(itemIndex, methodID);
if (keepMethodId == methodID)
{
m_Method.SetCurSel(itemIndex);
@@ -897,21 +901,16 @@ void CCompressDialog::SetEncryptionMethod()
int CCompressDialog::GetMethodID()
{
UString methodName;
m_Method.GetText(methodName);
for (int i = 0; i < MY_SIZE_OF_ARRAY(kMethodsNames); i++)
if (methodName.CompareNoCase(kMethodsNames[i]) == 0)
return i;
return -1;
if (m_Method.GetCount() <= 0)
return -1;
return (int)(UInt32)m_Method.GetItemData(m_Method.GetCurSel());
}
UString CCompressDialog::GetMethodSpec()
{
if (m_Method.GetCount() <= 1)
return UString();
UString result;
m_Method.GetText(result);
return result;
return kMethodsNames[GetMethodID()];
}
UString CCompressDialog::GetEncryptionMethodSpec()
@@ -964,7 +963,7 @@ void CCompressDialog::SetDictionary()
m_Dictionary.ResetContent();
const CArcInfoEx &ai = (*ArcFormats)[GetFormatIndex()];
int index = FindRegistryFormat(ai.Name);
UInt32 defaultDictionary = UInt32(-1);
UInt32 defaultDictionary = (UInt32)-1;
if (index >= 0)
{
const NCompression::CFormatOptions &fo = m_RegistryInfo.Formats[index];
@@ -982,7 +981,7 @@ void CCompressDialog::SetDictionary()
case kLZMA2:
{
static const UInt32 kMinDicSize = (1 << 16);
if (defaultDictionary == UInt32(-1))
if (defaultDictionary == (UInt32)-1)
{
if (level >= 9) defaultDictionary = (1 << 26);
else if (level >= 7) defaultDictionary = (1 << 25);
@@ -1011,7 +1010,7 @@ void CCompressDialog::SetDictionary()
UInt64 decomprSize;
UInt64 requiredComprSize = GetMemoryUsage(dictionary, decomprSize);
if (dictionary <= defaultDictionary && requiredComprSize <= maxRamSize)
m_Dictionary.SetCurSel(m_Dictionary.GetCount() - 1);
m_Dictionary.SetCurSel(m_Dictionary.GetCount() - 1);
}
// SetNearestSelectComboBox(m_Dictionary, defaultDictionary);
@@ -1019,7 +1018,7 @@ void CCompressDialog::SetDictionary()
}
case kPPMd:
{
if (defaultDictionary == UInt32(-1))
if (defaultDictionary == (UInt32)-1)
{
if (level >= 9) defaultDictionary = (192 << 20);
else if (level >= 7) defaultDictionary = ( 64 << 20);
@@ -1039,7 +1038,7 @@ void CCompressDialog::SetDictionary()
UInt64 decomprSize;
UInt64 requiredComprSize = GetMemoryUsage(dictionary, decomprSize);
if (dictionary <= defaultDictionary && requiredComprSize <= maxRamSize || m_Dictionary.GetCount() == 0)
m_Dictionary.SetCurSel(m_Dictionary.GetCount() - 1);
m_Dictionary.SetCurSel(m_Dictionary.GetCount() - 1);
}
SetNearestSelectComboBox(m_Dictionary, defaultDictionary);
break;
@@ -1058,8 +1057,7 @@ void CCompressDialog::SetDictionary()
}
case kBZip2:
{
// UInt32 defaultDictionary;
if (defaultDictionary == UInt32(-1))
if (defaultDictionary == (UInt32)-1)
{
if (level >= 5)
defaultDictionary = (900 << 10);
@@ -1073,10 +1071,26 @@ void CCompressDialog::SetDictionary()
UInt32 dictionary = (i * 100) << 10;
AddDictionarySize(dictionary);
if (dictionary <= defaultDictionary || m_Dictionary.GetCount() == 0)
m_Dictionary.SetCurSel(m_Dictionary.GetCount() - 1);
m_Dictionary.SetCurSel(m_Dictionary.GetCount() - 1);
}
break;
}
case kPPMdZip:
{
if (defaultDictionary == (UInt32)-1)
defaultDictionary = (1 << (19 + (level > 8 ? 8 : level)));
for (int i = 20; i <= 28; i++)
{
UInt32 dictionary = (1 << i);
AddDictionarySize(dictionary);
UInt64 decomprSize;
UInt64 requiredComprSize = GetMemoryUsage(dictionary, decomprSize);
if (dictionary <= defaultDictionary && requiredComprSize <= maxRamSize || m_Dictionary.GetCount() == 0)
m_Dictionary.SetCurSel(m_Dictionary.GetCount() - 1);
}
SetNearestSelectComboBox(m_Dictionary, defaultDictionary);
break;
}
}
}
@@ -1109,7 +1123,7 @@ void CCompressDialog::SetOrder()
m_Order.ResetContent();
const CArcInfoEx &ai = (*ArcFormats)[GetFormatIndex()];
int index = FindRegistryFormat(ai.Name);
UInt32 defaultOrder = UInt32(-1);
UInt32 defaultOrder = (UInt32)-1;
if (index >= 0)
{
const NCompression::CFormatOptions &fo = m_RegistryInfo.Formats[index];
@@ -1125,7 +1139,7 @@ void CCompressDialog::SetOrder()
case kLZMA:
case kLZMA2:
{
if (defaultOrder == UInt32(-1))
if (defaultOrder == (UInt32)-1)
defaultOrder = (level >= 7) ? 64 : 32;
for (int i = 3; i <= 8; i++)
for (int j = 0; j < 2; j++)
@@ -1140,7 +1154,7 @@ void CCompressDialog::SetOrder()
}
case kPPMd:
{
if (defaultOrder == UInt32(-1))
if (defaultOrder == (UInt32)-1)
{
if (level >= 9)
defaultOrder = 32;
@@ -1168,7 +1182,7 @@ void CCompressDialog::SetOrder()
case kDeflate:
case kDeflate64:
{
if (defaultOrder == UInt32(-1))
if (defaultOrder == (UInt32)-1)
{
if (level >= 9)
defaultOrder = 128;
@@ -1193,6 +1207,15 @@ void CCompressDialog::SetOrder()
{
break;
}
case kPPMdZip:
{
if (defaultOrder == (UInt32)-1)
defaultOrder = level + 3;
for (int i = 2; i <= 16; i++)
AddOrder(i);
SetNearestSelectComboBox(m_Order, defaultOrder);
break;
}
}
}
@@ -1221,7 +1244,7 @@ void CCompressDialog::SetSolidBlockSize()
return;
UInt32 dictionary = GetDictionarySpec();
if (dictionary == UInt32(-1))
if (dictionary == (UInt32)-1)
dictionary = 1;
UInt32 defaultBlockSize = (UInt32)-1;
@@ -1299,7 +1322,6 @@ void CCompressDialog::SetNumThreads()
SetNearestSelectComboBox(m_NumThreads, defaultValue);
}
UInt64 CCompressDialog::GetMemoryUsage(UInt32 dictionary, UInt64 &decompressMemory)
{
decompressMemory = UInt64(Int64(-1));
@@ -1377,7 +1399,7 @@ UInt64 CCompressDialog::GetMemoryUsage(UInt32 dictionary, UInt64 &decompressMemo
case kDeflate64:
{
UInt32 order = GetOrder();
if (order == UInt32(-1))
if (order == (UInt32)-1)
order = 32;
if (level >= 7)
size += (1 << 20);
@@ -1391,8 +1413,13 @@ UInt64 CCompressDialog::GetMemoryUsage(UInt32 dictionary, UInt64 &decompressMemo
UInt64 memForOneThread = (10 << 20);
return size + memForOneThread * numThreads;
}
case kPPMdZip:
{
decompressMemory = dictionary + (2 << 20);
return size + (UInt64)decompressMemory * numThreads;
}
}
return UInt64(Int64(-1));
return (UInt64)(Int64)-1;
}
UInt64 CCompressDialog::GetMemoryUsage(UInt64 &decompressMemory)

View File

@@ -10,8 +10,8 @@ AppName = "7-Zip"
InstallDir = %CE1%\%AppName%
[Strings]
AppVer = "9.11"
AppDate = "2010-03-14"
AppVer = "9.12"
AppDate = "2010-03-24"
[CEDevice]
; ProcessorType = 2577 ; ARM

View File

@@ -2,7 +2,7 @@
;Defines
!define VERSION_MAJOR 9
!define VERSION_MINOR 11
!define VERSION_MINOR 12
!define VERSION_POSTFIX_FULL " beta"
!ifdef WIN64
!ifdef IA64

View File

@@ -1,7 +1,7 @@
<?xml version="1.0"?>
<?define VerMajor = "9" ?>
<?define VerMinor = "11" ?>
<?define VerMinor = "12" ?>
<?define VerBuild = "00" ?>
<?define MmVer = "$(var.VerMajor).$(var.VerMinor)" ?>
<?define MmHex = "0$(var.VerMajor)$(var.VerMinor)" ?>

View File

@@ -1,4 +1,4 @@
LZMA SDK 9.11
LZMA SDK 9.12
-------------
LZMA SDK provides the documentation, samples, header files, libraries,