# grain-free-av1 — a refinement over the platform-decoded floor The corpus of [`extensions/platform-decode.md`](../../extensions/platform-decode.md) §6: a grain-free `wai.video.av1` stream, which every conforming AV1 decoder decodes to the same frames, as the base of `wai.video.int_refine` layers written against its reference decode. **Equivalence.** A conforming sink makes the base from the frames its decoder gives (`I420`, in output order) and the probe's outcome for that decoder, converts them to `RGB8` units (§6.3), and, replaying each case of `cases.json`, reports what the case states at every step and ends with every unit at the stated stage, producer, tier and stage hash, and the stated clip hash. It refuses `base-grain.wai` as a base (`av1_film_grain`). ## Files - `base.wai` — `WAI1`, `wai.video.av1`: eight frames of 160×96, 8-bit 4:2:0, codec string `av01.0.31M.08`, every sequence header with `film_grain_params_present` 0. Encoded with rav1e from a source clip that `wai_av1_refine_vectors` computes (integer ramps, a moving checkerboard and a band of stripes), at quantizer 140, one thread, low latency. - `base-grain.wai` — the same source, encoded with photon-noise film grain: refused as a base. - `base.i420` — the reference decode of `base.wai` (libdav1d): each frame's luma plane, then Cb, then Cr, rows tightly packed, frames in output order. - `probe.json` — §6.2's probe of `base.wai`: the codec string and coded size a page configures, each frame's SHA-256 over its `I420` samples (`frame_sha256`) and the clip digest. - `layer1.wai`, `layer2.wai` — `WAI1`, `wai.video.int_refine`, `WIR1` with the identity predictor: layer 1 (step 6) over the base's `RGB8` units toward the source clip, layer 2 (step 1) over layer 1's output, which reaches the source exactly. - `layer1-over-grain.wai` — layer 1's payload with `refines` naming `base-grain.wai`. - `cases.json` — `stage0_sha256` (each unit's stage-0 hash) and the cases: `stage0`, `one-layer`, `two-layers`, `two-layers-reference`, `two-layers-out-of-order`, `unprobed` and `film-grain`. Each states its base, the decoder whose frames make it (`reference` and `probe-matched` at `decode-equivalence`, `unprobed` at none), its steps (an offer at step index + 1 ms, or `expire@t`), and what a sink reports and holds. ## Verifiers - `wai_av1_refine_vectors verify .` (from `../../wai-rs`, feature `av1_refine_vectors`, libdav1d): decodes `base.wai` and requires `base.i420`; refuses `base-grain.wai` before decoding it; regenerates every other file but the two streams byte for byte. `gen` writes them from the committed streams; `gen --encode` encodes the streams again. - `cargo test --no-default-features --features staged --test av1_refine` (add `av1_base` for the libdav1d decode): every case through `staged::StageSink`, the probe and stage-0 hashes, the grain flag set alone, and one changed sample. - `python3 -I verify.py [--dav1d PATH]`: the second implementation, standard library only, with the sink of `../../staged-conformance/staged_verify.py`; `--dav1d` decodes the stream with the dav1d tool (section 5 input) and requires `base.i420`. - `node ../../wai-web/demo/verify_av1_refine_wasm.mjs `: every case through wai-web's wasm32 `StageSink` from `base.i420`. - `node ../../wai-web/demo/verify_av1_refine.mjs` (Playwright): the page decodes `base.wai` through the browser's WebCodecs, puts each decode to the probe, and replays every case from the no-preference decode's frames, in each browser `WAI_AV1_BROWSERS` names (Chromium and WebKit by default). What it measured is in platform-decode §6.4.