Go to the source code of this file.
Defines | |
#define | Align (SpecPos + kNumFullDistances - kEndPosModelIndex) |
#define | GET_BIT(p, i) GET_BIT2(p, i, ; , ;) |
#define | GET_BIT2(p, i, A0, A1) |
#define | GET_BIT2_CHECK(p, i, A0, A1) |
#define | GET_BIT_CHECK(p, i) GET_BIT2_CHECK(p, i, ; , ;) |
#define | IF_BIT_0(p) ttt = *(p); NORMALIZE; bound = (range >> kNumBitModelTotalBits) * ttt; if (code < bound) |
#define | IF_BIT_0_CHECK(p) ttt = *(p); NORMALIZE_CHECK; bound = (range >> kNumBitModelTotalBits) * ttt; if (code < bound) |
#define | IsMatch 0 |
#define | IsRep (IsMatch + (kNumStates << kNumPosBitsMax)) |
#define | IsRep0Long (IsRepG2 + kNumStates) |
#define | IsRepG0 (IsRep + kNumStates) |
#define | IsRepG1 (IsRepG0 + kNumStates) |
#define | IsRepG2 (IsRepG1 + kNumStates) |
#define | kAlignTableSize (1 << kNumAlignBits) |
#define | kBitModelTotal (1 << kNumBitModelTotalBits) |
#define | kEndPosModelIndex 14 |
#define | kLenNumHighBits 8 |
#define | kLenNumHighSymbols (1 << kLenNumHighBits) |
#define | kLenNumLowBits 3 |
#define | kLenNumLowSymbols (1 << kLenNumLowBits) |
#define | kLenNumMidBits 3 |
#define | kLenNumMidSymbols (1 << kLenNumMidBits) |
#define | kMatchMinLen 2 |
#define | kMatchSpecLenStart (kMatchMinLen + kLenNumLowSymbols + kLenNumMidSymbols + kLenNumHighSymbols) |
#define | kNumAlignBits 4 |
#define | kNumBitModelTotalBits 11 |
#define | kNumFullDistances (1 << (kEndPosModelIndex >> 1)) |
#define | kNumLenProbs (LenHigh + kLenNumHighSymbols) |
#define | kNumLenToPosStates 4 |
#define | kNumLitStates 7 |
#define | kNumMoveBits 5 |
#define | kNumPosBitsMax 4 |
#define | kNumPosSlotBits 6 |
#define | kNumPosStatesMax (1 << kNumPosBitsMax) |
#define | kNumStates 12 |
#define | kNumTopBits 24 |
#define | kStartPosModelIndex 4 |
#define | kTopValue ((UInt32)1 << kNumTopBits) |
#define | LenChoice 0 |
#define | LenChoice2 (LenChoice + 1) |
#define | LenCoder (Align + kAlignTableSize) |
#define | LenHigh (LenMid + (kNumPosStatesMax << kLenNumMidBits)) |
#define | LenLow (LenChoice2 + 1) |
#define | LenMid (LenLow + (kNumPosStatesMax << kLenNumLowBits)) |
#define | Literal (RepLenCoder + kNumLenProbs) |
#define | LZMA_BASE_SIZE 1846 |
#define | LZMA_DIC_MIN (1 << 12) |
#define | LZMA_LIT_SIZE 768 |
#define | LzmaProps_GetNumProbs(p) ((UInt32)LZMA_BASE_SIZE + (LZMA_LIT_SIZE << ((p)->lc + (p)->lp))) |
#define | NORMALIZE if (range < kTopValue) { range <<= 8; code = (code << 8) | (*buf++); } |
#define | NORMALIZE_CHECK if (range < kTopValue) { if (buf >= bufLimit) return DUMMY_ERROR; range <<= 8; code = (code << 8) | (*buf++); } |
#define | PosSlot (IsRep0Long + (kNumStates << kNumPosBitsMax)) |
#define | RC_INIT_SIZE 5 |
#define | RepLenCoder (LenCoder + kNumLenProbs) |
#define | SpecPos (PosSlot + (kNumLenToPosStates << kNumPosSlotBits)) |
#define | TREE_6_DECODE(probs, i) |
#define | TREE_DECODE(probs, limit, i) { i = 1; do { TREE_GET_BIT(probs, i); } while (i < limit); i -= limit; } |
#define | TREE_DECODE_CHECK(probs, limit, i) { i = 1; do { GET_BIT_CHECK(probs + i, i) } while (i < limit); i -= limit; } |
#define | TREE_GET_BIT(probs, i) { GET_BIT((probs + i), i); } |
#define | UPDATE_0(p) range = bound; *(p) = (CLzmaProb)(ttt + ((kBitModelTotal - ttt) >> kNumMoveBits)); |
#define | UPDATE_0_CHECK range = bound; |
#define | UPDATE_1(p) range -= bound; code -= bound; *(p) = (CLzmaProb)(ttt - (ttt >> kNumMoveBits)); |
#define | UPDATE_1_CHECK range -= bound; code -= bound; |
Enumerations | |
enum | ELzmaDummy { DUMMY_ERROR, DUMMY_LIT, DUMMY_MATCH, DUMMY_REP } |
Functions | |
SRes | LzmaDec_Allocate (CLzmaDec *p, const Byte *props, unsigned propsSize, ISzAlloc *alloc) |
SRes | LzmaDec_AllocateProbs (CLzmaDec *p, const Byte *props, unsigned propsSize, ISzAlloc *alloc) |
static SRes | LzmaDec_AllocateProbs2 (CLzmaDec *p, const CLzmaProps *propNew, ISzAlloc *alloc) |
static int MY_FAST_CALL | LzmaDec_DecodeReal (CLzmaDec *p, SizeT limit, const Byte *bufLimit) |
static int MY_FAST_CALL | LzmaDec_DecodeReal2 (CLzmaDec *p, SizeT limit, const Byte *bufLimit) |
SRes | LzmaDec_DecodeToBuf (CLzmaDec *p, Byte *dest, SizeT *destLen, const Byte *src, SizeT *srcLen, ELzmaFinishMode finishMode, ELzmaStatus *status) |
SRes | LzmaDec_DecodeToDic (CLzmaDec *p, SizeT dicLimit, const Byte *src, SizeT *srcLen, ELzmaFinishMode finishMode, ELzmaStatus *status) |
void | LzmaDec_Free (CLzmaDec *p, ISzAlloc *alloc) |
static void | LzmaDec_FreeDict (CLzmaDec *p, ISzAlloc *alloc) |
void | LzmaDec_FreeProbs (CLzmaDec *p, ISzAlloc *alloc) |
void | LzmaDec_Init (CLzmaDec *p) |
void | LzmaDec_InitDicAndState (CLzmaDec *p, Bool initDic, Bool initState) |
static void | LzmaDec_InitRc (CLzmaDec *p, const Byte *data) |
static void | LzmaDec_InitStateReal (CLzmaDec *p) |
static ELzmaDummy | LzmaDec_TryDummy (const CLzmaDec *p, const Byte *buf, SizeT inSize) |
static void MY_FAST_CALL | LzmaDec_WriteRem (CLzmaDec *p, SizeT limit) |
SRes | LzmaDecode (Byte *dest, SizeT *destLen, const Byte *src, SizeT *srcLen, const Byte *propData, unsigned propSize, ELzmaFinishMode finishMode, ELzmaStatus *status, ISzAlloc *alloc) |
SRes | LzmaProps_Decode (CLzmaProps *p, const Byte *data, unsigned size) |
#define Align (SpecPos + kNumFullDistances - kEndPosModelIndex) |
Definition at line 102 of file LzmaDec.cc.
Referenced by LzmaDec_DecodeReal(), and LzmaDec_TryDummy().
Definition at line 25 of file LzmaDec.cc.
Referenced by LzmaDec_DecodeReal().
#define GET_BIT2 | ( | p, | |
i, | |||
A0, | |||
A1 | |||
) |
#define GET_BIT2_CHECK | ( | p, | |
i, | |||
A0, | |||
A1 | |||
) |
IF_BIT_0_CHECK(p) \ { UPDATE_0_CHECK; i = (i + i); A0; } else \ { UPDATE_1_CHECK; i = (i + i) + 1; A1; }
Definition at line 52 of file LzmaDec.cc.
Referenced by LzmaDec_TryDummy().
Definition at line 55 of file LzmaDec.cc.
Referenced by LzmaDec_TryDummy().
#define IF_BIT_0 | ( | p | ) | ttt = *(p); NORMALIZE; bound = (range >> kNumBitModelTotalBits) * ttt; if (code < bound) |
Definition at line 19 of file LzmaDec.cc.
Referenced by LzmaDec_DecodeReal().
#define IF_BIT_0_CHECK | ( | p | ) | ttt = *(p); NORMALIZE_CHECK; bound = (range >> kNumBitModelTotalBits) * ttt; if (code < bound) |
Definition at line 49 of file LzmaDec.cc.
Referenced by LzmaDec_TryDummy().
#define IsMatch 0 |
Definition at line 94 of file LzmaDec.cc.
Referenced by LzmaDec_DecodeReal(), and LzmaDec_TryDummy().
#define IsRep (IsMatch + (kNumStates << kNumPosBitsMax)) |
Definition at line 95 of file LzmaDec.cc.
Referenced by LzmaDec_DecodeReal(), and LzmaDec_TryDummy().
#define IsRep0Long (IsRepG2 + kNumStates) |
Definition at line 99 of file LzmaDec.cc.
Referenced by LzmaDec_DecodeReal(), and LzmaDec_TryDummy().
#define IsRepG0 (IsRep + kNumStates) |
Definition at line 96 of file LzmaDec.cc.
Referenced by LzmaDec_DecodeReal(), and LzmaDec_TryDummy().
#define IsRepG1 (IsRepG0 + kNumStates) |
Definition at line 97 of file LzmaDec.cc.
Referenced by LzmaDec_DecodeReal(), and LzmaDec_TryDummy().
#define IsRepG2 (IsRepG1 + kNumStates) |
Definition at line 98 of file LzmaDec.cc.
Referenced by LzmaDec_DecodeReal(), and LzmaDec_TryDummy().
#define kAlignTableSize (1 << kNumAlignBits) |
Definition at line 89 of file LzmaDec.cc.
#define kBitModelTotal (1 << kNumBitModelTotalBits) |
Definition at line 12 of file LzmaDec.cc.
Referenced by LzmaDec_InitStateReal().
#define kEndPosModelIndex 14 |
Definition at line 82 of file LzmaDec.cc.
Referenced by LzmaDec_DecodeReal(), and LzmaDec_TryDummy().
#define kLenNumHighBits 8 |
Definition at line 67 of file LzmaDec.cc.
Referenced by LzmaDec_DecodeReal(), and LzmaDec_TryDummy().
#define kLenNumHighSymbols (1 << kLenNumHighBits) |
Definition at line 68 of file LzmaDec.cc.
#define kLenNumLowBits 3 |
Definition at line 63 of file LzmaDec.cc.
Referenced by LzmaDec_DecodeReal(), and LzmaDec_TryDummy().
#define kLenNumLowSymbols (1 << kLenNumLowBits) |
Definition at line 64 of file LzmaDec.cc.
Referenced by LzmaDec_DecodeReal(), and LzmaDec_TryDummy().
#define kLenNumMidBits 3 |
Definition at line 65 of file LzmaDec.cc.
Referenced by LzmaDec_DecodeReal(), and LzmaDec_TryDummy().
#define kLenNumMidSymbols (1 << kLenNumMidBits) |
Definition at line 66 of file LzmaDec.cc.
Referenced by LzmaDec_DecodeReal(), and LzmaDec_TryDummy().
#define kMatchMinLen 2 |
Definition at line 91 of file LzmaDec.cc.
Referenced by LzmaDec_DecodeReal().
#define kMatchSpecLenStart (kMatchMinLen + kLenNumLowSymbols + kLenNumMidSymbols + kLenNumHighSymbols) |
Definition at line 92 of file LzmaDec.cc.
Referenced by LzmaDec_DecodeReal(), LzmaDec_DecodeReal2(), LzmaDec_DecodeToDic(), and LzmaDec_WriteRem().
#define kNumAlignBits 4 |
Definition at line 88 of file LzmaDec.cc.
Referenced by LzmaDec_DecodeReal(), and LzmaDec_TryDummy().
#define kNumBitModelTotalBits 11 |
Definition at line 11 of file LzmaDec.cc.
#define kNumFullDistances (1 << (kEndPosModelIndex >> 1)) |
Definition at line 83 of file LzmaDec.cc.
#define kNumLenProbs (LenHigh + kLenNumHighSymbols) |
Definition at line 75 of file LzmaDec.cc.
#define kNumLenToPosStates 4 |
Definition at line 86 of file LzmaDec.cc.
Referenced by LzmaDec_DecodeReal(), and LzmaDec_TryDummy().
#define kNumLitStates 7 |
Definition at line 79 of file LzmaDec.cc.
Referenced by LzmaDec_DecodeReal(), and LzmaDec_TryDummy().
#define kNumMoveBits 5 |
Definition at line 13 of file LzmaDec.cc.
#define kNumPosBitsMax 4 |
Definition at line 60 of file LzmaDec.cc.
Referenced by LzmaDec_DecodeReal(), and LzmaDec_TryDummy().
#define kNumPosSlotBits 6 |
Definition at line 85 of file LzmaDec.cc.
Referenced by LzmaDec_DecodeReal(), and LzmaDec_TryDummy().
#define kNumPosStatesMax (1 << kNumPosBitsMax) |
Definition at line 61 of file LzmaDec.cc.
#define kNumStates 12 |
Definition at line 78 of file LzmaDec.cc.
Referenced by LzmaDec_DecodeReal(), and LzmaDec_TryDummy().
#define kNumTopBits 24 |
Definition at line 8 of file LzmaDec.cc.
#define kStartPosModelIndex 4 |
Definition at line 81 of file LzmaDec.cc.
Referenced by LzmaDec_DecodeReal(), and LzmaDec_TryDummy().
#define kTopValue ((UInt32)1 << kNumTopBits) |
Definition at line 9 of file LzmaDec.cc.
#define LenChoice 0 |
Definition at line 70 of file LzmaDec.cc.
Referenced by LzmaDec_DecodeReal(), and LzmaDec_TryDummy().
#define LenChoice2 (LenChoice + 1) |
Definition at line 71 of file LzmaDec.cc.
Referenced by LzmaDec_DecodeReal(), and LzmaDec_TryDummy().
#define LenCoder (Align + kAlignTableSize) |
Definition at line 103 of file LzmaDec.cc.
Referenced by LzmaDec_DecodeReal(), and LzmaDec_TryDummy().
#define LenHigh (LenMid + (kNumPosStatesMax << kLenNumMidBits)) |
Definition at line 74 of file LzmaDec.cc.
Referenced by LzmaDec_DecodeReal(), and LzmaDec_TryDummy().
#define LenLow (LenChoice2 + 1) |
Definition at line 72 of file LzmaDec.cc.
Referenced by LzmaDec_DecodeReal(), and LzmaDec_TryDummy().
#define LenMid (LenLow + (kNumPosStatesMax << kLenNumLowBits)) |
Definition at line 73 of file LzmaDec.cc.
Referenced by LzmaDec_DecodeReal(), and LzmaDec_TryDummy().
#define Literal (RepLenCoder + kNumLenProbs) |
Definition at line 105 of file LzmaDec.cc.
Referenced by LzmaDec_DecodeReal(), LzmaDec_InitStateReal(), and LzmaDec_TryDummy().
#define LZMA_BASE_SIZE 1846 |
Definition at line 107 of file LzmaDec.cc.
#define LZMA_DIC_MIN (1 << 12) |
Definition at line 116 of file LzmaDec.cc.
Referenced by LzmaProps_Decode().
#define LZMA_LIT_SIZE 768 |
Definition at line 108 of file LzmaDec.cc.
Referenced by LzmaDec_DecodeReal(), LzmaDec_InitStateReal(), and LzmaDec_TryDummy().
#define LzmaProps_GetNumProbs | ( | p | ) | ((UInt32)LZMA_BASE_SIZE + (LZMA_LIT_SIZE << ((p)->lc + (p)->lp))) |
Definition at line 110 of file LzmaDec.cc.
Referenced by LzmaDec_AllocateProbs2().
#define NORMALIZE if (range < kTopValue) { range <<= 8; code = (code << 8) | (*buf++); } |
Definition at line 17 of file LzmaDec.cc.
Referenced by LzmaDec_DecodeReal().
#define NORMALIZE_CHECK if (range < kTopValue) { if (buf >= bufLimit) return DUMMY_ERROR; range <<= 8; code = (code << 8) | (*buf++); } |
Definition at line 47 of file LzmaDec.cc.
Referenced by LzmaDec_TryDummy().
#define PosSlot (IsRep0Long + (kNumStates << kNumPosBitsMax)) |
Definition at line 100 of file LzmaDec.cc.
Referenced by LzmaDec_DecodeReal(), and LzmaDec_TryDummy().
#define RC_INIT_SIZE 5 |
Definition at line 15 of file LzmaDec.cc.
Referenced by LzmaDec_DecodeToDic(), and LzmaDecode().
#define RepLenCoder (LenCoder + kNumLenProbs) |
Definition at line 104 of file LzmaDec.cc.
Referenced by LzmaDec_DecodeReal(), and LzmaDec_TryDummy().
#define SpecPos (PosSlot + (kNumLenToPosStates << kNumPosSlotBits)) |
Definition at line 101 of file LzmaDec.cc.
Referenced by LzmaDec_DecodeReal(), and LzmaDec_TryDummy().
#define TREE_6_DECODE | ( | probs, | |
i | |||
) |
{ i = 1; \ TREE_GET_BIT(probs, i); \ TREE_GET_BIT(probs, i); \ TREE_GET_BIT(probs, i); \ TREE_GET_BIT(probs, i); \ TREE_GET_BIT(probs, i); \ TREE_GET_BIT(probs, i); \ i -= 0x40; }
Definition at line 36 of file LzmaDec.cc.
Referenced by LzmaDec_DecodeReal().
#define TREE_DECODE | ( | probs, | |
limit, | |||
i | |||
) | { i = 1; do { TREE_GET_BIT(probs, i); } while (i < limit); i -= limit; } |
Definition at line 28 of file LzmaDec.cc.
Referenced by LzmaDec_DecodeReal().
#define TREE_DECODE_CHECK | ( | probs, | |
limit, | |||
i | |||
) | { i = 1; do { GET_BIT_CHECK(probs + i, i) } while (i < limit); i -= limit; } |
Definition at line 56 of file LzmaDec.cc.
Referenced by LzmaDec_TryDummy().
Definition at line 27 of file LzmaDec.cc.
#define UPDATE_0 | ( | p | ) | range = bound; *(p) = (CLzmaProb)(ttt + ((kBitModelTotal - ttt) >> kNumMoveBits)); |
Definition at line 20 of file LzmaDec.cc.
Referenced by LzmaDec_DecodeReal().
#define UPDATE_0_CHECK range = bound; |
Definition at line 50 of file LzmaDec.cc.
Referenced by LzmaDec_TryDummy().
#define UPDATE_1 | ( | p | ) | range -= bound; code -= bound; *(p) = (CLzmaProb)(ttt - (ttt >> kNumMoveBits)); |
Definition at line 21 of file LzmaDec.cc.
Referenced by LzmaDec_DecodeReal().
#define UPDATE_1_CHECK range -= bound; code -= bound; |
Definition at line 51 of file LzmaDec.cc.
Referenced by LzmaDec_TryDummy().
enum ELzmaDummy |
Definition at line 479 of file LzmaDec.cc.
{ DUMMY_ERROR, /* unexpected end of input stream */ DUMMY_LIT, DUMMY_MATCH, DUMMY_REP } ELzmaDummy;
Definition at line 947 of file LzmaDec.cc.
References ISzAlloc::Alloc, CLzmaDec::dic, CLzmaDec::dicBufSize, _CLzmaProps::dicSize, LzmaDec_AllocateProbs2(), LzmaDec_FreeDict(), LzmaDec_FreeProbs(), LzmaProps_Decode(), CLzmaDec::prop, RINOK, SZ_ERROR_MEM, and SZ_OK.
Referenced by LzmaFile::Open().
{ CLzmaProps propNew; SizeT dicBufSize; RINOK(LzmaProps_Decode(&propNew, props, propsSize)); RINOK(LzmaDec_AllocateProbs2(p, &propNew, alloc)); dicBufSize = propNew.dicSize; if (p->dic == 0 || dicBufSize != p->dicBufSize) { LzmaDec_FreeDict(p, alloc); p->dic = (Byte *)alloc->Alloc(alloc, dicBufSize); if (p->dic == 0) { LzmaDec_FreeProbs(p, alloc); return SZ_ERROR_MEM; } } p->dicBufSize = dicBufSize; p->prop = propNew; return SZ_OK; }
SRes LzmaDec_AllocateProbs | ( | CLzmaDec * | p, |
const Byte * | props, | ||
unsigned | propsSize, | ||
ISzAlloc * | alloc | ||
) |
Definition at line 938 of file LzmaDec.cc.
References LzmaDec_AllocateProbs2(), LzmaProps_Decode(), CLzmaDec::prop, RINOK, and SZ_OK.
Referenced by LzmaDecode().
{ CLzmaProps propNew; RINOK(LzmaProps_Decode(&propNew, props, propsSize)); RINOK(LzmaDec_AllocateProbs2(p, &propNew, alloc)); p->prop = propNew; return SZ_OK; }
static SRes LzmaDec_AllocateProbs2 | ( | CLzmaDec * | p, |
const CLzmaProps * | propNew, | ||
ISzAlloc * | alloc | ||
) | [static] |
Definition at line 924 of file LzmaDec.cc.
References ISzAlloc::Alloc, CLzmaProb, LzmaDec_FreeProbs(), LzmaProps_GetNumProbs, CLzmaDec::numProbs, CLzmaDec::probs, SZ_ERROR_MEM, and SZ_OK.
Referenced by LzmaDec_Allocate(), and LzmaDec_AllocateProbs().
{ UInt32 numProbs = LzmaProps_GetNumProbs(propNew); if (p->probs == 0 || numProbs != p->numProbs) { LzmaDec_FreeProbs(p, alloc); p->probs = (CLzmaProb *)alloc->Alloc(alloc, numProbs * sizeof(CLzmaProb)); p->numProbs = numProbs; if (p->probs == 0) return SZ_ERROR_MEM; } return SZ_OK; }
static int MY_FAST_CALL LzmaDec_DecodeReal | ( | CLzmaDec * | p, |
SizeT | limit, | ||
const Byte * | bufLimit | ||
) | [static] |
Definition at line 131 of file LzmaDec.cc.
References Align, CLzmaDec::buf, CLzmaDec::checkDicSize, CLzmaProb, CLzmaDec::code, alignCSCRings::dest, CLzmaDec::dic, CLzmaDec::dicBufSize, CLzmaDec::dicPos, GET_BIT, GET_BIT2, i, IF_BIT_0, IsMatch, IsRep, IsRep0Long, IsRepG0, IsRepG1, IsRepG2, kEndPosModelIndex, kLenNumHighBits, kLenNumLowBits, kLenNumLowSymbols, kLenNumMidBits, kLenNumMidSymbols, kMatchMinLen, kMatchSpecLenStart, kNumAlignBits, kNumLenToPosStates, kNumLitStates, kNumPosBitsMax, kNumPosSlotBits, kNumStates, kStartPosModelIndex, _CLzmaProps::lc, LenChoice, LenChoice2, LenCoder, LenHigh, LenLow, LenMid, MessageLogger_cff::limit, Literal, _CLzmaProps::lp, LZMA_LIT_SIZE, NORMALIZE, evf::evtn::offset(), _CLzmaProps::pb, pos, PosSlot, CLzmaDec::probs, CLzmaDec::processedPos, CLzmaDec::prop, CLzmaDec::range, CLzmaDec::remainLen, RepLenCoder, CLzmaDec::reps, SpecPos, alcazmumu_cfi::src, CLzmaDec::state, evf::utils::state, SZ_ERROR_DATA, SZ_OK, lumiQTWidget::t, TREE_6_DECODE, TREE_DECODE, UPDATE_0, and UPDATE_1.
Referenced by LzmaDec_DecodeReal2().
{ CLzmaProb *probs = p->probs; unsigned state = p->state; UInt32 rep0 = p->reps[0], rep1 = p->reps[1], rep2 = p->reps[2], rep3 = p->reps[3]; unsigned pbMask = ((unsigned)1 << (p->prop.pb)) - 1; unsigned lpMask = ((unsigned)1 << (p->prop.lp)) - 1; unsigned lc = p->prop.lc; Byte *dic = p->dic; SizeT dicBufSize = p->dicBufSize; SizeT dicPos = p->dicPos; UInt32 processedPos = p->processedPos; UInt32 checkDicSize = p->checkDicSize; unsigned len = 0; const Byte *buf = p->buf; UInt32 range = p->range; UInt32 code = p->code; do { CLzmaProb *prob; UInt32 bound; unsigned ttt; unsigned posState = processedPos & pbMask; prob = probs + IsMatch + (state << kNumPosBitsMax) + posState; IF_BIT_0(prob) { unsigned symbol; UPDATE_0(prob); prob = probs + Literal; if (checkDicSize != 0 || processedPos != 0) prob += (LZMA_LIT_SIZE * (((processedPos & lpMask) << lc) + (dic[(dicPos == 0 ? dicBufSize : dicPos) - 1] >> (8 - lc)))); if (state < kNumLitStates) { state -= (state < 4) ? state : 3; symbol = 1; do { GET_BIT(prob + symbol, symbol) } while (symbol < 0x100); } else { unsigned matchByte = p->dic[(dicPos - rep0) + ((dicPos < rep0) ? dicBufSize : 0)]; unsigned offs = 0x100; state -= (state < 10) ? 3 : 6; symbol = 1; do { unsigned bit; CLzmaProb *probLit; matchByte <<= 1; bit = (matchByte & offs); probLit = prob + offs + bit + symbol; GET_BIT2(probLit, symbol, offs &= ~bit, offs &= bit) } while (symbol < 0x100); } dic[dicPos++] = (Byte)symbol; processedPos++; continue; } else { UPDATE_1(prob); prob = probs + IsRep + state; IF_BIT_0(prob) { UPDATE_0(prob); state += kNumStates; prob = probs + LenCoder; } else { UPDATE_1(prob); if (checkDicSize == 0 && processedPos == 0) return SZ_ERROR_DATA; prob = probs + IsRepG0 + state; IF_BIT_0(prob) { UPDATE_0(prob); prob = probs + IsRep0Long + (state << kNumPosBitsMax) + posState; IF_BIT_0(prob) { UPDATE_0(prob); dic[dicPos] = dic[(dicPos - rep0) + ((dicPos < rep0) ? dicBufSize : 0)]; dicPos++; processedPos++; state = state < kNumLitStates ? 9 : 11; continue; } UPDATE_1(prob); } else { UInt32 distance; UPDATE_1(prob); prob = probs + IsRepG1 + state; IF_BIT_0(prob) { UPDATE_0(prob); distance = rep1; } else { UPDATE_1(prob); prob = probs + IsRepG2 + state; IF_BIT_0(prob) { UPDATE_0(prob); distance = rep2; } else { UPDATE_1(prob); distance = rep3; rep3 = rep2; } rep2 = rep1; } rep1 = rep0; rep0 = distance; } state = state < kNumLitStates ? 8 : 11; prob = probs + RepLenCoder; } { unsigned limit, offset; CLzmaProb *probLen = prob + LenChoice; IF_BIT_0(probLen) { UPDATE_0(probLen); probLen = prob + LenLow + (posState << kLenNumLowBits); offset = 0; limit = (1 << kLenNumLowBits); } else { UPDATE_1(probLen); probLen = prob + LenChoice2; IF_BIT_0(probLen) { UPDATE_0(probLen); probLen = prob + LenMid + (posState << kLenNumMidBits); offset = kLenNumLowSymbols; limit = (1 << kLenNumMidBits); } else { UPDATE_1(probLen); probLen = prob + LenHigh; offset = kLenNumLowSymbols + kLenNumMidSymbols; limit = (1 << kLenNumHighBits); } } TREE_DECODE(probLen, limit, len); len += offset; } if (state >= kNumStates) { UInt32 distance; prob = probs + PosSlot + ((len < kNumLenToPosStates ? len : kNumLenToPosStates - 1) << kNumPosSlotBits); TREE_6_DECODE(prob, distance); if (distance >= kStartPosModelIndex) { unsigned posSlot = (unsigned)distance; int numDirectBits = (int)(((distance >> 1) - 1)); distance = (2 | (distance & 1)); if (posSlot < kEndPosModelIndex) { distance <<= numDirectBits; prob = probs + SpecPos + distance - posSlot - 1; { UInt32 mask = 1; unsigned i = 1; do { GET_BIT2(prob + i, i, ; , distance |= mask); mask <<= 1; } while (--numDirectBits != 0); } } else { numDirectBits -= kNumAlignBits; do { NORMALIZE range >>= 1; { UInt32 t; code -= range; t = (0 - ((UInt32)code >> 31)); /* (UInt32)((Int32)code >> 31) */ distance = (distance << 1) + (t + 1); code += range & t; } /* distance <<= 1; if (code >= range) { code -= range; distance |= 1; } */ } while (--numDirectBits != 0); prob = probs + Align; distance <<= kNumAlignBits; { unsigned i = 1; GET_BIT2(prob + i, i, ; , distance |= 1); GET_BIT2(prob + i, i, ; , distance |= 2); GET_BIT2(prob + i, i, ; , distance |= 4); GET_BIT2(prob + i, i, ; , distance |= 8); } if (distance == (UInt32)0xFFFFFFFF) { len += kMatchSpecLenStart; state -= kNumStates; break; } } } rep3 = rep2; rep2 = rep1; rep1 = rep0; rep0 = distance + 1; if (checkDicSize == 0) { if (distance >= processedPos) return SZ_ERROR_DATA; } else if (distance >= checkDicSize) return SZ_ERROR_DATA; state = (state < kNumStates + kNumLitStates) ? kNumLitStates : kNumLitStates + 3; } len += kMatchMinLen; if (limit == dicPos) return SZ_ERROR_DATA; { SizeT rem = limit - dicPos; unsigned curLen = ((rem < len) ? (unsigned)rem : len); SizeT pos = (dicPos - rep0) + ((dicPos < rep0) ? dicBufSize : 0); processedPos += curLen; len -= curLen; if (pos + curLen <= dicBufSize) { Byte *dest = dic + dicPos; ptrdiff_t src = (ptrdiff_t)pos - (ptrdiff_t)dicPos; const Byte *lim = dest + curLen; dicPos += curLen; do *(dest) = (Byte)*(dest + src); while (++dest != lim); } else { do { dic[dicPos++] = dic[pos]; if (++pos == dicBufSize) pos = 0; } while (--curLen != 0); } } } } while (dicPos < limit && buf < bufLimit); NORMALIZE; p->buf = buf; p->range = range; p->code = code; p->remainLen = len; p->dicPos = dicPos; p->processedPos = processedPos; p->reps[0] = rep0; p->reps[1] = rep1; p->reps[2] = rep2; p->reps[3] = rep3; p->state = state; return SZ_OK; }
static int MY_FAST_CALL LzmaDec_DecodeReal2 | ( | CLzmaDec * | p, |
SizeT | limit, | ||
const Byte * | bufLimit | ||
) | [static] |
Definition at line 454 of file LzmaDec.cc.
References CLzmaDec::buf, CLzmaDec::checkDicSize, CLzmaDec::dicPos, _CLzmaProps::dicSize, kMatchSpecLenStart, MessageLogger_cff::limit, LzmaDec_DecodeReal(), LzmaDec_WriteRem(), CLzmaDec::processedPos, CLzmaDec::prop, CLzmaDec::remainLen, and RINOK.
Referenced by LzmaDec_DecodeToDic().
{ do { SizeT limit2 = limit; if (p->checkDicSize == 0) { UInt32 rem = p->prop.dicSize - p->processedPos; if (limit - p->dicPos > rem) limit2 = p->dicPos + rem; } RINOK(LzmaDec_DecodeReal(p, limit2, bufLimit)); if (p->processedPos >= p->prop.dicSize) p->checkDicSize = p->prop.dicSize; LzmaDec_WriteRem(p, limit); } while (p->dicPos < limit && p->buf < bufLimit && p->remainLen < kMatchSpecLenStart); if (p->remainLen > kMatchSpecLenStart) { p->remainLen = kMatchSpecLenStart; } return 0; }
SRes LzmaDec_DecodeToBuf | ( | CLzmaDec * | p, |
Byte * | dest, | ||
SizeT * | destLen, | ||
const Byte * | src, | ||
SizeT * | srcLen, | ||
ELzmaFinishMode | finishMode, | ||
ELzmaStatus * | status | ||
) |
Definition at line 840 of file LzmaDec.cc.
References CLzmaDec::dic, CLzmaDec::dicBufSize, CLzmaDec::dicPos, LZMA_FINISH_ANY, LzmaDec_DecodeToDic(), and SZ_OK.
Referenced by LzmaFile::DecodeAll(), and LzmaFile::DecodeBuffer().
{ SizeT outSize = *destLen; SizeT inSize = *srcLen; *srcLen = *destLen = 0; for (;;) { SizeT inSizeCur = inSize, outSizeCur, dicPos; ELzmaFinishMode curFinishMode; SRes res; if (p->dicPos == p->dicBufSize) p->dicPos = 0; dicPos = p->dicPos; if (outSize > p->dicBufSize - dicPos) { outSizeCur = p->dicBufSize; curFinishMode = LZMA_FINISH_ANY; } else { outSizeCur = dicPos + outSize; curFinishMode = finishMode; } res = LzmaDec_DecodeToDic(p, outSizeCur, src, &inSizeCur, curFinishMode, status); src += inSizeCur; inSize -= inSizeCur; *srcLen += inSizeCur; outSizeCur = p->dicPos - dicPos; memcpy(dest, p->dic + dicPos, outSizeCur); dest += outSizeCur; outSize -= outSizeCur; *destLen += outSizeCur; if (res != 0) return res; if (outSizeCur == 0 || outSize == 0) return SZ_OK; } }
SRes LzmaDec_DecodeToDic | ( | CLzmaDec * | p, |
SizeT | dicLimit, | ||
const Byte * | src, | ||
SizeT * | srcLen, | ||
ELzmaFinishMode | finishMode, | ||
ELzmaStatus * | status | ||
) |
Definition at line 719 of file LzmaDec.cc.
References CLzmaDec::buf, CLzmaDec::code, CLzmaDec::dicPos, DUMMY_ERROR, DUMMY_MATCH, if(), kMatchSpecLenStart, LZMA_FINISH_ANY, LZMA_REQUIRED_INPUT_MAX, LZMA_STATUS_FINISHED_WITH_MARK, LZMA_STATUS_MAYBE_FINISHED_WITHOUT_MARK, LZMA_STATUS_NEEDS_MORE_INPUT, LZMA_STATUS_NOT_FINISHED, LZMA_STATUS_NOT_SPECIFIED, LzmaDec_DecodeReal2(), LzmaDec_InitRc(), LzmaDec_InitStateReal(), LzmaDec_TryDummy(), LzmaDec_WriteRem(), CLzmaDec::needFlush, CLzmaDec::needInitState, RC_INIT_SIZE, CLzmaDec::remainLen, alcazmumu_cfi::src, SZ_ERROR_DATA, SZ_OK, CLzmaDec::tempBuf, and CLzmaDec::tempBufSize.
Referenced by LzmaDec_DecodeToBuf(), and LzmaDecode().
{ SizeT inSize = *srcLen; (*srcLen) = 0; LzmaDec_WriteRem(p, dicLimit); *status = LZMA_STATUS_NOT_SPECIFIED; while (p->remainLen != kMatchSpecLenStart) { int checkEndMarkNow; if (p->needFlush != 0) { for (; inSize > 0 && p->tempBufSize < RC_INIT_SIZE; (*srcLen)++, inSize--) p->tempBuf[p->tempBufSize++] = *src++; if (p->tempBufSize < RC_INIT_SIZE) { *status = LZMA_STATUS_NEEDS_MORE_INPUT; return SZ_OK; } if (p->tempBuf[0] != 0) return SZ_ERROR_DATA; LzmaDec_InitRc(p, p->tempBuf); p->tempBufSize = 0; } checkEndMarkNow = 0; if (p->dicPos >= dicLimit) { if (p->remainLen == 0 && p->code == 0) { *status = LZMA_STATUS_MAYBE_FINISHED_WITHOUT_MARK; return SZ_OK; } if (finishMode == LZMA_FINISH_ANY) { *status = LZMA_STATUS_NOT_FINISHED; return SZ_OK; } if (p->remainLen != 0) { *status = LZMA_STATUS_NOT_FINISHED; return SZ_ERROR_DATA; } checkEndMarkNow = 1; } if (p->needInitState) LzmaDec_InitStateReal(p); if (p->tempBufSize == 0) { SizeT processed; const Byte *bufLimit; if (inSize < LZMA_REQUIRED_INPUT_MAX || checkEndMarkNow) { int dummyRes = LzmaDec_TryDummy(p, src, inSize); if (dummyRes == DUMMY_ERROR) { memcpy(p->tempBuf, src, inSize); p->tempBufSize = (unsigned)inSize; (*srcLen) += inSize; *status = LZMA_STATUS_NEEDS_MORE_INPUT; return SZ_OK; } if (checkEndMarkNow && dummyRes != DUMMY_MATCH) { *status = LZMA_STATUS_NOT_FINISHED; return SZ_ERROR_DATA; } bufLimit = src; } else bufLimit = src + inSize - LZMA_REQUIRED_INPUT_MAX; p->buf = src; if (LzmaDec_DecodeReal2(p, dicLimit, bufLimit) != 0) return SZ_ERROR_DATA; processed = (SizeT)(p->buf - src); (*srcLen) += processed; src += processed; inSize -= processed; } else { unsigned rem = p->tempBufSize, lookAhead = 0; while (rem < LZMA_REQUIRED_INPUT_MAX && lookAhead < inSize) p->tempBuf[rem++] = src[lookAhead++]; p->tempBufSize = rem; if (rem < LZMA_REQUIRED_INPUT_MAX || checkEndMarkNow) { int dummyRes = LzmaDec_TryDummy(p, p->tempBuf, rem); if (dummyRes == DUMMY_ERROR) { (*srcLen) += lookAhead; *status = LZMA_STATUS_NEEDS_MORE_INPUT; return SZ_OK; } if (checkEndMarkNow && dummyRes != DUMMY_MATCH) { *status = LZMA_STATUS_NOT_FINISHED; return SZ_ERROR_DATA; } } p->buf = p->tempBuf; if (LzmaDec_DecodeReal2(p, dicLimit, p->buf) != 0) return SZ_ERROR_DATA; lookAhead -= (rem - (unsigned)(p->buf - p->tempBuf)); (*srcLen) += lookAhead; src += lookAhead; inSize -= lookAhead; p->tempBufSize = 0; } } if (p->code == 0) *status = LZMA_STATUS_FINISHED_WITH_MARK; return (p->code == 0) ? SZ_OK : SZ_ERROR_DATA; }
Definition at line 892 of file LzmaDec.cc.
References LzmaDec_FreeDict(), and LzmaDec_FreeProbs().
Referenced by LzmaFile::Close().
{ LzmaDec_FreeProbs(p, alloc); LzmaDec_FreeDict(p, alloc); }
Definition at line 886 of file LzmaDec.cc.
References CLzmaDec::dic, and ISzAlloc::Free.
Referenced by LzmaDec_Allocate(), and LzmaDec_Free().
Definition at line 880 of file LzmaDec.cc.
References ISzAlloc::Free, and CLzmaDec::probs.
Referenced by LzmaDec_Allocate(), LzmaDec_AllocateProbs2(), LzmaDec_Free(), and LzmaDecode().
void LzmaDec_Init | ( | CLzmaDec * | p | ) |
Definition at line 701 of file LzmaDec.cc.
References CLzmaDec::dicPos, LzmaDec_InitDicAndState(), and True.
Referenced by LzmaDecode(), and LzmaFile::Open().
{ p->dicPos = 0; LzmaDec_InitDicAndState(p, True, True); }
Definition at line 685 of file LzmaDec.cc.
References CLzmaDec::checkDicSize, CLzmaDec::needFlush, CLzmaDec::needInitState, CLzmaDec::processedPos, CLzmaDec::remainLen, and CLzmaDec::tempBufSize.
Referenced by LzmaDec_Init().
{ p->needFlush = 1; p->remainLen = 0; p->tempBufSize = 0; if (initDic) { p->processedPos = 0; p->checkDicSize = 0; p->needInitState = 1; } if (initState) p->needInitState = 1; }
Definition at line 678 of file LzmaDec.cc.
References CLzmaDec::code, CLzmaDec::needFlush, and CLzmaDec::range.
Referenced by LzmaDec_DecodeToDic().
static void LzmaDec_InitStateReal | ( | CLzmaDec * | p | ) | [static] |
Definition at line 707 of file LzmaDec.cc.
References CLzmaProb, i, kBitModelTotal, _CLzmaProps::lc, Literal, _CLzmaProps::lp, LZMA_LIT_SIZE, CLzmaDec::needInitState, CLzmaDec::probs, CLzmaDec::prop, CLzmaDec::reps, and CLzmaDec::state.
Referenced by LzmaDec_DecodeToDic().
static ELzmaDummy LzmaDec_TryDummy | ( | const CLzmaDec * | p, |
const Byte * | buf, | ||
SizeT | inSize | ||
) | [static] |
Definition at line 487 of file LzmaDec.cc.
References Align, CLzmaDec::checkDicSize, CLzmaProb, CLzmaDec::code, CLzmaDec::dic, CLzmaDec::dicBufSize, CLzmaDec::dicPos, DUMMY_LIT, DUMMY_MATCH, DUMMY_REP, GET_BIT2_CHECK, GET_BIT_CHECK, i, IF_BIT_0_CHECK, IsMatch, IsRep, IsRep0Long, IsRepG0, IsRepG1, IsRepG2, kEndPosModelIndex, kLenNumHighBits, kLenNumLowBits, kLenNumLowSymbols, kLenNumMidBits, kLenNumMidSymbols, kNumAlignBits, kNumLenToPosStates, kNumLitStates, kNumPosBitsMax, kNumPosSlotBits, kNumStates, kStartPosModelIndex, _CLzmaProps::lc, LenChoice, LenChoice2, LenCoder, LenHigh, LenLow, LenMid, MessageLogger_cff::limit, Literal, _CLzmaProps::lp, LZMA_LIT_SIZE, NORMALIZE_CHECK, evf::evtn::offset(), _CLzmaProps::pb, PosSlot, CLzmaDec::probs, CLzmaDec::processedPos, CLzmaDec::prop, CLzmaDec::range, RepLenCoder, CLzmaDec::reps, SpecPos, CLzmaDec::state, evf::utils::state, TREE_DECODE_CHECK, UPDATE_0_CHECK, and UPDATE_1_CHECK.
Referenced by LzmaDec_DecodeToDic().
{ UInt32 range = p->range; UInt32 code = p->code; const Byte *bufLimit = buf + inSize; CLzmaProb *probs = p->probs; unsigned state = p->state; ELzmaDummy res; { CLzmaProb *prob; UInt32 bound; unsigned ttt; unsigned posState = (p->processedPos) & ((1 << p->prop.pb) - 1); prob = probs + IsMatch + (state << kNumPosBitsMax) + posState; IF_BIT_0_CHECK(prob) { UPDATE_0_CHECK /* if (bufLimit - buf >= 7) return DUMMY_LIT; */ prob = probs + Literal; if (p->checkDicSize != 0 || p->processedPos != 0) prob += (LZMA_LIT_SIZE * ((((p->processedPos) & ((1 << (p->prop.lp)) - 1)) << p->prop.lc) + (p->dic[(p->dicPos == 0 ? p->dicBufSize : p->dicPos) - 1] >> (8 - p->prop.lc)))); if (state < kNumLitStates) { unsigned symbol = 1; do { GET_BIT_CHECK(prob + symbol, symbol) } while (symbol < 0x100); } else { unsigned matchByte = p->dic[p->dicPos - p->reps[0] + ((p->dicPos < p->reps[0]) ? p->dicBufSize : 0)]; unsigned offs = 0x100; unsigned symbol = 1; do { unsigned bit; CLzmaProb *probLit; matchByte <<= 1; bit = (matchByte & offs); probLit = prob + offs + bit + symbol; GET_BIT2_CHECK(probLit, symbol, offs &= ~bit, offs &= bit) } while (symbol < 0x100); } res = DUMMY_LIT; } else { unsigned len; UPDATE_1_CHECK; prob = probs + IsRep + state; IF_BIT_0_CHECK(prob) { UPDATE_0_CHECK; state = 0; prob = probs + LenCoder; res = DUMMY_MATCH; } else { UPDATE_1_CHECK; res = DUMMY_REP; prob = probs + IsRepG0 + state; IF_BIT_0_CHECK(prob) { UPDATE_0_CHECK; prob = probs + IsRep0Long + (state << kNumPosBitsMax) + posState; IF_BIT_0_CHECK(prob) { UPDATE_0_CHECK; NORMALIZE_CHECK; return DUMMY_REP; } else { UPDATE_1_CHECK; } } else { UPDATE_1_CHECK; prob = probs + IsRepG1 + state; IF_BIT_0_CHECK(prob) { UPDATE_0_CHECK; } else { UPDATE_1_CHECK; prob = probs + IsRepG2 + state; IF_BIT_0_CHECK(prob) { UPDATE_0_CHECK; } else { UPDATE_1_CHECK; } } } state = kNumStates; prob = probs + RepLenCoder; } { unsigned limit, offset; CLzmaProb *probLen = prob + LenChoice; IF_BIT_0_CHECK(probLen) { UPDATE_0_CHECK; probLen = prob + LenLow + (posState << kLenNumLowBits); offset = 0; limit = 1 << kLenNumLowBits; } else { UPDATE_1_CHECK; probLen = prob + LenChoice2; IF_BIT_0_CHECK(probLen) { UPDATE_0_CHECK; probLen = prob + LenMid + (posState << kLenNumMidBits); offset = kLenNumLowSymbols; limit = 1 << kLenNumMidBits; } else { UPDATE_1_CHECK; probLen = prob + LenHigh; offset = kLenNumLowSymbols + kLenNumMidSymbols; limit = 1 << kLenNumHighBits; } } TREE_DECODE_CHECK(probLen, limit, len); len += offset; } if (state < 4) { unsigned posSlot; prob = probs + PosSlot + ((len < kNumLenToPosStates ? len : kNumLenToPosStates - 1) << kNumPosSlotBits); TREE_DECODE_CHECK(prob, 1 << kNumPosSlotBits, posSlot); if (posSlot >= kStartPosModelIndex) { int numDirectBits = ((posSlot >> 1) - 1); /* if (bufLimit - buf >= 8) return DUMMY_MATCH; */ if (posSlot < kEndPosModelIndex) { prob = probs + SpecPos + ((2 | (posSlot & 1)) << numDirectBits) - posSlot - 1; } else { numDirectBits -= kNumAlignBits; do { NORMALIZE_CHECK range >>= 1; code -= range & (((code - range) >> 31) - 1); /* if (code >= range) code -= range; */ } while (--numDirectBits != 0); prob = probs + Align; numDirectBits = kNumAlignBits; } { unsigned i = 1; do { GET_BIT_CHECK(prob + i, i); } while (--numDirectBits != 0); } } } } } NORMALIZE_CHECK; return res; }
Definition at line 428 of file LzmaDec.cc.
References CLzmaDec::checkDicSize, CLzmaDec::dic, CLzmaDec::dicBufSize, CLzmaDec::dicPos, _CLzmaProps::dicSize, kMatchSpecLenStart, CLzmaDec::processedPos, CLzmaDec::prop, CLzmaDec::remainLen, and CLzmaDec::reps.
Referenced by LzmaDec_DecodeReal2(), and LzmaDec_DecodeToDic().
{ if (p->remainLen != 0 && p->remainLen < kMatchSpecLenStart) { Byte *dic = p->dic; SizeT dicPos = p->dicPos; SizeT dicBufSize = p->dicBufSize; unsigned len = p->remainLen; UInt32 rep0 = p->reps[0]; if (limit - dicPos < len) len = (unsigned)(limit - dicPos); if (p->checkDicSize == 0 && p->prop.dicSize - p->processedPos <= len) p->checkDicSize = p->prop.dicSize; p->processedPos += len; p->remainLen -= len; while (len-- != 0) { dic[dicPos] = dic[(dicPos - rep0) + ((dicPos < rep0) ? dicBufSize : 0)]; dicPos++; } p->dicPos = dicPos; } }
SRes LzmaDecode | ( | Byte * | dest, |
SizeT * | destLen, | ||
const Byte * | src, | ||
SizeT * | srcLen, | ||
const Byte * | propData, | ||
unsigned | propSize, | ||
ELzmaFinishMode | finishMode, | ||
ELzmaStatus * | status, | ||
ISzAlloc * | alloc | ||
) |
Definition at line 969 of file LzmaDec.cc.
References alignCSCRings::dest, CLzmaDec::dic, CLzmaDec::dicBufSize, CLzmaDec::dicPos, LZMA_STATUS_NEEDS_MORE_INPUT, LzmaDec_AllocateProbs(), LzmaDec_Construct, LzmaDec_DecodeToDic(), LzmaDec_FreeProbs(), LzmaDec_Init(), AlCaHLTBitMon_ParallelJobs::p, RC_INIT_SIZE, SZ_ERROR_INPUT_EOF, and SZ_OK.
{ CLzmaDec p; SRes res; SizeT inSize = *srcLen; SizeT outSize = *destLen; *srcLen = *destLen = 0; if (inSize < RC_INIT_SIZE) return SZ_ERROR_INPUT_EOF; LzmaDec_Construct(&p); res = LzmaDec_AllocateProbs(&p, propData, propSize, alloc); if (res != 0) return res; p.dic = dest; p.dicBufSize = outSize; LzmaDec_Init(&p); *srcLen = inSize; res = LzmaDec_DecodeToDic(&p, outSize, src, srcLen, finishMode, status); if (res == SZ_OK && *status == LZMA_STATUS_NEEDS_MORE_INPUT) res = SZ_ERROR_INPUT_EOF; (*destLen) = p.dicPos; LzmaDec_FreeProbs(&p, alloc); return res; }
SRes LzmaProps_Decode | ( | CLzmaProps * | p, |
const Byte * | data, | ||
unsigned | size | ||
) |
Definition at line 898 of file LzmaDec.cc.
References _CLzmaProps::dicSize, _CLzmaProps::lc, _CLzmaProps::lp, LZMA_DIC_MIN, LZMA_PROPS_SIZE, _CLzmaProps::pb, SZ_ERROR_UNSUPPORTED, and SZ_OK.
Referenced by LzmaDec_Allocate(), and LzmaDec_AllocateProbs().
{ UInt32 dicSize; Byte d; if (size < LZMA_PROPS_SIZE) return SZ_ERROR_UNSUPPORTED; else dicSize = data[1] | ((UInt32)data[2] << 8) | ((UInt32)data[3] << 16) | ((UInt32)data[4] << 24); if (dicSize < LZMA_DIC_MIN) dicSize = LZMA_DIC_MIN; p->dicSize = dicSize; d = data[0]; if (d >= (9 * 5 * 5)) return SZ_ERROR_UNSUPPORTED; p->lc = d % 9; d /= 9; p->pb = d / 5; p->lp = d % 5; return SZ_OK; }