#h265 #reader #bits #writer #vp8 #debugging #context #range #cabac #bypass

bin+lib cabac

Context-adaptive binary arithmetic coding library

6 releases (breaking)

0.6.0 Nov 18, 2023
0.5.0 Nov 17, 2023
0.4.0 Nov 17, 2023
0.3.0 Mar 5, 2023
0.1.0 Feb 3, 2023

#105 in Video

Download history 4/week @ 2023-08-18 6/week @ 2023-08-25 3/week @ 2023-09-01 2/week @ 2023-09-08 1/week @ 2023-09-15 1/week @ 2023-09-22 2/week @ 2023-09-29 1/week @ 2023-10-06 1/week @ 2023-10-20 3/week @ 2023-10-27 2/week @ 2023-11-03 1/week @ 2023-11-10 96/week @ 2023-11-17 27/week @ 2023-11-24 36/week @ 2023-12-01

161 downloads per month
Used in preflate-rs



Context-adaptive binary arithmetic coding (CABAC) encoder / decoder in Rust

Implementation of the H.264/265 and VP8 encoders.

The coder is designed to encode binary values in an efficient manner, taking into account the bits that were previously seen. The previous state is stored in the Context object, which is updated each time a bit is seen. Normally multi-bit symbols are converted to binary form, and each bit is assigned a corresponding bin (which gets its own context). Bits that are expected to be random can use the "bypass" mode, which are very efficiently added to the bitstream without a context.

In order to decode the bistream, the same contexts need to be used in the exact same sequence or you will get back garbage. This also include any bypass bits that must also be read in the same exact order.

There are two encoders included: the h264/h265 CABAC which uses a 6 bit state to track previously seen bits, and the VP8 CABAC which uses a 16-bit state to track what it has seen.