Пример #1
0
 public static void ReverseEncode(RangeBitEncoder[] Models, UInt32 startIndex,
     RangeEncoder 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;
     }
 }
Пример #2
0
 public static UInt32 ReverseGetPrice(RangeBitEncoder[] Models, UInt32 startIndex,
     int NumBitLevels, UInt32 symbol)
 {
     UInt32 price = 0;
     UInt32 m = 1;
     for (int i = NumBitLevels; i > 0; i--)
     {
         UInt32 bit = symbol & 1;
         symbol >>= 1;
         price += Models[startIndex + m].GetPrice(bit);
         m = (m << 1) | bit;
     }
     return price;
 }