コード例 #1
0
        // 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);
        }
コード例 #2
0
        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);
        }