示例#1
0
  public static int readZeroBitCount(BitReader bits, String message) {
    int count = 0;
    while (bits.read1Bit() == 0 && count < 32) count++;

    trace(message, String.valueOf(count));

    return count;
  }
示例#2
0
  public static boolean readBool(BitReader bits, String message) {

    boolean res = bits.read1Bit() == 0 ? false : true;

    trace(message, res ? 1 : 0);

    return res;
  }
示例#3
0
  public static int readUE(BitReader bits) {
    int cnt = 0;
    while (bits.read1Bit() == 0 && cnt < 31) cnt++;

    int res = 0;
    if (cnt > 0) {
      long val = bits.readNBit(cnt);

      res = (int) ((1 << cnt) - 1 + val);
    }

    return res;
  }
示例#4
0
 public static int readTE(BitReader bits, int max) {
   if (max > 1) return readUE(bits);
   return ~bits.read1Bit() & 0x1;
 }