Crates.io | cabac |
lib.rs | cabac |
version | 0.12.0 |
source | src |
created_at | 2023-02-03 11:38:39.88412 |
updated_at | 2024-11-05 11:17:28.511635 |
description | Context-adaptive binary arithmetic coding library |
homepage | |
repository | https://github.com/mcroomp/cabac |
max_upload_size | |
id | 775509 |
size | 120,280 |
Implementation of CABAC using H.264/265, VP8, rANS and Fpaq0 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 four encoders included:
Performance notes:
Here is the relative performance (in microseconds, lower is better) for encoding, decoding as measured on Intel i9-12900K (compiled with -Ctarget-cpu=native):
Encoder | Read | Read bypass | Write |
---|---|---|---|
H264/265 | 437 | 55 | 386 |
VP8 | 288 | 149 | 229 |
rANS | 259 | 59 | 190 |
Fpaq0 | 311 | 183 | |
Fpaq0 parallel | 195 | 265 |