Esempio n. 1
0
            public int Decode(TRangeDecoder rangeDecoder)
            {
                int m, bitIndex;

                m = 1;
                for (bitIndex = NumBitLevels; bitIndex >= 1; bitIndex--)
                {
                    m = m << 1 + rangeDecoder.DecodeBit(Models, m);
                }
                return(m - (1 << NumBitLevels));
            }
Esempio n. 2
0
            public byte DecodeNormal(TRangeDecoder rangeDecoder)
            {
                int symbol;

                symbol = 1;
                do
                {
                    symbol = (symbol << 1) | rangeDecoder.DecodeBit(m_Decoders, symbol);
                } while (symbol < 0x100);
                return((byte)symbol);
            }
Esempio n. 3
0
        public static int ReverseDecode(short[] Models, int startIndex, TRangeDecoder rangeDecoder, int NumBitLevels)
        {
            int m, symbol, bitindex, bit;

            m      = 1;
            symbol = 0;
            for (bitindex = 0; bitindex < NumBitLevels; bitindex++)
            {
                bit    = rangeDecoder.DecodeBit(Models, startIndex + m);
                m      = (m << 1) + bit;
                symbol = symbol | bit << bitindex;
            }
            return(symbol);
        }
Esempio n. 4
0
            public int ReverseDecode(TRangeDecoder rangeDecoder)
            {
                int m, symbol, bitindex, bit;

                m      = 1;
                symbol = 0;
                for (bitindex = 0; bitindex < NumBitLevels; bitindex++)
                {
                    bit    = rangeDecoder.DecodeBit(Models, m);
                    m      = (m << 1) + bit;
                    symbol = symbol | (bit << bitindex);
                }
                return(symbol);
            }
Esempio n. 5
0
            public TLZMADecoder()
            {
                int i;

                FOnProgress           = null;
                m_OutWindow           = new TLZOutWindow();
                m_RangeDecoder        = new TRangeDecoder();
                m_PosAlignDecoder     = new TBitTreeDecoder(ULZMABase.kNumAlignBits);
                m_LenDecoder          = new TLZMALenDecoder();
                m_RepLenDecoder       = new TLZMALenDecoder();
                m_LiteralDecoder      = new TLZMALiteralDecoder();
                m_DictionarySize      = -1;
                m_DictionarySizeCheck = -1;
                for (i = 0; i < ULZMABase.kNumLenToPosStates; i++)
                {
                    m_PosSlotDecoder[i] = new TBitTreeDecoder(ULZMABase.kNumPosSlotBits);
                }
            }
Esempio n. 6
0
            public int Decode(TRangeDecoder rangeDecoder, int posState)
            {
                int symbol;

                if (rangeDecoder.DecodeBit(m_Choice, 0) == 0)
                {
                    return(m_LowCoder[posState].Decode(rangeDecoder));
                }
                symbol = ULZMABase.kNumLowLenSymbols;
                if (rangeDecoder.DecodeBit(m_Choice, 1) == 0)
                {
                    symbol = symbol + m_MidCoder[posState].Decode(rangeDecoder);
                }
                else
                {
                    symbol = symbol + ULZMABase.kNumMidLenSymbols + m_HighCoder.Decode(rangeDecoder);
                }
                return(symbol);
            }
Esempio n. 7
0
            public byte DecodeWithMatchByte(TRangeDecoder rangeDecoder, byte matchByte)
            {
                int symbol;
                int matchBit;
                int bit;

                symbol = 1;
                do
                {
                    matchBit  = (matchByte >> 7) & 1;
                    matchByte = (byte)(matchByte << 1);
                    bit       = rangeDecoder.DecodeBit(m_Decoders, ((1 + matchBit) << 8) + symbol);
                    symbol    = (symbol << 1) | bit;
                    if (matchBit != bit)
                    {
                        while (symbol < 0x100)
                        {
                            symbol = (symbol << 1) | rangeDecoder.DecodeBit(m_Decoders, symbol);
                        }
                        break;
                    }
                } while (symbol < 0x100);
                return((byte)symbol);
            }