Exemplo n.º 1
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;
  }
Exemplo n.º 2
0
  public static int readNBit(BitReader bits, int n, String message) {
    int val = bits.readNBit(n);

    trace(message, val);

    return val;
  }
Exemplo n.º 3
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;
  }
Exemplo n.º 4
0
  public static boolean readBool(BitReader bits, String message) {

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

    trace(message, res ? 1 : 0);

    return res;
  }
Exemplo n.º 5
0
 public static boolean moreRBSPData(BitReader bits) {
   return !(bits.remaining() < 32 && bits.checkNBit(1) == 1 && (bits.checkNBit(24) << 9) == 0);
 }
Exemplo n.º 6
0
 public static int readTE(BitReader bits, int max) {
   if (max > 1) return readUE(bits);
   return ~bits.read1Bit() & 0x1;
 }