"The int_hyper of 3D" — extends conformance-is-a-hash to the last missing modality.
A Gaussian splat is N Gaussians × 14 attributes (pos[3], scale[3], rot[4], color[3],
opacity); the SOTA splat codecs (SOG / self-organizing Gaussians) decode through a
FLOAT network, so the reconstructed cloud — and its hash — drift between machines.
Here the synthesis is integer (the int_hyper machinery, 14 channels instead of RGB's
3) over a per-channel factorized-rANS latent, all i64 — so the decoded attribute
tensor is byte-identical on every machine (NeuralIntegerExact; splat-equivalence, a
portable cloud hash). The float rasterizer stays sink-supplied presentation; the
attributes are the conformance contract.
- src/int_splat.rs (feature splat_int = ["neural_int"]): factorized rANS-decode the
per-channel latent (y_q = s·2^afrac + median_q) → integer synthesis g_s (reuses
int_hyper_synth run_net) → [14,S,S] attribute tensor → round-half-up u8. Pure i64,
wasm-ready, self-contained b64.
- tools/wai_int_splat_export.py: a synthetic structured Gaussian cloud → Morton-sorted
[14,S,S] attribute image → learned transform codec (Conv2d+GDN / ConvTranspose2d+
IGDN) → PTQ g_s to WHM1 → integer reference decode mirroring the Rust → attr hash.
Reuses the int_hyper 2D integer ops + the world tool's WHM1/PTQ helpers.
- capability wai.splat.int_codec registered (Lossy tier, NeuralIntegerExact; nie set
now {int_synth, int_hyper, video.int_hyper, audio.int_codec, splat.int_codec}).
SPEC row added.
- tests/int_splat.rs never-skips: the committed tiny vector (1024 gaussians × 14
attrs) decodes to the committed attr_hash 5a94ebc9f0399a35. Rust == Python.
Co-Authored-By: Claude Opus 4.8 <[email protected]>
34 lines
1.7 KiB
Rust
34 lines
1.7 KiB
Rust
//! `wai.splat.int_codec` — **splat-equivalence**: a LEARNED Gaussian-splat attribute
|
||
//! codec whose integer synthesis decodes a factorized-rANS latent to the `[14,S,S]`
|
||
//! attribute tensor byte-identically on every machine, so the reconstructed cloud's
|
||
//! hash is portable — the int_hyper of 3D. Committed tiny vector under
|
||
//! `tests/vectors/int_splat/`; never skips.
|
||
#![cfg(feature = "splat_int")]
|
||
|
||
use std::path::PathBuf;
|
||
|
||
use wai::int_hyper_synth::IntModel;
|
||
use wai::int_splat::decode;
|
||
|
||
fn dir() -> PathBuf {
|
||
PathBuf::from(env!("CARGO_MANIFEST_DIR")).join("tests/vectors/int_splat")
|
||
}
|
||
|
||
#[test]
|
||
fn decodes_the_learned_splat_cloud_attribute_for_attribute() {
|
||
// The committed integer model (WHM1) + factorized bitstream decode — no float, no
|
||
// ML runtime — to the SAME [14,S,S] attribute tensor the Python integer reference
|
||
// produced. A single disagreeing attribute would diverge this FNV-1a.
|
||
let gs = IntModel::from_bytes(&std::fs::read(dir().join("splat_gs.bin")).unwrap()).expect("WHM1 g_s");
|
||
let bs: serde_json::Value =
|
||
serde_json::from_slice(&std::fs::read(dir().join("splat.json")).unwrap()).unwrap();
|
||
|
||
let clip = decode(&gs, &bs).expect("decode");
|
||
assert_eq!(clip.n_attr, bs["attr"].as_u64().unwrap() as usize);
|
||
assert_eq!(clip.attr.len(), clip.n_attr * clip.s * clip.s, "attribute tensor size");
|
||
assert_eq!(clip.s * clip.s, bs["n_gaussians"].as_u64().unwrap() as usize, "N gaussians = S²");
|
||
|
||
let got = format!("{:016x}", clip.attr_hash());
|
||
assert_eq!(got, bs["attr_hash"].as_str().unwrap(), "attributes must reproduce their committed hash");
|
||
println!("int_splat: {} gaussians × {} attrs -> attribute-exact, hash {got}", clip.s * clip.s, clip.n_attr);
|
||
}
|