get lzma_c from kerpack_linux
This commit is contained in:
3
.gitignore
vendored
Normal file
3
.gitignore
vendored
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
*.exe
|
||||||
|
kpack_c
|
||||||
|
*.code-workspace
|
1078
lzma_c/LZMAEncoder.c
Normal file
1078
lzma_c/LZMAEncoder.c
Normal file
File diff suppressed because it is too large
Load Diff
53
lzma_c/LZMAEncoder.h
Normal file
53
lzma_c/LZMAEncoder.h
Normal file
@@ -0,0 +1,53 @@
|
|||||||
|
#ifndef _LZMA_ENCODER_H
|
||||||
|
#define _LZMA_ENCODER_H
|
||||||
|
|
||||||
|
#include "lzma.h"
|
||||||
|
#include "RangeCoderBitTree.h"
|
||||||
|
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
CState State;
|
||||||
|
bool Prev1IsChar;
|
||||||
|
bool Prev2;
|
||||||
|
unsigned PosPrev2;
|
||||||
|
unsigned BackPrev2;
|
||||||
|
unsigned Price;
|
||||||
|
unsigned PosPrev;
|
||||||
|
unsigned BackPrev;
|
||||||
|
unsigned Backs[kNumRepDistances];
|
||||||
|
} COptimal;
|
||||||
|
#define COptimal_MakeAsChar(a) (a)->BackPrev=(unsigned)-1,(a)->Prev1IsChar=false
|
||||||
|
#define COptimal_MakeAsShortRep(a) (a)->BackPrev=0,(a)->Prev1IsChar=false
|
||||||
|
#define COptimal_IsShortRep(a) ((a)->BackPrev==0)
|
||||||
|
|
||||||
|
#define kIfinityPrice 0xFFFFFFF
|
||||||
|
#define kNumOpts (1<<12)
|
||||||
|
|
||||||
|
typedef CMyBitEncoder CLiteralEncoder2[0x300];
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
CLiteralEncoder2* _coders;
|
||||||
|
int _numPrevBits;
|
||||||
|
int _numPosBits;
|
||||||
|
unsigned _posMask;
|
||||||
|
} CLiteralEncoder;
|
||||||
|
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
CMyBitEncoder _choice;
|
||||||
|
CMyBitEncoder _choice2;
|
||||||
|
NRangeCoder_CBitTreeEncoder _lowCoder[kNumPosStatesEncodingMax];
|
||||||
|
NRangeCoder_CBitTreeEncoder _midCoder[kNumPosStatesEncodingMax];
|
||||||
|
NRangeCoder_CBitTreeEncoder _highCoder;
|
||||||
|
} NLength_CEncoder;
|
||||||
|
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
NLength_CEncoder base;
|
||||||
|
unsigned _prices[kNumSymbolsTotal][kNumPosStatesEncodingMax];
|
||||||
|
unsigned _tableSize;
|
||||||
|
unsigned _counters[kNumPosStatesEncodingMax];
|
||||||
|
} NLength_CPriceTableEncoder;
|
||||||
|
#define CPriceTableEncoder_Init(a,b) NLength_CEncoder_Init(&a.base,b)
|
||||||
|
|
||||||
|
#endif
|
14
lzma_c/LZMAEncoderApi.h
Normal file
14
lzma_c/LZMAEncoderApi.h
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
#ifndef LZMA_ENCODER_API_H_
|
||||||
|
#define LZMA_ENCODER_API_H_
|
||||||
|
|
||||||
|
void __stdcall lzma_set_dict_size(unsigned logdictsize);
|
||||||
|
|
||||||
|
unsigned __stdcall lzma_compress(
|
||||||
|
const void* source,
|
||||||
|
void* destination,
|
||||||
|
unsigned length,
|
||||||
|
void* workmem,
|
||||||
|
int is_kerpack
|
||||||
|
);
|
||||||
|
|
||||||
|
#endif
|
422
lzma_c/MatchFinder.c
Normal file
422
lzma_c/MatchFinder.c
Normal file
@@ -0,0 +1,422 @@
|
|||||||
|
#include "MatchFinder.h"
|
||||||
|
/* memcpy must be inlined - we do not want to use RTL */
|
||||||
|
#include <memory.h>
|
||||||
|
/*#pragma function(memcpy)
|
||||||
|
void* __cdecl memcpy(void* _Dst, const void* _Src, size_t _Size)
|
||||||
|
{
|
||||||
|
unsigned long i;
|
||||||
|
for (i = 0; i < _Size; i++)
|
||||||
|
((char*)_Dst)[i] = ((char*)_Src)[i];
|
||||||
|
return _Dst;
|
||||||
|
}*/
|
||||||
|
//#pragma intrinsic(memcpy)
|
||||||
|
|
||||||
|
#define kMaxValForNormalize (((unsigned)1<<31)-1)
|
||||||
|
|
||||||
|
/* settings for bt4:
|
||||||
|
defined HASH_ARRAY_2
|
||||||
|
defined HASH_ARRAY_3
|
||||||
|
*/
|
||||||
|
|
||||||
|
//#define kHash2Size 0x400
|
||||||
|
#define kNumHashDirectBytes 0
|
||||||
|
#define kNumHashBytes 3
|
||||||
|
//#define kHash3Size 0x40000
|
||||||
|
#define kHash2Size 0x10000
|
||||||
|
#define kHashSize 0x100000
|
||||||
|
|
||||||
|
#define kHashSizeSum (kHashSize+kHash2Size)
|
||||||
|
#define kHash2Offset kHashSize
|
||||||
|
|
||||||
|
static unsigned _cyclicBufferPos;
|
||||||
|
static unsigned _cyclicBufferSize;
|
||||||
|
static unsigned _matchMaxLen;
|
||||||
|
static unsigned* _hash;
|
||||||
|
static unsigned _cutValue;
|
||||||
|
|
||||||
|
#ifdef GENERIC_INPUT
|
||||||
|
static byte* _bufferBase;
|
||||||
|
static unsigned _posLimit;
|
||||||
|
static bool _streamEndWasReached;
|
||||||
|
static byte* _pointerToLastSafePosition;
|
||||||
|
static byte* _buffer;
|
||||||
|
static unsigned _blockSize;
|
||||||
|
static unsigned _pos;
|
||||||
|
static unsigned _keepSizeBefore;
|
||||||
|
static unsigned _keepSizeAfter;
|
||||||
|
static unsigned _keepSizeReserv;
|
||||||
|
static unsigned _streamPos;
|
||||||
|
#else
|
||||||
|
#define _buffer curin
|
||||||
|
#define _pos pack_pos
|
||||||
|
#define _streamPos pack_length
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef GENERIC_INPUT
|
||||||
|
/* LZ Window */
|
||||||
|
|
||||||
|
static void LZInWindow_Create(unsigned keepSizeBefore,unsigned keepSizeAfter,unsigned keepSizeReserv,byte**mem)
|
||||||
|
{
|
||||||
|
_keepSizeBefore = keepSizeBefore;
|
||||||
|
_keepSizeAfter = keepSizeAfter;
|
||||||
|
_keepSizeReserv = keepSizeReserv;
|
||||||
|
_blockSize = keepSizeBefore + keepSizeAfter + keepSizeReserv;
|
||||||
|
_bufferBase = *mem;
|
||||||
|
_blockSize = (_blockSize + 3) & ~3;
|
||||||
|
*mem += _blockSize;
|
||||||
|
_pointerToLastSafePosition = _bufferBase + _blockSize - keepSizeAfter;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void ReadBlock(void)
|
||||||
|
{
|
||||||
|
if (_streamEndWasReached)
|
||||||
|
return;
|
||||||
|
for (;;)
|
||||||
|
{
|
||||||
|
unsigned size;
|
||||||
|
size = (unsigned)(_bufferBase-_buffer) + _blockSize - _streamPos;
|
||||||
|
if (!size) return;
|
||||||
|
if (size > pack_length - pack_pos)
|
||||||
|
size = pack_length - pack_pos;
|
||||||
|
memcpy(_buffer+_streamPos,curin,size);
|
||||||
|
curin += size;
|
||||||
|
pack_pos += size;
|
||||||
|
if (size == 0)
|
||||||
|
{
|
||||||
|
byte* pointerToPosition;
|
||||||
|
_posLimit = _streamPos;
|
||||||
|
pointerToPosition = _buffer + _posLimit;
|
||||||
|
if (pointerToPosition > _pointerToLastSafePosition)
|
||||||
|
_posLimit = _pointerToLastSafePosition - _buffer;
|
||||||
|
_streamEndWasReached = true;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
_streamPos += size;
|
||||||
|
if (_streamPos >= _pos + _keepSizeAfter)
|
||||||
|
{
|
||||||
|
_posLimit = _streamPos - _keepSizeAfter;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void LZInWindow_Init(void)
|
||||||
|
{
|
||||||
|
_buffer = _bufferBase;
|
||||||
|
_pos = 0;
|
||||||
|
_streamPos = 0;
|
||||||
|
_streamEndWasReached = false;
|
||||||
|
ReadBlock();
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
#define LZInWindow_Create(a,b,c,d) /* nothing */
|
||||||
|
#define LZInWindow_Init() _buffer--, _pos++, _streamPos++
|
||||||
|
#endif
|
||||||
|
|
||||||
|
const byte* GetPointerToCurrentPos(void) {return _buffer+_pos;}
|
||||||
|
|
||||||
|
#ifdef GENERIC_INPUT
|
||||||
|
static void MoveBlock(void)
|
||||||
|
{
|
||||||
|
unsigned offset,numBytes;
|
||||||
|
offset = _buffer-_bufferBase+_pos-_keepSizeBefore;
|
||||||
|
numBytes = _buffer-_bufferBase+_streamPos-offset;
|
||||||
|
// copying backwards: safe to use memcpy instead of memmove
|
||||||
|
memcpy(_bufferBase,_bufferBase+offset,numBytes);
|
||||||
|
_buffer -= offset;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void LZInWindow_MovePos(void)
|
||||||
|
{
|
||||||
|
_pos++;
|
||||||
|
if (_pos > _posLimit)
|
||||||
|
{
|
||||||
|
const byte* pointerToPosition = _buffer+_pos;
|
||||||
|
if (pointerToPosition > _pointerToLastSafePosition)
|
||||||
|
MoveBlock();
|
||||||
|
ReadBlock();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
#define LZInWindow_MovePos() _pos++
|
||||||
|
#endif
|
||||||
|
|
||||||
|
byte GetIndexByte(int index) {return _buffer[_pos+index];}
|
||||||
|
|
||||||
|
unsigned GetMatchLen(int index,unsigned distance,unsigned limit)
|
||||||
|
{
|
||||||
|
const byte* pby;
|
||||||
|
unsigned i;
|
||||||
|
#ifdef GENERIC_INPUT
|
||||||
|
if (_streamEndWasReached)
|
||||||
|
if ((_pos+index)+limit > _streamPos)
|
||||||
|
limit = _streamPos - (_pos+index);
|
||||||
|
#else
|
||||||
|
unsigned limit2 = pack_length - (pack_pos + index);
|
||||||
|
if (limit > limit2)
|
||||||
|
limit = limit2;
|
||||||
|
#endif
|
||||||
|
distance++;
|
||||||
|
pby = _buffer + _pos + index;
|
||||||
|
for (i=0;i<limit && pby[i]==pby[(int)(i-distance)];i++) ;
|
||||||
|
return i;
|
||||||
|
}
|
||||||
|
|
||||||
|
unsigned GetNumAvailableBytes(void) {return _streamPos-_pos;}
|
||||||
|
|
||||||
|
#ifdef GENERIC_INPUT
|
||||||
|
void ReduceOffsets(int subValue)
|
||||||
|
{
|
||||||
|
_buffer += subValue;
|
||||||
|
_posLimit -= subValue;
|
||||||
|
_pos -= subValue;
|
||||||
|
_streamPos -= subValue;
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
#define ReduceOffsets(a) /* nothing */
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Binary tree Match Finder */
|
||||||
|
|
||||||
|
static unsigned crc_table[256];
|
||||||
|
|
||||||
|
void MatchFinder_Create(unsigned historySize,unsigned keepAddBufferBefore,unsigned matchMaxLen,unsigned keepAddBufferAfter,byte**mem)
|
||||||
|
{
|
||||||
|
unsigned sizeReserv;
|
||||||
|
sizeReserv = (historySize + keepAddBufferBefore + matchMaxLen + keepAddBufferAfter)/2+256;
|
||||||
|
LZInWindow_Create(historySize+keepAddBufferBefore,matchMaxLen+keepAddBufferAfter,sizeReserv,mem);
|
||||||
|
_matchMaxLen = matchMaxLen;
|
||||||
|
_cyclicBufferSize = historySize+1;
|
||||||
|
_hash = (unsigned*)*mem;
|
||||||
|
*mem += (kHashSizeSum + _cyclicBufferSize*2) * sizeof(unsigned);
|
||||||
|
_cutValue = 0xFF;
|
||||||
|
}
|
||||||
|
|
||||||
|
void MatchFinder_Init(void)
|
||||||
|
{
|
||||||
|
unsigned i,j,r;
|
||||||
|
LZInWindow_Init();
|
||||||
|
for (i=0;i<kHashSizeSum;i++)
|
||||||
|
_hash[i] = 0;
|
||||||
|
_cyclicBufferPos = 0;
|
||||||
|
ReduceOffsets(-1);
|
||||||
|
for (i=0;i<256;i++)
|
||||||
|
{
|
||||||
|
r = i;
|
||||||
|
for (j=0;j<8;j++)
|
||||||
|
{
|
||||||
|
if (r & 1)
|
||||||
|
r = (r>>1) ^ 0xEDB88320;
|
||||||
|
else
|
||||||
|
r >>= 1;
|
||||||
|
}
|
||||||
|
crc_table[i] = r;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static unsigned Hash(const byte* ptr, unsigned* hash2Value)
|
||||||
|
{
|
||||||
|
unsigned temp;
|
||||||
|
temp = crc_table[ptr[0]] ^ ptr[1];
|
||||||
|
*hash2Value = *(word*)ptr; //ptr[0] + ((unsigned)ptr[1] << 8);
|
||||||
|
return (temp ^ ((unsigned)ptr[2]<<8)) & (kHashSize - 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
unsigned GetLongestMatch(unsigned* distances)
|
||||||
|
{
|
||||||
|
unsigned lenLimit,maxLen=0;
|
||||||
|
unsigned matchMinPos;
|
||||||
|
const byte* cur;
|
||||||
|
unsigned hash2Value,hashValue;
|
||||||
|
unsigned curMatch,curMatch2;
|
||||||
|
unsigned *son,*ptr0,*ptr1;
|
||||||
|
unsigned len0,len1,count;
|
||||||
|
if (_pos + _matchMaxLen <= _streamPos)
|
||||||
|
lenLimit = _matchMaxLen;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
lenLimit = _streamPos - _pos;
|
||||||
|
if (lenLimit < kNumHashBytes)
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
matchMinPos = (_pos>_cyclicBufferSize) ? (_pos-_cyclicBufferSize) : 0;
|
||||||
|
cur = _buffer+_pos;
|
||||||
|
hashValue = Hash(cur,&hash2Value);
|
||||||
|
curMatch = _hash[hashValue];
|
||||||
|
curMatch2 = _hash[kHash2Offset + hash2Value];
|
||||||
|
_hash[kHash2Offset + hash2Value] = _pos;
|
||||||
|
distances[2] = 0xFFFFFFFF;
|
||||||
|
if (curMatch2 > matchMinPos)
|
||||||
|
//if (_buffer[curMatch2] == cur[0])
|
||||||
|
{
|
||||||
|
distances[2] = _pos - curMatch2 - 1;
|
||||||
|
maxLen = 2;
|
||||||
|
}
|
||||||
|
_hash[hashValue] = _pos;
|
||||||
|
son = _hash + kHashSizeSum;
|
||||||
|
ptr0 = son + (_cyclicBufferPos << 1) + 1;
|
||||||
|
ptr1 = son + (_cyclicBufferPos << 1);
|
||||||
|
distances[kNumHashBytes] = 0xFFFFFFFF;
|
||||||
|
len0 = len1 = kNumHashDirectBytes;
|
||||||
|
count = _cutValue;
|
||||||
|
for (;;)
|
||||||
|
{
|
||||||
|
const byte* pb;
|
||||||
|
unsigned len,delta;
|
||||||
|
unsigned cyclicPos;
|
||||||
|
unsigned* pair;
|
||||||
|
if (curMatch <= matchMinPos || count--==0)
|
||||||
|
{
|
||||||
|
*ptr0 = *ptr1 = 0;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
pb = _buffer+curMatch;
|
||||||
|
len = (len0<len1) ? len0 : len1;
|
||||||
|
do
|
||||||
|
if (pb[len] != cur[len]) break;
|
||||||
|
while (++len != lenLimit);
|
||||||
|
delta = _pos - curMatch;
|
||||||
|
while (maxLen < len)
|
||||||
|
distances[++maxLen] = delta-1;
|
||||||
|
cyclicPos = (delta <= _cyclicBufferPos) ?
|
||||||
|
(_cyclicBufferPos - delta) :
|
||||||
|
(_cyclicBufferPos - delta + _cyclicBufferSize);
|
||||||
|
pair = son + (cyclicPos<<1);
|
||||||
|
if (len != lenLimit)
|
||||||
|
{
|
||||||
|
if (pb[len] < cur[len])
|
||||||
|
{
|
||||||
|
*ptr1 = curMatch;
|
||||||
|
ptr1 = pair+1;
|
||||||
|
curMatch = *ptr1;
|
||||||
|
len1 = len;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
*ptr0 = curMatch;
|
||||||
|
ptr0 = pair;
|
||||||
|
curMatch = *ptr0;
|
||||||
|
len0 = len;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
*ptr1 = pair[0];
|
||||||
|
*ptr0 = pair[1];
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/*if (distances[4] < distances[3])
|
||||||
|
distances[3] = distances[4];
|
||||||
|
if (distances[3] < distances[2])
|
||||||
|
distances[2] = distances[3];*/
|
||||||
|
return maxLen;
|
||||||
|
}
|
||||||
|
|
||||||
|
void DummyLongestMatch(void)
|
||||||
|
{
|
||||||
|
unsigned lenLimit;
|
||||||
|
unsigned matchMinPos;
|
||||||
|
const byte* cur;
|
||||||
|
unsigned hash2Value,hashValue;
|
||||||
|
unsigned curMatch;
|
||||||
|
unsigned* son,*ptr0,*ptr1;
|
||||||
|
unsigned len0,len1,count;
|
||||||
|
if (_pos + _matchMaxLen <= _streamPos)
|
||||||
|
lenLimit = _matchMaxLen;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
lenLimit = _streamPos - _pos;
|
||||||
|
if (lenLimit < kNumHashBytes)
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
matchMinPos = (_pos > _cyclicBufferSize) ? (_pos - _cyclicBufferSize) : 0;
|
||||||
|
cur = _buffer+_pos;
|
||||||
|
hashValue = Hash(cur,&hash2Value);
|
||||||
|
_hash[kHash2Offset + hash2Value] = _pos;
|
||||||
|
curMatch = _hash[hashValue];
|
||||||
|
_hash[hashValue] = _pos;
|
||||||
|
son = _hash+kHashSizeSum;
|
||||||
|
ptr0 = son + (_cyclicBufferPos << 1) + 1;
|
||||||
|
ptr1 = son + (_cyclicBufferPos << 1);
|
||||||
|
len0 = len1 = kNumHashDirectBytes;
|
||||||
|
count = _cutValue;
|
||||||
|
for (;;)
|
||||||
|
{
|
||||||
|
const byte* pb;
|
||||||
|
unsigned len;
|
||||||
|
unsigned delta,cyclicPos;
|
||||||
|
unsigned* pair;
|
||||||
|
if (curMatch <= matchMinPos || count--==0)
|
||||||
|
break;
|
||||||
|
pb = _buffer+curMatch;
|
||||||
|
len = (len0<len1) ? len0 : len1;
|
||||||
|
do
|
||||||
|
if (pb[len] != cur[len]) break;
|
||||||
|
while (++len != lenLimit);
|
||||||
|
delta = _pos - curMatch;
|
||||||
|
cyclicPos = (delta <= _cyclicBufferPos) ?
|
||||||
|
(_cyclicBufferPos - delta) :
|
||||||
|
(_cyclicBufferPos - delta + _cyclicBufferSize);
|
||||||
|
pair = son + (cyclicPos << 1);
|
||||||
|
if (len != lenLimit)
|
||||||
|
{
|
||||||
|
if (pb[len] < cur[len])
|
||||||
|
{
|
||||||
|
*ptr1 = curMatch;
|
||||||
|
ptr1 = pair+1;
|
||||||
|
curMatch = *ptr1;
|
||||||
|
len1 = len;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
*ptr0 = curMatch;
|
||||||
|
ptr0 = pair;
|
||||||
|
curMatch = *ptr0;
|
||||||
|
len0 = len;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
*ptr1 = pair[0];
|
||||||
|
*ptr0 = pair[1];
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
*ptr0 = *ptr1 = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifdef GENERIC_INPUT
|
||||||
|
// for memory input size is always less than kMaxValForNormalize
|
||||||
|
static void Normalize(void)
|
||||||
|
{
|
||||||
|
unsigned subValue;
|
||||||
|
unsigned* items;
|
||||||
|
unsigned i,numItems;
|
||||||
|
subValue = _pos - _cyclicBufferSize;
|
||||||
|
items = _hash;
|
||||||
|
numItems = (kHashSizeSum + _cyclicBufferSize*2);
|
||||||
|
for (i=0;i<numItems;i++)
|
||||||
|
{
|
||||||
|
unsigned value;
|
||||||
|
value = items[i];
|
||||||
|
if (value <= subValue)
|
||||||
|
value = 0;
|
||||||
|
else
|
||||||
|
value -= subValue;
|
||||||
|
items[i] = value;
|
||||||
|
}
|
||||||
|
ReduceOffsets(subValue);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
void MatchFinder_MovePos(void)
|
||||||
|
{
|
||||||
|
if (++_cyclicBufferPos == _cyclicBufferSize)
|
||||||
|
_cyclicBufferPos = 0;
|
||||||
|
LZInWindow_MovePos();
|
||||||
|
#ifdef GENERIC_INPUT
|
||||||
|
if (_pos == kMaxValForNormalize)
|
||||||
|
Normalize();
|
||||||
|
#endif
|
||||||
|
}
|
13
lzma_c/MatchFinder.h
Normal file
13
lzma_c/MatchFinder.h
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
#include "common.h"
|
||||||
|
|
||||||
|
extern const byte* GetPointerToCurrentPos(void);
|
||||||
|
extern byte GetIndexByte(int index);
|
||||||
|
extern unsigned GetMatchLen(int index,unsigned distance,unsigned limit);
|
||||||
|
extern unsigned GetNumAvailableBytes(void);
|
||||||
|
extern void ReduceOffsets(int subValue);
|
||||||
|
|
||||||
|
extern void MatchFinder_Init(void);
|
||||||
|
extern void MatchFinder_Create(unsigned historySize,unsigned keepAddBufferBefore,unsigned matchMaxLen,unsigned keepAddBufferAfter,byte**mem);
|
||||||
|
extern unsigned GetLongestMatch(unsigned*distances);
|
||||||
|
extern void DummyLongestMatch(void);
|
||||||
|
extern void MatchFinder_MovePos(void);
|
191
lzma_c/RangeCoder.c
Normal file
191
lzma_c/RangeCoder.c
Normal file
@@ -0,0 +1,191 @@
|
|||||||
|
#include "RangeCoderBitTree.h"
|
||||||
|
#include "lzma.h"
|
||||||
|
|
||||||
|
static unsigned _cacheSize;
|
||||||
|
static byte _cache;
|
||||||
|
static uint64 low;
|
||||||
|
static unsigned range;
|
||||||
|
|
||||||
|
static unsigned PriceTable[kBitModelTotal >> kNumMoveReducingBits];
|
||||||
|
|
||||||
|
void RangeEncoder_Init(void)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
unsigned start,end,j;
|
||||||
|
low = 0;
|
||||||
|
range = 0xFFFFFFFF;
|
||||||
|
_cacheSize = 1;
|
||||||
|
_cache = 0;
|
||||||
|
/* init price table */
|
||||||
|
#define kNumBits (kNumBitModelTotalBits - kNumMoveReducingBits)
|
||||||
|
for (i=kNumBits;i--;)
|
||||||
|
{
|
||||||
|
start = 1 << (kNumBits - i - 1);
|
||||||
|
end = 1 << (kNumBits - i);
|
||||||
|
for (j=start;j<end;j++)
|
||||||
|
PriceTable[j] = (i<<kNumBitPriceShiftBits) +
|
||||||
|
(((end-j)<<kNumBitPriceShiftBits) >> (kNumBits - i - 1));
|
||||||
|
}
|
||||||
|
#undef kNumBits
|
||||||
|
}
|
||||||
|
|
||||||
|
void RangeEncoder_ShiftLow(void)
|
||||||
|
{
|
||||||
|
if ((unsigned)low < 0xFF000000U || (int)(low>>32))
|
||||||
|
{
|
||||||
|
byte temp = _cache;
|
||||||
|
do
|
||||||
|
{
|
||||||
|
*curout++ = (byte)(temp + (byte)(low>>32));
|
||||||
|
temp = 0xFF;
|
||||||
|
} while (--_cacheSize);
|
||||||
|
_cache = (byte)((unsigned)low>>24);
|
||||||
|
}
|
||||||
|
_cacheSize++;
|
||||||
|
low = (unsigned)low << 8;
|
||||||
|
}
|
||||||
|
|
||||||
|
void RangeEncoder_FlushData(void)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
for (i=0;i<5;i++)
|
||||||
|
RangeEncoder_ShiftLow();
|
||||||
|
}
|
||||||
|
|
||||||
|
void RangeEncoder_EncodeDirectBits(unsigned value,int numTotalBits)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
for (i=numTotalBits;i--;)
|
||||||
|
{
|
||||||
|
range >>= 1;
|
||||||
|
if (((value >> i) & 1) == 1)
|
||||||
|
low += range;
|
||||||
|
if (range < kTopValue)
|
||||||
|
{
|
||||||
|
range <<= 8;
|
||||||
|
RangeEncoder_ShiftLow();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CMyBitEncoder_Encode(CMyBitEncoder* e,unsigned symbol)
|
||||||
|
{
|
||||||
|
unsigned newBound;
|
||||||
|
newBound = (range >> kNumBitModelTotalBits) * *e;
|
||||||
|
if (symbol == 0)
|
||||||
|
{
|
||||||
|
range = newBound;
|
||||||
|
*e += (kBitModelTotal - *e) >> kNumMoveBits;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
low += newBound;
|
||||||
|
range -= newBound;
|
||||||
|
*e -= *e >> kNumMoveBits;
|
||||||
|
}
|
||||||
|
if (range < kTopValue)
|
||||||
|
{
|
||||||
|
range <<= 8;
|
||||||
|
RangeEncoder_ShiftLow();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
unsigned CMyBitEncoder_GetPrice(CMyBitEncoder* e, unsigned symbol)
|
||||||
|
{
|
||||||
|
return PriceTable[(((*e-symbol)^((-(int)symbol))) & (kBitModelTotal-1)) >> kNumMoveReducingBits];
|
||||||
|
}
|
||||||
|
unsigned CMyBitEncoder_GetPrice0(CMyBitEncoder* e)
|
||||||
|
{
|
||||||
|
return PriceTable[*e >> kNumMoveReducingBits];
|
||||||
|
}
|
||||||
|
unsigned CMyBitEncoder_GetPrice1(CMyBitEncoder* e)
|
||||||
|
{
|
||||||
|
return PriceTable[(kBitModelTotal - *e) >> kNumMoveReducingBits];
|
||||||
|
}
|
||||||
|
|
||||||
|
void CBitTreeEncoder_Init(NRangeCoder_CBitTreeEncoder*e,int numBitLevels)
|
||||||
|
{
|
||||||
|
unsigned i;
|
||||||
|
e->numBitLevels = numBitLevels;
|
||||||
|
for (i=1;i<((unsigned)1<<numBitLevels);i++)
|
||||||
|
CMyBitEncoder_Init(e->Models[i]);
|
||||||
|
}
|
||||||
|
void CBitTreeEncoder_Encode(NRangeCoder_CBitTreeEncoder*e,unsigned symbol)
|
||||||
|
{
|
||||||
|
unsigned modelIndex = 1;
|
||||||
|
int bitIndex;
|
||||||
|
unsigned bit;
|
||||||
|
for (bitIndex = e->numBitLevels; bitIndex--;)
|
||||||
|
{
|
||||||
|
bit = (symbol >> bitIndex) & 1;
|
||||||
|
CMyBitEncoder_Encode(&e->Models[modelIndex],bit);
|
||||||
|
modelIndex = (modelIndex << 1) | bit;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
void CBitTreeEncoder_ReverseEncode(NRangeCoder_CBitTreeEncoder*e,unsigned symbol)
|
||||||
|
{
|
||||||
|
unsigned modelIndex = 1;
|
||||||
|
int i;
|
||||||
|
unsigned bit;
|
||||||
|
for (i=0;i<e->numBitLevels;i++)
|
||||||
|
{
|
||||||
|
bit = symbol & 1;
|
||||||
|
CMyBitEncoder_Encode(&e->Models[modelIndex],bit);
|
||||||
|
modelIndex = (modelIndex << 1) | bit;
|
||||||
|
symbol >>= 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
unsigned CBitTreeEncoder_GetPrice(NRangeCoder_CBitTreeEncoder*e,unsigned symbol)
|
||||||
|
{
|
||||||
|
unsigned price = 0;
|
||||||
|
symbol |= (1 << e->numBitLevels);
|
||||||
|
while (symbol != 1)
|
||||||
|
{
|
||||||
|
price += CMyBitEncoder_GetPrice(&e->Models[symbol>>1],symbol&1);
|
||||||
|
symbol >>= 1;
|
||||||
|
}
|
||||||
|
return price;
|
||||||
|
}
|
||||||
|
unsigned CBitTreeEncoder_ReverseGetPrice(NRangeCoder_CBitTreeEncoder*e,unsigned symbol)
|
||||||
|
{
|
||||||
|
unsigned price=0;
|
||||||
|
unsigned modelIndex=1;
|
||||||
|
int i;
|
||||||
|
unsigned bit;
|
||||||
|
for (i=e->numBitLevels;i;i--)
|
||||||
|
{
|
||||||
|
bit = symbol&1;
|
||||||
|
symbol >>= 1;
|
||||||
|
price += CMyBitEncoder_GetPrice(&e->Models[modelIndex],bit);
|
||||||
|
modelIndex = (modelIndex<<1)|bit;
|
||||||
|
}
|
||||||
|
return price;
|
||||||
|
}
|
||||||
|
unsigned ReverseBitTreeGetPrice(CMyBitEncoder*Models,unsigned NumBitLevels,unsigned symbol)
|
||||||
|
{
|
||||||
|
unsigned price=0;
|
||||||
|
unsigned modelIndex=1;
|
||||||
|
unsigned bit;
|
||||||
|
int i;
|
||||||
|
for (i=NumBitLevels;i;i--)
|
||||||
|
{
|
||||||
|
bit = symbol & 1;
|
||||||
|
symbol >>= 1;
|
||||||
|
price += CMyBitEncoder_GetPrice(Models+modelIndex,bit);
|
||||||
|
modelIndex = (modelIndex<<1)|bit;
|
||||||
|
}
|
||||||
|
return price;
|
||||||
|
}
|
||||||
|
void ReverseBitTreeEncode(CMyBitEncoder*Models,int NumBitLevels,unsigned symbol)
|
||||||
|
{
|
||||||
|
unsigned modelIndex = 1;
|
||||||
|
int i;
|
||||||
|
unsigned bit;
|
||||||
|
for (i=0;i<NumBitLevels;i++)
|
||||||
|
{
|
||||||
|
bit = symbol & 1;
|
||||||
|
CMyBitEncoder_Encode(Models+modelIndex,bit);
|
||||||
|
modelIndex = (modelIndex<<1)|bit;
|
||||||
|
symbol >>= 1;
|
||||||
|
}
|
||||||
|
}
|
7
lzma_c/RangeCoder.h
Normal file
7
lzma_c/RangeCoder.h
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
#include "common.h"
|
||||||
|
#define kNumTopBits 24
|
||||||
|
#define kTopValue (1<<kNumTopBits)
|
||||||
|
extern void RangeEncoder_Init(void);
|
||||||
|
extern void RangeEncoder_FlushData(void);
|
||||||
|
extern void RangeEncoder_ShiftLow(void);
|
||||||
|
extern void RangeEncoder_EncodeDirectBits(unsigned value,int numTotalBits);
|
18
lzma_c/RangeCoderBit.h
Normal file
18
lzma_c/RangeCoderBit.h
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
#include "RangeCoder.h"
|
||||||
|
|
||||||
|
#define kNumBitModelTotalBits 11
|
||||||
|
#define kBitModelTotal (1<<kNumBitModelTotalBits)
|
||||||
|
|
||||||
|
#define kNumMoveReducingBits 2
|
||||||
|
|
||||||
|
#define kNumBitPriceShiftBits 6
|
||||||
|
#define kBitPrice (1<<kNumBitPriceShiftBits)
|
||||||
|
|
||||||
|
typedef unsigned NRangeCoder_CBitModel;
|
||||||
|
typedef NRangeCoder_CBitModel CMyBitEncoder;
|
||||||
|
|
||||||
|
extern void CMyBitEncoder_Encode(CMyBitEncoder* e,unsigned symbol);
|
||||||
|
extern unsigned CMyBitEncoder_GetPrice(CMyBitEncoder* e, unsigned symbol);
|
||||||
|
extern unsigned CMyBitEncoder_GetPrice0(CMyBitEncoder* e);
|
||||||
|
extern unsigned CMyBitEncoder_GetPrice1(CMyBitEncoder* e);
|
||||||
|
#define CMyBitEncoder_Init(a) a=kBitModelTotal/2
|
15
lzma_c/RangeCoderBitTree.h
Normal file
15
lzma_c/RangeCoderBitTree.h
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
#include "RangeCoderBit.h"
|
||||||
|
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
CMyBitEncoder Models[1<<8];
|
||||||
|
int numBitLevels;
|
||||||
|
} NRangeCoder_CBitTreeEncoder;
|
||||||
|
|
||||||
|
extern void CBitTreeEncoder_Init(NRangeCoder_CBitTreeEncoder*e,int numBitLevels);
|
||||||
|
extern void CBitTreeEncoder_Encode(NRangeCoder_CBitTreeEncoder*e,unsigned symbol);
|
||||||
|
extern void CBitTreeEncoder_ReverseEncode(NRangeCoder_CBitTreeEncoder*e,unsigned symbol);
|
||||||
|
extern unsigned CBitTreeEncoder_GetPrice(NRangeCoder_CBitTreeEncoder*e,unsigned symbol);
|
||||||
|
extern unsigned CBitTreeEncoder_ReverseGetPrice(NRangeCoder_CBitTreeEncoder*e,unsigned symbol);
|
||||||
|
extern unsigned ReverseBitTreeGetPrice(CMyBitEncoder*Models,unsigned NumBitLevels,unsigned symbol);
|
||||||
|
extern void ReverseBitTreeEncode(CMyBitEncoder*Models,int NumBitLevels,unsigned symbol);
|
22
lzma_c/common.h
Normal file
22
lzma_c/common.h
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
#ifndef _COMMON_H
|
||||||
|
#define _COMMON_H
|
||||||
|
|
||||||
|
typedef unsigned char byte;
|
||||||
|
typedef unsigned short word;
|
||||||
|
// conditional compiling, mike.dld
|
||||||
|
#ifdef WIN32
|
||||||
|
typedef unsigned __int64 uint64;
|
||||||
|
#else
|
||||||
|
typedef unsigned long long uint64;
|
||||||
|
#define __stdcall __attribute__((stdcall))
|
||||||
|
#endif
|
||||||
|
typedef byte bool;
|
||||||
|
#define true 1
|
||||||
|
#define false 0
|
||||||
|
|
||||||
|
extern unsigned pack_length;
|
||||||
|
extern unsigned pack_pos;
|
||||||
|
extern const byte* curin;
|
||||||
|
extern byte* curout;
|
||||||
|
|
||||||
|
#endif
|
52
lzma_c/lzma.h
Normal file
52
lzma_c/lzma.h
Normal file
@@ -0,0 +1,52 @@
|
|||||||
|
#include "common.h"
|
||||||
|
#define kNumRepDistances 4
|
||||||
|
#define kNumStates 12
|
||||||
|
extern const byte kLiteralNextStates[kNumStates];
|
||||||
|
extern const byte kMatchNextStates[kNumStates];
|
||||||
|
extern const byte kRepNextStates[kNumStates];
|
||||||
|
extern const byte kShortRepNextStates[kNumStates];
|
||||||
|
|
||||||
|
typedef byte CState;
|
||||||
|
#define CState_Init(a) a=0
|
||||||
|
#define CState_UpdateChar(a) a=kLiteralNextStates[a]
|
||||||
|
#define CState_UpdateMatch(a) a=kMatchNextStates[a]
|
||||||
|
#define CState_UpdateRep(a) a=kRepNextStates[a]
|
||||||
|
#define CState_UpdateShortRep(a) a=kShortRepNextStates[a]
|
||||||
|
#define CState_IsCharState(a) (a<7)
|
||||||
|
|
||||||
|
#define kNumPosSlotBits 6
|
||||||
|
#define kDicLogSizeMin 0
|
||||||
|
#define kDicLogSizeMax 32
|
||||||
|
#define kDistTableSizeMax (kDicLogSizeMax*2)
|
||||||
|
#define kNumLenToPosStates 4
|
||||||
|
|
||||||
|
#define GetLenToPosState(len) ((len<kNumLenToPosStates+2)?len-2:kNumLenToPosStates-1)
|
||||||
|
|
||||||
|
#define kNumPosStatesBitsMax 4
|
||||||
|
#define kNumPosStatesMax (1<<kNumPosStatesBitsMax)
|
||||||
|
|
||||||
|
#define kNumPosStatesBitsEncodingMax 4
|
||||||
|
#define kNumPosStatesEncodingMax (1 << kNumPosStatesBitsEncodingMax)
|
||||||
|
|
||||||
|
#define kNumLowBits 3
|
||||||
|
#define kNumMidBits 3
|
||||||
|
#define kNumHighBits 8
|
||||||
|
#define kNumLowSymbols (1<<kNumLowBits)
|
||||||
|
#define kNumMidSymbols (1<<kNumMidBits)
|
||||||
|
#define kNumSymbolsTotal (kNumLowSymbols + kNumMidSymbols + (1<<kNumHighBits))
|
||||||
|
|
||||||
|
#define kMatchMinLen 2
|
||||||
|
#define kMatchMaxLen (kMatchMinLen + kNumSymbolsTotal - 1)
|
||||||
|
|
||||||
|
#define kNumAlignBits 4
|
||||||
|
#define kAlignTableSize (1<<kNumAlignBits)
|
||||||
|
#define kAlignMask (kAlignTableSize-1)
|
||||||
|
|
||||||
|
#define kStartPosModelIndex 4
|
||||||
|
#define kEndPosModelIndex 14
|
||||||
|
#define kNumPosModels (kEndPosModelIndex-kStartPosModelIndex)
|
||||||
|
|
||||||
|
#define kNumFullDistances (1<<(kEndPosModelIndex/2))
|
||||||
|
#define kNumLitPosStatesBitsEncodingMax 4
|
||||||
|
#define kNumLitContextBitsMax 8
|
||||||
|
#define kNumMoveBits 5
|
132
lzma_c/lzmapack.dsp
Normal file
132
lzma_c/lzmapack.dsp
Normal file
@@ -0,0 +1,132 @@
|
|||||||
|
# Microsoft Developer Studio Project File - Name="lzmapack" - Package Owner=<4>
|
||||||
|
# Microsoft Developer Studio Generated Build File, Format Version 6.00
|
||||||
|
# ** DO NOT EDIT **
|
||||||
|
|
||||||
|
# TARGTYPE "Win32 (x86) Static Library" 0x0104
|
||||||
|
|
||||||
|
CFG=lzmapack - Win32 Debug
|
||||||
|
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
|
||||||
|
!MESSAGE use the Export Makefile command and run
|
||||||
|
!MESSAGE
|
||||||
|
!MESSAGE NMAKE /f "lzmapack.mak".
|
||||||
|
!MESSAGE
|
||||||
|
!MESSAGE You can specify a configuration when running NMAKE
|
||||||
|
!MESSAGE by defining the macro CFG on the command line. For example:
|
||||||
|
!MESSAGE
|
||||||
|
!MESSAGE NMAKE /f "lzmapack.mak" CFG="lzmapack - Win32 Debug"
|
||||||
|
!MESSAGE
|
||||||
|
!MESSAGE Possible choices for configuration are:
|
||||||
|
!MESSAGE
|
||||||
|
!MESSAGE "lzmapack - Win32 Release" (based on "Win32 (x86) Static Library")
|
||||||
|
!MESSAGE "lzmapack - Win32 Debug" (based on "Win32 (x86) Static Library")
|
||||||
|
!MESSAGE
|
||||||
|
|
||||||
|
# Begin Project
|
||||||
|
# PROP AllowPerConfigDependencies 0
|
||||||
|
# PROP Scc_ProjName ""
|
||||||
|
# PROP Scc_LocalPath ""
|
||||||
|
CPP=cl.exe
|
||||||
|
RSC=rc.exe
|
||||||
|
|
||||||
|
!IF "$(CFG)" == "lzmapack - Win32 Release"
|
||||||
|
|
||||||
|
# PROP BASE Use_MFC 0
|
||||||
|
# PROP BASE Use_Debug_Libraries 0
|
||||||
|
# PROP BASE Output_Dir "Release"
|
||||||
|
# PROP BASE Intermediate_Dir "Release"
|
||||||
|
# PROP BASE Target_Dir ""
|
||||||
|
# PROP Use_MFC 0
|
||||||
|
# PROP Use_Debug_Libraries 0
|
||||||
|
# PROP Output_Dir ""
|
||||||
|
# PROP Intermediate_Dir "Release"
|
||||||
|
# PROP Target_Dir ""
|
||||||
|
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c
|
||||||
|
# ADD CPP /nologo /W3 /GX /O1 /Ob1 /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /Zl /FD /c
|
||||||
|
# ADD BASE RSC /l 0x419 /d "NDEBUG"
|
||||||
|
# ADD RSC /l 0x419 /d "NDEBUG"
|
||||||
|
BSC32=bscmake.exe
|
||||||
|
# ADD BASE BSC32 /nologo
|
||||||
|
# ADD BSC32 /nologo
|
||||||
|
LIB32=link.exe -lib
|
||||||
|
# ADD BASE LIB32 /nologo
|
||||||
|
# ADD LIB32 /nologo
|
||||||
|
|
||||||
|
!ELSEIF "$(CFG)" == "lzmapack - Win32 Debug"
|
||||||
|
|
||||||
|
# PROP BASE Use_MFC 0
|
||||||
|
# PROP BASE Use_Debug_Libraries 1
|
||||||
|
# PROP BASE Output_Dir "Debug"
|
||||||
|
# PROP BASE Intermediate_Dir "Debug"
|
||||||
|
# PROP BASE Target_Dir ""
|
||||||
|
# PROP Use_MFC 0
|
||||||
|
# PROP Use_Debug_Libraries 1
|
||||||
|
# PROP Output_Dir ""
|
||||||
|
# PROP Intermediate_Dir "Debug"
|
||||||
|
# PROP Target_Dir ""
|
||||||
|
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c
|
||||||
|
# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c
|
||||||
|
# ADD BASE RSC /l 0x419 /d "_DEBUG"
|
||||||
|
# ADD RSC /l 0x419 /d "_DEBUG"
|
||||||
|
BSC32=bscmake.exe
|
||||||
|
# ADD BASE BSC32 /nologo
|
||||||
|
# ADD BSC32 /nologo
|
||||||
|
LIB32=link.exe -lib
|
||||||
|
# ADD BASE LIB32 /nologo
|
||||||
|
# ADD LIB32 /nologo
|
||||||
|
|
||||||
|
!ENDIF
|
||||||
|
|
||||||
|
# Begin Target
|
||||||
|
|
||||||
|
# Name "lzmapack - Win32 Release"
|
||||||
|
# Name "lzmapack - Win32 Debug"
|
||||||
|
# Begin Group "Source Files"
|
||||||
|
|
||||||
|
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=.\LZMAEncoder.c
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=.\MatchFinder.c
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=.\RangeCoder.c
|
||||||
|
# End Source File
|
||||||
|
# End Group
|
||||||
|
# Begin Group "Header Files"
|
||||||
|
|
||||||
|
# PROP Default_Filter "h;hpp;hxx;hm;inl"
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=.\common.h
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=.\lzma.h
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=.\LZMAEncoder.h
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=.\MatchFinder.h
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=.\RangeCoder.h
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=.\RangeCoderBit.h
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=.\RangeCoderBitTree.h
|
||||||
|
# End Source File
|
||||||
|
# End Group
|
||||||
|
# End Target
|
||||||
|
# End Project
|
44
lzma_c/lzmapack.dsw
Normal file
44
lzma_c/lzmapack.dsw
Normal file
@@ -0,0 +1,44 @@
|
|||||||
|
Microsoft Developer Studio Workspace File, Format Version 6.00
|
||||||
|
# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
|
||||||
|
|
||||||
|
###############################################################################
|
||||||
|
|
||||||
|
Project: "lzmapack"=.\lzmapack.dsp - Package Owner=<4>
|
||||||
|
|
||||||
|
Package=<5>
|
||||||
|
{{{
|
||||||
|
}}}
|
||||||
|
|
||||||
|
Package=<4>
|
||||||
|
{{{
|
||||||
|
}}}
|
||||||
|
|
||||||
|
###############################################################################
|
||||||
|
|
||||||
|
Project: "lzmatest"=.\lzmatest\lzmatest.dsp - Package Owner=<4>
|
||||||
|
|
||||||
|
Package=<5>
|
||||||
|
{{{
|
||||||
|
}}}
|
||||||
|
|
||||||
|
Package=<4>
|
||||||
|
{{{
|
||||||
|
Begin Project Dependency
|
||||||
|
Project_Dep_Name lzmapack
|
||||||
|
End Project Dependency
|
||||||
|
}}}
|
||||||
|
|
||||||
|
###############################################################################
|
||||||
|
|
||||||
|
Global:
|
||||||
|
|
||||||
|
Package=<5>
|
||||||
|
{{{
|
||||||
|
}}}
|
||||||
|
|
||||||
|
Package=<3>
|
||||||
|
{{{
|
||||||
|
}}}
|
||||||
|
|
||||||
|
###############################################################################
|
||||||
|
|
102
lzma_c/lzmatest/lzmatest.dsp
Normal file
102
lzma_c/lzmatest/lzmatest.dsp
Normal file
@@ -0,0 +1,102 @@
|
|||||||
|
# Microsoft Developer Studio Project File - Name="lzmatest" - Package Owner=<4>
|
||||||
|
# Microsoft Developer Studio Generated Build File, Format Version 6.00
|
||||||
|
# ** DO NOT EDIT **
|
||||||
|
|
||||||
|
# TARGTYPE "Win32 (x86) Console Application" 0x0103
|
||||||
|
|
||||||
|
CFG=lzmatest - Win32 Debug
|
||||||
|
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
|
||||||
|
!MESSAGE use the Export Makefile command and run
|
||||||
|
!MESSAGE
|
||||||
|
!MESSAGE NMAKE /f "lzmatest.mak".
|
||||||
|
!MESSAGE
|
||||||
|
!MESSAGE You can specify a configuration when running NMAKE
|
||||||
|
!MESSAGE by defining the macro CFG on the command line. For example:
|
||||||
|
!MESSAGE
|
||||||
|
!MESSAGE NMAKE /f "lzmatest.mak" CFG="lzmatest - Win32 Debug"
|
||||||
|
!MESSAGE
|
||||||
|
!MESSAGE Possible choices for configuration are:
|
||||||
|
!MESSAGE
|
||||||
|
!MESSAGE "lzmatest - Win32 Release" (based on "Win32 (x86) Console Application")
|
||||||
|
!MESSAGE "lzmatest - Win32 Debug" (based on "Win32 (x86) Console Application")
|
||||||
|
!MESSAGE
|
||||||
|
|
||||||
|
# Begin Project
|
||||||
|
# PROP AllowPerConfigDependencies 0
|
||||||
|
# PROP Scc_ProjName ""
|
||||||
|
# PROP Scc_LocalPath ""
|
||||||
|
CPP=cl.exe
|
||||||
|
RSC=rc.exe
|
||||||
|
|
||||||
|
!IF "$(CFG)" == "lzmatest - Win32 Release"
|
||||||
|
|
||||||
|
# PROP BASE Use_MFC 0
|
||||||
|
# PROP BASE Use_Debug_Libraries 0
|
||||||
|
# PROP BASE Output_Dir "Release"
|
||||||
|
# PROP BASE Intermediate_Dir "Release"
|
||||||
|
# PROP BASE Target_Dir ""
|
||||||
|
# PROP Use_MFC 0
|
||||||
|
# PROP Use_Debug_Libraries 0
|
||||||
|
# PROP Output_Dir "Release"
|
||||||
|
# PROP Intermediate_Dir "Release"
|
||||||
|
# PROP Ignore_Export_Lib 0
|
||||||
|
# PROP Target_Dir ""
|
||||||
|
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
|
||||||
|
# ADD CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
|
||||||
|
# ADD BASE RSC /l 0x419 /d "NDEBUG"
|
||||||
|
# ADD RSC /l 0x419 /d "NDEBUG"
|
||||||
|
BSC32=bscmake.exe
|
||||||
|
# ADD BASE BSC32 /nologo
|
||||||
|
# ADD BSC32 /nologo
|
||||||
|
LINK32=link.exe
|
||||||
|
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
|
||||||
|
# ADD LINK32 kernel32.lib ..\lzmapack.lib /nologo /subsystem:console /machine:I386
|
||||||
|
|
||||||
|
!ELSEIF "$(CFG)" == "lzmatest - Win32 Debug"
|
||||||
|
|
||||||
|
# PROP BASE Use_MFC 0
|
||||||
|
# PROP BASE Use_Debug_Libraries 1
|
||||||
|
# PROP BASE Output_Dir "Debug"
|
||||||
|
# PROP BASE Intermediate_Dir "Debug"
|
||||||
|
# PROP BASE Target_Dir ""
|
||||||
|
# PROP Use_MFC 0
|
||||||
|
# PROP Use_Debug_Libraries 1
|
||||||
|
# PROP Output_Dir "Debug"
|
||||||
|
# PROP Intermediate_Dir "Debug"
|
||||||
|
# PROP Ignore_Export_Lib 0
|
||||||
|
# PROP Target_Dir ""
|
||||||
|
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
|
||||||
|
# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
|
||||||
|
# ADD BASE RSC /l 0x419 /d "_DEBUG"
|
||||||
|
# ADD RSC /l 0x419 /d "_DEBUG"
|
||||||
|
BSC32=bscmake.exe
|
||||||
|
# ADD BASE BSC32 /nologo
|
||||||
|
# ADD BSC32 /nologo
|
||||||
|
LINK32=link.exe
|
||||||
|
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
|
||||||
|
# ADD LINK32 kernel32.lib ..\lzmapack.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
|
||||||
|
|
||||||
|
!ENDIF
|
||||||
|
|
||||||
|
# Begin Target
|
||||||
|
|
||||||
|
# Name "lzmatest - Win32 Release"
|
||||||
|
# Name "lzmatest - Win32 Debug"
|
||||||
|
# Begin Group "Source Files"
|
||||||
|
|
||||||
|
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=.\main.cpp
|
||||||
|
# End Source File
|
||||||
|
# End Group
|
||||||
|
# Begin Group "Header Files"
|
||||||
|
|
||||||
|
# PROP Default_Filter "h;hpp;hxx;hm;inl"
|
||||||
|
# End Group
|
||||||
|
# Begin Group "Resource Files"
|
||||||
|
|
||||||
|
# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
|
||||||
|
# End Group
|
||||||
|
# End Target
|
||||||
|
# End Project
|
31
lzma_c/lzmatest/main.cpp
Normal file
31
lzma_c/lzmatest/main.cpp
Normal file
@@ -0,0 +1,31 @@
|
|||||||
|
#include <stdio.h>
|
||||||
|
#include <windows.h>
|
||||||
|
extern "C" __stdcall lzma_set_dict_size(unsigned logdictsize);
|
||||||
|
extern "C" __stdcall lzma_compress(
|
||||||
|
const void* source,
|
||||||
|
void* destination,
|
||||||
|
unsigned length,
|
||||||
|
void* workmem);
|
||||||
|
|
||||||
|
int main()
|
||||||
|
{
|
||||||
|
FILE* f;
|
||||||
|
f = fopen("test.in","rb");
|
||||||
|
fseek(f,0,SEEK_END);
|
||||||
|
unsigned inlen = ftell(f);
|
||||||
|
fseek(f,0,SEEK_SET);
|
||||||
|
void* in = VirtualAlloc(NULL,inlen,MEM_COMMIT,PAGE_READWRITE);
|
||||||
|
void* out = VirtualAlloc(NULL,inlen,MEM_COMMIT,PAGE_READWRITE);
|
||||||
|
fread(in,1,inlen,f);
|
||||||
|
fclose(f);
|
||||||
|
unsigned logdictsize,dictsize;
|
||||||
|
for (logdictsize=0,dictsize=1;dictsize<inlen && logdictsize<=28;logdictsize++,dictsize<<=1) ;
|
||||||
|
lzma_set_dict_size(logdictsize);
|
||||||
|
void* work = VirtualAlloc(NULL,dictsize*19/2+0x509000,MEM_COMMIT,PAGE_READWRITE);
|
||||||
|
unsigned outlen = lzma_compress(in,out,inlen,work);
|
||||||
|
printf("%d -> %d\n",inlen,outlen);
|
||||||
|
f = fopen("test.out","wb");
|
||||||
|
fwrite(out,1,outlen,f);
|
||||||
|
fclose(f);
|
||||||
|
return 0;
|
||||||
|
}
|
44
lzma_c/readme.txt
Normal file
44
lzma_c/readme.txt
Normal file
@@ -0,0 +1,44 @@
|
|||||||
|
<EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> C <20><><EFBFBD><EFBFBD>, diamond'<27><>, <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||||
|
LZMA-<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>. <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> LZMA SDK 4.32 <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> copyright (c) 1999-2005
|
||||||
|
Igor Pavlov, <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> http://www.7-zip.org/sdk.html,
|
||||||
|
<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>, <20> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>, <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><> C++,C# <20> Java <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>
|
||||||
|
<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>, <20><><EFBFBD> LZMA-<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> ANSI-C, <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 7z.
|
||||||
|
|
||||||
|
<EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>, <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||||
|
bt4 match-finder, <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> (<28><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>, <20><><EFBFBD> <20><><EFBFBD>
|
||||||
|
<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>), <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>
|
||||||
|
<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>. (<28><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD> <20> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> LZMA
|
||||||
|
SDK.) <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>, <20><><EFBFBD> <20> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||||
|
<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> VC++, <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> ANSI C <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>
|
||||||
|
<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> VC-<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> #pragma intrinsic(memcpy), <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,
|
||||||
|
<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> memcpy <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> <20> <20><><EFBFBD> - <20> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||||
|
<EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> C run-time library. (<28><><EFBFBD> <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>, <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||||
|
<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> MtApPack, <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||||
|
RTL <20> <20> <20><><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20> <20><><EFBFBD> Windows, <20> <20><><EFBFBD> Kolibri.)
|
||||||
|
|
||||||
|
<EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>, <20><><EFBFBD> <20> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> LZMA SDK, <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||||
|
<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20> <20><><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> (<28><> <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>) GNU LGPL <20><><EFBFBD>
|
||||||
|
GNU CPL. (<28><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> SDK <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||||
|
<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD>
|
||||||
|
<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>, <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>.)
|
||||||
|
|
||||||
|
<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: <20> C++-<2D><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD>:
|
||||||
|
extern "C" __stdcall void lzma_set_dict_size(unsigned logdictsize);
|
||||||
|
extern "C" __stdcall unsigned lzma_compress(
|
||||||
|
const void* source,
|
||||||
|
void* destination,
|
||||||
|
unsigned length,
|
||||||
|
void* workmem);
|
||||||
|
|
||||||
|
<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,
|
||||||
|
<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 2 <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||||
|
(<28>.<2E>. dictsize == (1<<logdictsize)). <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> 256Mb,
|
||||||
|
<EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> logdictsize <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 28. <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||||
|
<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>, <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,
|
||||||
|
<EFBFBD>.<2E>. <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 12345 <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> 16384 <20><><EFBFBD><EFBFBD> <20>
|
||||||
|
<EFBFBD><EFBFBD> 1 <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>.
|
||||||
|
<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>. source - <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><>
|
||||||
|
<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>, destination - <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,
|
||||||
|
length - <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>, workmem - <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,
|
||||||
|
<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>; <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD> 0x509000+dictsize*19/2
|
||||||
|
<EFBFBD><EFBFBD><EFBFBD><EFBFBD>. <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 0x10 + length*9/8 <20><><EFBFBD><EFBFBD>.
|
Reference in New Issue
Block a user