- if(!get_bits1(gb)){ //Leaf
- int val, i1, i2, b1, b2;
- b1 = get_bits_count(gb);
- i1 = ctx->v1->table ? get_vlc2(gb, ctx->v1->table, SMKTREE_BITS, 3) : 0;
- b1 = get_bits_count(gb) - b1;
- b2 = get_bits_count(gb);
- i2 = ctx->v2->table ? get_vlc2(gb, ctx->v2->table, SMKTREE_BITS, 3) : 0;
- b2 = get_bits_count(gb) - b2;
+ if (!bitstream_read_bit(bc)) { // Leaf
+ int val, i1, i2;
+ i1 = ctx->v1->table ? bitstream_read_vlc(bc, ctx->v1->table, SMKTREE_BITS, 3) : 0;
+ i2 = ctx->v2->table ? bitstream_read_vlc(bc, ctx->v2->table, SMKTREE_BITS, 3) : 0;