Merge lane-av1txctxband2 r2: the mixed-lossless RESIDUE arms are the SAME missing publish, not three more defects
Browse files at this commit5 changed files +137 -10
- crates/ec-av1/fixtures/420_mixll_256x128_6f.obu +0 -0
- crates/ec-av1/fixtures/420_mixll_320x240_5f.obu +0 -0
- crates/ec-av1/fixtures/420_mixll_320x240_6f.obu +0 -0
- crates/ec-av1/src/stream.rs +77 -0
- lanes/av1txctxband2.report.md +60 -10
crates/ec-av1/fixtures/420_mixll_256x128_6f.obuadded+0 -0
Binary file changed
crates/ec-av1/fixtures/420_mixll_320x240_5f.obuadded+0 -0
Binary file changed
crates/ec-av1/fixtures/420_mixll_320x240_6f.obuadded+0 -0
Binary file changed
crates/ec-av1/src/stream.rsmodified+77 -0
| @@ -9476,6 +9476,83 @@ pub(crate) mod tests { | |||
| 9476 | block(s) overwrote a stale above-band size" | 9476 | block(s) overwrote a stale above-band size" |
| 9477 | ); | 9477 | ); |
| 9478 | } | 9478 | } |
| 9479 | + | ||
| 9480 | + /// lane-av1txctxband2 r2: the SAME one-line publish, three MORE cells — | ||
| 9481 | + /// the mixed-lossless RESIDUE `lanes/av1mixllconj.report.md` §7 left | ||
| 9482 | + /// explicitly unnamed ("separate defects this change shrinks but does not | ||
| 9483 | + /// remove"). **They are the same defect.** All three are this recipe's | ||
| 9484 | + /// mixed-lossless+altref stream at 256x128 (6 frames) and 320x240 (5 and 6 | ||
| 9485 | + /// frames); each has a lossy block whose `get_tx_size_context` / | ||
| 9486 | + /// `txfm_partition_context` read a band a lossless block above should have | ||
| 9487 | + /// published into and did not. | ||
| 9488 | + /// | ||
| 9489 | + /// Measured on `f2dd27b0~1` (= `0bfee517`, the tip before this lane's | ||
| 9490 | + /// publish) against `aomdec`'s `EC_AV1_FINAL_DUMP`, decode order, per | ||
| 9491 | + /// differing frame: | ||
| 9492 | + /// | ||
| 9493 | + /// ```text | ||
| 9494 | + /// 420_mixll_256x128_6f.obu 7 dumps red f1..f6: 6051 / 4115 / 2962 / 26566 / 41876 / 14749 | ||
| 9495 | + /// 420_mixll_320x240_5f.obu 6 dumps red f1..f5: 15031 / 16259 / 21932 / 65405 / 90077 | ||
| 9496 | + /// 420_mixll_320x240_6f.obu 7 dumps red f6 only: 19398 | ||
| 9497 | + /// ``` | ||
| 9498 | + /// | ||
| 9499 | + /// With the publish: **7/7, 6/6 and 7/7 byte-exact**, 0 differing bytes on | ||
| 9500 | + /// every plane of every decode-order frame. `m5_320x240`'s f2/f3 here | ||
| 9501 | + /// (16259 / 21932) differ from the 16006 / 21930 `lane-av1mixllconj` §7 | ||
| 9502 | + /// records, because that table was taken before `lane-av1offtile`'s | ||
| 9503 | + /// chroma-plane clip merged; f1/f4/f5 and both other cells match it exactly. | ||
| 9504 | + /// | ||
| 9505 | + /// Recipe (ffmpeg 8.1.3 `testsrc2`, shared oracle `aomenc`; `--limit` is the | ||
| 9506 | + /// only variable per cell): | ||
| 9507 | + /// ```text | ||
| 9508 | + /// ffmpeg -f lavfi -i testsrc2=size=<W>x<H>:rate=25 -frames:v <N> -pix_fmt yuv420p src.y4m | ||
| 9509 | + /// aomenc --codec=av1 --obu -o <cell>.obu --passes=1 --cpu-used=4 --limit=<N> \ | ||
| 9510 | + /// --end-usage=q --cq-level=0 --aq-mode=1 src.y4m | ||
| 9511 | + /// ``` | ||
| 9512 | + /// sha256 `8a203e52…` (22336 B), `40d613fd…` (28716 B), `37fbe7cb…` | ||
| 9513 | + /// (38686 B); pinned below by fnv1a64, not a `const SHA256` compared | ||
| 9514 | + /// against itself. | ||
| 9515 | + #[test] | ||
| 9516 | + fn a_420_mixed_lossless_residue_arms_are_byte_exact_in_decode_order() { | ||
| 9517 | + const NAME: &str = "a_420_mixed_lossless_residue_arms_are_byte_exact_in_decode_order"; | ||
| 9518 | + let _gate_lock = lock_gate_counters(); | ||
| 9519 | + // (file, bytes, fnv1a64, decode-order frames, hidden) | ||
| 9520 | + const CELLS: [(&str, usize, u64, usize, usize); 3] = [ | ||
| 9521 | + ("420_mixll_256x128_6f.obu", 22336, 5694016005779287373, 7, 1), | ||
| 9522 | + ("420_mixll_320x240_5f.obu", 28716, 5855109243102450179, 6, 1), | ||
| 9523 | + ("420_mixll_320x240_6f.obu", 38686, 49021385186397678, 7, 1), | ||
| 9524 | + ]; | ||
| 9525 | + for (file, bytes, fnv, frames, hidden) in CELLS { | ||
| 9526 | + let path = crate_pin(file); | ||
| 9527 | + let data = std::fs::read(&path) | ||
| 9528 | + .unwrap_or_else(|e| panic!("{NAME}: the committed pin {file} is missing ({e})")); | ||
| 9529 | + assert_eq!(data.len(), bytes, "{NAME}: {file} size drifted"); | ||
| 9530 | + assert_eq!(fnv1a64(&data), fnv, "{NAME}: {file} bytes drifted"); | ||
| 9531 | + let before = crate::decode::lossless_sq_txfm_band_overwrite_hits(); | ||
| 9532 | + let (decoded, got_hidden) = decode_all_frames_vs_oracle(&data, file); | ||
| 9533 | + let overwrote = crate::decode::lossless_sq_txfm_band_overwrite_hits() - before; | ||
| 9534 | + assert_eq!( | ||
| 9535 | + decoded, frames, | ||
| 9536 | + "{NAME}/{file}: the oracle decoded {decoded} frames in DECODE order" | ||
| 9537 | + ); | ||
| 9538 | + assert_eq!( | ||
| 9539 | + got_hidden, hidden, | ||
| 9540 | + "{NAME}/{file}: {decoded} decode-order dumps against {decoded} - {got_hidden} \ | ||
| 9541 | + shown outputs means the gate saw {hidden} hidden alt-ref picture/ies" | ||
| 9542 | + ); | ||
| 9543 | + assert!( | ||
| 9544 | + overwrote > 0, | ||
| 9545 | + "{NAME}/{file}: no lossless square block on an inter frame published a txfm \ | ||
| 9546 | + band that OVERWROTE an earlier block's size ({overwrote} of them did), so this \ | ||
| 9547 | + cell does not exercise the missing publish at all (class \ | ||
| 9548 | + gate-blind-to-feature) -- re-encode per the recipe above" | ||
| 9549 | + ); | ||
| 9550 | + eprintln!( | ||
| 9551 | + "{NAME}/{file}: {decoded} decode-order frame(s) byte-exact ({got_hidden} hidden), \ | ||
| 9552 | + {overwrote} lossless square inter block(s) overwrote a stale above-band size" | ||
| 9553 | + ); | ||
| 9554 | + } | ||
| 9555 | + } | ||
| 9479 | /// lane-av1444rect r2 — the SAME class as the gate above, second | 9556 | /// lane-av1444rect r2 — the SAME class as the gate above, second |
| 9480 | /// instance: `decode_rect4_16_intrabc` applied the 4:2:0 pair geometry at | 9557 | /// instance: `decode_rect4_16_intrabc` applied the 4:2:0 pair geometry at |
| 9481 | /// ss (0,0), where `is_chroma_reference` makes an intra-BC 1:4 strip its | 9558 | /// ss (0,0), where `is_chroma_reference` makes an intra-BC 1:4 strip its |
lanes/av1txctxband2.report.mdmodified+60 -10
| @@ -19,6 +19,7 @@ mi=(80,110) …)`, plus the same claim independently re-measured by | |||
| 19 | | The reader that broke | the 8x4 intra leaf with `use_filter_intra` at **mi=(80,110)**, `tx_size_cat0[2]` where libaom reads row 1. | | 19 | | The reader that broke | the 8x4 intra leaf with `use_filter_intra` at **mi=(80,110)**, `tx_size_cat0[2]` where libaom reads row 1. | |
| 20 | | `420_mixll_altref_640x480_5f.obu` (87537 B) | **REFUSED** at base → **6/6 decode-order frames byte-exact**; whole-stream paired `EC_SYMR` ladder **457 907 / 457 907 bit-identical, zero divergence** | | 20 | | `420_mixll_altref_640x480_5f.obu` (87537 B) | **REFUSED** at base → **6/6 decode-order frames byte-exact**; whole-stream paired `EC_SYMR` ladder **457 907 / 457 907 bit-identical, zero divergence** | |
| 21 | | `420_mixll_altref_640x480_6f.obu` (115615 B) | **REFUSED** at base → **7/7 decode-order frames byte-exact** | | 21 | | `420_mixll_altref_640x480_6f.obu` (115615 B) | **REFUSED** at base → **7/7 decode-order frames byte-exact** | |
| 22 | +| the three `m_256x128` / `m_320x240` **residue** arms `lane-av1mixllconj` §7 handed over as unnamed | **THE SAME DEFECT — red at base (96319 / 208704 / 19398 differing bytes) → 7/7, 6/6, 7/7 byte-exact**, now fixtures + a second gate (§6.2) | | ||
| 22 | | Corpus sweep, 110 committed fixtures | **EXACT 100 → 100, REFUSED 10 → 10, RED 0 → 0, FRAMECOUNT 0 → 0** — all ten refusals are the pre-existing by-name 4:2:2 chroma refusal. **Zero rows change**: the fix is a strict no-op on everything already correct, and it is the two NEW 640x480 fixtures that go REFUSED → 6/6 and 7/7 EXACT. | | 23 | | Corpus sweep, 110 committed fixtures | **EXACT 100 → 100, REFUSED 10 → 10, RED 0 → 0, FRAMECOUNT 0 → 0** — all ten refusals are the pre-existing by-name 4:2:2 chroma refusal. **Zero rows change**: the fix is a strict no-op on everything already correct, and it is the two NEW 640x480 fixtures that go REFUSED → 6/6 and 7/7 EXACT. | |
| 23 | | Recipe's closed cells | re-measured with the fix: 256x128 pin **6/6 EXACT**, 176x144 **6/6 EXACT**, 352x288 **6/6 EXACT**, the 4:4:4 arm green in the corpus (§6.1) | | 24 | | Recipe's closed cells | re-measured with the fix: 256x128 pin **6/6 EXACT**, 176x144 **6/6 EXACT**, 352x288 **6/6 EXACT**, the 4:4:4 arm green in the corpus (§6.1) | |
| 24 | | Class sweep | 5 sites of `context-band-not-published`; **1 was this defect (fixed), 1 is a real libaom-fidelity gap that IS reached but has NO observable effect on any fixture measured (`read_block_tx_size_rect`'s lossless arm, missing the `skip && is_inter` term — 29/1/9/6/16 measured hits), 2 are unobservable by construction, 1 is a deliberate gate that measurement clears** (§7) | | 25 | | Class sweep | 5 sites of `context-band-not-published`; **1 was this defect (fixed), 1 is a real libaom-fidelity gap that IS reached but has NO observable effect on any fixture measured (`read_block_tx_size_rect`'s lossless arm, missing the `skip && is_inter` term — 29/1/9/6/16 measured hits), 2 are unobservable by construction, 1 is a deliberate gate that measurement clears** (§7) | |
| @@ -287,7 +288,37 @@ by the project's 4:2:2 decision. | |||
| 287 | | 176x144 of the same recipe, regenerated and re-encoded here | **6/6 decode-order EXACT** (oracle 6 dumps, 0 differing bytes) | | 288 | | 176x144 of the same recipe, regenerated and re-encoded here | **6/6 decode-order EXACT** (oracle 6 dumps, 0 differing bytes) | |
| 288 | | 352x288 of the same recipe, regenerated and re-encoded here | **6/6 decode-order EXACT** (oracle 6 dumps, 0 differing bytes) | | 289 | | 352x288 of the same recipe, regenerated and re-encoded here | **6/6 decode-order EXACT** (oracle 6 dumps, 0 differing bytes) | |
| 289 | | the 4:4:4 arm | green; every `440_*` fixture in the §6 sweep is `EXACT` except the one by-name 4:2:2 refusal | | 290 | | the 4:4:4 arm | green; every `440_*` fixture in the §6 sweep is `EXACT` except the one by-name 4:2:2 refusal | |
| 290 | -| `m_320x240`, `m5_320x240`, the 6-frame `m_256x128` residuals named by `lane-av1mixllconj` §7 | **not claimed closed, and not measured here** — they are generated cells, not committed fixtures, so the §6 sweep does not cover them and no number in this report speaks to them | | 291 | +| the `m_320x240` / `m5_320x240` / 6-frame `m_256x128` **residue** that `lane-av1mixllconj` §7 left unnamed ("separate defects this change shrinks but does not remove") | **THE SAME DEFECT, and closed.** Measured on `f2dd27b0~1` they are red; with this lane's one publish they are **7/7, 6/6 and 7/7 byte-exact** (§6.2), and they now carry their own fixtures and gate `a_420_mixed_lossless_residue_arms_are_byte_exact_in_decode_order` | |
| 292 | + | ||
| 293 | +### 6.2 The residue arms, measured and gated | ||
| 294 | + | ||
| 295 | +`lane-av1mixllconj` §7 named three residuals on this same recipe and explicitly | ||
| 296 | +declined to claim them: *"separate defects this change shrinks but does not | ||
| 297 | +remove."* They are not separate. Each is a lossy block whose | ||
| 298 | +`get_tx_size_context` / `txfm_partition_context` read a band that a lossless | ||
| 299 | +block above it should have published into and did not — this lane's defect, at | ||
| 300 | +smaller frame sizes. | ||
| 301 | + | ||
| 302 | +```text | ||
| 303 | + at f2dd27b0~1 (= 0bfee517) with this lane's publish | ||
| 304 | +420_mixll_256x128_6f.obu 7 dumps, red f1..f6: 7/7 byte-exact | ||
| 305 | + 6051 / 4115 / 2962 / 26566 / 41876 / 14749 | ||
| 306 | +420_mixll_320x240_5f.obu 6 dumps, red f1..f5: 6/6 byte-exact | ||
| 307 | + 15031 / 16259 / 21932 / 65405 / 90077 | ||
| 308 | +420_mixll_320x240_6f.obu 7 dumps, red f6 only: 19398 7/7 byte-exact | ||
| 309 | +``` | ||
| 310 | + | ||
| 311 | +Decode order, per differing frame, against `aomdec`'s `EC_AV1_FINAL_DUMP`, both | ||
| 312 | +sides bit-depth-correct, hidden alt-ref frames included. The recipes reproduce | ||
| 313 | +`lane-av1mixllconj` §1's byte counts and sha prefixes (`37fbe7cb…`, `40d613fd…`). | ||
| 314 | +`m5_320x240`'s f2/f3 here read 16259 / 21932 against the 16006 / 21930 that | ||
| 315 | +report's §7 table records, because that table predates `lane-av1offtile`'s | ||
| 316 | +chroma-plane clip; f1/f4/f5 and both other cells match it exactly. | ||
| 317 | + | ||
| 318 | +All three are committed as fixtures and asserted by | ||
| 319 | +`a_420_mixed_lossless_residue_arms_are_byte_exact_in_decode_order`, pinned by | ||
| 320 | +fnv1a64. They are excluded from the §6 corpus sweep (which is the pre-existing | ||
| 321 | +corpus plus nothing else), so the zero-row diff in §6 is unaffected. | ||
| 291 | 322 | ||
| 292 | ## 7. Class sweep — `context-band-not-published` | 323 | ## 7. Class sweep — `context-band-not-published` |
| 293 | 324 | ||
| @@ -365,8 +396,9 @@ SITE3-PATCHED 420_mixll_altref_640x480_6f: oracle=7 diffbytes=0 | |||
| 365 | 396 | ||
| 366 | ## 9. Fix-now | deferred(<unblock>) | accepted | 397 | ## 9. Fix-now | deferred(<unblock>) | accepted |
| 367 | 398 | ||
| 368 | -* **fix-now** — the one-call publish, its route counter and accessor, the two | 399 | +* **fix-now** — the one-call publish, its route counter and accessor, FIVE |
| 369 | - fixtures and the gate. Landed in this commit. | 400 | + fixtures (the two 640x480 cells plus the three residue arms of §6.2) and TWO |
| 401 | + gates. Landed in this commit. | ||
| 370 | * **fix-now** — the class sweep (§7), because it is what found the site. | 402 | * **fix-now** — the class sweep (§7), because it is what found the site. |
| 371 | * **deferred(unblock: a cell where a SKIPPED inter rect strip sits on a LOSSLESS | 403 | * **deferred(unblock: a cell where a SKIPPED inter rect strip sits on a LOSSLESS |
| 372 | segment AND a lossy block later reads its column — the five fixtures that | 404 | segment AND a lossy block later reads its column — the five fixtures that |
| @@ -377,24 +409,42 @@ SITE3-PATCHED 420_mixll_altref_640x480_6f: oracle=7 diffbytes=0 | |||
| 377 | * **accepted** — §7 site 2's missing publish on a `tx_mode != TX_MODE_SELECT` | 409 | * **accepted** — §7 site 2's missing publish on a `tx_mode != TX_MODE_SELECT` |
| 378 | frame. Unreachable by construction (both readers are gated on SELECT); closing | 410 | frame. Unreachable by construction (both readers are gated on SELECT); closing |
| 379 | it would add a write nothing reads. | 411 | it would add a write nothing reads. |
| 380 | -* **accepted** — the §6 residuals `lane-av1mixllconj` §7 names on the 6-frame | 412 | +* **fix-now (second commit)** — the three residue arms of §6.2. `lane-av1mixllconj` |
| 381 | - 256x128 and the 320x240 arms. Not this class, not measured here, not claimed. | 413 | + §7 handed them over as unnamed separate defects; measured, they are this |
| 414 | + lane's defect, and they are now fixtures and a gate rather than a report note. | ||
| 382 | 415 | ||
| 383 | ## 10. Scoped test command and output | 416 | ## 10. Scoped test command and output |
| 384 | 417 | ||
| 385 | ```text | 418 | ```text |
| 386 | CARGO_TARGET_DIR=$HOME/.cache/cargo-target-av1txctxband2 EC_NOMEMGUARD=1 \ | 419 | CARGO_TARGET_DIR=$HOME/.cache/cargo-target-av1txctxband2 EC_NOMEMGUARD=1 \ |
| 387 | - cargo test -p ec-av1 --lib -- a_420_mixed_lossless_alt_ref_640x480_txfm_band_publish \ | 420 | + cargo test -p ec-av1 --lib -- a_420_mixed_lossless |
| 388 | - a_420_mixed_lossless_alt_ref_sub8_vartx | ||
| 389 | ``` | 421 | ``` |
| 390 | 422 | ||
| 391 | ```text | 423 | ```text |
| 392 | -running 2 tests | 424 | +running 3 tests |
| 393 | -test stream::tests::a_420_mixed_lossless_alt_ref_640x480_txfm_band_publish_is_byte_exact_in_decode_order ... ok | ||
| 394 | test stream::tests::a_420_mixed_lossless_alt_ref_sub8_vartx_witness_is_byte_exact_in_decode_order ... ok | 425 | test stream::tests::a_420_mixed_lossless_alt_ref_sub8_vartx_witness_is_byte_exact_in_decode_order ... ok |
| 395 | -test result: ok. 2 passed; 0 failed; 0 ignored; 0 measured; 805 filtered out; finished in 2.06s | 426 | +test stream::tests::a_420_mixed_lossless_alt_ref_640x480_txfm_band_publish_is_byte_exact_in_decode_order ... ok |
| 427 | +test stream::tests::a_420_mixed_lossless_residue_arms_are_byte_exact_in_decode_order ... ok | ||
| 428 | +test result: ok. 3 passed; 0 failed; 0 ignored; 0 measured; 805 filtered out; finished in 2.51s | ||
| 396 | ``` | 429 | ``` |
| 397 | 430 | ||
| 431 | +The same command with the one `set_txfm_ctxs` call removed — the mutation proof | ||
| 432 | +across all three, and note the residue gate fails on a PIXEL diff while the | ||
| 433 | +640x480 gate fails on the REFUSAL, so neither gate is carried by the other: | ||
| 434 | + | ||
| 435 | +```text | ||
| 436 | +test …640x480_txfm_band_publish… ... FAILED | ||
| 437 | + this decoder refused the stream: unsupported: AV1 tile (a Golomb tail longer than this decoder reads) | ||
| 438 | +test …mixed_lossless_residue_arms… ... FAILED | ||
| 439 | + 420_mixll_256x128_6f.obu: decode-order frame 1 of 7 (6 shown, 1 hidden) differs from the | ||
| 440 | + oracle at byte 16584 (ours 96 vs 91), 6051 bytes differ | ||
| 441 | +test …alt_ref_sub8_vartx_witness… ... ok <-- lane-av1mixllconj's gate, untouched by this fix | ||
| 442 | +test result: FAILED. 1 passed; 2 failed; 0 ignored; 0 measured; 805 filtered out | ||
| 443 | +``` | ||
| 444 | + | ||
| 445 | +**6051** is the hand-measured base red for that frame's f1 in §6.2 — the mutation | ||
| 446 | +reproduces the number the pre-fix tree produced, not a different one. | ||
| 447 | + | ||
| 398 | The corpus sweep (§6) is the regression evidence for everything else: 110 | 448 | The corpus sweep (§6) is the regression evidence for everything else: 110 |
| 399 | fixtures swept before and after with **zero rows changing**. | 449 | fixtures swept before and after with **zero rows changing**. |
| 400 | 450 | ||