Lines Matching refs:UInt32
17 const UInt32 kIfinityPrice = 0xFFFFFFF;
29 UInt32 k = ((UInt32)1 << ((slotFast >> 1) - 1)); in Encoder()
30 for (UInt32 j = 0; j < k; j++, c++) in Encoder()
35 static UInt32 GetPosSlot(UInt32 pos) in GetPosSlot()
40 return (UInt32)(g_FastPos[pos >> 10] + 20); in GetPosSlot()
41 return (UInt32)(g_FastPos[pos >> 20] + 40); in GetPosSlot()
44 static UInt32 GetPosSlot2(UInt32 pos) in GetPosSlot2()
47 return (UInt32)(g_FastPos[pos >> 6] + 12); in GetPosSlot2()
49 return (UInt32)(g_FastPos[pos >> 16] + 32); in GetPosSlot2()
50 return (UInt32)(g_FastPos[pos >> 26] + 52); in GetPosSlot2()
55 UInt32[] _repDistances = new UInt32[Base.kNumRepDistances];
61 for (UInt32 i = 0; i < Base.kNumRepDistances; i++) in BaseInit()
66 const UInt32 kNumFastBytesDefault = 0x20;
163 public Encoder2 GetSubCoder(UInt32 pos, Byte prevByte) in GetSubCoder()
177 for (UInt32 posState = 0; posState < Base.kNumPosStatesEncodingMax; posState++) in LenEncoder()
184 public void Init(UInt32 numPosStates) in Init()
188 for (UInt32 posState = 0; posState < numPosStates; posState++) in Init()
196 public void Encode(RangeCoder.Encoder rangeEncoder, UInt32 symbol, UInt32 posState) in Encode()
220 public void SetPrices(UInt32 posState, UInt32 numSymbols, UInt32[] prices, UInt32 st) in SetPrices()
222 UInt32 a0 = _choice.GetPrice0(); in SetPrices()
223 UInt32 a1 = _choice.GetPrice1(); in SetPrices()
224 UInt32 b0 = a1 + _choice2.GetPrice0(); in SetPrices()
225 UInt32 b1 = a1 + _choice2.GetPrice1(); in SetPrices()
226 UInt32 i = 0; in SetPrices()
244 const UInt32 kNumLenSpecSymbols = Base.kNumLowLenSymbols + Base.kNumMidLenSymbols;
248 UInt32[] _prices = new UInt32[Base.kNumLenSymbols << Base.kNumPosStatesBitsEncodingMax];
249 UInt32 _tableSize;
250 UInt32[] _counters = new UInt32[Base.kNumPosStatesEncodingMax];
252 public void SetTableSize(UInt32 tableSize) { _tableSize = tableSize; } in SetTableSize()
254 public UInt32 GetPrice(UInt32 symbol, UInt32 posState) in GetPrice()
259 void UpdateTable(UInt32 posState) in UpdateTable()
265 public void UpdateTables(UInt32 numPosStates) in UpdateTables()
267 for (UInt32 posState = 0; posState < numPosStates; posState++) in UpdateTables()
271 public new void Encode(RangeCoder.Encoder rangeEncoder, UInt32 symbol, UInt32 posState) in Encode()
279 const UInt32 kNumOpts = 1 << 12;
287 public UInt32 PosPrev2;
288 public UInt32 BackPrev2;
290 public UInt32 Price;
291 public UInt32 PosPrev;
292 public UInt32 BackPrev;
294 public UInt32 Backs0;
295 public UInt32 Backs1;
296 public UInt32 Backs2;
297 public UInt32 Backs3;
324 UInt32[] _matchDistances = new UInt32[Base.kMatchMaxLen * 2 + 2];
326 UInt32 _numFastBytes = kNumFastBytesDefault;
327 UInt32 _longestMatchLength;
328 UInt32 _numDistancePairs;
330 UInt32 _additionalOffset;
332 UInt32 _optimumEndIndex;
333 UInt32 _optimumCurrentIndex;
337 UInt32[] _posSlotPrices = new UInt32[1 << (Base.kNumPosSlotBits + Base.kNumLenToPosStatesBits)];
338 UInt32[] _distancesPrices = new UInt32[Base.kNumFullDistances << Base.kNumLenToPosStatesBits];
339 UInt32[] _alignPrices = new UInt32[Base.kAlignTableSize];
340 UInt32 _alignPriceCount;
342 UInt32 _distTableSize = (kDefaultDictionaryLogSize * 2);
345 UInt32 _posStateMask = (4 - 1);
349 UInt32 _dictionarySize = (1 << kDefaultDictionaryLogSize);
350 UInt32 _dictionarySizePrev = 0xFFFFFFFF;
351 UInt32 _numFastBytesPrev = 0xFFFFFFFF;
420 _lenEncoder.Init((UInt32)1 << _posStateBits); in Init()
421 _repMatchLenEncoder.Init((UInt32)1 << _posStateBits); in Init()
431 void ReadMatchDistances(out UInt32 lenRes, out UInt32 numDistancePairs) in ReadMatchDistances()
446 void MovePos(UInt32 num) in MovePos()
455 UInt32 GetRepLen1Price(Base.State state, UInt32 posState) in GetRepLen1Price()
461 UInt32 GetPureRepPrice(UInt32 repIndex, Base.State state, UInt32 posState) in GetPureRepPrice()
463 UInt32 price; in GetPureRepPrice()
483 UInt32 GetRepPrice(UInt32 repIndex, UInt32 len, Base.State state, UInt32 posState) in GetRepPrice()
485 UInt32 price = _repMatchLenEncoder.GetPrice(len - Base.kMatchMinLen, posState); in GetRepPrice()
489 UInt32 GetPosLenPrice(UInt32 pos, UInt32 len, UInt32 posState) in GetPosLenPrice()
491 UInt32 price; in GetPosLenPrice()
492 UInt32 lenToPosState = Base.GetLenToPosState(len); in GetPosLenPrice()
501 UInt32 Backward(out UInt32 backRes, UInt32 cur) in Backward()
504 UInt32 posMem = _optimum[cur].PosPrev; in Backward()
505 UInt32 backMem = _optimum[cur].BackPrev; in Backward()
519 UInt32 posPrev = posMem; in Backward()
520 UInt32 backCur = backMem; in Backward()
535 UInt32[] reps = new UInt32[Base.kNumRepDistances];
536 UInt32[] repLens = new UInt32[Base.kNumRepDistances];
539 UInt32 GetOptimum(UInt32 position, out UInt32 backRes) in GetOptimum()
543 UInt32 lenRes = _optimum[_optimumCurrentIndex].PosPrev - _optimumCurrentIndex; in GetOptimum()
550 UInt32 lenMain, numDistancePairs; in GetOptimum()
562 UInt32 numAvailableBytes = _matchFinder.GetNumAvailableBytes() + 1; in GetOptimum()
571 UInt32 repMaxIndex = 0; in GetOptimum()
572 UInt32 i; in GetOptimum()
583 UInt32 lenRes = repLens[repMaxIndex]; in GetOptimum()
600 backRes = (UInt32)0xFFFFFFFF; in GetOptimum()
606 UInt32 posState = (position & _posStateMask); in GetOptimum()
612 UInt32 matchPrice = _isMatch[(_state.Index << Base.kNumPosStatesBitsMax) + posState].GetPrice1(); in GetOptimum()
613 UInt32 repMatchPrice = matchPrice + _isRep[_state.Index].GetPrice1(); in GetOptimum()
617 UInt32 shortRepPrice = repMatchPrice + GetRepLen1Price(_state, posState); in GetOptimum()
625 UInt32 lenEnd = ((lenMain >= repLens[repMaxIndex]) ? lenMain : repLens[repMaxIndex]); in GetOptimum()
640 UInt32 len = lenEnd; in GetOptimum()
647 UInt32 repLen = repLens[i]; in GetOptimum()
650 UInt32 price = repMatchPrice + GetPureRepPrice(i, _state, posState); in GetOptimum()
653 UInt32 curAndLenPrice = price + _repMatchLenEncoder.GetPrice(repLen - 2, posState); in GetOptimum()
666 UInt32 normalMatchPrice = matchPrice + _isRep[_state.Index].GetPrice0(); in GetOptimum()
671 UInt32 offs = 0; in GetOptimum()
676 UInt32 distance = _matchDistances[offs + 1]; in GetOptimum()
677 UInt32 curAndLenPrice = normalMatchPrice + GetPosLenPrice(distance, len, posState); in GetOptimum()
695 UInt32 cur = 0; in GetOptimum()
702 UInt32 newLen; in GetOptimum()
712 UInt32 posPrev = _optimum[cur].PosPrev; in GetOptimum()
740 UInt32 pos; in GetOptimum()
800 UInt32 curPrice = _optimum[cur].Price; in GetOptimum()
807 UInt32 curAnd1Price = curPrice + in GetOptimum()
829 UInt32 shortRepPrice = repMatchPrice + GetRepLen1Price(state, posState); in GetOptimum()
839 UInt32 numAvailableBytesFull = _matchFinder.GetNumAvailableBytes() + 1; in GetOptimum()
850 UInt32 t = Math.Min(numAvailableBytesFull - 1, _numFastBytes); in GetOptimum()
851 UInt32 lenTest2 = _matchFinder.GetMatchLen(0, reps[0], t); in GetOptimum()
856 UInt32 posStateNext = (position + 1) & _posStateMask; in GetOptimum()
857 UInt32 nextRepMatchPrice = curAnd1Price + in GetOptimum()
861 UInt32 offset = cur + 1 + lenTest2; in GetOptimum()
864 UInt32 curAndLenPrice = nextRepMatchPrice + GetRepPrice( in GetOptimum()
879 UInt32 startLen = 2; // speed optimization in GetOptimum()
881 for (UInt32 repIndex = 0; repIndex < Base.kNumRepDistances; repIndex++) in GetOptimum()
883 UInt32 lenTest = _matchFinder.GetMatchLen(0 - 1, reps[repIndex], numAvailableBytes); in GetOptimum()
886 UInt32 lenTestTemp = lenTest; in GetOptimum()
891 UInt32 curAndLenPrice = repMatchPrice + GetRepPrice(repIndex, lenTest, state, posState); in GetOptimum()
910 UInt32 t = Math.Min(numAvailableBytesFull - 1 - lenTest, _numFastBytes); in GetOptimum()
911 UInt32 lenTest2 = _matchFinder.GetMatchLen((Int32)lenTest, reps[repIndex], t); in GetOptimum()
916 UInt32 posStateNext = (position + lenTest) & _posStateMask; in GetOptimum()
917 UInt32 curAndLenCharPrice = in GetOptimum()
926 …UInt32 nextMatchPrice = curAndLenCharPrice + _isMatch[(state2.Index << Base.kNumPosStatesBitsMax) … in GetOptimum()
927 UInt32 nextRepMatchPrice = nextMatchPrice + _isRep[state2.Index].GetPrice1(); in GetOptimum()
931 UInt32 offset = lenTest + 1 + lenTest2; in GetOptimum()
934 UInt32 curAndLenPrice = nextRepMatchPrice + GetRepPrice(0, lenTest2, state2, posStateNext); in GetOptimum()
964 UInt32 offs = 0; in GetOptimum()
968 for (UInt32 lenTest = startLen; ; lenTest++) in GetOptimum()
970 UInt32 curBack = _matchDistances[offs + 1]; in GetOptimum()
971 UInt32 curAndLenPrice = normalMatchPrice + GetPosLenPrice(curBack, lenTest, posState); in GetOptimum()
985 UInt32 t = Math.Min(numAvailableBytesFull - 1 - lenTest, _numFastBytes); in GetOptimum()
986 UInt32 lenTest2 = _matchFinder.GetMatchLen((Int32)lenTest, curBack, t); in GetOptimum()
991 UInt32 posStateNext = (position + lenTest) & _posStateMask; in GetOptimum()
992 UInt32 curAndLenCharPrice = curAndLenPrice + in GetOptimum()
1001 …UInt32 nextMatchPrice = curAndLenCharPrice + _isMatch[(state2.Index << Base.kNumPosStatesBitsMax) … in GetOptimum()
1002 UInt32 nextRepMatchPrice = nextMatchPrice + _isRep[state2.Index].GetPrice1(); in GetOptimum()
1004 UInt32 offset = lenTest + 1 + lenTest2; in GetOptimum()
1030 bool ChangePair(UInt32 smallDist, UInt32 bigDist) in ChangePair()
1033 return (smallDist < ((UInt32)(1) << (32 - kDif)) && bigDist >= (smallDist << kDif)); in ChangePair()
1036 void WriteEndMarker(UInt32 posState) in WriteEndMarker()
1044 UInt32 len = Base.kMatchMinLen; in WriteEndMarker()
1046 UInt32 posSlot = (1 << Base.kNumPosSlotBits) - 1; in WriteEndMarker()
1047 UInt32 lenToPosState = Base.GetLenToPosState(len); in WriteEndMarker()
1050 UInt32 posReduced = (((UInt32)1) << footerBits) - 1; in WriteEndMarker()
1055 void Flush(UInt32 nowPos) in Flush()
1089 Flush((UInt32)nowPos64); in CodeOneBlock()
1092 UInt32 len, numDistancePairs; // it's not used in CodeOneBlock()
1094 UInt32 posState = (UInt32)(nowPos64) & _posStateMask; in CodeOneBlock()
1098 _literalEncoder.GetSubCoder((UInt32)(nowPos64), _previousByte).Encode(_rangeEncoder, curByte); in CodeOneBlock()
1105 Flush((UInt32)nowPos64); in CodeOneBlock()
1110 UInt32 pos; in CodeOneBlock()
1111 UInt32 len = GetOptimum((UInt32)nowPos64, out pos); in CodeOneBlock()
1113 UInt32 posState = ((UInt32)nowPos64) & _posStateMask; in CodeOneBlock()
1114 UInt32 complexState = (_state.Index << Base.kNumPosStatesBitsMax) + posState; in CodeOneBlock()
1119 … LiteralEncoder.Encoder2 subCoder = _literalEncoder.GetSubCoder((UInt32)nowPos64, _previousByte); in CodeOneBlock()
1162 UInt32 distance = _repDistances[pos]; in CodeOneBlock()
1165 for (UInt32 i = pos; i >= 1; i--) in CodeOneBlock()
1176 UInt32 posSlot = GetPosSlot(pos); in CodeOneBlock()
1177 UInt32 lenToPosState = Base.GetLenToPosState(len); in CodeOneBlock()
1183 UInt32 baseVal = ((2 | (posSlot & 1)) << footerBits); in CodeOneBlock()
1184 UInt32 posReduced = pos - baseVal; in CodeOneBlock()
1196 UInt32 distance = pos; in CodeOneBlock()
1197 for (UInt32 i = Base.kNumRepDistances - 1; i >= 1; i--) in CodeOneBlock()
1217 Flush((UInt32)nowPos64); in CodeOneBlock()
1265 _lenEncoder.UpdateTables((UInt32)1 << _posStateBits); in SetStreams()
1267 _repMatchLenEncoder.UpdateTables((UInt32)1 << _posStateBits); in SetStreams()
1311 UInt32[] tempPrices = new UInt32[Base.kNumFullDistances];
1312 UInt32 _matchPriceCount;
1316 for (UInt32 i = Base.kStartPosModelIndex; i < Base.kNumFullDistances; i++) in FillDistancesPrices()
1318 UInt32 posSlot = GetPosSlot(i); in FillDistancesPrices()
1320 UInt32 baseVal = ((2 | (posSlot & 1)) << footerBits); in FillDistancesPrices()
1325 for (UInt32 lenToPosState = 0; lenToPosState < Base.kNumLenToPosStates; lenToPosState++) in FillDistancesPrices()
1327 UInt32 posSlot; in FillDistancesPrices()
1330 UInt32 st = (lenToPosState << Base.kNumPosSlotBits); in FillDistancesPrices()
1336 UInt32 st2 = lenToPosState * Base.kNumFullDistances; in FillDistancesPrices()
1337 UInt32 i; in FillDistancesPrices()
1348 for (UInt32 i = 0; i < Base.kAlignTableSize; i++) in FillAlignPrices()
1370 for (UInt32 i = 0; i < properties.Length; i++) in SetCoderProperties()
1382 _numFastBytes = (UInt32)numFastBytes; in SetCoderProperties()
1418 if (dictionarySize < (UInt32)(1 << Base.kDicLogSizeMin) || in SetCoderProperties()
1419 dictionarySize > (UInt32)(1 << kDicLogSizeMaxCompress)) in SetCoderProperties()
1421 _dictionarySize = (UInt32)dictionarySize; in SetCoderProperties()
1423 for (dicLogSize = 0; dicLogSize < (UInt32)kDicLogSizeMaxCompress; dicLogSize++) in SetCoderProperties()
1424 if (dictionarySize <= ((UInt32)(1) << dicLogSize)) in SetCoderProperties()
1426 _distTableSize = (UInt32)dicLogSize * 2; in SetCoderProperties()
1434 if (v < 0 || v > (UInt32)Base.kNumPosStatesBitsEncodingMax) in SetCoderProperties()
1437 _posStateMask = (((UInt32)1) << (int)_posStateBits) - 1; in SetCoderProperties()
1445 if (v < 0 || v > (UInt32)Base.kNumLitPosStatesBitsEncodingMax) in SetCoderProperties()
1455 if (v < 0 || v > (UInt32)Base.kNumLitContextBitsMax) in SetCoderProperties()