ryg-rans-rs-cli
CLI tools for rANS encode, decode, inspect, trace, compare, and bench
Overview
This crate provides command-line tools for working with rANS entropy coding. It is currently a scaffold — the binary compiles and prints a usage message, but the subcommands are not yet implemented.
The CLI is designed around subcommands powered by the clap crate. When fully implemented, it will
serve as both a developer utility for debugging and inspecting rANS streams and a benchmarking
tool for evaluating encoding/decoding throughput.
Planned Commands
| Command | Status | Description |
|---|---|---|
encode |
✗ | Encode a file using rANS with a frequency model |
decode |
✗ | Decode an rANS-compressed file back to original |
inspect |
✗ | Inspect internal details of an rANS-encoded stream |
trace |
✗ | Trace encoding/decoder state through a sequence of symbols |
compare |
✗ | Compare Rust and C/C++ output side by side (invokes oracle) |
bench |
✗ | Run micro-benchmarks for throughput and latency |
Encode
Planned options: alphabet size, scale bits, interleave count, block size, verbosity.
Decode
Planned options: auto-detect scale bits and model from stream header.
Inspect
Planned output: stream metadata (scale bits, symbol count, final state), per-block statistics, entropy analysis.
Trace
Planned output: per-symbol state transitions (state values, emitted bytes, cumulative frequencies), useful for debugging encoder/decoder mismatches.
Compare
Planned behavior: invoke the oracle harness and display side-by-side diff of residuals.
Bench
Planned metrics: encode throughput (MB/s), decode throughput (MB/s), state throughput (Msym/s), cycle counts, branch mispredictions, cache misses.
Current Status
$ ryg-rans-rs
ryg-rans-rs-cli - rANS encoding tools
Usage: ryg-rans-rs encode|decode|inspect|trace|compare|bench
The binary currently prints a usage hint and exits. No subcommand dispatch, argument parsing, or actual rANS logic is wired up yet.
Cargo Features
| Feature | Default | Description |
|---|---|---|
| (none) | — | The CLI crate defines no optional features |
The crate always depends on ryg-rans-rs (for the rANS implementation) and clap (for CLI
argument parsing). The simd and alloc features of ryg-rans-rs are inherited transitively
through the dependency.
Development
To run the scaffold binary:
To add a new subcommand, follow the clap derive pattern in src/main.rs:
use ;
Dependencies
| Dependency | Version | Notes |
|---|---|---|
ryg-rans-rs |
0.1.0 |
Public facade (rANS implementation) |
ryg-rans-rs-core |
0.1.0 |
Direct access to low-level primitives |
clap |
4 |
CLI argument parsing (derive feature) |