mirror of
https://github.com/Xevion/easy7zip.git
synced 2025-12-10 20:07:05 -06:00
4.59 beta
This commit is contained in:
committed by
Kornel Lesiński
parent
3901bf0ab8
commit
173c07e166
@@ -1,5 +1,5 @@
|
||||
/* Lzma86Dec.h -- LZMA + x86 (BCJ) Filter Decoder
|
||||
2008-04-07
|
||||
2008-08-05
|
||||
Igor Pavlov
|
||||
Public domain */
|
||||
|
||||
@@ -10,10 +10,10 @@ Public domain */
|
||||
|
||||
/*
|
||||
Lzma86_GetUnpackSize:
|
||||
In:
|
||||
In:
|
||||
src - input data
|
||||
srcLen - input data size
|
||||
Out:
|
||||
Out:
|
||||
unpackSize - size of uncompressed stream
|
||||
Return code:
|
||||
SZ_OK - OK
|
||||
@@ -24,14 +24,14 @@ SRes Lzma86_GetUnpackSize(const Byte *src, SizeT srcLen, UInt64 *unpackSize);
|
||||
|
||||
/*
|
||||
Lzma86_Decode:
|
||||
In:
|
||||
In:
|
||||
dest - output data
|
||||
destLen - output data size
|
||||
src - input data
|
||||
srcLen - input data size
|
||||
Out:
|
||||
destLen - processed output size
|
||||
srcLen - processed input size
|
||||
Out:
|
||||
destLen - processed output size
|
||||
srcLen - processed input size
|
||||
Return code:
|
||||
SZ_OK - OK
|
||||
SZ_ERROR_DATA - Data error
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* Lzma86Enc.c -- LZMA + x86 (BCJ) Filter Encoder
|
||||
2008-04-07
|
||||
2008-08-05
|
||||
Igor Pavlov
|
||||
Public domain */
|
||||
|
||||
@@ -20,7 +20,7 @@ static ISzAlloc g_Alloc = { SzAlloc, SzFree };
|
||||
#define LZMA86_SIZE_OFFSET (1 + LZMA_PROPS_SIZE)
|
||||
#define LZMA86_HEADER_SIZE (LZMA86_SIZE_OFFSET + 8)
|
||||
|
||||
int Lzma86_Encode(Byte *dest, size_t *destLen, const Byte *src, size_t srcLen,
|
||||
int Lzma86_Encode(Byte *dest, size_t *destLen, const Byte *src, size_t srcLen,
|
||||
int level, UInt32 dictSize, int filterMode)
|
||||
{
|
||||
size_t outSize2 = *destLen;
|
||||
@@ -32,7 +32,7 @@ int Lzma86_Encode(Byte *dest, size_t *destLen, const Byte *src, size_t srcLen,
|
||||
props.level = level;
|
||||
props.dictSize = dictSize;
|
||||
|
||||
*destLen = 0;
|
||||
*destLen = 0;
|
||||
if (outSize2 < LZMA86_HEADER_SIZE)
|
||||
return SZ_ERROR_OUTPUT_EOF;
|
||||
|
||||
@@ -66,8 +66,8 @@ int Lzma86_Encode(Byte *dest, size_t *destLen, const Byte *src, size_t srcLen,
|
||||
Bool bestIsFiltered = False;
|
||||
|
||||
/* passes for SZ_FILTER_AUTO:
|
||||
0 - BCJ + LZMA
|
||||
1 - LZMA
|
||||
0 - BCJ + LZMA
|
||||
1 - LZMA
|
||||
2 - BCJ + LZMA agaian, if pass 0 (BCJ + LZMA) is better.
|
||||
*/
|
||||
int numPasses = (filterMode == SZ_FILTER_AUTO) ? 3 : 1;
|
||||
@@ -84,9 +84,9 @@ int Lzma86_Encode(Byte *dest, size_t *destLen, const Byte *src, size_t srcLen,
|
||||
if (useFilter && i == 0)
|
||||
curModeIsFiltered = True;
|
||||
|
||||
curRes = LzmaEncode(dest + LZMA86_HEADER_SIZE, &outSizeProcessed,
|
||||
curRes = LzmaEncode(dest + LZMA86_HEADER_SIZE, &outSizeProcessed,
|
||||
curModeIsFiltered ? filteredStream : src, srcLen,
|
||||
&props, dest + 1, &outPropsSize, 0,
|
||||
&props, dest + 1, &outPropsSize, 0,
|
||||
NULL, &g_Alloc, &g_Alloc);
|
||||
|
||||
if (curRes != SZ_ERROR_OUTPUT_EOF)
|
||||
@@ -95,7 +95,7 @@ int Lzma86_Encode(Byte *dest, size_t *destLen, const Byte *src, size_t srcLen,
|
||||
{
|
||||
mainResult = curRes;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (outSizeProcessed <= minSize || mainResult != SZ_OK)
|
||||
{
|
||||
minSize = outSizeProcessed;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* Lzma86Enc.h -- LZMA + x86 (BCJ) Filter Encoder
|
||||
2008-04-07
|
||||
2008-08-05
|
||||
Igor Pavlov
|
||||
Public domain */
|
||||
|
||||
@@ -14,7 +14,7 @@ You can use .lzma86 extension, if you write that stream to file.
|
||||
.lzma86 header adds one additional byte to standard .lzma header.
|
||||
.lzma86 header (14 bytes):
|
||||
Offset Size Description
|
||||
0 1 = 0 - no filter,
|
||||
0 1 = 0 - no filter,
|
||||
= 1 - x86 filter
|
||||
1 1 lc, lp and pb in encoded form
|
||||
2 4 dictSize (little endian)
|
||||
@@ -26,25 +26,25 @@ Lzma86_Encode
|
||||
level - compression level: 0 <= level <= 9, the default value for "level" is 5.
|
||||
|
||||
|
||||
dictSize - The dictionary size in bytes. The maximum value is
|
||||
dictSize - The dictionary size in bytes. The maximum value is
|
||||
128 MB = (1 << 27) bytes for 32-bit version
|
||||
1 GB = (1 << 30) bytes for 64-bit version
|
||||
The default value is 16 MB = (1 << 24) bytes, for level = 5.
|
||||
It's recommended to use the dictionary that is larger than 4 KB and
|
||||
that can be calculated as (1 << N) or (3 << N) sizes.
|
||||
It's recommended to use the dictionary that is larger than 4 KB and
|
||||
that can be calculated as (1 << N) or (3 << N) sizes.
|
||||
For better compression ratio dictSize must be >= inSize.
|
||||
|
||||
filterMode:
|
||||
SZ_FILTER_NO - no Filter
|
||||
SZ_FILTER_YES - x86 Filter
|
||||
SZ_FILTER_AUTO - it tries both alternatives to select best.
|
||||
SZ_FILTER_AUTO - it tries both alternatives to select best.
|
||||
Encoder will use 2 or 3 passes:
|
||||
2 passes when FILTER_NO provides better compression.
|
||||
3 passes when FILTER_YES provides better compression.
|
||||
|
||||
Lzma86Encode allocates Data with MyAlloc functions.
|
||||
RAM Requirements for compressing:
|
||||
RamSize = dictionarySize * 11.5 + 6MB + FilterBlockSize
|
||||
RamSize = dictionarySize * 11.5 + 6MB + FilterBlockSize
|
||||
filterMode FilterBlockSize
|
||||
SZ_FILTER_NO 0
|
||||
SZ_FILTER_YES inSize
|
||||
@@ -53,20 +53,20 @@ RAM Requirements for compressing:
|
||||
|
||||
Return code:
|
||||
SZ_OK - OK
|
||||
SZ_ERROR_MEM - Memory allocation error
|
||||
SZ_ERROR_MEM - Memory allocation error
|
||||
SZ_ERROR_PARAM - Incorrect paramater
|
||||
SZ_ERROR_OUTPUT_EOF - output buffer overflow
|
||||
SZ_ERROR_THREAD - errors in multithreading functions (only for Mt version)
|
||||
*/
|
||||
|
||||
enum ESzFilterMode
|
||||
enum ESzFilterMode
|
||||
{
|
||||
SZ_FILTER_NO,
|
||||
SZ_FILTER_YES,
|
||||
SZ_FILTER_AUTO
|
||||
};
|
||||
|
||||
SRes Lzma86_Encode(Byte *dest, size_t *destLen, const Byte *src, size_t srcLen,
|
||||
SRes Lzma86_Encode(Byte *dest, size_t *destLen, const Byte *src, size_t srcLen,
|
||||
int level, UInt32 dictSize, int filterMode);
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* LzmaUtil.c -- Test application for LZMA compression
|
||||
2008-04-29
|
||||
2008-08-05
|
||||
Igor Pavlov
|
||||
public domain */
|
||||
|
||||
@@ -35,10 +35,10 @@ int MyReadFileAndCheck(FILE *file, void *data, size_t size)
|
||||
{ return (MyReadFile(file, data, size) == size); }
|
||||
|
||||
size_t MyWriteFile(FILE *file, const void *data, size_t size)
|
||||
{
|
||||
{
|
||||
if (size == 0)
|
||||
return 0;
|
||||
return fwrite(data, 1, size, file);
|
||||
return fwrite(data, 1, size, file);
|
||||
}
|
||||
|
||||
int MyWriteFileAndCheck(FILE *file, const void *data, size_t size)
|
||||
@@ -137,7 +137,7 @@ static int Decode(FILE *inFile, FILE *outFile, char *rs)
|
||||
finishMode = LZMA_FINISH_END;
|
||||
}
|
||||
|
||||
res = LzmaDec_DecodeToBuf(&state, outBuf + outPos, &outProcessed,
|
||||
res = LzmaDec_DecodeToBuf(&state, outBuf + outPos, &outProcessed,
|
||||
inBuf + inPos, &inProcessed, finishMode, &status);
|
||||
inPos += (UInt32)inProcessed;
|
||||
outPos += outProcessed;
|
||||
@@ -228,7 +228,7 @@ static SRes Encode(FILE *inFile, FILE *outFile, char *rs)
|
||||
return PrintError(rs, "writing error");
|
||||
|
||||
if (res == SZ_OK)
|
||||
res = LzmaEnc_Encode(enc, &outStream.funcTable, &inStream.funcTable,
|
||||
res = LzmaEnc_Encode(enc, &outStream.funcTable, &inStream.funcTable,
|
||||
NULL, &g_Alloc, &g_Alloc);
|
||||
}
|
||||
LzmaEnc_Destroy(enc, &g_Alloc, &g_Alloc);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
PROG = lzma
|
||||
CXX = g++
|
||||
LIB =
|
||||
LIB =
|
||||
RM = rm -f
|
||||
CFLAGS = -c -O2 -Wall
|
||||
|
||||
|
||||
Reference in New Issue
Block a user