// Debug // public void dumpHeap() { // subAlloc.dumpHeap(); // } internal bool decodeInit(Stream stream, int maxOrder, int maxMemory) { if (stream != null) { Coder = new RangeCoder(stream); } if (maxOrder == 1) { SubAlloc.stopSubAllocator(); return(false); } SubAlloc.startSubAllocator(maxMemory); minContext = new PPMContext(Heap); //medContext = new PPMContext(Heap); maxContext = new PPMContext(Heap); FoundState = new State(Heap); dummySEE2Cont = new SEE2Context(); for (int i = 0; i < 25; i++) { for (int j = 0; j < 16; j++) { SEE2Cont[i][j] = new SEE2Context(); } } startModelRare(maxOrder); return(minContext.Address != 0); }
private void InitBlock() { for (int i = 0; i < 25; i++) { SEE2Cont[i] = new SEE2Context[16]; } for (int i2 = 0; i2 < 128; i2++) { binSumm[i2] = new int[64]; } }
internal bool decodeInit(Unpack unpackRead, int escChar) { int MaxOrder = unpackRead.Char & 0xff; bool reset = ((MaxOrder & 0x20) != 0); int MaxMB = 0; if (reset) { MaxMB = unpackRead.Char; } else { if (SubAlloc.GetAllocatedMemory() == 0) { return(false); } } if ((MaxOrder & 0x40) != 0) { escChar = unpackRead.Char; unpackRead.PpmEscChar = escChar; } Coder = new RangeCoder(unpackRead); if (reset) { MaxOrder = (MaxOrder & 0x1f) + 1; if (MaxOrder > 16) { MaxOrder = 16 + (MaxOrder - 16) * 3; } if (MaxOrder == 1) { SubAlloc.stopSubAllocator(); return(false); } SubAlloc.startSubAllocator((MaxMB + 1) << 20); minContext = new PPMContext(Heap); //medContext = new PPMContext(Heap); maxContext = new PPMContext(Heap); FoundState = new State(Heap); dummySEE2Cont = new SEE2Context(); for (int i = 0; i < 25; i++) { for (int j = 0; j < 16; j++) { SEE2Cont[i][j] = new SEE2Context(); } } startModelRare(MaxOrder); } return(minContext.Address != 0); }
internal bool decodeSymbol2(ModelPPM model) { long count; int hiCnt, i = NumStats - model.NumMasked; SEE2Context psee2c = makeEscFreq2(model, i); RangeCoder coder = model.Coder; // STATE* ps[256], ** pps=ps, * p=U.Stats-1; State p = tempState1.Initialize(model.Heap); State temp = tempState2.Initialize(model.Heap); p.Address = freqData.GetStats() - State.Size; int pps = 0; hiCnt = 0; do { do { p.IncrementAddress(); // p++; }while (model.CharMask[p.Symbol] == model.EscCount); hiCnt += p.Freq; ps[pps++] = p.Address; }while (--i != 0); coder.SubRange.incScale(hiCnt); count = coder.CurrentCount; if (count >= coder.SubRange.Scale) { return(false); } pps = 0; p.Address = ps[pps]; if (count < hiCnt) { hiCnt = 0; while ((hiCnt += p.Freq) <= count) { p.Address = ps[++pps]; // p=*++pps; } coder.SubRange.HighCount = hiCnt; coder.SubRange.LowCount = hiCnt - p.Freq; psee2c.update(); update2(model, p.Address); } else { coder.SubRange.LowCount = hiCnt; coder.SubRange.HighCount = coder.SubRange.Scale; i = NumStats - model.NumMasked; // ->NumMasked; pps--; do { temp.Address = ps[++pps]; // (*++pps) model.CharMask[temp.Symbol] = model.EscCount; }while (--i != 0); psee2c.incSumm((int)coder.SubRange.Scale); model.NumMasked = NumStats; } return(true); }