Merge lane/av1muchunkluma: c3 and c4 were the intra-in-inter gather, already fixed
Browse files at this commit4 changed files +439 -0
- crates/ec-av1/fixtures/422_muchunk_iis_128root_grad128.obu +0 -0
- crates/ec-av1/fixtures/422_muchunk_iis_128x256_grad256.obu +0 -0
- crates/ec-av1/src/stream.rs +271 -0
- lanes/av1muchunkluma.report.md +168 -0
crates/ec-av1/fixtures/422_muchunk_iis_128root_grad128.obuadded+0 -0
Binary file changed
crates/ec-av1/fixtures/422_muchunk_iis_128x256_grad256.obuadded+0 -0
Binary file changed
crates/ec-av1/src/stream.rsmodified+271 -0
| @@ -43453,6 +43453,277 @@ exit 0 | |||
| 43453 | } | 43453 | } |
| 43454 | } | 43454 | } |
| 43455 | 43455 | ||
| 43456 | + /// lane-av1muchunkluma: the **compound-arm CONTENT** stream that reaches | ||
| 43457 | + /// only the intra-in-inter `side > 64` mu-chunk walk. `aomenc` was driven | ||
| 43458 | + /// with the compound arm's own flags (`--enable-masked-comp=1 | ||
| 43459 | + /// --enable-onesided-comp=1 --auto-alt-ref=1`), so it *is* the compound | ||
| 43460 | + /// hunt's `c3_grad128_comp` -- but its partition search never enters the | ||
| 43461 | + /// compound mu-chunk walk (0 `compound/singleref` probe lines, 16 | ||
| 43462 | + /// `intra_in_inter` ones), so its ONLY mu-chunk walk is site 8. | ||
| 43463 | + /// | ||
| 43464 | + /// lane-av1muchunk422class measured this stream diverging on the | ||
| 43465 | + /// then-current tree: first wrong sample **Y (62, 6) of shown frame 1** | ||
| 43466 | + /// (`62 * 128 + 6 = 7942`, ours 74, ffmpeg 75) and a byte-identical decode | ||
| 43467 | + /// before and after the compound DC-sign fix. lane-av1muchunk422iis's | ||
| 43468 | + /// intra-in-inter gather fix closed it: the pinned halves below are the | ||
| 43469 | + /// exact plane and the exact sample the pre-fix square gather moved. | ||
| 43470 | + /// | ||
| 43471 | + /// Recipe (byte-reproducible; re-encoded by this lane from the frozen | ||
| 43472 | + /// `grad128.y4m`, sha256 `ab8b23137c4efc818884efcf0bb6ccda363bae4b8360f2ca10ca68506cbb777d`, | ||
| 43473 | + /// which itself regenerates byte-for-byte): | ||
| 43474 | + /// ```text | ||
| 43475 | + /// ffmpeg -v error -f lavfi -i "gradients=size=128x128:c0=0xa1128f:\ | ||
| 43476 | + /// c1=0xd98c48:c2=0x120601:c3=0x4abfba:seed=63:duration=0.24:rate=25,\ | ||
| 43477 | + /// noise=all_seed=63:alls=6:allf=t" -t 0.24 -pix_fmt yuv422p \ | ||
| 43478 | + /// -f yuv4mpegpipe - > grad128.y4m | ||
| 43479 | + /// aomenc --codec=av1 --profile=2 --input-chroma-subsampling-x=1 \ | ||
| 43480 | + /// --input-chroma-subsampling-y=0 --passes=1 --end-usage=q --cq-level=40 \ | ||
| 43481 | + /// --cpu-used=0 --threads=1 --row-mt=0 --sb-size=128 \ | ||
| 43482 | + /// --min-partition-size=128 --max-partition-size=128 \ | ||
| 43483 | + /// --enable-rect-partitions=0 --enable-ab-partitions=0 \ | ||
| 43484 | + /// --enable-1to4-partitions=0 --enable-palette=0 --enable-intrabc=0 \ | ||
| 43485 | + /// --deltaq-mode=0 --enable-tx-size-search=0 --limit=6 --lag-in-frames=25 \ | ||
| 43486 | + /// --auto-alt-ref=1 --enable-global-motion=1 --enable-warped-motion=1 \ | ||
| 43487 | + /// --enable-masked-comp=1 --enable-diff-wtd-comp=1 --enable-onesided-comp=1 \ | ||
| 43488 | + /// --obu -o c3_grad128_comp.obu grad128.y4m | ||
| 43489 | + /// ``` | ||
| 43490 | + #[test] | ||
| 43491 | + fn a_422_muchunk_iis_128root_grad128_comp_stream_is_exact_and_reaches_its_unit_walk() { | ||
| 43492 | + const NAME: &str = | ||
| 43493 | + "a_422_muchunk_iis_128root_grad128_comp_stream_is_exact_and_reaches_its_unit_walk"; | ||
| 43494 | + const FILE: &str = "422_muchunk_iis_128root_grad128.obu"; | ||
| 43495 | + const LEN: usize = 34449; | ||
| 43496 | + const FNV: u64 = 0xfc59_a295_38db_577e; | ||
| 43497 | + const MIN_UNITS: usize = 16; | ||
| 43498 | + const SHOWN: usize = 6; | ||
| 43499 | + // The stream carried in frame 1, the first frame the pre-fix gather | ||
| 43500 | + // moved; frame 0 is the unaffected control. | ||
| 43501 | + const F1_Y_FNV: u64 = 0x1b17_b4c2_4bd3_58d9; | ||
| 43502 | + const F0_Y_FNV: u64 = 0x7666_cd9b_dc47_be3f; | ||
| 43503 | + // Y (62, 6) of shown frame 1: the first sample that moved. The | ||
| 43504 | + // pre-fix square gather read 74 here, ffmpeg 75. | ||
| 43505 | + const FIRST_WRONG_Y: usize = 62 * 128 + 6; | ||
| 43506 | + const F1_Y_AT_FIRST_WRONG: u16 = 75; | ||
| 43507 | + let _gate_lock = lock_gate_counters(); | ||
| 43508 | + let stream = read_pinned_muchunk_fixture(FILE, LEN, FNV, NAME); | ||
| 43509 | + assert_eq!( | ||
| 43510 | + obu_stream_shape(&stream), | ||
| 43511 | + Some((true, 1, 0, false)), | ||
| 43512 | + "{NAME}: {FILE} is not a 4:2:2 (ss 1/0, non-mono) 128x128-superblock stream" | ||
| 43513 | + ); | ||
| 43514 | + let before = ( | ||
| 43515 | + crate::decode::mu_chunk_compound_units(), | ||
| 43516 | + crate::decode::mu_chunk_intra_in_inter_units(), | ||
| 43517 | + ); | ||
| 43518 | + let shown = crate::stream::decode_stream(&stream) | ||
| 43519 | + .unwrap_or_else(|e| panic!("{NAME}: {FILE} no longer decodes cleanly: {e}")); | ||
| 43520 | + let frames = shown.len(); | ||
| 43521 | + let (compound, intra) = ( | ||
| 43522 | + crate::decode::mu_chunk_compound_units() - before.0, | ||
| 43523 | + crate::decode::mu_chunk_intra_in_inter_units() - before.1, | ||
| 43524 | + ); | ||
| 43525 | + assert_eq!(frames, SHOWN, "{NAME}: {FILE} shown-frame count"); | ||
| 43526 | + assert!( | ||
| 43527 | + intra >= MIN_UNITS, | ||
| 43528 | + "{NAME}: {FILE} allocated only {intra} intra-in-inter `side > 64` mu-chunk units \ | ||
| 43529 | + (expected >= {MIN_UNITS}) -- the site counter this gate names did not move" | ||
| 43530 | + ); | ||
| 43531 | + assert_eq!( | ||
| 43532 | + compound, 0, | ||
| 43533 | + "{NAME}: {FILE} moved the compound-named counter ({compound} units) -- this stream's \ | ||
| 43534 | + only mu-chunk walk is the intra-in-inter one and the cells are no longer separated" | ||
| 43535 | + ); | ||
| 43536 | + // (b) the oracle-free half: shown frame 1 (the first frame the pre-fix | ||
| 43537 | + // gather moved) is asserted sample-for-sample on its luma plane, plus | ||
| 43538 | + // the single sample that moved first; shown frame 0's luma is the | ||
| 43539 | + // unaffected control that fails if the gather is "fixed" past its own | ||
| 43540 | + // cell. | ||
| 43541 | + assert_eq!( | ||
| 43542 | + shown[1].y.len(), | ||
| 43543 | + 128 * 128, | ||
| 43544 | + "{NAME}: {FILE} is no longer 4:2:2 at 128x128 -- the luma plane shape moved" | ||
| 43545 | + ); | ||
| 43546 | + assert_eq!( | ||
| 43547 | + fnv1a64(&shown[1].y.iter().map(|&s| s as u8).collect::<Vec<u8>>()), | ||
| 43548 | + F1_Y_FNV, | ||
| 43549 | + "{NAME}: {FILE} shown frame 1's luma moved -- the intra-in-inter mu-chunk walk's 4:2:2 \ | ||
| 43550 | + chroma context gather is wrong again (first sample to move is Y (62, 6), index \ | ||
| 43551 | + {FIRST_WRONG_Y})" | ||
| 43552 | + ); | ||
| 43553 | + assert_eq!( | ||
| 43554 | + shown[1].y[FIRST_WRONG_Y], F1_Y_AT_FIRST_WRONG, | ||
| 43555 | + "{NAME}: {FILE} shown frame 1 Y[{FIRST_WRONG_Y}] (luma (62, 6)) is {} -- the pre-fix \ | ||
| 43556 | + square gather read 74 here", | ||
| 43557 | + shown[1].y[FIRST_WRONG_Y] | ||
| 43558 | + ); | ||
| 43559 | + assert_eq!( | ||
| 43560 | + fnv1a64(&shown[0].y.iter().map(|&s| s as u8).collect::<Vec<u8>>()), | ||
| 43561 | + F0_Y_FNV, | ||
| 43562 | + "{NAME}: {FILE} shown frame 0's luma moved -- the 4:2:2 routing changed a frame it \ | ||
| 43563 | + must not touch" | ||
| 43564 | + ); | ||
| 43565 | + // (c) the required ffmpeg compare: every plane of every shown frame. | ||
| 43566 | + if !have_ffmpeg() { | ||
| 43567 | + eprintln!( | ||
| 43568 | + "SKIP {NAME}: no ffmpeg -- the 4:2:2 pixel compare this gate exists for did NOT \ | ||
| 43569 | + run (set EC_AV1_REQUIRE_FFMPEG=1 to make this a failure)" | ||
| 43570 | + ); | ||
| 43571 | + return; | ||
| 43572 | + } | ||
| 43573 | + let ff = ffmpeg_decode_sequence_422(&stream, 128, 128, SHOWN); | ||
| 43574 | + assert_eq!(ff.len(), SHOWN, "{NAME}: {FILE} ffmpeg shown-frame count"); | ||
| 43575 | + for (i, (got, want)) in shown.iter().zip(&ff).enumerate() { | ||
| 43576 | + assert_eq!( | ||
| 43577 | + got.y, want.y, | ||
| 43578 | + "{NAME}: {FILE} shown frame {i} luma vs ffmpeg" | ||
| 43579 | + ); | ||
| 43580 | + assert_eq!(got.u, want.u, "{NAME}: {FILE} shown frame {i} U vs ffmpeg"); | ||
| 43581 | + assert_eq!(got.v, want.v, "{NAME}: {FILE} shown frame {i} V vs ffmpeg"); | ||
| 43582 | + } | ||
| 43583 | + if aomdec_available(NAME) { | ||
| 43584 | + let (decoded, hidden) = decode_all_frames_vs_oracle(&stream, NAME); | ||
| 43585 | + assert_eq!( | ||
| 43586 | + decoded, | ||
| 43587 | + SHOWN + 1, | ||
| 43588 | + "{NAME}: {FILE} decode-order frame count (6 shown + the hidden alt-ref)" | ||
| 43589 | + ); | ||
| 43590 | + eprintln!( | ||
| 43591 | + "{NAME}: {FILE} byte-exact vs ffmpeg over {SHOWN} shown frames and vs the \ | ||
| 43592 | + decode-order oracle over {decoded} frame(s) ({hidden} hidden), \ | ||
| 43593 | + compound_units={compound} intra_in_inter_units={intra}" | ||
| 43594 | + ); | ||
| 43595 | + } else { | ||
| 43596 | + eprintln!( | ||
| 43597 | + "{NAME}: {FILE} byte-exact vs ffmpeg over {SHOWN} shown frames, \ | ||
| 43598 | + compound_units={compound} intra_in_inter_units={intra} -- the decode-order \ | ||
| 43599 | + oracle compare above did NOT run (no aomdec)" | ||
| 43600 | + ); | ||
| 43601 | + } | ||
| 43602 | + } | ||
| 43603 | + | ||
| 43604 | + /// lane-av1muchunkluma: the 128x256 twin of the gate above -- the compound | ||
| 43605 | + /// hunt's `c4_grad256_comp`. Unlike c3 this stream reaches BOTH `side > 64` | ||
| 43606 | + /// mu-chunk walks (16 `intra_in_inter` probe lines, 24 `compound/singleref` | ||
| 43607 | + /// ones with `compound=false`, i.e. the single-reference twin), yet | ||
| 43608 | + /// lane-av1muchunk422class measured it diverging luma-first (first wrong | ||
| 43609 | + /// sample **Y (126, 3) of shown frame 1**, `126 * 128 + 3 = 16131`, ours | ||
| 43610 | + /// 94, ffmpeg 93). This lane re-measured it: still diverging on the | ||
| 43611 | + /// pre-iis-gather tree, byte-exact on current `main`, so the | ||
| 43612 | + /// intra-in-inter gather is what closed it -- its `MU_CHUNK_COMPOUND_UNITS` | ||
| 43613 | + /// delta stays 0 (the counter names the compound arm only), which is why | ||
| 43614 | + /// the gate's site half asserts the intra-in-inter counter. | ||
| 43615 | + /// | ||
| 43616 | + /// Recipe: same `aomenc` argv as the 128x128 gate above with the 128x256 | ||
| 43617 | + /// source (`gradients=size=128x256`, the frozen `grad256.y4m`, sha256 | ||
| 43618 | + /// `03c7fab7a6abc4e6764836cd2d35e76489438ecdba4ca1167fcd868250c0464c`, | ||
| 43619 | + /// which regenerates byte-for-byte). | ||
| 43620 | + #[test] | ||
| 43621 | + fn a_422_muchunk_iis_128x256_grad256_comp_stream_is_exact_and_reaches_its_unit_walk() { | ||
| 43622 | + const NAME: &str = | ||
| 43623 | + "a_422_muchunk_iis_128x256_grad256_comp_stream_is_exact_and_reaches_its_unit_walk"; | ||
| 43624 | + const FILE: &str = "422_muchunk_iis_128x256_grad256.obu"; | ||
| 43625 | + const LEN: usize = 68925; | ||
| 43626 | + const FNV: u64 = 0x65b8_d4dd_3806_7e09; | ||
| 43627 | + const MIN_UNITS: usize = 16; | ||
| 43628 | + const SHOWN: usize = 6; | ||
| 43629 | + const F1_Y_FNV: u64 = 0x75e6_e790_47a8_9882; | ||
| 43630 | + const F0_Y_FNV: u64 = 0x1265_8460_c00e_a10f; | ||
| 43631 | + // Y (126, 3) of shown frame 1: the first sample that moved. The | ||
| 43632 | + // pre-fix square gather read 94 here, ffmpeg 93. | ||
| 43633 | + const FIRST_WRONG_Y: usize = 126 * 128 + 3; | ||
| 43634 | + const F1_Y_AT_FIRST_WRONG: u16 = 93; | ||
| 43635 | + let _gate_lock = lock_gate_counters(); | ||
| 43636 | + let stream = read_pinned_muchunk_fixture(FILE, LEN, FNV, NAME); | ||
| 43637 | + assert_eq!( | ||
| 43638 | + obu_stream_shape(&stream), | ||
| 43639 | + Some((true, 1, 0, false)), | ||
| 43640 | + "{NAME}: {FILE} is not a 4:2:2 (ss 1/0, non-mono) 128x128-superblock stream" | ||
| 43641 | + ); | ||
| 43642 | + let before = ( | ||
| 43643 | + crate::decode::mu_chunk_compound_units(), | ||
| 43644 | + crate::decode::mu_chunk_intra_in_inter_units(), | ||
| 43645 | + ); | ||
| 43646 | + let shown = crate::stream::decode_stream(&stream) | ||
| 43647 | + .unwrap_or_else(|e| panic!("{NAME}: {FILE} no longer decodes cleanly: {e}")); | ||
| 43648 | + let frames = shown.len(); | ||
| 43649 | + let (compound, intra) = ( | ||
| 43650 | + crate::decode::mu_chunk_compound_units() - before.0, | ||
| 43651 | + crate::decode::mu_chunk_intra_in_inter_units() - before.1, | ||
| 43652 | + ); | ||
| 43653 | + assert_eq!(frames, SHOWN, "{NAME}: {FILE} shown-frame count"); | ||
| 43654 | + assert!( | ||
| 43655 | + intra >= MIN_UNITS, | ||
| 43656 | + "{NAME}: {FILE} allocated only {intra} intra-in-inter `side > 64` mu-chunk units \ | ||
| 43657 | + (expected >= {MIN_UNITS}) -- the site counter this gate names did not move" | ||
| 43658 | + ); | ||
| 43659 | + assert_eq!( | ||
| 43660 | + compound, 0, | ||
| 43661 | + "{NAME}: {FILE} moved the compound-named counter ({compound} units) -- the fixture's \ | ||
| 43662 | + `compound/singleref` hits are its single-reference twin, which must not be counted \ | ||
| 43663 | + here" | ||
| 43664 | + ); | ||
| 43665 | + assert_eq!( | ||
| 43666 | + shown[1].y.len(), | ||
| 43667 | + 128 * 256, | ||
| 43668 | + "{NAME}: {FILE} is no longer 4:2:2 at 128x256 -- the luma plane shape moved" | ||
| 43669 | + ); | ||
| 43670 | + assert_eq!( | ||
| 43671 | + fnv1a64(&shown[1].y.iter().map(|&s| s as u8).collect::<Vec<u8>>()), | ||
| 43672 | + F1_Y_FNV, | ||
| 43673 | + "{NAME}: {FILE} shown frame 1's luma moved -- the intra-in-inter mu-chunk walk's 4:2:2 \ | ||
| 43674 | + chroma context gather is wrong again (first sample to move is Y (126, 3), index \ | ||
| 43675 | + {FIRST_WRONG_Y})" | ||
| 43676 | + ); | ||
| 43677 | + assert_eq!( | ||
| 43678 | + shown[1].y[FIRST_WRONG_Y], F1_Y_AT_FIRST_WRONG, | ||
| 43679 | + "{NAME}: {FILE} shown frame 1 Y[{FIRST_WRONG_Y}] (luma (126, 3)) is {} -- the pre-fix \ | ||
| 43680 | + square gather read 94 here", | ||
| 43681 | + shown[1].y[FIRST_WRONG_Y] | ||
| 43682 | + ); | ||
| 43683 | + assert_eq!( | ||
| 43684 | + fnv1a64(&shown[0].y.iter().map(|&s| s as u8).collect::<Vec<u8>>()), | ||
| 43685 | + F0_Y_FNV, | ||
| 43686 | + "{NAME}: {FILE} shown frame 0's luma moved -- the 4:2:2 routing changed a frame it \ | ||
| 43687 | + must not touch" | ||
| 43688 | + ); | ||
| 43689 | + if !have_ffmpeg() { | ||
| 43690 | + eprintln!( | ||
| 43691 | + "SKIP {NAME}: no ffmpeg -- the 4:2:2 pixel compare this gate exists for did NOT \ | ||
| 43692 | + run (set EC_AV1_REQUIRE_FFMPEG=1 to make this a failure)" | ||
| 43693 | + ); | ||
| 43694 | + return; | ||
| 43695 | + } | ||
| 43696 | + let ff = ffmpeg_decode_sequence_422(&stream, 128, 256, SHOWN); | ||
| 43697 | + assert_eq!(ff.len(), SHOWN, "{NAME}: {FILE} ffmpeg shown-frame count"); | ||
| 43698 | + for (i, (got, want)) in shown.iter().zip(&ff).enumerate() { | ||
| 43699 | + assert_eq!( | ||
| 43700 | + got.y, want.y, | ||
| 43701 | + "{NAME}: {FILE} shown frame {i} luma vs ffmpeg" | ||
| 43702 | + ); | ||
| 43703 | + assert_eq!(got.u, want.u, "{NAME}: {FILE} shown frame {i} U vs ffmpeg"); | ||
| 43704 | + assert_eq!(got.v, want.v, "{NAME}: {FILE} shown frame {i} V vs ffmpeg"); | ||
| 43705 | + } | ||
| 43706 | + if aomdec_available(NAME) { | ||
| 43707 | + let (decoded, hidden) = decode_all_frames_vs_oracle(&stream, NAME); | ||
| 43708 | + assert_eq!( | ||
| 43709 | + decoded, | ||
| 43710 | + SHOWN + 1, | ||
| 43711 | + "{NAME}: {FILE} decode-order frame count (6 shown + the hidden alt-ref)" | ||
| 43712 | + ); | ||
| 43713 | + eprintln!( | ||
| 43714 | + "{NAME}: {FILE} byte-exact vs ffmpeg over {SHOWN} shown frames and vs the \ | ||
| 43715 | + decode-order oracle over {decoded} frame(s) ({hidden} hidden), \ | ||
| 43716 | + compound_units={compound} intra_in_inter_units={intra}" | ||
| 43717 | + ); | ||
| 43718 | + } else { | ||
| 43719 | + eprintln!( | ||
| 43720 | + "{NAME}: {FILE} byte-exact vs ffmpeg over {SHOWN} shown frames, \ | ||
| 43721 | + compound_units={compound} intra_in_inter_units={intra} -- the decode-order \ | ||
| 43722 | + oracle compare above did NOT run (no aomdec)" | ||
| 43723 | + ); | ||
| 43724 | + } | ||
| 43725 | + } | ||
| 43726 | + | ||
| 43456 | /// lane-sbpart r2: a real `aomenc` stream whose superblock-level | 43727 | /// lane-sbpart r2: a real `aomenc` stream whose superblock-level |
| 43457 | /// partition decision is genuinely HORZ/VERT (not NONE/SPLIT) must | 43728 | /// partition decision is genuinely HORZ/VERT (not NONE/SPLIT) must |
| 43458 | /// decode pixel-exact through [`crate::decode::decode_block_rect64`] -- | 43729 | /// decode pixel-exact through [`crate::decode::decode_block_rect64`] -- |
lanes/av1muchunkluma.report.mdadded+168 -0
| @@ -0,0 +1,168 @@ | |||
| 1 | +# lane-av1muchunkluma — c3 and c4: the first wrong block, named and gated | ||
| 2 | + | ||
| 3 | +Base: `main` @ `c2e592e3`. Branch: `lane/av1muchunkluma`. No decode code is | ||
| 4 | +changed by this lane: the two streams were already closed by a landed fix, so | ||
| 5 | +the deliverable is the **pin + gate** that says so, plus the red-before proof. | ||
| 6 | + | ||
| 7 | +**Verdict: both c3 and c4 are byte-exact on current `main`, and the site that | ||
| 8 | +owns both is the intra-in-inter `side > 64` mu-chunk chroma gather | ||
| 9 | +(`crates/ec-av1/src/decode.rs:46834`, the `around_mi_422_chroma` call), fixed by | ||
| 10 | +`bd762046` (lane-av1muchunk422iis).** Neither stream needed an edit — the | ||
| 11 | +class report's tree predates that fix. Both are now pinned as fixtures and | ||
| 12 | +gated; surgically restoring the plain `around_mi` gather reds BOTH gates on the | ||
| 13 | +luma plane of shown frame 1, the frame the class report named. | ||
| 14 | + | ||
| 15 | +## 1. The bytes | ||
| 16 | + | ||
| 17 | +The hunt's bytes still exist at `~/.cache/av1muchunk422b/`, byte-equal to the | ||
| 18 | +shas in `lanes/av1muchunk422class.report.md` (zero aomenc attempts were needed | ||
| 19 | +to find them): | ||
| 20 | + | ||
| 21 | +| stream | sha256 | bytes | | ||
| 22 | +|---|---|---| | ||
| 23 | +| `c3_grad128_comp.obu` | `e801ce5596c9ed72e7af9c5428b39aa3730262b9a24220f1e05b0f1992acd9c7` | 34449 | | ||
| 24 | +| `c4_grad256_comp.obu` | `90232481d39afa5389501feaee11645390fc714635249381f077749e616a0fd5` | 68925 | | ||
| 25 | + | ||
| 26 | +Both are 4:2:2 (ss 1/0), `part128 split=0`, 128 root, 6 shown frames. | ||
| 27 | + | ||
| 28 | +## 2. The first wrong sample is still luma — and it is gone | ||
| 29 | + | ||
| 30 | +`ffmpeg -v error -i X.obu -pix_fmt yuv422p -f rawvideo` (the pixel oracle) vs | ||
| 31 | +`dump_yuv X.obu <out>`, compared per plane per shown frame: | ||
| 32 | + | ||
| 33 | +| stream | tree | first wrong sample | plane diff counts (f0..f5) | | ||
| 34 | +|---|---|---|---| | ||
| 35 | +| `c3_grad128_comp` | pre-fix (`dc2deff2` binary) | **Y (62, 6) f1**, ours 74 / ffmpeg 75 | 0, Y8145 U5088 V6079, Y8168 U5107 V6131, Y16190 U8090 V8120, Y16220 U8117 V8113, 0 | | ||
| 36 | +| `c3_grad128_comp` | `main` `c2e592e3` | **none** | all planes, all 6 frames: EXACT | | ||
| 37 | +| `c4_grad256_comp` | pre-fix | **Y (126, 3) f1**, ours 94 / ffmpeg 93 | 0, Y16280 U8143 V8138, Y32747 …, Y32480 …, Y32448 …, Y24415 … | | ||
| 38 | +| `c4_grad256_comp` | `main` | **none** | all planes, all 6 frames: EXACT | | ||
| 39 | + | ||
| 40 | +The pre-fix column reproduces the class report's numbers exactly (`c3` f1 Y | ||
| 41 | +first at (62, 6); `c4` first at (126, 3)), so the control is the class report's | ||
| 42 | +own tree: the `dc2deff2` binary is the sym-DC-sign-fixed, iis-unfixed build | ||
| 43 | +`~/.cache/tgt-av1muchunk422class/debug/examples/dump_yuv`. Luma-first confirmed | ||
| 44 | +on both, at the exact coordinates the report gave. | ||
| 45 | + | ||
| 46 | +## 3. The owning block | ||
| 47 | + | ||
| 48 | +Both streams' only mu-chunk walk that matters is site 8, the **intra-in-inter | ||
| 49 | +`side > 64`** per-unit chroma walk: | ||
| 50 | + | ||
| 51 | +Counts here are the committed counter's per-TX_32X32-UNIT deltas, not the | ||
| 52 | +hunt's per-mu-chunk probe lines (the hunt's 16 / 24 lines are 4 units each on | ||
| 53 | +this walk, e.g. the landed 128x256 iis fixture: 24 probe lines, 96 units). | ||
| 54 | + | ||
| 55 | +- `c3`: 64 counter units, 0 compound-named units. Its content was encoded with | ||
| 56 | + the compound arm's flags (`--enable-masked-comp=1 --enable-onesided-comp=1 | ||
| 57 | + --auto-alt-ref=1`) but its partition search never enters the compound mu-chunk | ||
| 58 | + walk (0 `compound/singleref` probe lines), so site 8 is its only one. | ||
| 59 | +- `c4`: 96 intra-in-inter units, 0 compound-named units; it additionally takes | ||
| 60 | + the **single-reference twin** (the class report's site 5, 24 probe lines with | ||
| 61 | + `compound=false`), which the `MU_CHUNK_COMPOUND_UNITS` counter by design does | ||
| 62 | + not name. | ||
| 63 | + | ||
| 64 | +The gather that owned it is a single site, `decode.rs:46834` inside | ||
| 65 | +`decode_inter_block`'s intra-in-inter `side > 64` unit loop: it read | ||
| 66 | +`neighbours.around_mi(unit_mi, unit_luma_w)`, which at ss (1, 0) sums | ||
| 67 | +`unit_luma_w / MI` above luma cells where libaom sums `txb_w_unit` — twice as | ||
| 68 | +many — flipping `dc_sign_ctx`'s signum. `bd762046` routed it through | ||
| 69 | +`around_mi_422_chroma(unit_mi, unit_luma_w, unit_luma_h)` under the ss (1, 0) | ||
| 70 | +gate; 4:2:0 / 4:4:4 keep the plain gather. **This lane did not edit it.** | ||
| 71 | + | ||
| 72 | +## 4. Pinned and gated | ||
| 73 | + | ||
| 74 | +Two new fixtures (`crates/ec-av1/fixtures/`) and two new tests | ||
| 75 | +(`crates/ec-av1/src/stream.rs`), following the lane-av1muchunk422iis pattern: | ||
| 76 | + | ||
| 77 | +| fixture | len | sha256 | | ||
| 78 | +|---|---|---| | ||
| 79 | +| `422_muchunk_iis_128root_grad128.obu` | 34449 | `e801ce5596c9ed72…` | | ||
| 80 | +| `422_muchunk_iis_128x256_grad256.obu` | 68925 | `90232481d39afa53…` | | ||
| 81 | + | ||
| 82 | +Provenance: both were **re-encoded by this lane** from the frozen sources with | ||
| 83 | +the hunt's own argv (`run.sh` `BASE` + `--cq-level=40` + `COMP`) and are | ||
| 84 | +byte-identical to the hunt's `.obu`; the sources also regenerate | ||
| 85 | +byte-for-byte (lavfi `gradients` + `noise`, seed 63): | ||
| 86 | + | ||
| 87 | +- `grad128.y4m` sha256 `ab8b23137c4efc818884efcf0bb6ccda363bae4b8360f2ca10ca68506cbb777d` | ||
| 88 | +- `grad256.y4m` sha256 `03c7fab7a6abc4e6764836cd2d35e76489438ecdba4ca1167fcd868250c0464c` | ||
| 89 | + | ||
| 90 | +Each gate asserts, in order: pinned length + FNV; 4:2:2 (ss 1/0) sequence-header | ||
| 91 | +shape; the shown-frame count; the intra-in-inter counter delta (c3 64, c4 96) | ||
| 92 | +and that the compound-named counter did not move; the **oracle-free** half — | ||
| 93 | +shown frame 1's luma plane FNV plus the single sample that moved first (75 / | ||
| 94 | +93), with shown frame 0 as the unaffected control — and then the required | ||
| 95 | +ffmpeg compare of every plane of every shown frame, plus the decode-order aom | ||
| 96 | +oracle compare (7 frames, 1 hidden alt-ref). | ||
| 97 | + | ||
| 98 | +Green at `main`: | ||
| 99 | + | ||
| 100 | +``` | ||
| 101 | +cargo test -p ec-av1 --lib muchunk # 5 passed (this lane's 2 + the 3 landed lanes') | ||
| 102 | +``` | ||
| 103 | + | ||
| 104 | +## 5. Red-before (the fix reverted) | ||
| 105 | + | ||
| 106 | +Surgical revert of `bd762046`'s one hunk (the `cu_around` expression back to the | ||
| 107 | +plain `neighbours.around_mi(unit_mi, unit_luma_w)`) reds both gates, on the | ||
| 108 | +luma plane of shown frame 1 — the frame the class report named: | ||
| 109 | + | ||
| 110 | +``` | ||
| 111 | +a_422_muchunk_iis_128root_grad128_comp_stream_…: shown frame 1's luma moved — | ||
| 112 | + the intra-in-inter mu-chunk walk's 4:2:2 chroma context gather is wrong again | ||
| 113 | + (first sample to move is Y (62, 6), index 7942) | ||
| 114 | +a_422_muchunk_iis_128x256_grad256_comp_stream_…: … (first sample to move is | ||
| 115 | + Y (126, 3), index 16131) | ||
| 116 | +``` | ||
| 117 | + | ||
| 118 | +`decode.rs` was restored from a byte copy afterwards and `git diff` shows no | ||
| 119 | +change to it; the two gates are green again (run above). | ||
| 120 | + | ||
| 121 | +## 6. Acceptance | ||
| 122 | + | ||
| 123 | +- **c3**: gated (`422_muchunk_iis_128root_grad128.obu`) and exact against | ||
| 124 | + ffmpeg on all 6 shown frames and against the decode-order oracle on 7. | ||
| 125 | +- **c4**: the same site owns it (its first wrong sample is closed by the same | ||
| 126 | + fix), so it is added to the gate as its own test | ||
| 127 | + (`422_muchunk_iis_128x256_grad256.obu`), exact on the same two comparisons. | ||
| 128 | +- **No edit to the decoder**: the owning site was already fixed on `main`; the | ||
| 129 | + only changes are the two fixtures, the two tests and this report. | ||
| 130 | + | ||
| 131 | +## 7. Repro | ||
| 132 | + | ||
| 133 | +``` | ||
| 134 | +git worktree add -b lane/av1muchunkluma ~/.cache/wt/av1muchunkluma c2e592e3 | ||
| 135 | +cd ~/.cache/wt/av1muchunkluma | ||
| 136 | +CARGO_TARGET_DIR=$HOME/.cache/tgt-av1muchunkluma cargo build -p ec-av1 --example dump_yuv | ||
| 137 | +B=$HOME/.cache/tgt-av1muchunkluma/debug/examples/dump_yuv | ||
| 138 | +S=$HOME/.cache/av1muchunk422b | ||
| 139 | +for n in c3_grad128_comp c4_grad256_comp; do | ||
| 140 | + ffmpeg -v error -y -i $S/$n.obu -pix_fmt yuv422p -f rawvideo /tmp/$n.ref.yuv | ||
| 141 | + TMPDIR=$HOME/.cache/tmp $B $S/$n.obu /tmp/$n.ours # per-frame, per-plane cmp | ||
| 142 | +done | ||
| 143 | +# the gates (both green on main; red with bd762046's hunk reverted) | ||
| 144 | +EC_AV1_AOMDEC=$HOME/.cache/aom-oracle/build/aomdec EC_AV1_REQUIRE_AOMDEC=1 \ | ||
| 145 | + EC_AV1_REQUIRE_FFMPEG=1 TMPDIR=$HOME/.cache/tmp CARGO_TARGET_DIR=$HOME/.cache/tgt-av1muchunkluma \ | ||
| 146 | + cargo test -p ec-av1 --lib muchunk_iis_128 | ||
| 147 | +``` | ||
| 148 | + | ||
| 149 | +Pre-fix control: `~/.cache/tgt-av1muchunk422class/debug/examples/dump_yuv` | ||
| 150 | +(the class lane's tip `dc2deff2`, i.e. the tree `lanes/av1muchunk422class.report.md` | ||
| 151 | +measured); it reproduces both streams' first wrong samples exactly. | ||
| 152 | + | ||
| 153 | +Re-encode check (this lane): | ||
| 154 | +``` | ||
| 155 | +AOM=~/.cache/aom-oracle/build/aomenc | ||
| 156 | +$AOM --codec=av1 --profile=2 --input-chroma-subsampling-x=1 --input-chroma-subsampling-y=0 \ | ||
| 157 | + --passes=1 --end-usage=q --cq-level=40 --cpu-used=0 --threads=1 --row-mt=0 --sb-size=128 \ | ||
| 158 | + --min-partition-size=128 --max-partition-size=128 --enable-rect-partitions=0 \ | ||
| 159 | + --enable-ab-partitions=0 --enable-1to4-partitions=0 --enable-palette=0 --enable-intrabc=0 \ | ||
| 160 | + --deltaq-mode=0 --enable-tx-size-search=0 --limit=6 --lag-in-frames=25 --auto-alt-ref=1 \ | ||
| 161 | + --enable-global-motion=1 --enable-warped-motion=1 --enable-masked-comp=1 \ | ||
| 162 | + --enable-diff-wtd-comp=1 --enable-onesided-comp=1 --obu -o out.obu grad128.y4m | ||
| 163 | +``` | ||
| 164 | + | ||
| 165 | +Note on local runs: the class lane's `/tmp` writes died with | ||
| 166 | +`Disk quota exceeded (os error 122)` on the 128x256 frames; this lane's compare | ||
| 167 | +files are per-frame and small enough that `/tmp` held them, but a home-backed | ||
| 168 | +`TMPDIR` is the safe default. | ||