Proves the int_hyper-keyframe video codec at real resolution: a 256x256 clip whose I-frame is the FULL SOTA int_hyper learned codec (the 42.6 dB photo) decoded byte-exact, panned into P-frames by integer block motion compensation. Same capability (wai.video.int_hyper) as the committed 16x16 vector, now at scale. - examples/int_hyper_decode_frame.rs: decode a SOTA int_hyper bitstream dir → dump frame 0 as raw RGB (the byte-exact keyframe the encoder builds P-frames on). - tools/wai_int_video_sota_keyframe_encode.py: reads frame0.rgb (256²), pans it, block-MC + quantized residual + rANS → the P-frame bitstream + expected hashes (frame 0's hash IS int_hyper's, adeb12d3). Skip-if-absent. - tests/int_video_sota_keyframe.rs (skip if WAI_SOTA_INT_DIR/tmp absent, like the int_hyper SOTA test): decode_conditional (the learned 256² I-frame) ∘ decode_pframes → every frame byte-for-byte + clip hash b5bdfb5d71c51a31, in ~4.4s. Verified visually: the SOTA photo pans diagonally, decode exact. The SOTA artifacts (frame0.rgb, video_sota_*) live in /tmp (not committed, too large); the committed 16x16 int_video_keyframe test stays the never-skip companion. Co-Authored-By: Claude Opus 4.8 <[email protected]>
30 lines
1.4 KiB
Rust
30 lines
1.4 KiB
Rust
//! Decode a SOTA `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 --example int_hyper_decode_frame --features neural_int -- <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());
|
|
}
|