lane-av1422lrless: add the gate FOR REAL, and re-pin from a truly controlled recipe
Browse files at this commit78b7b48994a7edf5cc8efde26cdde833d0f7805aParent: 959ed1d2 changed files +96 -4
- crates/ec-av1/fixtures/422_residual_compound_warp_nolr_16f.obu +0 -0
- crates/ec-av1/src/stream.rs +96 -4
crates/ec-av1/fixtures/422_residual_compound_warp_nolr_16f.obumodified+0 -0
Binary file changed
crates/ec-av1/src/stream.rsmodified+96 -4
| @@ -2293,17 +2293,29 @@ pub(crate) mod tests { | |||
| 2293 | /// `d78e2afb43ce311d3d82335a945c6f80f62db4537966d881c1349a68b3aecb95`: | 2293 | /// `d78e2afb43ce311d3d82335a945c6f80f62db4537966d881c1349a68b3aecb95`: |
| 2294 | /// | 2294 | /// |
| 2295 | /// ```text | 2295 | /// ```text |
| 2296 | - /// ffmpeg -f lavfi -i "mandelbrot=size=256x288:rate=24:maxiter=220: | 2296 | + /// ffmpeg -f lavfi -i "mandelbrot=size=256x288:rate=24:maxiter=220:start_scale=3:end_scale=0.35:end_pts=300,rotate=a=0.10*t:c=none:ow=256:oh=288" \ |
| 2297 | - /// start_scale=3:end_scale=0.35:end_pts=300:rotate=a=0.10" | ||
| 2298 | /// -frames:v 24 -pix_fmt yuv422p -f yuv4mpegpipe src422.y4m | 2297 | /// -frames:v 24 -pix_fmt yuv422p -f yuv4mpegpipe src422.y4m |
| 2299 | /// aomenc --codec=av1 --profile=2 --input-bit-depth=8 --limit=16 | 2298 | /// aomenc --codec=av1 --profile=2 --input-bit-depth=8 --limit=16 |
| 2300 | /// --width=256 --height=288 --lag-in-frames=25 --auto-alt-ref=1 | 2299 | /// --width=256 --height=288 --lag-in-frames=25 --auto-alt-ref=1 |
| 2301 | - /// --enable-global-motion=1 --cq-level=24 --cpu-used=0 | 2300 | + /// --enable-global-motion=1 --pass=1 |
| 2301 | + /// --cq-level=24 --cpu-used=0 | ||
| 2302 | /// --threads=4 --kf-min-dist=0 --kf-max-dist=999999 \ | 2302 | /// --threads=4 --kf-min-dist=0 --kf-max-dist=999999 \ |
| 2303 | - /// -n ffp --pass=2 --fpf=src422.y4m -o a1.webm | 2303 | + /// src422.y4m -o a1.webm |
| 2304 | /// ffmpeg -i a1.webm -c copy -f obu -y a1.obu | 2304 | /// ffmpeg -i a1.webm -c copy -f obu -y a1.obu |
| 2305 | /// ``` | 2305 | /// ``` |
| 2306 | /// | 2306 | /// |
| 2307 | + /// CORRECTED by lane-av1422lrless (reviewer P2). This doc previously | ||
| 2308 | + /// carried a different ffmpeg filter (`rotate=a=0.10`, no `*t`, no | ||
| 2309 | + /// `:c=none:ow/oh`) and a `-n ffp --pass=2 --fpf=...` two-pass line. | ||
| 2310 | + /// **Neither produced these bytes.** Re-encoding from the recorded | ||
| 2311 | + /// source `src422.y4m` (sha256 | ||
| 2312 | + /// `4d35eaf65d1a5541b3177e1183644c163b3868d8f141bed0ce9fdf833280ba9f`) | ||
| 2313 | + /// was measured three ways: the two-pass form gives 38774 bytes | ||
| 2314 | + /// (`e93c4ed7...`), and only adding `--pass=1` reproduces these 38845 | ||
| 2315 | + /// bytes byte for byte (`d78e2afb...`). `aomenc` DEFAULTS to two-pass, | ||
| 2316 | + /// so the flag has to be stated to get back the pinned stream. The | ||
| 2317 | + /// recipe above is the one that was actually run. | ||
| 2318 | + /// | ||
| 2307 | /// Measured on a patch-run-restore build (the `EC_AV1_ALLOW_422_PROBE` | 2319 | /// Measured on a patch-run-restore build (the `EC_AV1_ALLOW_422_PROBE` |
| 2308 | /// bypass applied for the run, reverted after -- it is deliberately NOT | 2320 | /// bypass applied for the run, reverted after -- it is deliberately NOT |
| 2309 | /// committed, and the refusal below is what the committed tree asserts): | 2321 | /// committed, and the refusal below is what the committed tree asserts): |
| @@ -2359,6 +2371,86 @@ pub(crate) mod tests { | |||
| 2359 | "{NAME}: {FILE} must refuse by name, got: {err}" | 2371 | "{NAME}: {FILE} must refuse by name, got: {err}" |
| 2360 | ); | 2372 | ); |
| 2361 | } | 2373 | } |
| 2374 | + /// lane-av1422lrless: the LR-OFF half of the 4:2:2 coverage pair. | ||
| 2375 | + /// | ||
| 2376 | + /// This is `422_residual_compound_warp_16f.obu`'s recipe with EXACTLY | ||
| 2377 | + /// ONE flag changed, `--enable-restoration=0`, and that is a measured | ||
| 2378 | + /// claim rather than an assertion: both arms were re-encoded from the | ||
| 2379 | + /// same source `src422.y4m` (sha256 | ||
| 2380 | + /// `4d35eaf65d1a5541b3177e1183644c163b3868d8f141bed0ce9fdf833280ba9f`) | ||
| 2381 | + /// with the same aomenc invocation, and the LR-on arm reproduces the | ||
| 2382 | + /// committed 38845 bytes byte for byte. So the pair is controlled, and | ||
| 2383 | + /// the corners code is the only thing that can differ between their | ||
| 2384 | + /// decodes: with restoration off, every plane's `frame_restoration_type` | ||
| 2385 | + /// is `RESTORE_NONE`, so `read_lr` skips each plane and never computes a | ||
| 2386 | + /// range. The LR-on stream exercises the range; this one proves the skip | ||
| 2387 | + /// is the skip. | ||
| 2388 | + /// | ||
| 2389 | + /// ```text | ||
| 2390 | + /// aomenc --codec=av1 --profile=2 --input-bit-depth=8 --limit=16 | ||
| 2391 | + /// --width=256 --height=288 --lag-in-frames=25 --auto-alt-ref=1 | ||
| 2392 | + /// --enable-global-motion=1 --pass=1 --enable-restoration=0 | ||
| 2393 | + /// --cq-level=24 --cpu-used=0 | ||
| 2394 | + /// --threads=4 --kf-min-dist=0 --kf-max-dist=999999 \ | ||
| 2395 | + /// src422.y4m -o a3.webm | ||
| 2396 | + /// ffmpeg -i a3.webm -c copy -f obu -y a3.obu | ||
| 2397 | + /// ``` | ||
| 2398 | + /// | ||
| 2399 | + /// 38538 bytes, sha256 | ||
| 2400 | + /// `8bed368f7ec4bca772137c6a9c2af89e1b2767ed5f937b91bd9e72ec60aeb42f`. | ||
| 2401 | + /// | ||
| 2402 | + /// Measured on a patch-run-restore build (the `EC_AV1_ALLOW_422_PROBE` | ||
| 2403 | + /// bypass applied for the run, reverted after -- deliberately not | ||
| 2404 | + /// committed, and the refusal asserted below is what this tree ships): | ||
| 2405 | + /// | ||
| 2406 | + /// - all 16 frames pixel-exact against `aomdec --rawvideo`, 2359296 | ||
| 2407 | + /// bytes each, sha256 `1cf47bc9e06a6e286452dfe4ffe457a85b6badd25 | ||
| 2408 | + /// 657dfd36af48262e8eb2464` on both sides; | ||
| 2409 | + /// - the entropy stream pairs **244756-for-244756** against the | ||
| 2410 | + /// instrumented oracle with no divergence anywhere -- a different | ||
| 2411 | + /// read count from the LR-on sibling's 246735, which is the corners | ||
| 2412 | + /// skip showing up in the symbol stream, so the two arms really are | ||
| 2413 | + /// on different paths; | ||
| 2414 | + /// - **loop restoration is proved off, not inferred from the flag**: | ||
| 2415 | + /// all five LR counters read zero where the LR-on sibling reads | ||
| 2416 | + /// `lr_wiener` 22, `lr_sgrproj` 10, `lr_stripe0` 26, `lr_last_stripe` | ||
| 2417 | + /// 28; | ||
| 2418 | + /// - and it carries MORE of the coverage than its sibling, which is | ||
| 2419 | + /// what rescues the thin leg of the lift argument: **top-half | ||
| 2420 | + /// compound 11** against the sibling's 3, and top-half warp 5 against | ||
| 2421 | + /// 3. Frame-globally compound_warp 25, compound_warp_8 15, rotzoom | ||
| 2422 | + /// global-warp 77, cdef_idx 39, part128_split 95. The stronger arm is | ||
| 2423 | + /// the one where `read_lr` does nothing at all, so the engagement is | ||
| 2424 | + /// not an artefact of the code under test. | ||
| 2425 | + /// | ||
| 2426 | + /// Same scope as its siblings, for the same reason: with the header | ||
| 2427 | + /// refusal standing no committed test can decode a 4:2:2 stream, | ||
| 2428 | + /// because the bypass that would allow it must never be committed. | ||
| 2429 | + #[test] | ||
| 2430 | + fn the_pinned_422_lr_off_witness_is_present_and_refuses_by_name() { | ||
| 2431 | + const NAME: &str = "the_pinned_422_lr_off_witness_is_present_and_refuses_by_name"; | ||
| 2432 | + const REFUSAL: &str = "a chroma format of 4:2:2"; | ||
| 2433 | + const FILE: &str = "422_residual_compound_warp_nolr_16f.obu"; | ||
| 2434 | + const BYTES: usize = 38538; | ||
| 2435 | + const FP: u64 = 0x4b8ff761701e2bef; | ||
| 2436 | + let path = std::path::Path::new(env!("CARGO_MANIFEST_DIR")) | ||
| 2437 | + .join("fixtures") | ||
| 2438 | + .join(FILE); | ||
| 2439 | + let data = std::fs::read(&path).unwrap_or_else(|e| { | ||
| 2440 | + panic!( | ||
| 2441 | + "{NAME}: pinned witness {} is missing ({e}) -- the gate cannot run", | ||
| 2442 | + path.display() | ||
| 2443 | + ) | ||
| 2444 | + }); | ||
| 2445 | + assert_eq!(data.len(), BYTES, "{NAME}: {FILE} size drifted"); | ||
| 2446 | + assert_eq!(fnv1a64(&data), FP, "{NAME}: {FILE} bytes drifted"); | ||
| 2447 | + let err = decode_stream(&data).unwrap_err().to_string(); | ||
| 2448 | + assert!( | ||
| 2449 | + err.contains(REFUSAL), | ||
| 2450 | + "{NAME}: {FILE} must refuse by name, got: {err}" | ||
| 2451 | + ); | ||
| 2452 | + } | ||
| 2453 | + | ||
| 2362 | 2454 | ||
| 2363 | 2455 | ||
| 2364 | /// lane-av1-qmatrix: WITNESS for the lifted `using_qmatrix` refusal (the | 2456 | /// lane-av1-qmatrix: WITNESS for the lifted `using_qmatrix` refusal (the |