D2c M4, gate 7 (delete). - int_hyper_synth::decode_conditional, the unchecked conditional decode, is deleted; its callers decode through decode_conditional_checked (the lowering, with its check ranges): the int_hyper_decode_frame example (step 3 of tools/wai_sota_vectors.sh), wai_decode_bench's tiny-vector case, int_payload's JSON-equivalence unit tests, tests/int_hyper_synth.rs, int_kernels_vectors.rs, int_video_keyframe.rs, int_video_sota_keyframe.rs, and byte-exact's neural_keyframe_golden (the trap: it gains the check ranges, outputs equal; gate 2's duplicate test through ops::decode goes). - The pretrained synthesis-only and hyper-decoder-only goldens (tests/int_hyper_synth.rs) are also held through the lowering. - The conditional codec's direct guard (legacy's run_checked) is test-only since gate 6. run_net_checked, check_layer and igdn_check stay: their one production caller left is int_mlicpp (M5); run_net and decode stay for the world renderer (M6), and int_hyper_synth's kernel_equivalence with them, since their conv dispatch is still run_net's. Docs say so. - Doc references (int_video, int_video_golden, two tools) and CHANGELOG. Co-Authored-By: Claude Opus 5.5 <[email protected]>
30 lines
1.4 KiB
Rust
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_checked, 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_checked(&g_s, &h_s, &ent, &bs.stream()).expect("the conditional decode");
|
|
std::fs::write(&a[2], &rgb).unwrap();
|
|
eprintln!("{h}x{w} -> {} ({} bytes)", a[2], rgb.len());
|
|
}
|