示例#1
0
        internal int CreateChild(ModelPpm model, State pStats, StateRef firstState)
        {
            PpmContext pc = GetTempPpmContext(model.SubAlloc.Heap);

            pc.Address = model.SubAlloc.AllocContext();
            if (pc != null)
            {
                pc.NumStats = 1;
                pc.SetOneState(firstState);
                pc.SetSuffix(this);
                pStats.SetSuccessor(pc);
            }
            return(pc.Address);
        }
示例#2
0
        private void RestartModelRare()
        {
            Utility.Fill(_charMask, 0);
            SubAlloc.InitSubAllocator();
            _initRl = -(_maxOrder < 12 ? _maxOrder : 12) - 1;
            int addr = SubAlloc.AllocContext();

            _minContext.Address = addr;
            _maxContext.Address = addr;
            _minContext.SetSuffix(0);
            _orderFall                    = _maxOrder;
            _minContext.NumStats          = 256;
            _minContext.FreqData.SummFreq = _minContext.NumStats + 1;

            addr = SubAlloc.AllocUnits(256 / 2);
            FoundState.Address = addr;
            _minContext.FreqData.SetStats(addr);

            State state = new State(SubAlloc.Heap);

            addr         = _minContext.FreqData.GetStats();
            _runLength   = _initRl;
            _prevSuccess = 0;
            for (int i = 0; i < 256; i++)
            {
                state.Address = addr + i * State.SIZE;
                state.Symbol  = i;
                state.Freq    = 1;
                state.SetSuccessor(0);
            }

            for (int i = 0; i < 128; i++)
            {
                for (int k = 0; k < 8; k++)
                {
                    for (int m = 0; m < 64; m += 8)
                    {
                        _binSumm[i][k + m] = BIN_SCALE - INIT_BIN_ESC[k] / (i + 2);
                    }
                }
            }
            for (int i = 0; i < 25; i++)
            {
                for (int k = 0; k < 16; k++)
                {
                    _see2Cont[i][k].Initialize(5 * i + 10);
                }
            }
        }