Exemple #1
0
        public void ReverseEncode(CRangeEncoder rangeEncoder, UInt32 symbol)
        {
            UInt32 m = 1;

            for (UInt32 i = 0; i < NumBitLevels; i++)
            {
                UInt32 bit = symbol & 1;
                Models[m].Encode(rangeEncoder, bit);
                m        = (m << 1) | bit;
                symbol >>= 1;
            }
        }
Exemple #2
0
        public void Encode(CRangeEncoder rangeEncoder, UInt32 symbol)
        {
            UInt32 m = 1;

            for (int bitIndex = NumBitLevels; bitIndex > 0;)
            {
                bitIndex--;
                UInt32 bit = (symbol >> bitIndex) & 1;
                Models[m].Encode(rangeEncoder, bit);
                m = (m << 1) | bit;
            }
        }
Exemple #3
0
        public static void ReverseEncode(CBitEncoder[] Models, UInt32 startIndex,
                                         CRangeEncoder rangeEncoder, int NumBitLevels, UInt32 symbol)
        {
            UInt32 m = 1;

            for (int i = 0; i < NumBitLevels; i++)
            {
                UInt32 bit = symbol & 1;
                Models[startIndex + m].Encode(rangeEncoder, bit);
                m        = (m << 1) | bit;
                symbol >>= 1;
            }
        }
        public void Encode(CRangeEncoder encoder, uint symbol)
        {
            // encoder.EncodeBit(Prob, kNumBitModelTotalBits, symbol);
            // UpdateModel(symbol);
            uint newBound = (encoder.Range >> kNumBitModelTotalBits) * Prob;

            if (symbol == 0)
            {
                encoder.Range = newBound;
                Prob         += (kBitModelTotal - Prob) >> kNumMoveBits;
            }
            else
            {
                encoder.Low   += newBound;
                encoder.Range -= newBound;
                Prob          -= (Prob) >> kNumMoveBits;
            }
            if (encoder.Range < CRangeEncoder.kTopValue)
            {
                encoder.Range <<= 8;
                encoder.ShiftLow();
            }
        }