msrtc-rans
Safe public Rust entropy-coder API for msrtc_rans.
This crate provides the high-level entropy coder API, wrapping the raw rANS primitives from msrtc-rans-core with PMF validation, CDF table construction, bypass coding, and distribution descriptors.
Status
| Feature | Status |
|---|---|
EntropyEncoder |
✅ Implemented |
EntropyDecoder |
✅ Implemented |
| PMF validation | ✅ Implemented |
| CDF table construction | ✅ Implemented |
| Bypass coding (variable-width) | ✅ Implemented |
| Entropy differential court | ✅ Sealed (6/6 cases) |
The full entropy encode/decode pipeline (PMF → CDF → bypass) has been verified byte-for-byte against the pinned Microsoft C++ oracle.
Features
#![forbid(unsafe_code)]— pure safe Rust- Both RansByte (u8) and Rans64 (u32) variant support
- PMF validation: rejects empty tables, invalid dimensions, zero frequencies
- Bypass coding for out-of-range values with configurable bypass bits
- Mixed in-range and bypass value streams
- Comprehensive error handling via
EntropyErrorenum - Re-exports all
msrtc-rans-coretypes and traits
Usage
use EntropyEncoder;
use RansByte;
let mut encoder = new;
let pmf_lengths = vec!;
let pmf_offsets = vec!;
let pmf_table = vec!; // frequencies
let symbol_bits = 16;
let bypass_bits = 4;
encoder.initialize
.expect;
let values = vec!;
let encoded = encoder.encode.expect;
Repository
Full project: github.com/infinityabundance/msrtc-rans-rs