#h265 #h264 #exp-golomb

scuffle-expgolomb

Exponential-Golomb encoder and decoder

5 releases

Uses new Rust 2024

new 0.1.4 May 17, 2025
0.1.3 May 15, 2025
0.1.2 Apr 27, 2025
0.1.1 Feb 21, 2025
0.0.1 Feb 9, 2025

#590 in Video

Download history 246/week @ 2025-02-09 149/week @ 2025-02-16 31/week @ 2025-02-23 20/week @ 2025-03-02 4/week @ 2025-03-09 4/week @ 2025-04-06 2/week @ 2025-04-13 157/week @ 2025-04-27 21/week @ 2025-05-04 182/week @ 2025-05-11

360 downloads per month
Used in 5 crates (2 directly)

MIT/Apache

100KB
2K SLoC

scuffle-expgolomb

[!WARNING]
This crate is under active development and may not be stable.

License: MIT OR Apache-2.0 docs.rs crates.io GitHub Actions: ci Codecov


A set of helper functions to encode and decode exponential-golomb values.

This crate extends upon the [BitReader] and [BitWriter] from the [scuffle-bytes-util][scuffle_bytes_util] crate to provide functionality for reading and writing Exp-Golomb encoded numbers.

See the changelog for a full release history.

Feature flags

  • docs — Enables changelog and documentation of feature flags

Usage

use scuffle_expgolomb::{BitReaderExpGolombExt, BitWriterExpGolombExt};
use scuffle_bytes_util::{BitReader, BitWriter};

let mut bit_writer = BitWriter::default();
bit_writer.write_exp_golomb(0)?;
bit_writer.write_exp_golomb(1)?;
bit_writer.write_exp_golomb(2)?;

let data: Vec<u8> = bit_writer.finish()?;

let mut bit_reader = BitReader::new(std::io::Cursor::new(data));

let result = bit_reader.read_exp_golomb()?;
assert_eq!(result, 0);

let result = bit_reader.read_exp_golomb()?;
assert_eq!(result, 1);

let result = bit_reader.read_exp_golomb()?;
assert_eq!(result, 2);

License

This project is licensed under the MIT or Apache-2.0 license. You can choose between one of them if you use this work.

SPDX-License-Identifier: MIT OR Apache-2.0

Dependencies

~0.3–1MB
~17K SLoC