Flip the warp gate to must-decode
Browse files at this commit8d5c79fd726cf062c8ccac81a88f4abfe9698a34Parent: de81760- feat
- flip the warp gate to must-decode
- r5e report
2 changed files +67 -16
- crates/ec-av1/src/stream.rs +26 -16
- lanes/warp-r5e.report.md +41 -0
crates/ec-av1/src/stream.rsmodified+26 -16
| @@ -3298,15 +3298,15 @@ mod tests { | |||
| 3298 | ); | 3298 | ); |
| 3299 | } | 3299 | } |
| 3300 | 3300 | ||
| 3301 | - /// lane-motionmode round 1: `--enable-warped-motion=1` must be a NAMED | 3301 | + /// lane-warp r5e (flipped from lane-motionmode r1's refuses-or-matches): |
| 3302 | - /// refusal, never a silent mis-decode -- this decoder does not port | 3302 | + /// `--enable-warped-motion=1` streams must DECODE pixel-exact -- |
| 3303 | - /// `av1_findSamples`/`num_proj_ref`, so it cannot tell `OBMC_CAUSAL` | 3303 | + /// `av1_findSamples`/`num_proj_ref`, the 3-symbol `motion_mode` read, |
| 3304 | - /// from `WARPED_CAUSAL` at an eligible block once the header allows | 3304 | + /// the affine projection/filter, and the WARPED_CAUSAL interp-filter |
| 3305 | - /// warp (see `decode_inter_block`'s own `allow_warped_motion` refusal). | 3305 | + /// derivation are all ported. A refusal naming warp, or any pixel |
| 3306 | - /// Every attempt across the seed sweep must either name the refusal or | 3306 | + /// mismatch, fails the gate; refusals for OTHER named capabilities |
| 3307 | - /// decode pixel-exact (an eligible block simply never fired in that | 3307 | + /// (screen content tools) still skip that seed. The sweep must also |
| 3308 | - /// attempt) -- a silent pixel mismatch here would mean the refusal | 3308 | + /// actually exercise warp (`warp_selected_hits > 0`) so a decoder that |
| 3309 | - /// failed to fire on a stream that actually needed it. | 3309 | + /// silently stops selecting WARPED_CAUSAL cannot pass vacuously. |
| 3310 | #[test] | 3310 | #[test] |
| 3311 | fn a_real_aomenc_stream_with_warped_motion_refuses_or_matches() { | 3311 | fn a_real_aomenc_stream_with_warped_motion_refuses_or_matches() { |
| 3312 | const NAME: &str = "a_real_aomenc_stream_with_warped_motion_refuses_or_matches"; | 3312 | const NAME: &str = "a_real_aomenc_stream_with_warped_motion_refuses_or_matches"; |
| @@ -3425,8 +3425,13 @@ mod tests { | |||
| 3425 | msg.contains("unsupported"), | 3425 | msg.contains("unsupported"), |
| 3426 | "{NAME} failed outright, not a named refusal (seed {seed}): {msg}" | 3426 | "{NAME} failed outright, not a named refusal (seed {seed}): {msg}" |
| 3427 | ); | 3427 | ); |
| 3428 | + assert!( | ||
| 3429 | + !msg.contains("warp"), | ||
| 3430 | + "{NAME} refused on warp (seed {seed}) -- warp decode is ported, this \ | ||
| 3431 | + refusal must not exist: {msg}" | ||
| 3432 | + ); | ||
| 3428 | named_refusals += 1; | 3433 | named_refusals += 1; |
| 3429 | - eprintln!("seed {seed} refusal: {msg}"); | 3434 | + eprintln!("seed {seed} refusal (non-warp capability): {msg}"); |
| 3430 | continue; | 3435 | continue; |
| 3431 | } | 3436 | } |
| 3432 | Ok(frames) => frames, | 3437 | Ok(frames) => frames, |
| @@ -3442,18 +3447,23 @@ mod tests { | |||
| 3442 | eprintln!("EC_AV1_GATE_DUMP: wrote mismatching stream (seed {seed}) to {path}"); | 3447 | eprintln!("EC_AV1_GATE_DUMP: wrote mismatching stream (seed {seed}) to {path}"); |
| 3443 | } | 3448 | } |
| 3444 | for (i, (got, want)) in frames.iter().zip(&ffmpeg_frames).enumerate() { | 3449 | for (i, (got, want)) in frames.iter().zip(&ffmpeg_frames).enumerate() { |
| 3445 | - assert_eq!( | 3450 | + assert_eq!(got.y, want.y, "{NAME} frame {i} luma vs ffmpeg (seed {seed})"); |
| 3446 | - got.y, want.y, | ||
| 3447 | - "{NAME} frame {i} luma vs ffmpeg (seed {seed}) -- decoded without a named \ | ||
| 3448 | - refusal but mismatched, meaning the refusal failed to fire" | ||
| 3449 | - ); | ||
| 3450 | assert_eq!(got.u, want.u, "{NAME} frame {i} U vs ffmpeg (seed {seed})"); | 3451 | assert_eq!(got.u, want.u, "{NAME} frame {i} U vs ffmpeg (seed {seed})"); |
| 3451 | assert_eq!(got.v, want.v, "{NAME} frame {i} V vs ffmpeg (seed {seed})"); | 3452 | assert_eq!(got.v, want.v, "{NAME} frame {i} V vs ffmpeg (seed {seed})"); |
| 3452 | } | 3453 | } |
| 3453 | matched += 1; | 3454 | matched += 1; |
| 3454 | } | 3455 | } |
| 3456 | + assert!( | ||
| 3457 | + matched > 0, | ||
| 3458 | + "{NAME}: every attempt refused on other capabilities; the gate never exercised warp" | ||
| 3459 | + ); | ||
| 3460 | + assert!( | ||
| 3461 | + crate::decode::warp_selected_hits() > 0, | ||
| 3462 | + "{NAME}: {matched} matches but zero WARPED_CAUSAL blocks fired -- the gate decodes \ | ||
| 3463 | + warp streams without ever selecting warp, so it proves nothing about warp" | ||
| 3464 | + ); | ||
| 3455 | eprintln!( | 3465 | eprintln!( |
| 3456 | - "{NAME}: {named_refusals} named refusals, {matched} pixel-exact matches out of {n_attempts}, warp_selected_hits={}", | 3466 | + "{NAME}: {named_refusals} non-warp refusals, {matched} pixel-exact matches out of {n_attempts}, warp_selected_hits={}", |
| 3457 | crate::decode::warp_selected_hits() | 3467 | crate::decode::warp_selected_hits() |
| 3458 | ); | 3468 | ); |
| 3459 | } | 3469 | } |
lanes/warp-r5e.report.mdadded+41 -0
| @@ -0,0 +1,41 @@ | |||
| 1 | +# lane-warp r5e report — PASS (run by orchestrator inline after two builder task kills) | ||
| 2 | + | ||
| 3 | +PASS: pinned_warp_stream_decodes_pixel_exact 24/24 pixel-exact vs ffmpeg, green twice; | ||
| 4 | +ec-av1 lib suite 217 passed / 0 failed. Fix committed f231bab. | ||
| 5 | + | ||
| 6 | +## Root cause (the whole r3→r5e chain) | ||
| 7 | +libaom's `av1_is_interp_needed` DERIVES the interp filter (Regular) instead of reading | ||
| 8 | +switchable_interp symbols when `motion_mode == WARPED_CAUSAL` — keyed on the symbol value, | ||
| 9 | +not projection validity. Our single-ref path suppressed the read only for GLOBALMV | ||
| 10 | +(decode.rs resolve_interp_filter call), so a warped block consumed 1–2 extra symbols. | ||
| 11 | + | ||
| 12 | +Where it bit: the hidden no-show altref (decode-order 13, display 23) is four 32x32 blocks — | ||
| 13 | +NEWMV SIMPLE / NEARMV OBMC / NEWMV WARPED skip / NEWMV OBMC. Our symbols matched libaom's | ||
| 14 | +through the first three (mvs transposed-equal), then B10's warped tail over-read and B11's | ||
| 15 | +partition_w32 decoded phantom HORZ_B (5) where libaom reads NONE. The corrupted ALTREF then | ||
| 16 | +leaked into shown frames 13+ through zero-mv skip compound copies (display 13 quad (1,1) is | ||
| 17 | +32x32 NEAREST_NEARESTMV zero-mv skip) — class gate-blind-to-hidden-frames, verbatim. | ||
| 18 | + | ||
| 19 | +## Method (evidence) | ||
| 20 | +- libaom `examples/inspect` (built in /tmp/libaom-build; needs IVF wrap: | ||
| 21 | + `ffmpeg -i fixtures/warp-mismatch.obu -c copy x.ivf`) — ground-truth per-block | ||
| 22 | + bsize/mode/mv/ref/motion_mode: /tmp/claude-1000/r5e-inspect.json. | ||
| 23 | +- Our EC_AV1_TRACE decode-order frame-13 section: /tmp/claude-1000/r5e-ours-trace.log. | ||
| 24 | +- Frame index mapping decode→display from inspect: display 13 = decode 16; decode 13 = | ||
| 25 | + display 23 no-show. r5c/r5d's "frame 13 HORZ_B" trace was the HIDDEN frame, and the | ||
| 26 | + HORZ_B itself was desync garbage, not content. | ||
| 27 | + | ||
| 28 | +## What else this explains | ||
| 29 | +- The r5 extended partitions (HORZ_B/VERT_A/VERT_B arms) decoded desync GARBAGE on this pin — | ||
| 30 | + the pin never legitimately contained them (min/max partition 32 in the gate recipe!). They | ||
| 31 | + are exercised by hand only via desync; their correctness is UNPROVEN by this pin. They stay | ||
| 32 | + (harmless spec surface) but need a rect-partition-enabled gate before being trusted. | ||
| 33 | + DISPOSITION: deferred(rect/ab-partition gate) — the warp gate recipe pins | ||
| 34 | + --enable-rect-partitions=0 --enable-ab-partitions=0. | ||
| 35 | +- r5d's bh4 fix + 89122b0 coordinate fix stay (adjudicated PROVEN-RIGHT r5d). | ||
| 36 | + | ||
| 37 | +## Still owed on the lane (in flight / next) | ||
| 38 | +- Warp gate flip: refuses-or-matches → must-decode (named_refusals == 0, warp_selected_hits | ||
| 39 | + > 0); 40-seed sweep measuring now (r5e-warpgate.log). | ||
| 40 | +- Full workspace gate + merge to main + push + teardown per only-main-survives. | ||
| 41 | +- Debts rewrite: warp leaves the NAMED-refusal list. | ||