Пример #1
0
        public void Code(Stream inStream, Stream outStream,
                         Int64 inSize, Int64 outSize, ICodeProgress progress)
        {
            if (_outWindow is null)
            {
                CreateDictionary();
            }
            _outWindow.Init(outStream);
            if (outSize > 0)
            {
                _outWindow.SetLimit(outSize);
            }
            else
            {
                _outWindow.SetLimit(Int64.MaxValue - _outWindow._total);
            }

            RangeCoder.Decoder rangeDecoder = new RangeCoder.Decoder();
            rangeDecoder.Init(inStream);

            Code(_dictionarySize, _outWindow, rangeDecoder);

            _outWindow.ReleaseStream();
            rangeDecoder.ReleaseStream();

            if (!rangeDecoder.IsFinished || (inSize > 0 && rangeDecoder._total != inSize))
            {
                throw new DataErrorException();
            }
            if (_outWindow.HasPending)
            {
                throw new DataErrorException();
            }
            _outWindow = null;
        }
Пример #2
0
        private void Init(Stream inStream, Stream outStream)
        {
            m_RangeDecoder.Init(inStream);
            m_OutWindow.Init(outStream, _solid);
            for (uint num = 0u; num < 12; num++)
            {
                for (uint num2 = 0u; num2 <= m_PosStateMask; num2++)
                {
                    uint num3 = (num << 4) + num2;
                    m_IsMatchDecoders[num3].Init();
                    m_IsRep0LongDecoders[num3].Init();
                }

                m_IsRepDecoders[num].Init();
                m_IsRepG0Decoders[num].Init();
                m_IsRepG1Decoders[num].Init();
                m_IsRepG2Decoders[num].Init();
            }

            m_LiteralDecoder.Init();
            for (uint num = 0u; num < 4; num++)
            {
                m_PosSlotDecoder[num].Init();
            }

            for (uint num = 0u; num < 114; num++)
            {
                m_PosDecoders[num].Init();
            }

            m_LenDecoder.Init();
            m_RepLenDecoder.Init();
            m_PosAlignDecoder.Init();
        }
Пример #3
0
        public void Code(Stream inStream, Stream outStream,
                         Int64 inSize, Int64 outSize, ICodeProgress progress)
        {
            if (_outWindow is null)
            {
                CreateDictionary();
            }
            _outWindow.Init(outStream);
            if (outSize > 0)
            {
                _outWindow.SetLimit(outSize);
            }
            else
            {
                _outWindow.SetLimit(Int64.MaxValue - _outWindow._total);
            }

            RangeCoder.Decoder rangeDecoder = new RangeCoder.Decoder();
            rangeDecoder.Init(inStream);

            Code(_dictionarySize, _outWindow, rangeDecoder);

            _outWindow.ReleaseStream();
            rangeDecoder.ReleaseStream();

            _outWindow = null;
        }
Пример #4
0
        void Init(Stream inStream, Stream outStream)
        {
            m_RangeDecoder.Init(inStream);
            m_OutWindow.Init(outStream, _solid);

            uint i;

            for (i = 0; i < Base.kNumStates; i++)
            {
                for (uint j = 0; j <= m_PosStateMask; j++)
                {
                    uint index = (i << Base.kNumPosStatesBitsMax) + j;
                    m_IsMatchDecoders[index].Init();
                    m_IsRep0LongDecoders[index].Init();
                }
                m_IsRepDecoders[i].Init();
                m_IsRepG0Decoders[i].Init();
                m_IsRepG1Decoders[i].Init();
                m_IsRepG2Decoders[i].Init();
            }

            m_LiteralDecoder.Init();
            for (i = 0; i < Base.kNumLenToPosStates; i++)
            {
                m_PosSlotDecoder[i].Init();
            }
            // m_PosSpecDecoder.Init();
            for (i = 0; i < Base.kNumFullDistances - Base.kEndPosModelIndex; i++)
            {
                m_PosDecoders[i].Init();
            }

            m_LenDecoder.Init();
            m_RepLenDecoder.Init();
            m_PosAlignDecoder.Init();
        }