Пример #1
0
 public new void Encode(LzmaRangeEncoder rangeEncoder, uint symbol, uint posState)
 {
     base.Encode(rangeEncoder, symbol, posState);
     if (--this.counters[(IntPtr)posState] != 0U)
     {
         return;
     }
     this.UpdateTable(posState);
 }
Пример #2
0
            public void Encode(LzmaRangeEncoder rangeEncoder, byte symbol)
            {
                uint num = 1;

                for (int index = 7; index >= 0; --index)
                {
                    uint symbol1 = (uint)((int)symbol >> index & 1);
                    this.Encoders[(IntPtr)num].Encode(rangeEncoder, symbol1);
                    num = num << 1 | symbol1;
                }
            }
Пример #3
0
        public void ReverseEncode(LzmaRangeEncoder rangeEncoder, uint symbol)
        {
            uint num = 1;

            for (uint index = 0; (long)index < (long)this.bitLevels; ++index)
            {
                uint symbol1 = symbol & 1U;
                this.models[(IntPtr)num].Encode(rangeEncoder, symbol1);
                num      = num << 1 | symbol1;
                symbol >>= 1;
            }
        }
Пример #4
0
        public void Encode(LzmaRangeEncoder rangeEncoder, uint symbol)
        {
            uint num       = 1;
            int  bitLevels = this.bitLevels;

            while (bitLevels > 0)
            {
                --bitLevels;
                uint symbol1 = symbol >> bitLevels & 1U;
                this.models[(IntPtr)num].Encode(rangeEncoder, symbol1);
                num = num << 1 | symbol1;
            }
        }
Пример #5
0
        public static void ReverseEncode(
            LzmaRangeBitEncoder[] models,
            uint startIndex,
            LzmaRangeEncoder rangeEncoder,
            int bitLevelsNumber,
            uint symbol)
        {
            uint num = 1;

            for (int index = 0; index < bitLevelsNumber; ++index)
            {
                uint symbol1 = symbol & 1U;
                models[(IntPtr)(startIndex + num)].Encode(rangeEncoder, symbol1);
                num      = num << 1 | symbol1;
                symbol >>= 1;
            }
        }
Пример #6
0
            public void EncodeMatched(LzmaRangeEncoder rangeEncoder, byte matchByte, byte symbol)
            {
                uint num1 = 1;
                bool flag = true;

                for (int index = 7; index >= 0; --index)
                {
                    uint symbol1 = (uint)((int)symbol >> index & 1);
                    uint num2    = num1;
                    if (flag)
                    {
                        uint num3 = (uint)((int)matchByte >> index & 1);
                        num2 += (uint)(1 + (int)num3 << 8);
                        flag  = (int)num3 == (int)symbol1;
                    }
                    this.Encoders[(IntPtr)num2].Encode(rangeEncoder, symbol1);
                    num1 = num1 << 1 | symbol1;
                }
            }
Пример #7
0
        public void Encode(LzmaRangeEncoder encoder, uint symbol)
        {
            uint num = (encoder.Range >> 11) * this.probability;

            if (symbol == 0U)
            {
                encoder.Range     = num;
                this.probability += 2048U - this.probability >> 5;
            }
            else
            {
                encoder.Low      += (ulong)num;
                encoder.Range    -= num;
                this.probability -= this.probability >> 5;
            }
            if (encoder.Range >= 16777216U)
            {
                return;
            }
            encoder.Range <<= 8;
            encoder.ShiftLow();
        }
Пример #8
0
 public void Encode(LzmaRangeEncoder rangeEncoder, uint symbol, uint posState)
 {
     if (symbol < 8U)
     {
         this.choice.Encode(rangeEncoder, 0U);
         this.lowCoder[(IntPtr)posState].Encode(rangeEncoder, symbol);
     }
     else
     {
         symbol -= 8U;
         this.choice.Encode(rangeEncoder, 1U);
         if (symbol < 8U)
         {
             this.choice2.Encode(rangeEncoder, 0U);
             this.middleCoder[(IntPtr)posState].Encode(rangeEncoder, symbol);
         }
         else
         {
             this.choice2.Encode(rangeEncoder, 1U);
             this.highCoder.Encode(rangeEncoder, symbol - 8U);
         }
     }
 }