mirror of
https://github.com/ckolivas/lrzip.git
synced 2025-12-06 07:12:00 +01:00
Update to lzma 920 library.
This commit is contained in:
parent
7104809cd1
commit
71bb72f5da
2
README
2
README
|
|
@ -244,7 +244,7 @@ A. It has been tested on gcc, ekopath and the intel compiler successfully
|
||||||
previously. Whether the commercial compilers help or not, I could not tell you.
|
previously. Whether the commercial compilers help or not, I could not tell you.
|
||||||
|
|
||||||
Q. What codebase are you basing this on?
|
Q. What codebase are you basing this on?
|
||||||
A. rzip v2.1 and lzma sdk907, but it should be possible to stay in sync with
|
A. rzip v2.1 and lzma sdk920, but it should be possible to stay in sync with
|
||||||
each of these in the future.
|
each of these in the future.
|
||||||
|
|
||||||
Q. Do we really need yet another compression format?
|
Q. Do we really need yet another compression format?
|
||||||
|
|
|
||||||
|
|
@ -1,18 +1,19 @@
|
||||||
/* Alloc.h -- Memory allocation functions
|
/* Alloc.h -- Memory allocation functions
|
||||||
2008-03-13
|
2009-02-07 : Igor Pavlov : Public domain */
|
||||||
Igor Pavlov
|
|
||||||
Public domain */
|
|
||||||
|
|
||||||
#ifndef __COMMON_ALLOC_H
|
#ifndef __COMMON_ALLOC_H
|
||||||
#define __COMMON_ALLOC_H
|
#define __COMMON_ALLOC_H
|
||||||
|
|
||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
void *MyAlloc(size_t size);
|
void *MyAlloc(size_t size);
|
||||||
void MyFree(void *address);
|
void MyFree(void *address);
|
||||||
|
|
||||||
|
#ifdef _WIN32
|
||||||
|
|
||||||
void SetLargePageSize();
|
void SetLargePageSize();
|
||||||
|
|
||||||
|
|
@ -23,15 +24,15 @@ void BigFree(void *address);
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
#include <stdlib.h> /* malloc */
|
#define MidAlloc(size) MyAlloc(size)
|
||||||
|
#define MidFree(address) MyFree(address)
|
||||||
#define MyAlloc(size) malloc(size)
|
#define BigAlloc(size) MyAlloc(size)
|
||||||
#define MyFree(address) free(address)
|
#define BigFree(address) MyFree(address)
|
||||||
#define MidAlloc(size) malloc(size)
|
|
||||||
#define MidFree(address) free(address)
|
|
||||||
#define BigAlloc(size) malloc(size)
|
|
||||||
#define BigFree(address) free(address)
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/* LzFindMt.c -- multithreaded Match finder for LZ algorithms
|
/* LzFindMt.c -- multithreaded Match finder for LZ algorithms
|
||||||
2009-05-26 : Igor Pavlov : Public domain */
|
2009-09-20 : Igor Pavlov : Public domain */
|
||||||
|
|
||||||
#include "LzHash.h"
|
#include "LzHash.h"
|
||||||
|
|
||||||
|
|
@ -711,47 +711,47 @@ UInt32 MatchFinderMt_GetMatches(CMatchFinderMt *p, UInt32 *distances)
|
||||||
return len;
|
return len;
|
||||||
}
|
}
|
||||||
|
|
||||||
#define SKIP_HEADER2 do { GET_NEXT_BLOCK_IF_REQUIRED
|
#define SKIP_HEADER2_MT do { GET_NEXT_BLOCK_IF_REQUIRED
|
||||||
#define SKIP_HEADER(n) SKIP_HEADER2 if (p->btNumAvailBytes-- >= (n)) { const Byte *cur = p->pointerToCurPos; UInt32 *hash = p->hash;
|
#define SKIP_HEADER_MT(n) SKIP_HEADER2_MT if (p->btNumAvailBytes-- >= (n)) { const Byte *cur = p->pointerToCurPos; UInt32 *hash = p->hash;
|
||||||
#define SKIP_FOOTER } INCREASE_LZ_POS p->btBufPos += p->btBuf[p->btBufPos] + 1; } while (--num != 0);
|
#define SKIP_FOOTER_MT } INCREASE_LZ_POS p->btBufPos += p->btBuf[p->btBufPos] + 1; } while (--num != 0);
|
||||||
|
|
||||||
void MatchFinderMt0_Skip(CMatchFinderMt *p, UInt32 num)
|
void MatchFinderMt0_Skip(CMatchFinderMt *p, UInt32 num)
|
||||||
{
|
{
|
||||||
SKIP_HEADER2 { p->btNumAvailBytes--;
|
SKIP_HEADER2_MT { p->btNumAvailBytes--;
|
||||||
SKIP_FOOTER
|
SKIP_FOOTER_MT
|
||||||
}
|
}
|
||||||
|
|
||||||
void MatchFinderMt2_Skip(CMatchFinderMt *p, UInt32 num)
|
void MatchFinderMt2_Skip(CMatchFinderMt *p, UInt32 num)
|
||||||
{
|
{
|
||||||
SKIP_HEADER(2)
|
SKIP_HEADER_MT(2)
|
||||||
UInt32 hash2Value;
|
UInt32 hash2Value;
|
||||||
MT_HASH2_CALC
|
MT_HASH2_CALC
|
||||||
hash[hash2Value] = p->lzPos;
|
hash[hash2Value] = p->lzPos;
|
||||||
SKIP_FOOTER
|
SKIP_FOOTER_MT
|
||||||
}
|
}
|
||||||
|
|
||||||
void MatchFinderMt3_Skip(CMatchFinderMt *p, UInt32 num)
|
void MatchFinderMt3_Skip(CMatchFinderMt *p, UInt32 num)
|
||||||
{
|
{
|
||||||
SKIP_HEADER(3)
|
SKIP_HEADER_MT(3)
|
||||||
UInt32 hash2Value, hash3Value;
|
UInt32 hash2Value, hash3Value;
|
||||||
MT_HASH3_CALC
|
MT_HASH3_CALC
|
||||||
hash[kFix3HashSize + hash3Value] =
|
hash[kFix3HashSize + hash3Value] =
|
||||||
hash[ hash2Value] =
|
hash[ hash2Value] =
|
||||||
p->lzPos;
|
p->lzPos;
|
||||||
SKIP_FOOTER
|
SKIP_FOOTER_MT
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
void MatchFinderMt4_Skip(CMatchFinderMt *p, UInt32 num)
|
void MatchFinderMt4_Skip(CMatchFinderMt *p, UInt32 num)
|
||||||
{
|
{
|
||||||
SKIP_HEADER(4)
|
SKIP_HEADER_MT(4)
|
||||||
UInt32 hash2Value, hash3Value, hash4Value;
|
UInt32 hash2Value, hash3Value, hash4Value;
|
||||||
MT_HASH4_CALC
|
MT_HASH4_CALC
|
||||||
hash[kFix4HashSize + hash4Value] =
|
hash[kFix4HashSize + hash4Value] =
|
||||||
hash[kFix3HashSize + hash3Value] =
|
hash[kFix3HashSize + hash3Value] =
|
||||||
hash[ hash2Value] =
|
hash[ hash2Value] =
|
||||||
p->lzPos;
|
p->lzPos;
|
||||||
SKIP_FOOTER
|
SKIP_FOOTER_MT
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/* LzmaDec.c -- LZMA Decoder
|
/* LzmaDec.c -- LZMA Decoder
|
||||||
2008-11-06 : Igor Pavlov : Public domain */
|
2009-09-20 : Igor Pavlov : Public domain */
|
||||||
|
|
||||||
#include "LzmaDec.h"
|
#include "LzmaDec.h"
|
||||||
|
|
||||||
|
|
@ -113,12 +113,6 @@
|
||||||
StopCompilingDueBUG
|
StopCompilingDueBUG
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static const Byte kLiteralNextStates[kNumStates * 2] =
|
|
||||||
{
|
|
||||||
0, 0, 0, 0, 1, 2, 3, 4, 5, 6, 4, 5,
|
|
||||||
7, 7, 7, 7, 7, 7, 7, 10, 10, 10, 10, 10
|
|
||||||
};
|
|
||||||
|
|
||||||
#define LZMA_DIC_MIN (1 << 12)
|
#define LZMA_DIC_MIN (1 << 12)
|
||||||
|
|
||||||
/* First LZMA-symbol is always decoded.
|
/* First LZMA-symbol is always decoded.
|
||||||
|
|
@ -175,6 +169,7 @@ static int MY_FAST_CALL LzmaDec_DecodeReal(CLzmaDec *p, SizeT limit, const Byte
|
||||||
|
|
||||||
if (state < kNumLitStates)
|
if (state < kNumLitStates)
|
||||||
{
|
{
|
||||||
|
state -= (state < 4) ? state : 3;
|
||||||
symbol = 1;
|
symbol = 1;
|
||||||
do { GET_BIT(prob + symbol, symbol) } while (symbol < 0x100);
|
do { GET_BIT(prob + symbol, symbol) } while (symbol < 0x100);
|
||||||
}
|
}
|
||||||
|
|
@ -182,6 +177,7 @@ static int MY_FAST_CALL LzmaDec_DecodeReal(CLzmaDec *p, SizeT limit, const Byte
|
||||||
{
|
{
|
||||||
unsigned matchByte = p->dic[(dicPos - rep0) + ((dicPos < rep0) ? dicBufSize : 0)];
|
unsigned matchByte = p->dic[(dicPos - rep0) + ((dicPos < rep0) ? dicBufSize : 0)];
|
||||||
unsigned offs = 0x100;
|
unsigned offs = 0x100;
|
||||||
|
state -= (state < 10) ? 3 : 6;
|
||||||
symbol = 1;
|
symbol = 1;
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
|
|
@ -196,9 +192,6 @@ static int MY_FAST_CALL LzmaDec_DecodeReal(CLzmaDec *p, SizeT limit, const Byte
|
||||||
}
|
}
|
||||||
dic[dicPos++] = (Byte)symbol;
|
dic[dicPos++] = (Byte)symbol;
|
||||||
processedPos++;
|
processedPos++;
|
||||||
|
|
||||||
state = kLiteralNextStates[state];
|
|
||||||
/* if (state < 4) state = 0; else if (state < 10) state -= 3; else state -= 6; */
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
@ -378,7 +371,6 @@ static int MY_FAST_CALL LzmaDec_DecodeReal(CLzmaDec *p, SizeT limit, const Byte
|
||||||
else if (distance >= checkDicSize)
|
else if (distance >= checkDicSize)
|
||||||
return SZ_ERROR_DATA;
|
return SZ_ERROR_DATA;
|
||||||
state = (state < kNumStates + kNumLitStates) ? kNumLitStates : kNumLitStates + 3;
|
state = (state < kNumStates + kNumLitStates) ? kNumLitStates : kNumLitStates + 3;
|
||||||
/* state = kLiteralNextStates[state]; */
|
|
||||||
}
|
}
|
||||||
|
|
||||||
len += kMatchMinLen;
|
len += kMatchMinLen;
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/* LzmaEnc.c -- LZMA Encoder
|
/* LzmaEnc.c -- LZMA Encoder
|
||||||
2009-04-22 : Igor Pavlov : Public domain */
|
2010-04-16 : Igor Pavlov : Public domain */
|
||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
|
|
@ -13,7 +13,7 @@
|
||||||
#include "LzmaEnc.h"
|
#include "LzmaEnc.h"
|
||||||
|
|
||||||
#include "LzFind.h"
|
#include "LzFind.h"
|
||||||
#ifdef COMPRESS_MF_MT
|
#ifndef _7ZIP_ST
|
||||||
#include "LzFindMt.h"
|
#include "LzFindMt.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
@ -66,7 +66,7 @@ void LzmaEncProps_Normalize(CLzmaEncProps *p)
|
||||||
if (p->mc == 0) p->mc = (16 + (p->fb >> 1)) >> (p->btMode ? 0 : 1);
|
if (p->mc == 0) p->mc = (16 + (p->fb >> 1)) >> (p->btMode ? 0 : 1);
|
||||||
if (p->numThreads < 0)
|
if (p->numThreads < 0)
|
||||||
p->numThreads =
|
p->numThreads =
|
||||||
#ifdef COMPRESS_MF_MT
|
#ifndef _7ZIP_ST
|
||||||
((p->btMode && p->algo) ? 2 : 1);
|
((p->btMode && p->algo) ? 2 : 1);
|
||||||
#else
|
#else
|
||||||
1;
|
1;
|
||||||
|
|
@ -172,7 +172,7 @@ typedef struct
|
||||||
#define kEndPosModelIndex 14
|
#define kEndPosModelIndex 14
|
||||||
#define kNumPosModels (kEndPosModelIndex - kStartPosModelIndex)
|
#define kNumPosModels (kEndPosModelIndex - kStartPosModelIndex)
|
||||||
|
|
||||||
#define kNumFullDistances (1 << (kEndPosModelIndex / 2))
|
#define kNumFullDistances (1 << (kEndPosModelIndex >> 1))
|
||||||
|
|
||||||
#ifdef _LZMA_PROB32
|
#ifdef _LZMA_PROB32
|
||||||
#define CLzmaProb UInt32
|
#define CLzmaProb UInt32
|
||||||
|
|
@ -259,14 +259,14 @@ typedef struct
|
||||||
IMatchFinder matchFinder;
|
IMatchFinder matchFinder;
|
||||||
void *matchFinderObj;
|
void *matchFinderObj;
|
||||||
|
|
||||||
#ifdef COMPRESS_MF_MT
|
#ifndef _7ZIP_ST
|
||||||
Bool mtMode;
|
Bool mtMode;
|
||||||
CMatchFinderMt matchFinderMt;
|
CMatchFinderMt matchFinderMt;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
CMatchFinder matchFinderBase;
|
CMatchFinder matchFinderBase;
|
||||||
|
|
||||||
#ifdef COMPRESS_MF_MT
|
#ifndef _7ZIP_ST
|
||||||
Byte pad[128];
|
Byte pad[128];
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
@ -395,7 +395,7 @@ SRes LzmaEnc_SetProps(CLzmaEncHandle pp, const CLzmaEncProps *props2)
|
||||||
LzmaEncProps_Normalize(&props);
|
LzmaEncProps_Normalize(&props);
|
||||||
|
|
||||||
if (props.lc > LZMA_LC_MAX || props.lp > LZMA_LP_MAX || props.pb > LZMA_PB_MAX ||
|
if (props.lc > LZMA_LC_MAX || props.lp > LZMA_LP_MAX || props.pb > LZMA_PB_MAX ||
|
||||||
props.dictSize > (unsigned)(1 << kDicLogSizeMaxCompress) || props.dictSize > (1 << 30))
|
props.dictSize > ((UInt32)1 << kDicLogSizeMaxCompress) || props.dictSize > ((UInt32)1 << 30))
|
||||||
return SZ_ERROR_PARAM;
|
return SZ_ERROR_PARAM;
|
||||||
p->dictSize = props.dictSize;
|
p->dictSize = props.dictSize;
|
||||||
p->matchFinderCycles = props.mc;
|
p->matchFinderCycles = props.mc;
|
||||||
|
|
@ -428,7 +428,7 @@ SRes LzmaEnc_SetProps(CLzmaEncHandle pp, const CLzmaEncProps *props2)
|
||||||
|
|
||||||
p->writeEndMark = props.writeEndMark;
|
p->writeEndMark = props.writeEndMark;
|
||||||
|
|
||||||
#ifdef COMPRESS_MF_MT
|
#ifndef _7ZIP_ST
|
||||||
/*
|
/*
|
||||||
if (newMultiThread != _multiThread)
|
if (newMultiThread != _multiThread)
|
||||||
{
|
{
|
||||||
|
|
@ -804,7 +804,7 @@ static void MovePos(CLzmaEnc *p, UInt32 num)
|
||||||
{
|
{
|
||||||
#ifdef SHOW_STAT
|
#ifdef SHOW_STAT
|
||||||
ttt += num;
|
ttt += num;
|
||||||
fprintf(stderr, "\n MovePos %d", num);
|
printf("\n MovePos %d", num);
|
||||||
#endif
|
#endif
|
||||||
if (num != 0)
|
if (num != 0)
|
||||||
{
|
{
|
||||||
|
|
@ -819,12 +819,12 @@ static UInt32 ReadMatchDistances(CLzmaEnc *p, UInt32 *numDistancePairsRes)
|
||||||
p->numAvail = p->matchFinder.GetNumAvailableBytes(p->matchFinderObj);
|
p->numAvail = p->matchFinder.GetNumAvailableBytes(p->matchFinderObj);
|
||||||
numPairs = p->matchFinder.GetMatches(p->matchFinderObj, p->matches);
|
numPairs = p->matchFinder.GetMatches(p->matchFinderObj, p->matches);
|
||||||
#ifdef SHOW_STAT
|
#ifdef SHOW_STAT
|
||||||
fprintf(stderr, "\n i = %d numPairs = %d ", ttt, numPairs / 2);
|
printf("\n i = %d numPairs = %d ", ttt, numPairs / 2);
|
||||||
ttt++;
|
ttt++;
|
||||||
{
|
{
|
||||||
UInt32 i;
|
UInt32 i;
|
||||||
for (i = 0; i < numPairs; i += 2)
|
for (i = 0; i < numPairs; i += 2)
|
||||||
fprintf(stderr, "%2d %6d | ", p->matches[i], p->matches[i + 1]);
|
printf("%2d %6d | ", p->matches[i], p->matches[i + 1]);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
if (numPairs > 0)
|
if (numPairs > 0)
|
||||||
|
|
@ -1115,9 +1115,9 @@ static UInt32 GetOptimum(CLzmaEnc *p, UInt32 position, UInt32 *backRes)
|
||||||
if (position >= 0)
|
if (position >= 0)
|
||||||
{
|
{
|
||||||
unsigned i;
|
unsigned i;
|
||||||
fprintf(stderr, "\n pos = %4X", position);
|
printf("\n pos = %4X", position);
|
||||||
for (i = cur; i <= lenEnd; i++)
|
for (i = cur; i <= lenEnd; i++)
|
||||||
fprintf(stderr, "\nprice[%4X] = %d", position - cur + i, p->opt[i].price);
|
printf("\nprice[%4X] = %d", position - cur + i, p->opt[i].price);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
@ -1677,7 +1677,7 @@ void LzmaEnc_Construct(CLzmaEnc *p)
|
||||||
{
|
{
|
||||||
RangeEnc_Construct(&p->rc);
|
RangeEnc_Construct(&p->rc);
|
||||||
MatchFinder_Construct(&p->matchFinderBase);
|
MatchFinder_Construct(&p->matchFinderBase);
|
||||||
#ifdef COMPRESS_MF_MT
|
#ifndef _7ZIP_ST
|
||||||
MatchFinderMt_Construct(&p->matchFinderMt);
|
MatchFinderMt_Construct(&p->matchFinderMt);
|
||||||
p->matchFinderMt.MatchFinder = &p->matchFinderBase;
|
p->matchFinderMt.MatchFinder = &p->matchFinderBase;
|
||||||
#endif
|
#endif
|
||||||
|
|
@ -1716,7 +1716,7 @@ void LzmaEnc_FreeLits(CLzmaEnc *p, ISzAlloc *alloc)
|
||||||
|
|
||||||
void LzmaEnc_Destruct(CLzmaEnc *p, ISzAlloc *alloc, ISzAlloc *allocBig)
|
void LzmaEnc_Destruct(CLzmaEnc *p, ISzAlloc *alloc, ISzAlloc *allocBig)
|
||||||
{
|
{
|
||||||
#ifdef COMPRESS_MF_MT
|
#ifndef _7ZIP_ST
|
||||||
MatchFinderMt_Destruct(&p->matchFinderMt, allocBig);
|
MatchFinderMt_Destruct(&p->matchFinderMt, allocBig);
|
||||||
#endif
|
#endif
|
||||||
MatchFinder_Free(&p->matchFinderBase, allocBig);
|
MatchFinder_Free(&p->matchFinderBase, allocBig);
|
||||||
|
|
@ -1772,7 +1772,7 @@ static SRes LzmaEnc_CodeOneBlock(CLzmaEnc *p, Bool useLimits, UInt32 maxPackSize
|
||||||
len = GetOptimum(p, nowPos32, &pos);
|
len = GetOptimum(p, nowPos32, &pos);
|
||||||
|
|
||||||
#ifdef SHOW_STAT2
|
#ifdef SHOW_STAT2
|
||||||
fprintf(stderr, "\n pos = %4X, len = %d pos = %d", nowPos32, len, pos);
|
printf("\n pos = %4X, len = %d pos = %d", nowPos32, len, pos);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
posState = nowPos32 & p->pbMask;
|
posState = nowPos32 & p->pbMask;
|
||||||
|
|
@ -1901,7 +1901,7 @@ static SRes LzmaEnc_Alloc(CLzmaEnc *p, UInt32 keepWindowSize, ISzAlloc *alloc, I
|
||||||
if (!RangeEnc_Alloc(&p->rc, alloc))
|
if (!RangeEnc_Alloc(&p->rc, alloc))
|
||||||
return SZ_ERROR_MEM;
|
return SZ_ERROR_MEM;
|
||||||
btMode = (p->matchFinderBase.btMode != 0);
|
btMode = (p->matchFinderBase.btMode != 0);
|
||||||
#ifdef COMPRESS_MF_MT
|
#ifndef _7ZIP_ST
|
||||||
p->mtMode = (p->multiThread && !p->fastMode && btMode);
|
p->mtMode = (p->multiThread && !p->fastMode && btMode);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
@ -1926,7 +1926,7 @@ static SRes LzmaEnc_Alloc(CLzmaEnc *p, UInt32 keepWindowSize, ISzAlloc *alloc, I
|
||||||
if (beforeSize + p->dictSize < keepWindowSize)
|
if (beforeSize + p->dictSize < keepWindowSize)
|
||||||
beforeSize = keepWindowSize - p->dictSize;
|
beforeSize = keepWindowSize - p->dictSize;
|
||||||
|
|
||||||
#ifdef COMPRESS_MF_MT
|
#ifndef _7ZIP_ST
|
||||||
if (p->mtMode)
|
if (p->mtMode)
|
||||||
{
|
{
|
||||||
RINOK(MatchFinderMt_Create(&p->matchFinderMt, p->dictSize, beforeSize, p->numFastBytes, LZMA_MATCH_LEN_MAX, allocBig));
|
RINOK(MatchFinderMt_Create(&p->matchFinderMt, p->dictSize, beforeSize, p->numFastBytes, LZMA_MATCH_LEN_MAX, allocBig));
|
||||||
|
|
@ -2073,7 +2073,7 @@ SRes LzmaEnc_MemPrepare(CLzmaEncHandle pp, const Byte *src, SizeT srcLen,
|
||||||
|
|
||||||
void LzmaEnc_Finish(CLzmaEncHandle pp)
|
void LzmaEnc_Finish(CLzmaEncHandle pp)
|
||||||
{
|
{
|
||||||
#ifdef COMPRESS_MF_MT
|
#ifndef _7ZIP_ST
|
||||||
CLzmaEnc *p = (CLzmaEnc *)pp;
|
CLzmaEnc *p = (CLzmaEnc *)pp;
|
||||||
if (p->mtMode)
|
if (p->mtMode)
|
||||||
MatchFinderMt_ReleaseStream(&p->matchFinderMt);
|
MatchFinderMt_ReleaseStream(&p->matchFinderMt);
|
||||||
|
|
@ -2155,7 +2155,7 @@ static SRes LzmaEnc_Encode2(CLzmaEnc *p, ICompressProgress *progress)
|
||||||
{
|
{
|
||||||
SRes res = SZ_OK;
|
SRes res = SZ_OK;
|
||||||
|
|
||||||
#ifdef COMPRESS_MF_MT
|
#ifndef _7ZIP_ST
|
||||||
Byte allocaDummy[0x300];
|
Byte allocaDummy[0x300];
|
||||||
int i = 0;
|
int i = 0;
|
||||||
for (i = 0; i < 16; i++)
|
for (i = 0; i < 16; i++)
|
||||||
|
|
|
||||||
|
|
@ -11,25 +11,26 @@ endif
|
||||||
noinst_LTLIBRARIES = liblzma.la
|
noinst_LTLIBRARIES = liblzma.la
|
||||||
liblzma_la_SOURCES = \
|
liblzma_la_SOURCES = \
|
||||||
$(ASM_S) \
|
$(ASM_S) \
|
||||||
Alloc.h \
|
LzmaDec.h \
|
||||||
basetyps.h \
|
LzmaEnc.h \
|
||||||
LzFind.h \
|
LzFind.c \
|
||||||
LzFindMt.h \
|
LzFind.h \
|
||||||
LzHash.h \
|
LzFindMt.c \
|
||||||
LzmaDec.h \
|
LzFindMt.h \
|
||||||
LzmaEnc.h \
|
LzmaDec.c \
|
||||||
LzmaLib.h \
|
LzmaEnc.c \
|
||||||
MyGuidDef.h \
|
LzmaLib.c \
|
||||||
MyWindows.h \
|
LzmaLib.h \
|
||||||
Threads.h \
|
Alloc.c \
|
||||||
Types.h \
|
Alloc.h \
|
||||||
windows.h \
|
Threads.c \
|
||||||
Threads.c \
|
Threads.h \
|
||||||
LzFind.c \
|
Types.h \
|
||||||
LzFindMt.c \
|
LzHash.h \
|
||||||
LzmaDec.c \
|
windows.h \
|
||||||
LzmaEnc.c \
|
basetyps.h \
|
||||||
LzmaLib.c
|
MyWindows.h \
|
||||||
|
MyGuidDef.h
|
||||||
liblzma_so_LIBS = $(ASM_LIBS)
|
liblzma_so_LIBS = $(ASM_LIBS)
|
||||||
|
|
||||||
liblzma_so_CFLAGS = \
|
liblzma_so_CFLAGS = \
|
||||||
|
|
|
||||||
|
|
@ -46,6 +46,7 @@ typedef int SRes;
|
||||||
typedef DWORD WRes;
|
typedef DWORD WRes;
|
||||||
#else
|
#else
|
||||||
typedef int WRes;
|
typedef int WRes;
|
||||||
|
typedef void * HANDLE;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef RINOK
|
#ifndef RINOK
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
7-Zip method IDs (4.61)
|
7-Zip method IDs (9.18)
|
||||||
-----------------------
|
-----------------------
|
||||||
|
|
||||||
Each compression or crypto method in 7z has unique binary value (ID).
|
Each compression or crypto method in 7z has unique binary value (ID).
|
||||||
|
|
@ -24,14 +24,22 @@ List of defined IDs
|
||||||
-------------------
|
-------------------
|
||||||
|
|
||||||
00 - Copy
|
00 - Copy
|
||||||
01 - Reserved
|
|
||||||
02 - Common
|
03 - Delta
|
||||||
|
04 - x86 (BCJ)
|
||||||
|
05 - PPC (Big Endian)
|
||||||
|
06 - IA64
|
||||||
|
07 - ARM (little endian)
|
||||||
|
08 - ARM Thumb (little endian)
|
||||||
|
09 - SPARC
|
||||||
|
21 - LZMA2
|
||||||
|
|
||||||
|
02.. - Common
|
||||||
03 Swap
|
03 Swap
|
||||||
- 2 Swap2
|
- 2 Swap2
|
||||||
- 4 Swap4
|
- 4 Swap4
|
||||||
04 Delta (subject to change)
|
|
||||||
|
|
||||||
03 - 7z
|
03.. - 7z
|
||||||
01 - LZMA
|
01 - LZMA
|
||||||
01 - Version
|
01 - Version
|
||||||
|
|
||||||
|
|
@ -60,11 +68,8 @@ List of defined IDs
|
||||||
7F -
|
7F -
|
||||||
01 - experimental methods.
|
01 - experimental methods.
|
||||||
|
|
||||||
80 - reserved for independent developers
|
|
||||||
|
|
||||||
E0 - Random IDs
|
04.. - Misc
|
||||||
|
|
||||||
04 - Misc
|
|
||||||
00 - Reserved
|
00 - Reserved
|
||||||
01 - Zip
|
01 - Zip
|
||||||
00 - Copy (not used). Use {00} instead
|
00 - Copy (not used). Use {00} instead
|
||||||
|
|
@ -72,7 +77,13 @@ List of defined IDs
|
||||||
06 - Implode
|
06 - Implode
|
||||||
08 - Deflate
|
08 - Deflate
|
||||||
09 - Deflate64
|
09 - Deflate64
|
||||||
|
10 - Imploding
|
||||||
12 - BZip2 (not used). Use {04 02 02} instead
|
12 - BZip2 (not used). Use {04 02 02} instead
|
||||||
|
14 - LZMA
|
||||||
|
60 - Jpeg
|
||||||
|
61 - WavPack
|
||||||
|
62 - PPMd
|
||||||
|
63 - wzAES
|
||||||
02 - BZip
|
02 - BZip
|
||||||
02 - BZip2
|
02 - BZip2
|
||||||
03 - Rar
|
03 - Rar
|
||||||
|
|
@ -91,7 +102,7 @@ List of defined IDs
|
||||||
02 - BZip2NSIS
|
02 - BZip2NSIS
|
||||||
|
|
||||||
|
|
||||||
06 - Crypto
|
06.. - Crypto
|
||||||
00 -
|
00 -
|
||||||
01 - AES
|
01 - AES
|
||||||
0x - AES-128
|
0x - AES-128
|
||||||
|
|
@ -118,7 +129,7 @@ List of defined IDs
|
||||||
07 - 7z
|
07 - 7z
|
||||||
01 - AES-256 + SHA-256
|
01 - AES-256 + SHA-256
|
||||||
|
|
||||||
07 - Hash (subject to change)
|
07.. - Hash (subject to change)
|
||||||
00 -
|
00 -
|
||||||
01 - CRC
|
01 - CRC
|
||||||
02 - SHA-1
|
02 - SHA-1
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,46 @@
|
||||||
HISTORY of the LZMA SDK
|
HISTORY of the LZMA SDK
|
||||||
-----------------------
|
-----------------------
|
||||||
|
|
||||||
|
9.18 beta 2010-11-02
|
||||||
|
-------------------------
|
||||||
|
- New small SFX module for installers (SfxSetup).
|
||||||
|
|
||||||
|
|
||||||
|
9.12 beta 2010-03-24
|
||||||
|
-------------------------
|
||||||
|
- The BUG in LZMA SDK 9.* was fixed: LZMA2 codec didn't work,
|
||||||
|
if more than 10 threads were used (or more than 20 threads in some modes).
|
||||||
|
|
||||||
|
|
||||||
|
9.11 beta 2010-03-15
|
||||||
|
-------------------------
|
||||||
|
- PPMd compression method support
|
||||||
|
|
||||||
|
|
||||||
|
9.09 2009-12-12
|
||||||
|
-------------------------
|
||||||
|
- The bug was fixed:
|
||||||
|
Utf16_To_Utf8 funstions in UTFConvert.cpp and 7zMain.c
|
||||||
|
incorrectly converted surrogate characters (the code >= 0x10000) to UTF-8.
|
||||||
|
- Some bugs were fixed
|
||||||
|
|
||||||
|
|
||||||
|
9.06 2009-08-17
|
||||||
|
-------------------------
|
||||||
|
- Some changes in ANSI-C 7z Decoder interfaces.
|
||||||
|
|
||||||
|
|
||||||
|
9.04 2009-05-30
|
||||||
|
-------------------------
|
||||||
|
- LZMA2 compression method support
|
||||||
|
- xz format support
|
||||||
|
|
||||||
|
|
||||||
|
4.65 2009-02-03
|
||||||
|
-------------------------
|
||||||
|
- Some minor fixes
|
||||||
|
|
||||||
|
|
||||||
4.63 2008-12-31
|
4.63 2008-12-31
|
||||||
-------------------------
|
-------------------------
|
||||||
- Some minor fixes
|
- Some minor fixes
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
LZMA SDK 4.63
|
LZMA SDK 9.20
|
||||||
-------------
|
-------------
|
||||||
|
|
||||||
LZMA SDK provides the documentation, samples, header files, libraries,
|
LZMA SDK provides the documentation, samples, header files, libraries,
|
||||||
|
|
@ -20,6 +20,10 @@ LICENSE
|
||||||
|
|
||||||
LZMA SDK is written and placed in the public domain by Igor Pavlov.
|
LZMA SDK is written and placed in the public domain by Igor Pavlov.
|
||||||
|
|
||||||
|
Some code in LZMA SDK is based on public domain code from another developers:
|
||||||
|
1) PPMd var.H (2001): Dmitry Shkarin
|
||||||
|
2) SHA-256: Wei Dai (Crypto++ library)
|
||||||
|
|
||||||
|
|
||||||
LZMA SDK Contents
|
LZMA SDK Contents
|
||||||
-----------------
|
-----------------
|
||||||
|
|
@ -33,7 +37,7 @@ LZMA SDK includes:
|
||||||
UNIX/Linux version
|
UNIX/Linux version
|
||||||
------------------
|
------------------
|
||||||
To compile C++ version of file->file LZMA encoding, go to directory
|
To compile C++ version of file->file LZMA encoding, go to directory
|
||||||
C++/7zip/Compress/LZMA_Alone
|
CPP/7zip/Bundles/LzmaCon
|
||||||
and call make to recompile it:
|
and call make to recompile it:
|
||||||
make -f makefile.gcc clean all
|
make -f makefile.gcc clean all
|
||||||
|
|
||||||
|
|
@ -49,6 +53,7 @@ lzma.txt - LZMA SDK description (this file)
|
||||||
7zC.txt - 7z ANSI-C Decoder description
|
7zC.txt - 7z ANSI-C Decoder description
|
||||||
methods.txt - Compression method IDs for .7z
|
methods.txt - Compression method IDs for .7z
|
||||||
lzma.exe - Compiled file->file LZMA encoder/decoder for Windows
|
lzma.exe - Compiled file->file LZMA encoder/decoder for Windows
|
||||||
|
7zr.exe - 7-Zip with 7z/lzma/xz support.
|
||||||
history.txt - history of the LZMA SDK
|
history.txt - history of the LZMA SDK
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -66,7 +71,7 @@ C/ - C files
|
||||||
LzmaEnc.* - LZMA encoding
|
LzmaEnc.* - LZMA encoding
|
||||||
LzmaLib.* - LZMA Library for DLL calling
|
LzmaLib.* - LZMA Library for DLL calling
|
||||||
Types.h - Basic types for another .c files
|
Types.h - Basic types for another .c files
|
||||||
Threads.* - The code for multithreading.
|
Threads.* - The code for multithreading.
|
||||||
|
|
||||||
LzmaLib - LZMA Library (.DLL for Windows)
|
LzmaLib - LZMA Library (.DLL for Windows)
|
||||||
|
|
||||||
|
|
@ -86,12 +91,6 @@ CPP/ -- CPP files
|
||||||
|
|
||||||
Compress - files related to compression/decompression
|
Compress - files related to compression/decompression
|
||||||
|
|
||||||
Copy - Copy coder
|
|
||||||
RangeCoder - Range Coder (special code of compression/decompression)
|
|
||||||
LZMA - LZMA compression/decompression on C++
|
|
||||||
LZMA_Alone - file->file LZMA compression/decompression
|
|
||||||
Branch - Filters for x86, IA-64, ARM, ARM-Thumb, PowerPC and SPARC code
|
|
||||||
|
|
||||||
Archive - files related to archiving
|
Archive - files related to archiving
|
||||||
|
|
||||||
Common - common files for archive handling
|
Common - common files for archive handling
|
||||||
|
|
@ -100,6 +99,7 @@ CPP/ -- CPP files
|
||||||
Bundles - Modules that are bundles of other modules
|
Bundles - Modules that are bundles of other modules
|
||||||
|
|
||||||
Alone7z - 7zr.exe: Standalone version of 7z.exe that supports only 7z/LZMA/BCJ/BCJ2
|
Alone7z - 7zr.exe: Standalone version of 7z.exe that supports only 7z/LZMA/BCJ/BCJ2
|
||||||
|
LzmaCon - lzma.exe: LZMA compression/decompression
|
||||||
Format7zR - 7zr.dll: Reduced version of 7za.dll: extracting/compressing to 7z/LZMA/BCJ/BCJ2
|
Format7zR - 7zr.dll: Reduced version of 7za.dll: extracting/compressing to 7z/LZMA/BCJ/BCJ2
|
||||||
Format7zExtractR - 7zxr.dll: Reduced version of 7zxa.dll: extracting from 7z/LZMA/BCJ/BCJ2.
|
Format7zExtractR - 7zxr.dll: Reduced version of 7zxa.dll: extracting from 7z/LZMA/BCJ/BCJ2.
|
||||||
|
|
||||||
|
|
@ -369,8 +369,8 @@ Interface:
|
||||||
propData - LZMA properties (5 bytes)
|
propData - LZMA properties (5 bytes)
|
||||||
propSize - size of propData buffer (5 bytes)
|
propSize - size of propData buffer (5 bytes)
|
||||||
finishMode - It has meaning only if the decoding reaches output limit (*destLen).
|
finishMode - It has meaning only if the decoding reaches output limit (*destLen).
|
||||||
LZMA_FINISH_ANY - Decode just destLen bytes.
|
LZMA_FINISH_ANY - Decode just destLen bytes.
|
||||||
LZMA_FINISH_END - Stream must be finished after (*destLen).
|
LZMA_FINISH_END - Stream must be finished after (*destLen).
|
||||||
You can use LZMA_FINISH_END, when you know that
|
You can use LZMA_FINISH_END, when you know that
|
||||||
current output buffer covers last bytes of stream.
|
current output buffer covers last bytes of stream.
|
||||||
alloc - Memory allocator.
|
alloc - Memory allocator.
|
||||||
|
|
@ -431,7 +431,7 @@ Memory Requirements:
|
||||||
{
|
{
|
||||||
...
|
...
|
||||||
int res = LzmaDec_DecodeToBuf(CLzmaDec *p, Byte *dest, SizeT *destLen,
|
int res = LzmaDec_DecodeToBuf(CLzmaDec *p, Byte *dest, SizeT *destLen,
|
||||||
const Byte *src, SizeT *srcLen, ELzmaFinishMode finishMode);
|
const Byte *src, SizeT *srcLen, ELzmaFinishMode finishMode);
|
||||||
...
|
...
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -527,7 +527,8 @@ static ISzAlloc g_Alloc = { SzAlloc, SzFree };
|
||||||
LzmaEnc_Destroy(enc, &g_Alloc, &g_Alloc);
|
LzmaEnc_Destroy(enc, &g_Alloc, &g_Alloc);
|
||||||
|
|
||||||
|
|
||||||
If callback function return some error code, LzmaEnc_Encode also returns that code.
|
If callback function return some error code, LzmaEnc_Encode also returns that code
|
||||||
|
or it can return the code like SZ_ERROR_READ, SZ_ERROR_WRITE or SZ_ERROR_PROGRESS.
|
||||||
|
|
||||||
|
|
||||||
Single-call RAM->RAM Compression
|
Single-call RAM->RAM Compression
|
||||||
|
|
@ -549,8 +550,8 @@ Return code:
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
LZMA Defines
|
Defines
|
||||||
------------
|
-------
|
||||||
|
|
||||||
_LZMA_SIZE_OPT - Enable some optimizations in LZMA Decoder to get smaller executable code.
|
_LZMA_SIZE_OPT - Enable some optimizations in LZMA Decoder to get smaller executable code.
|
||||||
|
|
||||||
|
|
@ -562,6 +563,9 @@ _LZMA_UINT32_IS_ULONG - Define it if int is 16-bit on your compiler and long is
|
||||||
_LZMA_NO_SYSTEM_SIZE_T - Define it if you don't want to use size_t type.
|
_LZMA_NO_SYSTEM_SIZE_T - Define it if you don't want to use size_t type.
|
||||||
|
|
||||||
|
|
||||||
|
_7ZIP_PPMD_SUPPPORT - Define it if you don't want to support PPMD method in AMSI-C .7z decoder.
|
||||||
|
|
||||||
|
|
||||||
C++ LZMA Encoder/Decoder
|
C++ LZMA Encoder/Decoder
|
||||||
~~~~~~~~~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
C++ LZMA code use COM-like interfaces. So if you want to use it,
|
C++ LZMA code use COM-like interfaces. So if you want to use it,
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue