public class VPXBooleanDecoder extends Object
Modifier | Constructor and Description |
---|---|
protected |
VPXBooleanDecoder()
Empty constructor just for testing
|
|
VPXBooleanDecoder(ByteBuffer input,
int offset) |
Modifier and Type | Method and Description |
---|---|
int |
decodeInt(int sizeInBits) |
static int |
getBitInBytes(byte[] bs,
int i) |
static int |
getBitsInBytes(byte[] bytes,
int idx,
int len) |
static int |
leadingZeroCountInByte(byte b) |
int |
readBit(int probability) |
int |
readBitEq() |
int |
readTree(int[] tree,
int[] probability)
General formula in VP8 trees.
|
int |
readTree3(int[] tree,
int prob0,
int prob1) |
int |
readTreeSkip(int[] t,
int[] p,
int skip_branches) |
void |
seek() |
String |
toString() |
public VPXBooleanDecoder(ByteBuffer input, int offset)
protected VPXBooleanDecoder()
public int readBitEq()
public int readBit(int probability)
public int decodeInt(int sizeInBits)
public int readTree(int[] tree, int[] probability)
tree[i] > 0
iand value
tree[i]
i+1and value
tree[i+1]
-tree[i]
const tree_index mb_segment_tree [2 * (4-1)] = // +-------+---+ // | | | { 2, 4, -0, -1, -2, -3 }; // | | | // +-----------+---+If presented in hierarchical form this tree would look like:
+---------------+ | root | | / \ | | 2 4 | | / \ / \ | | -0 -1 -2 -3 | +---------------+On the other hand probabilities are coded only for non-leaf nodes. Thus tree array has twice as many nodes as probabilities array Consider (3>>1) == 1 == (2>>1), and (0>>1) == 0 == (1>>1) Thus single probability element refers to single parent element in tree. if (using that probability) a '0' is coded, algorithm goes to the left branch, correspondingly if '1' is coded, algorithm goes to the right branch (see tree structure above). The process is repeated until a negative tree element is found.
public int readTree3(int[] tree, int prob0, int prob1)
public int readTreeSkip(int[] t, int[] p, int skip_branches)
public void seek()
public static int getBitInBytes(byte[] bs, int i)
public static int getBitsInBytes(byte[] bytes, int idx, int len)
public static int leadingZeroCountInByte(byte b)
Copyright © 2019. All rights reserved.