Пример #1
0
            public uint Decode(RangeDecoder decoder)
            {
                uint newBound = (decoder.Range >> kNumBitModelTotalBits) * Prob;

                if (decoder.Code < newBound)
                {
                    decoder.Range = newBound;
                    Prob         += (kBitModelTotal - Prob) >> numMoveBits;
                    if (decoder.Range < kTopValue)
                    {
                        decoder.Code    = (decoder.Code << 8) | decoder.ReadByte();
                        decoder.Range <<= 8;
                    }
                    return(0);
                }
                else
                {
                    decoder.Range -= newBound;
                    decoder.Code  -= newBound;
                    Prob          -= Prob >> numMoveBits;
                    if (decoder.Range < kTopValue)
                    {
                        decoder.Code    = (decoder.Code << 8) | decoder.ReadByte();
                        decoder.Range <<= 8;
                    }
                    return(1);
                }
            }
Пример #2
0
            public uint Decode(RangeDecoder decoder)
            {
                uint newBound = (decoder._range >> K_NUM_BIT_MODEL_TOTAL_BITS) * _prob;

                if (decoder._code < newBound)
                {
                    decoder._range = newBound;
                    _prob         += (K_BIT_MODEL_TOTAL - _prob) >> NUM_MOVE_BITS;
                    if (decoder._range < K_TOP_VALUE)
                    {
                        decoder._code    = (decoder._code << 8) | decoder.ReadByte();
                        decoder._range <<= 8;
                    }
                    return(0);
                }
                decoder._range -= newBound;
                decoder._code  -= newBound;
                _prob          -= _prob >> NUM_MOVE_BITS;
                if (decoder._range < K_TOP_VALUE)
                {
                    decoder._code    = (decoder._code << 8) | decoder.ReadByte();
                    decoder._range <<= 8;
                }
                return(1);
            }
Пример #3
0
 public uint Decode(RangeDecoder decoder)
 {
     uint newBound = (decoder.Range >> kNumBitModelTotalBits) * Prob;
     if (decoder.Code < newBound)
     {
         decoder.Range = newBound;
         Prob += (kBitModelTotal - Prob) >> numMoveBits;
         if (decoder.Range < kTopValue)
         {
             decoder.Code = (decoder.Code << 8) | decoder.ReadByte();
             decoder.Range <<= 8;
         }
         return 0;
     }
     else
     {
         decoder.Range -= newBound;
         decoder.Code -= newBound;
         Prob -= Prob >> numMoveBits;
         if (decoder.Range < kTopValue)
         {
             decoder.Code = (decoder.Code << 8) | decoder.ReadByte();
             decoder.Range <<= 8;
         }
         return 1;
     }
 }