ec-av1: lane-av1444rect r2 -- the same class, second instance, in the intra-BC 1:4 strip; plus an H3 retraction
Browse files at this commit2bcb6deb102e864ed48aabb6600ba38db2f1996aParent: ea4a14d5 changed files +343 -29
- crates/ec-av1/fixtures/420_intrabc_rect4_witness.obu +0 -0
- crates/ec-av1/fixtures/444_intrabc_rect4_witness.obu +0 -0
- crates/ec-av1/src/decode.rs +59 -3
- crates/ec-av1/src/stream.rs +151 -0
- lanes/av1444rect.report.md +133 -26
crates/ec-av1/fixtures/420_intrabc_rect4_witness.obuadded+0 -0
Binary file changed
crates/ec-av1/fixtures/444_intrabc_rect4_witness.obuadded+0 -0
Binary file changed
crates/ec-av1/src/decode.rsmodified+59 -3
| @@ -5526,6 +5526,26 @@ pub(crate) fn reset_rect4_inter_own_chroma444_hits() { | |||
| 5526 | RECT4_INTER_OWN_CHROMA444_HITS.with(|c| c.set(0)); | 5526 | RECT4_INTER_OWN_CHROMA444_HITS.with(|c| c.set(0)); |
| 5527 | } | 5527 | } |
| 5528 | 5528 | ||
| 5529 | +// lane-av1444rect r2: how many intra-BC 1:4 strips at `ss (0,0)` coded their | ||
| 5530 | +// OWN 16x4 / 4x16 chroma plane block instead of the 4:2:0 pair's 8x4 (see | ||
| 5531 | +// [`decode_rect4_16_intrabc`]'s `own444`). A 4:2:0 / 4:2:2 stream of the same | ||
| 5532 | +// recipe leaves it at 0, which is what makes it the 4:4:4-only route. | ||
| 5533 | +thread_local! { | ||
| 5534 | + static INTRABC_RECT4_OWN_CHROMA444_HITS: std::cell::Cell<usize> = const { std::cell::Cell::new(0) }; | ||
| 5535 | +} | ||
| 5536 | + | ||
| 5537 | +/// Current value of [`INTRABC_RECT4_OWN_CHROMA444_HITS`]. | ||
| 5538 | +#[allow(dead_code)] // read only from the `#[cfg(test)]` gates | ||
| 5539 | +pub(crate) fn intrabc_rect4_own_chroma444_hits() -> usize { | ||
| 5540 | + INTRABC_RECT4_OWN_CHROMA444_HITS.with(std::cell::Cell::get) | ||
| 5541 | +} | ||
| 5542 | + | ||
| 5543 | +/// Resets [`INTRABC_RECT4_OWN_CHROMA444_HITS`] before a decode. | ||
| 5544 | +#[allow(dead_code)] // read only from the `#[cfg(test)]` gates | ||
| 5545 | +pub(crate) fn reset_intrabc_rect4_own_chroma444_hits() { | ||
| 5546 | + INTRABC_RECT4_OWN_CHROMA444_HITS.with(|c| c.set(0)); | ||
| 5547 | +} | ||
| 5548 | + | ||
| 5529 | // lane-intra14 r1: set while an INTRA block of an INTER frame is decoded | 5549 | // lane-intra14 r1: set while an INTRA block of an INTER frame is decoded |
| 5530 | // through one of the key-frame rect readers ([`decode_block_rect4`], | 5550 | // through one of the key-frame rect readers ([`decode_block_rect4`], |
| 5531 | // [`decode_block_rect64`]). `Some((size_group, skip))` tells | 5551 | // [`decode_block_rect64`]). `Some((size_group, skip))` tells |
| @@ -16483,10 +16503,42 @@ fn decode_rect4_16_intrabc( | |||
| 16483 | pred_y[row * side..][..bw].copy_from_slice(&pred_y_dense[row * bw..][..bw]); | 16503 | pred_y[row * side..][..bw].copy_from_slice(&pred_y_dense[row * bw..][..bw]); |
| 16484 | } | 16504 | } |
| 16485 | 16505 | ||
| 16486 | - let (pw, ph) = if horz { (16usize, 8usize) } else { (8, 16) }; | 16506 | + // lane-av1444rect r2 (the class this lane named, second instance): the |
| 16487 | - let (cw, ch) = (pw / 2, ph / 2); | 16507 | + // pair geometry below is the 4:2:0 one and was applied at every `ss`. At |
| 16508 | + // ss (0,0) `is_chroma_reference` (av1_common_int.h:1454) is | ||
| 16509 | + // unconditionally true -- the strip is its own chroma reference, there is | ||
| 16510 | + // no pair, and its chroma plane block IS the strip: 16x4 (HORZ_4) / 4x16 | ||
| 16511 | + // (VERT_4) at the strip's own origin, with its coefficient context read | ||
| 16512 | + // over that same extent. The old constants instead predicted and coded an | ||
| 16513 | + // 8x4 block at `(lmi - 1) * MI / 2`, a quarter of the position. | ||
| 16514 | + // | ||
| 16515 | + // MEASURED on a `testsrc2` 640x480 `--tune-content=screen --enable-intrabc=1 | ||
| 16516 | + // --enable-palette=1 --cq-level=60 --min-partition-size=4 | ||
| 16517 | + // --max-partition-size=64 --sb-size=64 --profile=1` stream (1016 B, 17 | ||
| 16518 | + // intrabc 16x4 strips at ss (0,0)): 455240 of 921600 samples wrong, the | ||
| 16519 | + // entropy fork at read 11750 (`decodetxb.c:158`, the chroma `txb_skip`). | ||
| 16520 | + // `--enable-intrabc=0` at the same settings is byte-exact, and the 4:2:0 | ||
| 16521 | + // twin of the same recipe is byte-exact. | ||
| 16522 | + // | ||
| 16523 | + // 4:2:0 and 4:2:2 keep every constant below verbatim -- the arm is gated on | ||
| 16524 | + // the full ss (0,0), not on a per-axis shift, so `pw / 2` and the literal | ||
| 16525 | + // halving are untouched for both. | ||
| 16526 | + let own444 = ss_x(fctx) == 0 && ss_y(fctx) == 0; | ||
| 16527 | + if ss_x(fctx) == 0 && ss_y(fctx) == 0 && has_chroma { | ||
| 16528 | + hit!(INTRABC_RECT4_OWN_CHROMA444_HITS); | ||
| 16529 | + } | ||
| 16530 | + let (pw, ph) = if own444 { | ||
| 16531 | + (bw, bh) | ||
| 16532 | + } else if horz { | ||
| 16533 | + (16usize, 8usize) | ||
| 16534 | + } else { | ||
| 16535 | + (8, 16) | ||
| 16536 | + }; | ||
| 16537 | + let (cw, ch) = if own444 { (bw, bh) } else { (pw / 2, ph / 2) }; | ||
| 16488 | let pair_mi = if has_chroma { | 16538 | let pair_mi = if has_chroma { |
| 16489 | - if horz { | 16539 | + if own444 { |
| 16540 | + lmi | ||
| 16541 | + } else if horz { | ||
| 16490 | (lmi.0 - 1, lmi.1) | 16542 | (lmi.0 - 1, lmi.1) |
| 16491 | } else { | 16543 | } else { |
| 16492 | (lmi.0, lmi.1 - 1) | 16544 | (lmi.0, lmi.1 - 1) |
| @@ -16495,7 +16547,11 @@ fn decode_rect4_16_intrabc( | |||
| 16495 | lmi | 16547 | lmi |
| 16496 | }; | 16548 | }; |
| 16497 | let (cpx, cpy) = if has_chroma { | 16549 | let (cpx, cpy) = if has_chroma { |
| 16550 | + if own444 { | ||
| 16551 | + (px, py) | ||
| 16552 | + } else { | ||
| 16498 | (pair_mi.1 * MI / 2, pair_mi.0 * MI / 2) | 16553 | (pair_mi.1 * MI / 2, pair_mi.0 * MI / 2) |
| 16554 | + } | ||
| 16499 | } else { | 16555 | } else { |
| 16500 | (0, 0) | 16556 | (0, 0) |
| 16501 | }; | 16557 | }; |
crates/ec-av1/src/stream.rsmodified+151 -0
| @@ -7108,6 +7108,157 @@ pub(crate) mod tests { | |||
| 7108 | eprintln!("{NAME}: 4:2:0 control {h4} HORZ_4 / {v4} VERT_4 strips, 0 own-extent gathers"); | 7108 | eprintln!("{NAME}: 4:2:0 control {h4} HORZ_4 / {v4} VERT_4 strips, 0 own-extent gathers"); |
| 7109 | } | 7109 | } |
| 7110 | 7110 | ||
| 7111 | + /// lane-av1444rect r2 — the SAME class as the gate above, second | ||
| 7112 | + /// instance: `decode_rect4_16_intrabc` applied the 4:2:0 pair geometry at | ||
| 7113 | + /// ss (0,0), where `is_chroma_reference` makes an intra-BC 1:4 strip its | ||
| 7114 | + /// own chroma reference. It predicted and coded an 8x4 chroma block at | ||
| 7115 | + /// `(lmi - 1) * MI / 2` where libaom codes 16x4 at the strip's origin. | ||
| 7116 | + /// | ||
| 7117 | + /// **This is a PROGRESS gate, not an exactness gate, and it says so.** The | ||
| 7118 | + /// 4:4:4 intra-BC cell is still divergent: after the ss gate the LUMA | ||
| 7119 | + /// plane is exact to sample 205264 (it was 164416) and the entropy fork | ||
| 7120 | + /// moves from read 11750 to 12465, but both CHROMA planes still first | ||
| 7121 | + /// diverge at index 20532 and 390380 of 921600 samples are wrong. So the | ||
| 7122 | + /// assertion is a prefix floor on the plane the gate actually moved — | ||
| 7123 | + /// which only ever grows, and which the next lane's fix cannot turn red — | ||
| 7124 | + /// and the untouched chroma divergence is named, never asserted exact. | ||
| 7125 | + /// | ||
| 7126 | + /// Recipe (both fixtures, one frame, `testsrc2 640x480 r=25`): | ||
| 7127 | + /// ```text | ||
| 7128 | + /// aomenc --codec=av1 --bit-depth=8 --input-bit-depth=8 --passes=1 | ||
| 7129 | + /// --end-usage=q --cpu-used=0 --lag-in-frames=0 --kf-max-dist=1 | ||
| 7130 | + /// --limit=1 --threads=1 --enable-rect-partitions=1 | ||
| 7131 | + /// --enable-1to4-partitions=1 --min-partition-size=4 | ||
| 7132 | + /// --max-partition-size=64 --sb-size=64 --tune-content=screen | ||
| 7133 | + /// --enable-intrabc=1 --enable-palette=1 --cq-level=60 | ||
| 7134 | + /// --enable-tx-size-search=0 --obu [--profile=1] -o out.obu src.y4m | ||
| 7135 | + /// ``` | ||
| 7136 | + /// 4:4:4 (1016 B, sha256 7fe888ed…) carries 17 intrabc 16x4 strips at | ||
| 7137 | + /// ss (0,0); the 4:2:0 twin (890 B, sha256 d01352af…) is byte-exact and | ||
| 7138 | + /// is the identity arm — the ss gate cannot reach it, and the whole frame | ||
| 7139 | + /// is compared with the length asserted first. | ||
| 7140 | + #[test] | ||
| 7141 | + fn a_444_intrabc_rect4_reads_its_own_chroma_plane_block() { | ||
| 7142 | + const NAME: &str = "a_444_intrabc_rect4_reads_its_own_chroma_plane_block"; | ||
| 7143 | + const W: usize = 640; | ||
| 7144 | + const H: usize = 480; | ||
| 7145 | + const PS: usize = W * H; | ||
| 7146 | + /// The luma prefix the ss gate makes exact (measured: 205264, i.e. | ||
| 7147 | + /// Y(464,320); before the gate the first wrong luma sample was 164416, | ||
| 7148 | + /// Y(576,256)). A floor, not a pin: fixing the open chroma divergence | ||
| 7149 | + /// moves this later, never earlier. | ||
| 7150 | + const LUMA_EXACT_PREFIX: usize = 205264; | ||
| 7151 | + let read = |name: &str, file: &str, len: usize, fnv: u64| -> Vec<u8> { | ||
| 7152 | + let path = std::path::PathBuf::from(env!("CARGO_MANIFEST_DIR")) | ||
| 7153 | + .join(format!("fixtures/{file}")); | ||
| 7154 | + let bytes = std::fs::read(&path).unwrap_or_else(|e| { | ||
| 7155 | + panic!( | ||
| 7156 | + "{name}: pinned fixture {} is missing ({e}) -- a failure, not a skip", | ||
| 7157 | + path.display() | ||
| 7158 | + ) | ||
| 7159 | + }); | ||
| 7160 | + assert_eq!(bytes.len(), len, "{name}: {file} length moved"); | ||
| 7161 | + assert_eq!(fnv1a64(&bytes), fnv, "{name}: {file} bytes moved"); | ||
| 7162 | + bytes | ||
| 7163 | + }; | ||
| 7164 | + let stream444 = read( | ||
| 7165 | + NAME, | ||
| 7166 | + "444_intrabc_rect4_witness.obu", | ||
| 7167 | + 1016, | ||
| 7168 | + 0x27c2_fad5_4047_2994, | ||
| 7169 | + ); | ||
| 7170 | + let stream420 = read( | ||
| 7171 | + NAME, | ||
| 7172 | + "420_intrabc_rect4_witness.obu", | ||
| 7173 | + 890, | ||
| 7174 | + 0x57ec_3da2_a63b_403a, | ||
| 7175 | + ); | ||
| 7176 | + | ||
| 7177 | + let _guard = lock_gate_counters(); | ||
| 7178 | + crate::decode::reset_intrabc_rect4_own_chroma444_hits(); | ||
| 7179 | + let frames = decode_stream(&stream444) | ||
| 7180 | + .unwrap_or_else(|e| panic!("{NAME}: the pinned 4:4:4 stream was refused: {e}")); | ||
| 7181 | + let own = crate::decode::intrabc_rect4_own_chroma444_hits(); | ||
| 7182 | + assert!( | ||
| 7183 | + own > 0, | ||
| 7184 | + "{NAME}: no intra-BC 1:4 strip coded its own chroma plane block -- the \ | ||
| 7185 | + corrected route never ran (class gate-blind-to-feature)" | ||
| 7186 | + ); | ||
| 7187 | + assert_eq!(frames.len(), 1, "{NAME}: frame count"); | ||
| 7188 | + | ||
| 7189 | + // The identity arm FIRST and in full: the 4:2:0 twin must stay | ||
| 7190 | + // byte-exact. `decode_all_frames_vs_oracle` asserts the two frame | ||
| 7191 | + // lengths match before it compares anything -- the check whose absence | ||
| 7192 | + // turned an out-of-window divergence into a reported EXACT in this | ||
| 7193 | + // lane's own round 1. | ||
| 7194 | + if aomdec_path().is_file() { | ||
| 7195 | + decode_all_frames_vs_oracle(&stream420, &format!("{NAME}-420")); | ||
| 7196 | + crate::decode::reset_intrabc_rect4_own_chroma444_hits(); | ||
| 7197 | + decode_stream(&stream420) | ||
| 7198 | + .unwrap_or_else(|e| panic!("{NAME}: the 4:2:0 twin was refused: {e}")); | ||
| 7199 | + assert_eq!( | ||
| 7200 | + crate::decode::intrabc_rect4_own_chroma444_hits(), | ||
| 7201 | + 0, | ||
| 7202 | + "{NAME}: the 4:2:0 twin fired the ss (0,0)-only route" | ||
| 7203 | + ); | ||
| 7204 | + | ||
| 7205 | + // The 4:4:4 prefix claim. Same length-first discipline: an | ||
| 7206 | + // unequal-length compare would silently become a prefix compare | ||
| 7207 | + // and pass for the wrong reason. | ||
| 7208 | + let dir = std::env::temp_dir().join(format!("ec-av1-ibc444-{}", std::process::id())); | ||
| 7209 | + let _ = std::fs::remove_dir_all(&dir); | ||
| 7210 | + std::fs::create_dir_all(&dir).expect("scratch dir"); | ||
| 7211 | + let obu = dir.join("in.obu"); | ||
| 7212 | + std::fs::write(&obu, &stream444).expect("write stream"); | ||
| 7213 | + let out = Command::new(aomdec_path()) | ||
| 7214 | + .args(["--codec=av1", "-o"]) | ||
| 7215 | + .arg(dir.join("out.y4m")) | ||
| 7216 | + .arg(&obu) | ||
| 7217 | + .env("EC_AV1_FINAL_DUMP", dir.join("aom")) | ||
| 7218 | + .stdin(Stdio::null()) | ||
| 7219 | + .stdout(Stdio::piped()) | ||
| 7220 | + .stderr(Stdio::piped()) | ||
| 7221 | + .output() | ||
| 7222 | + .expect("aomdec failed to run"); | ||
| 7223 | + assert!( | ||
| 7224 | + out.status.success(), | ||
| 7225 | + "{NAME}: the oracle aomdec refused the stream: {}", | ||
| 7226 | + String::from_utf8_lossy(&out.stderr) | ||
| 7227 | + ); | ||
| 7228 | + let reference = std::fs::read(dir.join("aom.f0")).expect("oracle dump"); | ||
| 7229 | + assert_eq!( | ||
| 7230 | + reference.len(), | ||
| 7231 | + 3 * PS, | ||
| 7232 | + "{NAME}: the oracle dump is {} bytes, the 4:4:4 frame is {} -- a \ | ||
| 7233 | + compare across different lengths is a PREFIX compare and passes \ | ||
| 7234 | + for the wrong reason", | ||
| 7235 | + reference.len(), | ||
| 7236 | + 3 * PS | ||
| 7237 | + ); | ||
| 7238 | + let ours = &frames[0]; | ||
| 7239 | + let at = (0..LUMA_EXACT_PREFIX) | ||
| 7240 | + .find(|&k| ours.y[k] != u16::from(reference[k])) | ||
| 7241 | + .unwrap_or(LUMA_EXACT_PREFIX); | ||
| 7242 | + assert_eq!( | ||
| 7243 | + at, | ||
| 7244 | + LUMA_EXACT_PREFIX, | ||
| 7245 | + "{NAME}: the luma plane first differs from the oracle at sample {at} \ | ||
| 7246 | + (Y({},{})), inside the {LUMA_EXACT_PREFIX}-sample prefix this \ | ||
| 7247 | + gate covers -- the intra-BC own-chroma ss gate regressed", | ||
| 7248 | + at % W, | ||
| 7249 | + at / W | ||
| 7250 | + ); | ||
| 7251 | + let _ = std::fs::remove_dir_all(&dir); | ||
| 7252 | + eprintln!( | ||
| 7253 | + "{NAME}: {own} own-chroma intra-BC strip(s); luma exact to \ | ||
| 7254 | + {LUMA_EXACT_PREFIX}; chroma still diverges from index 20532 \ | ||
| 7255 | + (OPEN, see lanes/av1444rect.report.md §6)" | ||
| 7256 | + ); | ||
| 7257 | + } else { | ||
| 7258 | + eprintln!("{NAME}: no oracle aomdec, pixel arm skipped"); | ||
| 7259 | + } | ||
| 7260 | + } | ||
| 7261 | + | ||
| 7111 | /// lane-av1lrflush: the pipelined loop-restoration band release flushes | 7262 | /// lane-av1lrflush: the pipelined loop-restoration band release flushes |
| 7112 | /// RU row 0 on the inter frame whose top superblock row carries a | 7263 | /// RU row 0 on the inter frame whose top superblock row carries a |
| 7113 | /// 128-root rect -- the exact shape lanes/av1444sb.report.md r2 named as | 7264 | /// 128-root rect -- the exact shape lanes/av1444sb.report.md r2 named as |
lanes/av1444rect.report.mdmodified+133 -26
| @@ -1,7 +1,10 @@ | |||
| 1 | -# lane-av1444rect — H1: 4:4:4 lossy + a 1:4 (RECT) partition | 1 | +# lane-av1444rect — H1 (4:4:4 lossy + a 1:4 partition) and the class, round 2 |
| 2 | 2 | ||
| 3 | **Tree.** `lane-av1444rect` off `4155c7c7`, worktree `~/.cache/wt/av1444rect`. | 3 | **Tree.** `lane-av1444rect` off `4155c7c7`, worktree `~/.cache/wt/av1444rect`. |
| 4 | -Fix commit `f92776ba`. One decode.rs hunk, one gate, one pinned fixture. | 4 | +Round 1: `f92776ba` (H1 fix + gate + fixture), `bd0d0c37` (report). |
| 5 | +Round 2: the class's second instance, `decode_rect4_16_intrabc`, plus a | ||
| 6 | +retraction (§5) and a progress gate (§6). Read §5 before quoting any H3 number | ||
| 7 | +from this report. | ||
| 5 | 8 | ||
| 6 | ## 1. Root cause | 9 | ## 1. Root cause |
| 7 | 10 | ||
| @@ -187,40 +190,132 @@ clamp on a 4:4:4 chroma TX_32X64 is still the prime suspect. Re-measured | |||
| 187 | here to prove the class claim above: H2's numbers are bit-identical before | 190 | here to prove the class claim above: H2's numbers are bit-identical before |
| 188 | and after, so this fix neither caused nor cured it. | 191 | and after, so this fix neither caused nor cured it. |
| 189 | 192 | ||
| 190 | -**H3**: with the sweep's full flag set | 193 | +**H3: RETRACTED — my first claim was void, Agent142-2's measurement stands.** |
| 191 | -(`--profile=1 --passes=1 --lossless=1 --end-usage=q --cq-level=20 | 194 | +I reported this stream "byte-exact 6/6". It is not. My throwaway compare |
| 192 | ---cpu-used=2 --threads=1 --row-mt=0 --lag-in-frames=0 --kf-max-dist=100 | 195 | +script hardcoded the frame geometry to 128x96 (the H1 fixture's) and |
| 193 | ---limit=6 --tile-columns=1`) the 6-frame 77847-byte stream is byte-exact. | 196 | +derived the sample count as 3·128·96 = 36864; I fed it a 256×128 witness |
| 194 | -Without those flags the same source diverges hard, so the sweep's H3 recipe | 197 | +without overriding the size, so it compared only the **top-left 36864 |
| 195 | -was under-specified; the tile-column defect does not reproduce on the | 198 | +samples** of each 98304-sample frame and declared the frame exact. The |
| 196 | -recipe as re-derived here. Flagging, not claiming. | 199 | +defect sits at x ≥ 108, outside the window. A prefix compare passes |
| 200 | +exactly when the defect is outside the prefix. | ||
| 201 | + | ||
| 202 | +- fixture sha256 `87b0d1a5b3044552fc1fae839e868c30fdc0bebe79f8b3a3104030ffea24ab50`, | ||
| 203 | + 77847 B, `testsrc2 256x128 rate=25` yuv444p, `--limit=6 --kf-max-dist=100 | ||
| 204 | + --threads=1 --row-mt=0 --lag-in-frames=0 --passes=1 --end-usage=q | ||
| 205 | + --lossless=1 --tile-columns=1 --cpu-used=2` — byte-identical to | ||
| 206 | + Agent142-2's witness A, so this is a harness bug, not a different-ffmpeg | ||
| 207 | + story; | ||
| 208 | +- re-measured with the correct geometry on this tip: **63–162 wrong chroma | ||
| 209 | + samples in every one of the six frames, first at U(110,26)**, luma exact | ||
| 210 | + — Agent142-2's "29–103 wrong, x ≥ 108, luma exact", reproduced; | ||
| 211 | +- their second witness (75446 B, no `--cpu-used`, | ||
| 212 | + `65e94e91c56178d21f5c8441877d0dbfbee17bce0916e971fbe6c51677c9891e`) | ||
| 213 | + reproduces the sweep's original H3 signature (frame 0 only, 12 U + 40 V, | ||
| 214 | + first U(237,58)) and is bit-identical before and after this fix. | ||
| 215 | + | ||
| 216 | +**H3 is not cured by this fix and is not in this lane.** No H3 gate is | ||
| 217 | +pinned here. Agent142-2 owns it. The lesson is in §7: a per-frame byte | ||
| 218 | +compare must assert the two frame lengths match before comparing, and must | ||
| 219 | +not be handed a fixture whose geometry it does not know. | ||
| 197 | 220 | ||
| 198 | **H5 (lane-av1h5, Agent06-3): out of scope and structurally disjoint.** The | 221 | **H5 (lane-av1h5, Agent06-3): out of scope and structurally disjoint.** The |
| 199 | new arm lives inside `match strip_chroma`, which is `Some` only from the | 222 | new arm lives inside `match strip_chroma`, which is `Some` only from the |
| 200 | single setter the PARTITION_HORZ_4 / VERT_4 16x4 / 4x16 `inter_piece` loop | 223 | single setter the PARTITION_HORZ_4 / VERT_4 16x4 / 4x16 `inter_piece` loop |
| 201 | runs; a BLOCK_128X128 unsplit root never reaches it. | 224 | runs; a BLOCK_128X128 unsplit root never reaches it. |
| 202 | 225 | ||
| 203 | -## 6. Residue handed on, not fixed here | 226 | +## 6. The same class, second instance: `decode_rect4_16_intrabc` |
| 204 | - | 227 | + |
| 205 | -- **`decode_rect4_16_intrabc` (`decode.rs:16466`) — same class, still | 228 | +Round 1 left this open on inspection, noting it "needs a 4:4:4 witness I had |
| 206 | - open.** The intra-BC 16x4 / 4x16 strip reader hardcodes the 4:2:0 pair | 229 | +no budget to produce". Round 2 produced the witness. **It is live, not |
| 207 | - with no `ss` gate at all: | 230 | +latent.** |
| 208 | - `let (pw, ph) = if horz { (16, 8) } else { (8, 16) };`, | 231 | + |
| 209 | - `pair_mi = (lmi.0 - 1, lmi.1) | (lmi.0, lmi.1 - 1)`, and | 232 | +**Witness.** `testsrc2 640x480 r=25` yuv444p, `aomenc --tune-content=screen |
| 210 | - `cpx = pair_mi.1 * MI / 2` (a literal 4:2:0 halving). At ss (0,0) that | 233 | +--enable-intrabc=1 --enable-palette=1 --cq-level=60 --enable-tx-size-search=0 |
| 211 | - decodes an 8x4 chroma block at a halved anchor where libaom codes a | 234 | +--min-partition-size=4 --max-partition-size=64 --sb-size=64 |
| 212 | - 16x4 at the strip's own. I did not fix it: it needs a 4:4:4 witness with | 235 | +--enable-rect-partitions=1 --enable-1to4-partitions=1 --cpu-used=0 |
| 213 | - screen-content tools on (aomenc sets `allow_screen_content_tools` for | 236 | +--kf-max-dist=1 --limit=1 --profile=1` — 1016 B, sha256 `7fe888ed…`, carrying |
| 214 | - `testsrc2` yuv444p by default), which I had no budget to produce, and | 237 | +**17 intrabc 16x4 strips at ss (0,0)**. |
| 215 | - fixing an unreproduced branch here would be a guess. The pinned H1 fixture | 238 | + |
| 216 | - decodes exactly, so it does not reach that reader. | 239 | +**Controls, same recipe each:** |
| 240 | + | ||
| 241 | +| arm | verdict | | ||
| 242 | +|---|---| | ||
| 243 | +| 4:4:4, intrabc on | 455240 / 921600 wrong, first Y(576,256) | | ||
| 244 | +| 4:4:4, `--enable-intrabc=0` | **byte-exact** | | ||
| 245 | +| 4:2:0 twin, intrabc on (890 B, sha256 `d01352af…`) | **byte-exact** | | ||
| 246 | +| 4:4:4 with `--enable-1to4-partitions=0` and `--enable-rect-partitions=0` | 455240 wrong — the defect does NOT need a 1:4 or rect partition | | ||
| 247 | + | ||
| 248 | +So the divergence is intra-BC-at-4:4:4 in general; `decode_rect4_16_intrabc` | ||
| 249 | +is one site in it, not all of it. | ||
| 250 | + | ||
| 251 | +**The site.** `decode.rs:16489`: `(pw, ph) = if horz { (16, 8) } else { (8, 16) }`, | ||
| 252 | +`pair_mi = lmi - 1`, `cpx = pair_mi.1 * MI / 2`. At ss (0,0) that predicts and | ||
| 253 | +codes an 8x4 chroma block a quarter of the way off, where libaom codes a 16x4 | ||
| 254 | +at the strip's own origin. | ||
| 255 | + | ||
| 256 | +**Round 2's change.** One `own444 = ss_x == 0 && ss_y == 0` gate on | ||
| 257 | +`(pw, ph)`, `(cw, ch)`, `pair_mi` and `(cpx, cpy)`. 4:2:0 and 4:2:2 keep every | ||
| 258 | +constant verbatim, so the arm cannot reach them. | ||
| 259 | + | ||
| 260 | +**Measured, per plane:** | ||
| 261 | + | ||
| 262 | +| | before | after | | ||
| 263 | +|---|---|---| | ||
| 264 | +| first entropy fork | read **11750**, mi (78,128) | read **12465**, mi (90,108) | | ||
| 265 | +| luma first wrong | 164416 (Y 576,256) | **205264** (Y 464,320) | | ||
| 266 | +| luma differing | 95872 | 51716 | | ||
| 267 | +| U first wrong | 20532 | 20532 (untouched) | | ||
| 268 | +| V first wrong | 20532 | 20532 (untouched) | | ||
| 269 | +| total differing | 455240 | 390380 | | ||
| 270 | + | ||
| 271 | +**A partial improvement, NOT a fix, and the report says so.** The ss gate | ||
| 272 | +moves the luma divergence 40948 samples later and the entropy fork 715 reads | ||
| 273 | +later; both chroma planes are untouched. 390380 of 921600 samples are still | ||
| 274 | +wrong. No exactness is claimed — "the divergence moved" is evidence that the | ||
| 275 | +geometry was wrong, not that the new geometry is right. | ||
| 276 | + | ||
| 277 | +### Gate | ||
| 278 | + | ||
| 279 | +`a_444_intrabc_rect4_reads_its_own_chroma_plane_block` — a **progress gate, | ||
| 280 | +deliberately not an exactness gate**: | ||
| 281 | + | ||
| 282 | +- both fixtures pinned (length + FNV); | ||
| 283 | +- non-vacuity: `intrabc_rect4_own_chroma444_hits()` must be non-zero (18 on | ||
| 284 | + the 4:4:4 witness, 0 on the 4:2:0 twin), armed OUTSIDE the mutated | ||
| 285 | + expression so the mutation test below fails on the pixel arm, not on the | ||
| 286 | + counter; | ||
| 287 | +- identity: the 4:2:0 twin is compared byte-for-byte through | ||
| 288 | + `decode_all_frames_vs_oracle`, which asserts the two frame lengths match | ||
| 289 | + before comparing; | ||
| 290 | +- the 4:4:4 claim is a **prefix floor** on the plane the gate moved: the luma | ||
| 291 | + plane must be byte-exact to sample 205264. A floor only ever grows, so the | ||
| 292 | + next lane's fix cannot turn this gate red; | ||
| 293 | +- the untouched chroma divergence (U/V from index 20532) is printed and named, | ||
| 294 | + never asserted exact. | ||
| 295 | + | ||
| 296 | +**Mutation proof.** `own444 = false` (the old geometry, counter untouched) — | ||
| 297 | +the assert fires with the first luma difference at 164416 against a floor of | ||
| 298 | +205264. | ||
| 299 | + | ||
| 300 | +**Handed on, precisely:** the 4:4:4 intra-BC cell's remaining divergence is | ||
| 301 | +**in chroma, first at U/V index 20532 (x=52, y=32)**, and the entropy fork is | ||
| 302 | +read 12465 at mi (90,108) — same signature as the first (oracle | ||
| 303 | +`decodetxb.c:158`, the chroma `txb_skip`, symbol 1). Not localized to a line | ||
| 304 | +yet. Unverified candidates: `sub8_leaf_chroma444`'s single | ||
| 305 | +`around_mi_rect(lmi, bw, bh)` reused for both planes, and its non-lossless | ||
| 306 | +rect arm's context offset. | ||
| 307 | + | ||
| 308 | +## 7. Residue handed on, not fixed here | ||
| 309 | + | ||
| 310 | +- **4:4:4 intra-BC chroma** — read 12465, mi (90,108), U/V first wrong at | ||
| 311 | + index 20532. Per §6. | ||
| 217 | - **H2** — 4:4:4 lossy + tx-size-search chroma ±1, entropy-clean. Own lane. | 312 | - **H2** — 4:4:4 lossy + tx-size-search chroma ±1, entropy-clean. Own lane. |
| 313 | +- **H3** — 4:4:4 lossless + tile columns. Agent142-2 (see §5's retraction). | ||
| 218 | - **H4** — 4:4:4 lossless + tile rows, hard divergence. Own lane; untouched. | 314 | - **H4** — 4:4:4 lossless + tile rows, hard divergence. Own lane; untouched. |
| 219 | - **H5** — 4:4:4 10-bit lossless 128 root, chroma band/offset term. Agent06-3. | 315 | - **H5** — 4:4:4 10-bit lossless 128 root, chroma band/offset term. Agent06-3. |
| 220 | -- **H6** — 12-bit 4:4:4 needs a smoothed source. Coverage caveat, not a | 316 | +- **H6** — 12-bit 4:4:4 needs a smoothed source. Coverage caveat, not a defect. |
| 221 | - defect. | ||
| 222 | 317 | ||
| 223 | -## 7. Method notes for the next lane | 318 | +## 8. Method notes for the next lane |
| 224 | 319 | ||
| 225 | - `testsrc2` is time-parameterised: any sweep recipe quoting it must pin | 320 | - `testsrc2` is time-parameterised: any sweep recipe quoting it must pin |
| 226 | `rate`, or the fixture is not reproducible. `rate=1` vs `rate=25` on | 321 | `rate`, or the fixture is not reproducible. `rate=1` vs `rate=25` on |
| @@ -238,3 +333,15 @@ runs; a BLOCK_128X128 unsplit root never reaches it. | |||
| 238 | - `EC_DCDUMP` already dumps the above/left entropy contexts per plane; | 333 | - `EC_DCDUMP` already dumps the above/left entropy contexts per plane; |
| 239 | `#[track_caller]` on `Neighbours::around_mi_rect` names the gather site | 334 | `#[track_caller]` on `Neighbours::around_mi_rect` names the gather site |
| 240 | in one line if you ever need to attribute one again. | 335 | in one line if you ever need to attribute one again. |
| 336 | +- **A byte compare that truncates to `min(len(ours), len(ref))` is a PREFIX | ||
| 337 | + compare, and a prefix compare passes exactly when the defect is outside the | ||
| 338 | + prefix.** This lane reported an H3 stream "byte-exact 6/6" that way: the | ||
| 339 | + throwaway script carried the H1 fixture's 128x96 geometry, so it compared | ||
| 340 | + 36864 of 98304 samples and the divergence at x >= 108 was invisible. Agent142-2 | ||
| 341 | + caught it. **Every ours-vs-oracle compare must assert the two lengths are | ||
| 342 | + equal before it compares anything**, must not be handed a fixture whose | ||
| 343 | + geometry it does not know, and must clear BOTH sides' scratch files between | ||
| 344 | + runs (mine cleared `aom.*` and not `ours.*`, a stale-file hazard sitting right | ||
| 345 | + next to the truncation bug). The crate's own | ||
| 346 | + `decode_all_frames_vs_oracle` does assert `got.len() != want.len()`, which is | ||
| 347 | + why the committed gates in this lane were never exposed to it. | ||