blob: 2a90356d846890b137256bed22355ace9a67b312 [file] [log] [blame]
#### 9.5 Token Partition and Partition Data Offsets {#h-09-05}
VP8 allows DCT coefficients to be packed into multiple partitions besides the first partition with header and per-macroblock prediction information, so the decoder can perform parallel decoding in an efficient manner. There are two bits `L(2)` used to indicate the number of coefficient data partitions within a compressed frame. The two bits are defined in the following table:
| Bit 1 | Bit 0 | Number of Partitions
| :-----: | :-----: | :--------------------:
| 0 | 0 | 1
| 0 | 1 | 2
| 1 | 0 | 4
| 1 | 1 | 8
Offsets are embedded in the bitstream to provide the decoder direct access to token partitions. If the number of data partitions is greater then 1, the size of each partition (except the last) is written in 3 bytes (24 bits). The size of the last partition is the remainder of the data not used by any of the previous partitions. The partitioned data are consecutive in the bitstream, so the size can also be used to calculate the offset of each partition. The following pseudo code illustrates how the size/offset is defined by the three bytes in the bitstream.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Offset/size = (uint32)(byte0) + ((uint32)(byte1)<<8)
+ ((uint32)(byte2)<<16);
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~