open-standards/wai/wai-rs/examples/int_hyper_decode_frame.rs
Transaction Science 648f407f09 wai: the headline decode tests fail on a missing input, and CI supplies their inputs
The tests behind WAI's whole-decode claims read inputs from outside the
repository and returned early — reporting a pass — when those inputs were
absent. No workflow supplied them, so the claims were not checked
continuously.

- WAI_REQUIRE_SOTA_VECTORS=1 turns a missing input into a failure. A path
  variable naming a missing or incomplete input fails with or without the
  switch. Local runs without either still skip, and every skip prints a
  banner saying the claim was not verified.
- wai-sota-vectors.yml regenerates the int_hyper vectors from the pretrained
  mbt2018_mean checkpoint (pinned by SHA-256, with a pinned Python stack) and
  runs int_hyper_synth and int_video_sota_keyframe with the switch set. The
  regenerated vectors identify one run, not one machine: the encoder side is
  float.
- wai-jpegai-e2e.yml fetches the pinned JPEG AI inputs from the public models
  root, checks each against a SHA-256 manifest, and runs the whole-decode and
  reconstruction-binding tests with the switch set, requiring each test by
  name and the pinned pixel hash.
- Both jobs fail on any skip banner, and trigger on the kernels and float
  helpers the decode imports.
- The int_hyper claims are stated as the checks CI runs, with its quality
  measured on the pinned image; JPEG AI cross-machine identity is stated as a
  measurement, not a registry-class claim. determinism-tiers §5–§6 record the
  jobs.

Neither workflow has yet run through the forge.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-09-28 18:40:59 -04:00

30 lines
1.4 KiB
Rust

//! Decode an `int_hyper` conditional bitstream from a directory and dump the
//! reconstructed frame as raw RGB (HWC u8) — the byte-exact keyframe the
//! `int_hyper`-keyframe video codec builds its P-frames on.
//!
//! cargo run --release --no-default-features --features neural_int --example int_hyper_decode_frame -- <dir> <out.rgb>
//!
//! `<dir>` is an int_hyper vector dir (e.g. `/tmp/sota_int`) holding
//! `int_synth_sota_model.json`, `int_hs_model.json`, `cond_entropy.json`,
//! `cond_bitstream.json`.
use wai::int_hyper_synth::{decode_conditional, CondBitstream, CondEntropy, IntModel};
fn main() {
let a: Vec<String> = std::env::args().collect();
if a.len() < 3 {
eprintln!("usage: int_hyper_decode_frame <dir> <out.rgb>");
std::process::exit(2);
}
let d = std::path::PathBuf::from(&a[1]);
let jl = |n: &str| -> serde_json::Value {
serde_json::from_slice(&std::fs::read(d.join(n)).expect(n)).unwrap()
};
let g_s = IntModel::from_json(&jl("int_synth_sota_model.json"));
let h_s = IntModel::from_json(&jl("int_hs_model.json"));
let ent = CondEntropy::from_value(&jl("cond_entropy.json"));
let bs = CondBitstream::from_value(&jl("cond_bitstream.json"));
let (rgb, h, w) = decode_conditional(&g_s, &h_s, &ent, &bs).expect("decode_conditional");
std::fs::write(&a[2], &rgb).unwrap();
eprintln!("{h}x{w} -> {} ({} bytes)", a[2], rgb.len());
}