#h264 #h265 #exp-golomb

scuffle-expgolomb

Exponential-Golomb encoder and decoder

3 releases

Uses new Rust 2024

new 0.1.2 Apr 27, 2025
0.1.1 Feb 21, 2025
0.1.0 Feb 10, 2025
0.0.1 Feb 9, 2025

#654 in Video


Used in 5 crates (2 directly)

MIT/Apache

91KB
2K SLoC

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 crate to provide functionality for reading and writing Exp-Golomb encoded numbers.

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


scuffle-expgolomb

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

crates.io docs.rs


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

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

~355KB