lane-av1cflac: cfl_ac_q3_at's 4:4:4 defect is UNREACHABLE; closed with two gates, no behaviour change
Browse files at this commitd6bb5066187e08243730f7ea1235654d3989bbceParent: d9e67454 changed files +840 -2
- crates/ec-av1/examples/decode_probe.rs +5 -0
- crates/ec-av1/src/decode.rs +48 -2
- crates/ec-av1/src/stream.rs +397 -0
- lanes/av1cflac.report.md +390 -0
crates/ec-av1/examples/decode_probe.rsmodified+5 -0
| @@ -34,6 +34,11 @@ fn main() { | |||
| 34 | if !cfg!(feature = "gate-counters") { | 34 | if !cfg!(feature = "gate-counters") { |
| 35 | println!("counters disabled (built without the gate-counters feature)"); | 35 | println!("counters disabled (built without the gate-counters feature)"); |
| 36 | } | 36 | } |
| 37 | + let [a444, a422, s420, r420] = ec_av1::decode::cfl_ac_arm_hits(); | ||
| 38 | + println!( | ||
| 39 | + "cfl_ac: 444={a444} 422={a422} 420sq={s420} 420rect={r420} q3_at={}", | ||
| 40 | + ec_av1::decode::cfl_ac_q3_at_hits() | ||
| 41 | + ); | ||
| 37 | let (sc, dp) = ec_av1::decode::reelc_chroma_counters(); | 42 | let (sc, dp) = ec_av1::decode::reelc_chroma_counters(); |
| 38 | println!("reelc_chroma: skip_cfl={sc} dir_1to4_pairs={dp}"); | 43 | println!("reelc_chroma: skip_cfl={sc} dir_1to4_pairs={dp}"); |
| 39 | println!( | 44 | println!( |
crates/ec-av1/src/decode.rsmodified+48 -2
| @@ -5978,6 +5978,35 @@ thread_local! { | |||
| 5978 | static CFL_BLOCK_HITS: std::cell::Cell<usize> = const { std::cell::Cell::new(0) }; | 5978 | static CFL_BLOCK_HITS: std::cell::Cell<usize> = const { std::cell::Cell::new(0) }; |
| 5979 | static UV_ANGLE_DELTA_HITS: std::cell::Cell<usize> = const { std::cell::Cell::new(0) }; | 5979 | static UV_ANGLE_DELTA_HITS: std::cell::Cell<usize> = const { std::cell::Cell::new(0) }; |
| 5980 | } | 5980 | } |
| 5981 | +// lane-av1cfl: which `cfl_ac_ss` arm ran, one bump per CfL block. The 4:4:4 | ||
| 5982 | +// arm is libaom `cfl_luma_subsampling_444_lbd_c` (1x1 luma per chroma sample) | ||
| 5983 | +// and the 4:2:2 arm is `cfl_luma_subsampling_422_lbd_c`; only the last two | ||
| 5984 | +// reach `cfl_ac_q3_at`'s 2x2 average, so these four are the reachability | ||
| 5985 | +// evidence for that function's format-blind extent. | ||
| 5986 | +thread_local! { | ||
| 5987 | + static CFL_AC_444_HITS: std::cell::Cell<usize> = const { std::cell::Cell::new(0) }; | ||
| 5988 | + static CFL_AC_422_HITS: std::cell::Cell<usize> = const { std::cell::Cell::new(0) }; | ||
| 5989 | + static CFL_AC_420_SQ_HITS: std::cell::Cell<usize> = const { std::cell::Cell::new(0) }; | ||
| 5990 | + static CFL_AC_420_RECT_HITS: std::cell::Cell<usize> = const { std::cell::Cell::new(0) }; | ||
| 5991 | + static CFL_AC_Q3_AT_HITS: std::cell::Cell<usize> = const { std::cell::Cell::new(0) }; | ||
| 5992 | +} | ||
| 5993 | + | ||
| 5994 | +/// `[4:4:4, 4:2:2, 4:2:0 square, 4:2:0 rect]` [`cfl_ac_ss`] arm hits. | ||
| 5995 | +pub fn cfl_ac_arm_hits() -> [usize; 4] { | ||
| 5996 | + [ | ||
| 5997 | + CFL_AC_444_HITS.with(|c| c.get()), | ||
| 5998 | + CFL_AC_422_HITS.with(|c| c.get()), | ||
| 5999 | + CFL_AC_420_SQ_HITS.with(|c| c.get()), | ||
| 6000 | + CFL_AC_420_RECT_HITS.with(|c| c.get()), | ||
| 6001 | + ] | ||
| 6002 | +} | ||
| 6003 | + | ||
| 6004 | +/// Entries into [`cfl_ac_q3_at`] itself -- the one arm whose extent is | ||
| 6005 | +/// `bw / 2, bh / 2` and whose footprint is a 2x2 luma average. The gate | ||
| 6006 | +/// proves it is reached ONLY at 4:2:0. | ||
| 6007 | +pub fn cfl_ac_q3_at_hits() -> usize { | ||
| 6008 | + CFL_AC_Q3_AT_HITS.with(|c| c.get()) | ||
| 6009 | +} | ||
| 5981 | 6010 | ||
| 5982 | /// Current value of [`CFL_BLOCK_HITS`]. | 6011 | /// Current value of [`CFL_BLOCK_HITS`]. |
| 5983 | #[allow(dead_code)] // read only from the `#[cfg(test)]` gates | 6012 | #[allow(dead_code)] // read only from the `#[cfg(test)]` gates |
| @@ -9274,9 +9303,18 @@ impl Neighbours { | |||
| 9274 | /// differ from each other in not one sample. The gate for this value is | 9303 | /// differ from each other in not one sample. The gate for this value is |
| 9275 | /// therefore a source scan, not a pixel gate -- | 9304 | /// therefore a source scan, not a pixel gate -- |
| 9276 | /// `refusal_inventory::the_skipped_128_root_chroma_suppression_publishes_the_blocks_own_per_axis_chroma_extent`. | 9305 | /// `refusal_inventory::the_skipped_128_root_chroma_suppression_publishes_the_blocks_own_per_axis_chroma_extent`. |
| 9277 | - fn suppress_internal_lf_edges(&mut self, at_mi: (usize, usize), w_mi: usize, h_mi: usize, fctx: &FrameCtx) { | 9306 | + fn suppress_internal_lf_edges( |
| 9307 | + &mut self, | ||
| 9308 | + at_mi: (usize, usize), | ||
| 9309 | + w_mi: usize, | ||
| 9310 | + h_mi: usize, | ||
| 9311 | + fctx: &FrameCtx, | ||
| 9312 | + ) { | ||
| 9278 | let (mi_r, mi_c) = at_mi; | 9313 | let (mi_r, mi_c) = at_mi; |
| 9279 | - let (uv_w, uv_h) = (((w_mi * MI) >> ss_x(fctx)).max(4) as u8, ((h_mi * MI) >> ss_y(fctx)).max(4) as u8); | 9314 | + let (uv_w, uv_h) = ( |
| 9315 | + ((w_mi * MI) >> ss_x(fctx)).max(4) as u8, | ||
| 9316 | + ((h_mi * MI) >> ss_y(fctx)).max(4) as u8, | ||
| 9317 | + ); | ||
| 9280 | for rr in 0..h_mi { | 9318 | for rr in 0..h_mi { |
| 9281 | let start = (mi_r + rr) * self.skip_grid_cols_mi + mi_c; | 9319 | let start = (mi_r + rr) * self.skip_grid_cols_mi + mi_c; |
| 9282 | fill_span(&mut self.uv_tx_grid, start, w_mi, uv_w); | 9320 | fill_span(&mut self.uv_tx_grid, start, w_mi, uv_w); |
| @@ -19867,6 +19905,7 @@ fn cfl_ac_ss( | |||
| 19867 | ss_y: usize, | 19905 | ss_y: usize, |
| 19868 | ) -> Vec<i32> { | 19906 | ) -> Vec<i32> { |
| 19869 | if ss_x == 0 && ss_y == 0 { | 19907 | if ss_x == 0 && ss_y == 0 { |
| 19908 | + hit!(CFL_AC_444_HITS); | ||
| 19870 | let mut ac = vec![0i32; bw * bh]; | 19909 | let mut ac = vec![0i32; bw * bh]; |
| 19871 | let mut sum = 0i32; | 19910 | let mut sum = 0i32; |
| 19872 | for row in 0..bh { | 19911 | for row in 0..bh { |
| @@ -19886,6 +19925,7 @@ fn cfl_ac_ss( | |||
| 19886 | // (`(a + b) >> 1` in Q3 is `(a + b) << 2`). A rect luma strip's chroma | 19925 | // (`(a + b) >> 1` in Q3 is `(a + b) << 2`). A rect luma strip's chroma |
| 19887 | // is square here, and the 4:2:0 rect/square helpers below would halve | 19926 | // is square here, and the 4:2:0 rect/square helpers below would halve |
| 19888 | // the height it must keep. | 19927 | // the height it must keep. |
| 19928 | + hit!(CFL_AC_422_HITS); | ||
| 19889 | let (cw, ch) = (bw >> 1, bh); | 19929 | let (cw, ch) = (bw >> 1, bh); |
| 19890 | let mut ac = vec![0i32; cw * ch]; | 19930 | let mut ac = vec![0i32; cw * ch]; |
| 19891 | let mut sum = 0i32; | 19931 | let mut sum = 0i32; |
| @@ -19904,8 +19944,10 @@ fn cfl_ac_ss( | |||
| 19904 | ac.iter_mut().for_each(|v| *v -= avg); | 19944 | ac.iter_mut().for_each(|v| *v -= avg); |
| 19905 | ac | 19945 | ac |
| 19906 | } else if bw == bh { | 19946 | } else if bw == bh { |
| 19947 | + hit!(CFL_AC_420_SQ_HITS); | ||
| 19907 | cfl_ac_q3(y, px, py, bw) | 19948 | cfl_ac_q3(y, px, py, bw) |
| 19908 | } else { | 19949 | } else { |
| 19950 | + hit!(CFL_AC_420_RECT_HITS); | ||
| 19909 | cfl_ac_q3_rect(y, px, py, bw, bh) | 19951 | cfl_ac_q3_rect(y, px, py, bw, bh) |
| 19910 | } | 19952 | } |
| 19911 | } | 19953 | } |
| @@ -19917,6 +19959,10 @@ pub(crate) fn cfl_ac_q3_at( | |||
| 19917 | bh: usize, | 19959 | bh: usize, |
| 19918 | sample: impl Fn(usize, usize) -> i32, | 19960 | sample: impl Fn(usize, usize) -> i32, |
| 19919 | ) -> Vec<i32> { | 19961 | ) -> Vec<i32> { |
| 19962 | + hit!(CFL_AC_Q3_AT_HITS); | ||
| 19963 | + if crate::envflags::env_flag!("EC_HALVSWEEP") { | ||
| 19964 | + eprintln!("EC_HALV cfl_ac_q3_at px={px} py={py} bw={bw} bh={bh}"); | ||
| 19965 | + } | ||
| 19920 | let (cw, ch) = (bw / 2, bh / 2); | 19966 | let (cw, ch) = (bw / 2, bh / 2); |
| 19921 | let mut ac = vec![0i32; cw * ch]; | 19967 | let mut ac = vec![0i32; cw * ch]; |
| 19922 | let mut sum = 0i32; | 19968 | let mut sum = 0i32; |
crates/ec-av1/src/stream.rsmodified+397 -0
| @@ -47459,6 +47459,403 @@ pub(crate) mod tests { | |||
| 47459 | } | 47459 | } |
| 47460 | } | 47460 | } |
| 47461 | 47461 | ||
| 47462 | + /// lane-av1cfl: the 4:4:4 CfL AC body is a DIFFERENT function from the | ||
| 47463 | + /// 4:2:0 one, and this gate is the proof that the format-blind | ||
| 47464 | + /// `cfl_ac_q3_at` (`bw / 2, bh / 2`, a 2x2 luma average per chroma | ||
| 47465 | + /// sample) is reached only at 4:2:0. | ||
| 47466 | + /// | ||
| 47467 | + /// **The claim this closes.** `cfl_ac_q3_at` has no `fctx`/`ss` | ||
| 47468 | + /// parameter, so at 4:4:4 it would be wrong twice over: the chroma | ||
| 47469 | + /// extent equals the luma extent when `ss_x == ss_y == 0`, and libaom | ||
| 47470 | + /// averages 2x2 luma per chroma sample at 4:2:0 but 1x1 at 4:4:4 | ||
| 47471 | + /// (`cfl_luma_subsampling_420_lbd_c` vs `cfl_luma_subsampling_444_lbd_c`, | ||
| 47472 | + /// `~/.cache/aom-oracle/src/av1/common/cfl.c:230` and `:257`). The | ||
| 47473 | + /// inherited report claimed "188 rung hits on the 4:4:4 set" | ||
| 47474 | + /// (`lanes/av1chromahalvings.report.md` r3.4). **It does not | ||
| 47475 | + /// reproduce**: the env-gated rung `EC_HALVSWEEP` in `cfl_ac_q3_at`, | ||
| 47476 | + /// swept over all 27 `*444*` pins, printed **0 hits on every one**, | ||
| 47477 | + /// while the 4:4:4 arm of `cfl_ac_ss` fired 4..312 times on the same | ||
| 47478 | + /// fixtures. The 4:4:4 CfL path is real and heavily exercised; it just | ||
| 47479 | + /// does not go through this function. `cfl_ac_ss` dispatches 4:4:4 and | ||
| 47480 | + /// 4:2:2 to their own transcriptions of libaom's 444/422 subsampling | ||
| 47481 | + /// bodies BEFORE the 4:2:0 fallthrough, and the fallthrough is the only | ||
| 47482 | + /// road to `cfl_ac_q3_at`. | ||
| 47483 | + /// | ||
| 47484 | + /// Two-sided on purpose. The 4:4:4 arm asserts `> 0` (the CfL path | ||
| 47485 | + /// fired, so the `== 0` below is a routing fact and not an absence of | ||
| 47486 | + /// CfL) and the 4:2:0 arm asserts `> 0` on the SAME counter (so the | ||
| 47487 | + /// counter is live and the 4:4:4 zero is not a dead one). Both arms | ||
| 47488 | + /// compare every decoded frame to the instrumented `aomdec` | ||
| 47489 | + /// plane by plane, and the 4:2:0 arm is the "unchanged" quote: its | ||
| 47490 | + /// per-plane mismatch counts must be 0/0/0. | ||
| 47491 | + /// | ||
| 47492 | + /// Provenance: both fixtures are aomenc-produced and already pinned | ||
| 47493 | + /// with sha256 by the gates named beside them. 4:4:4 lossy | ||
| 47494 | + /// `444_lossy_superres_mode2_256x128.obu` (16620 bytes, sha256 | ||
| 47495 | + /// `c18496cf3b7db0feca9aa904024cec2115be80b5b94f87c848ac52f9b32ffd97`, | ||
| 47496 | + /// `testsrc2=size=256x128:rate=25 -pix_fmt yuv444p`, `--passes=1 | ||
| 47497 | + /// --end-usage=q --cq-level=20 --cpu-used=2 --superres-mode=2 | ||
| 47498 | + /// --limit=4 --obu`, 4 frames); 4:2:0 lossy | ||
| 47499 | + /// `420_intrabc_rect4_witness.obu` (890 bytes, sha256 | ||
| 47500 | + /// `d01352af5059919cdce733abdcbae8e8240ac3c2a6190fa1bd96d3c6f945b979`). | ||
| 47501 | + #[test] | ||
| 47502 | + fn cfl_ac_444_routes_to_its_own_1x1_luma_body_and_420_to_the_2x2_average() { | ||
| 47503 | + const NAME: &str = "cfl_ac_444_routes_to_its_own_1x1_luma_body_and_420_to_the_2x2_average"; | ||
| 47504 | + // (fixture, len, fnv1a64, sha256, (w, h), frames, cfL arm index, is_444) | ||
| 47505 | + const ARMS: [(&str, usize, u64, &str, (usize, usize), usize, usize, bool); 2] = [ | ||
| 47506 | + ( | ||
| 47507 | + "fixtures/444_lossy_superres_mode2_256x128.obu", | ||
| 47508 | + 16620, | ||
| 47509 | + 0x8cbb_36b2_5e0f_07ab, | ||
| 47510 | + "c18496cf3b7db0feca9aa904024cec2115be80b5b94f87c848ac52f9b32ffd97", | ||
| 47511 | + (256, 128), | ||
| 47512 | + 4, | ||
| 47513 | + 0, | ||
| 47514 | + true, | ||
| 47515 | + ), | ||
| 47516 | + ( | ||
| 47517 | + "fixtures/420_intrabc_rect4_witness.obu", | ||
| 47518 | + 890, | ||
| 47519 | + 0x57ec_3da2_a63b_403a, | ||
| 47520 | + "d01352af5059919cdce733abdcbae8e8240ac3c2a6190fa1bd96d3c6f945b979", | ||
| 47521 | + (640, 480), | ||
| 47522 | + 1, | ||
| 47523 | + 2, | ||
| 47524 | + false, | ||
| 47525 | + ), | ||
| 47526 | + ]; | ||
| 47527 | + let _guard = lock_gate_counters(); | ||
| 47528 | + for (fixture, len, fnv, sha, (w, h), want_frames, arm_idx, is_444) in ARMS { | ||
| 47529 | + let obu = std::path::PathBuf::from(env!("CARGO_MANIFEST_DIR")).join(fixture); | ||
| 47530 | + let stream = std::fs::read(&obu).unwrap_or_else(|e| { | ||
| 47531 | + panic!( | ||
| 47532 | + "{NAME}: pinned fixture {fixture} is missing ({e}) -- the gate cannot run, \ | ||
| 47533 | + which is a failure, not a skip" | ||
| 47534 | + ) | ||
| 47535 | + }); | ||
| 47536 | + assert_eq!(stream.len(), len, "{NAME}: {fixture} length moved"); | ||
| 47537 | + assert_eq!(fnv1a64(&stream), fnv, "{NAME}: {fixture} bytes moved"); | ||
| 47538 | + | ||
| 47539 | + // The arm counters are process-wide with no reset, so every read | ||
| 47540 | + // is a DELTA: a full-suite run has already put other streams' | ||
| 47541 | + // CfL blocks through this decoder, and an absolute count would be | ||
| 47542 | + // a non-vacuity assertion satisfied by residue. | ||
| 47543 | + let arms_before = crate::decode::cfl_ac_arm_hits(); | ||
| 47544 | + let q3_before = crate::decode::cfl_ac_q3_at_hits(); | ||
| 47545 | + let frames = decode_stream(&stream) | ||
| 47546 | + .unwrap_or_else(|e| panic!("{NAME}: {fixture} no longer decodes cleanly: {e}")); | ||
| 47547 | + let arms = crate::decode::cfl_ac_arm_hits(); | ||
| 47548 | + let q3_delta = crate::decode::cfl_ac_q3_at_hits() - q3_before; | ||
| 47549 | + let arm_delta: Vec<usize> = (0..4).map(|i| arms[i] - arms_before[i]).collect(); | ||
| 47550 | + | ||
| 47551 | + // The arm this stream's format MUST take, and the count that | ||
| 47552 | + // proves the CfL path is live on it. At 4:4:4 that is arm 0 | ||
| 47553 | + // (`cfl_luma_subsampling_444_lbd_c`'s 1x1 body); at 4:2:0 it is | ||
| 47554 | + // arm 2 (the square fallthrough into `cfl_ac_q3`). | ||
| 47555 | + assert!( | ||
| 47556 | + arm_delta[arm_idx] > 0, | ||
| 47557 | + "{NAME}: {fixture} ran {} 4:4:4 / {} 4:2:2 / {} 4:2:0-square / \ | ||
| 47558 | + {} 4:2:0-rect CfL blocks; arm {arm_idx} is the one this format must \ | ||
| 47559 | + take and it is ZERO -- the stream no longer exercises CfL, so the \ | ||
| 47560 | + routing assertion below would be vacuous (class gate-blind-to-feature)", | ||
| 47561 | + arm_delta[0], | ||
| 47562 | + arm_delta[1], | ||
| 47563 | + arm_delta[2], | ||
| 47564 | + arm_delta[3], | ||
| 47565 | + ); | ||
| 47566 | + if is_444 { | ||
| 47567 | + assert_eq!( | ||
| 47568 | + q3_delta, 0, | ||
| 47569 | + "{NAME}: {fixture} is 4:4:4 and entered the format-blind cfl_ac_q3_at \ | ||
| 47570 | + {q3_delta} time(s) -- its extent is bw/2, bh/2 and its footprint is a \ | ||
| 47571 | + 2x2 luma average, both wrong at ss (0,0) (libaom cfl.c:230 vs :257). \ | ||
| 47572 | + Arm deltas {arm_delta:?}. Either cfl_ac_ss lost its 4:4:4 arm or a new \ | ||
| 47573 | + caller reached cfl_ac_q3_at directly; both make this site LIVE" | ||
| 47574 | + ); | ||
| 47575 | + assert_eq!( | ||
| 47576 | + (arm_delta[2], arm_delta[3]), | ||
| 47577 | + (0, 0), | ||
| 47578 | + "{NAME}: {fixture} is 4:4:4 but ran the 4:2:0 CfL arms -- the format test \ | ||
| 47579 | + that keeps cfl_ac_q3_at format-blind has moved" | ||
| 47580 | + ); | ||
| 47581 | + } else { | ||
| 47582 | + assert!( | ||
| 47583 | + q3_delta > 0, | ||
| 47584 | + "{NAME}: {fixture} is 4:2:0 and cfl_ac_q3_at was entered ZERO times \ | ||
| 47585 | + (arm deltas {arm_delta:?}) -- the counter this gate proves 4:4:4 never \ | ||
| 47586 | + touches is dead on 4:2:0 too, so the 4:4:4 assertion is a dead zero" | ||
| 47587 | + ); | ||
| 47588 | + assert_eq!( | ||
| 47589 | + (arm_delta[0], arm_delta[1]), | ||
| 47590 | + (0, 0), | ||
| 47591 | + "{NAME}: {fixture} is 4:2:0 but ran a 4:4:4 or 4:2:2 CfL arm" | ||
| 47592 | + ); | ||
| 47593 | + } | ||
| 47594 | + assert_eq!(frames.len(), want_frames, "{NAME}: {fixture} frame count"); | ||
| 47595 | + for (i, f) in frames.iter().enumerate() { | ||
| 47596 | + assert_eq!( | ||
| 47597 | + (f.width, f.height), | ||
| 47598 | + (w, h), | ||
| 47599 | + "{NAME}: {fixture} frame {i} dimensions" | ||
| 47600 | + ); | ||
| 47601 | + if is_444 { | ||
| 47602 | + assert_eq!( | ||
| 47603 | + f.u.len(), | ||
| 47604 | + w * h, | ||
| 47605 | + "{NAME}: {fixture} frame {i} chroma plane is {} samples; at 4:4:4 it \ | ||
| 47606 | + must be full resolution ({w}x{h})", | ||
| 47607 | + f.u.len() | ||
| 47608 | + ); | ||
| 47609 | + } | ||
| 47610 | + } | ||
| 47611 | + // Per-plane mismatch counts against the instrumented oracle, so | ||
| 47612 | + // the "4:2:0 unchanged" claim is a number rather than a claim. | ||
| 47613 | + if aomdec_available(NAME) { | ||
| 47614 | + let [y, u, v] = oracle_plane_diffs( | ||
| 47615 | + &stream, | ||
| 47616 | + NAME, | ||
| 47617 | + [frames[0].y.len(), frames[0].u.len(), frames[0].v.len()], | ||
| 47618 | + ); | ||
| 47619 | + assert!( | ||
| 47620 | + y == 0 && u == 0 && v == 0, | ||
| 47621 | + "{NAME}: {fixture} differs from the oracle on {y}/{u}/{v} of the \ | ||
| 47622 | + {w}x{h} Y/U/V samples -- sha256 {sha}" | ||
| 47623 | + ); | ||
| 47624 | + eprintln!( | ||
| 47625 | + "{NAME}: {fixture} arm{arm_idx} {arm_delta:?}, cfl_ac_q3_at {q3_delta}, \ | ||
| 47626 | + per-plane Y/U/V mismatches vs aomdec {y}/{u}/{v} of {w}x{h}; \ | ||
| 47627 | + sha256 {sha}" | ||
| 47628 | + ); | ||
| 47629 | + } | ||
| 47630 | + } | ||
| 47631 | + } | ||
| 47632 | + | ||
| 47633 | + /// lane-av1cfl: the STATIC half of the same claim -- `cfl_ac_q3_at`'s | ||
| 47634 | + /// caller set, read out of the sources themselves, is what makes its | ||
| 47635 | + /// `bw / 2, bh / 2` extent and 2x2 luma footprint correct rather than | ||
| 47636 | + /// merely untested. The counter gate above measures that on two pinned | ||
| 47637 | + /// streams; this one survives a change no fixture would catch. | ||
| 47638 | + /// | ||
| 47639 | + /// **What is asserted, and why each part is load-bearing.** | ||
| 47640 | + /// | ||
| 47641 | + /// 1. `cfl_ac_q3_at` has exactly **three** call sites -- the two 4:2:0 | ||
| 47642 | + /// wrappers `cfl_ac_q3` / `cfl_ac_q3_rect` in `decode.rs` and the | ||
| 47643 | + /// encoder's CfL candidate in `encode.rs`. A fourth would be a new | ||
| 47644 | + /// road to a format-blind body. | ||
| 47645 | + /// 2. Both `decode.rs` wrappers are called from **exactly one** function, | ||
| 47646 | + /// `cfl_ac_ss`, and only from its LAST two arms -- the ones after the | ||
| 47647 | + /// `ss_x == 0 && ss_y == 0` (4:4:4) and `ss_x == 1 && ss_y == 0` | ||
| 47648 | + /// (4:2:2) tests. So every decode-side entry is 4:2:0 by | ||
| 47649 | + /// construction, whatever a stream's header says. | ||
| 47650 | + /// 3. The encoder's call site is 4:2:0 because `Colour::color_config` and | ||
| 47651 | + /// `unspecified_color_config` both hardcode `subsampling_x: 1, | ||
| 47652 | + /// subsampling_y: 1` -- there is no 4:4:4 encoder colour config in the | ||
| 47653 | + /// crate. A future encoder that grows one must thread `ss` into this | ||
| 47654 | + /// call, and the `subsampling_x: 0` count going above zero is what | ||
| 47655 | + /// says so. | ||
| 47656 | + /// | ||
| 47657 | + /// (0, 1) needs no arm: `ec-av1-syntax` reads `subsampling_y` only when | ||
| 47658 | + /// `subsampling_x == 1` (`crates/ec-av1-syntax/src/sequence.rs:483-485`), | ||
| 47659 | + /// so the pair is structurally uncodable and the 4:2:0 fallthrough is the | ||
| 47660 | + /// only residual. 4:2:2 is refused at the sequence header. | ||
| 47661 | + #[test] | ||
| 47662 | + fn cfl_ac_q3_at_is_reached_only_through_the_420_fallthrough_of_cfl_ac_ss() { | ||
| 47663 | + const NAME: &str = "cfl_ac_q3_at_is_reached_only_through_the_420_fallthrough_of_cfl_ac_ss"; | ||
| 47664 | + let decode = include_str!("decode.rs"); | ||
| 47665 | + let encode = include_str!("encode.rs"); | ||
| 47666 | + | ||
| 47667 | + // (1) The call-site set, definition excluded. A declaration is | ||
| 47668 | + // preceded by "pub(crate) fn " / "fn "; a call is not. | ||
| 47669 | + let mut sites: Vec<&str> = Vec::new(); | ||
| 47670 | + for src in [decode, encode] { | ||
| 47671 | + for (i, _) in src.match_indices("cfl_ac_q3_at(") { | ||
| 47672 | + if src[..i].ends_with("fn ") { | ||
| 47673 | + continue; | ||
| 47674 | + } | ||
| 47675 | + sites.push(if src == decode { | ||
| 47676 | + "decode.rs" | ||
| 47677 | + } else { | ||
| 47678 | + "encode.rs" | ||
| 47679 | + }); | ||
| 47680 | + } | ||
| 47681 | + } | ||
| 47682 | + let mut per_file: std::collections::BTreeMap<&str, usize> = | ||
| 47683 | + std::collections::BTreeMap::new(); | ||
| 47684 | + for s in &sites { | ||
| 47685 | + *per_file.entry(s).or_default() += 1; | ||
| 47686 | + } | ||
| 47687 | + assert_eq!( | ||
| 47688 | + per_file, | ||
| 47689 | + std::collections::BTreeMap::from([("decode.rs", 2), ("encode.rs", 1)]), | ||
| 47690 | + "{NAME}: cfl_ac_q3_at's call-site set changed -- {per_file:?} against an expected \ | ||
| 47691 | + 2 in decode.rs (the cfl_ac_q3 / cfl_ac_q3_rect wrappers) and 1 in encode.rs (the \ | ||
| 47692 | + encoder's CfL candidate). A new call site must thread the frame's subsampling in; \ | ||
| 47693 | + the body is a 4:2:0 2x2 luma average over a bw/2 x bh/2 extent and is WRONG at \ | ||
| 47694 | + 4:4:4 on both counts (libaom cfl_luma_subsampling_444_lbd_c is 1x1 over the full \ | ||
| 47695 | + extent, cfl.c:257)" | ||
| 47696 | + ); | ||
| 47697 | + | ||
| 47698 | + // (2) Both wrappers have exactly one caller, and it is cfl_ac_ss. | ||
| 47699 | + let cfl_ac_ss_at = decode | ||
| 47700 | + .find("fn cfl_ac_ss(") | ||
| 47701 | + .expect("cfl_ac_ss is gone -- re-derive the fallthrough arms below"); | ||
| 47702 | + for wrapper in ["cfl_ac_q3(", "cfl_ac_q3_rect("] { | ||
| 47703 | + let mut ats = Vec::new(); | ||
| 47704 | + for (i, _) in decode.match_indices(wrapper) { | ||
| 47705 | + if decode[..i].ends_with("fn ") { | ||
| 47706 | + continue; | ||
| 47707 | + } | ||
| 47708 | + ats.push(i); | ||
| 47709 | + } | ||
| 47710 | + // The scan string carries its own open paren, so it cannot match | ||
| 47711 | + // `cfl_ac_q3_rect(` or `cfl_ac_q3_at(` -- those are `cfl_ac_q3` | ||
| 47712 | + // followed by `_`, not `(`. No prefix filter is needed. | ||
| 47713 | + assert_eq!( | ||
| 47714 | + ats.len(), | ||
| 47715 | + 1, | ||
| 47716 | + "{NAME}: `{wrapper}` is called {} time(s) outside its own definition, expected \ | ||
| 47717 | + exactly 1 (from cfl_ac_ss) -- a second caller is a new road to the 4:2:0 \ | ||
| 47718 | + average that this gate's counter arm measures only on 4:2:0", | ||
| 47719 | + ats.len() | ||
| 47720 | + ); | ||
| 47721 | + assert!( | ||
| 47722 | + ats[0] > cfl_ac_ss_at && ats[0] < cfl_ac_ss_at + 4000, | ||
| 47723 | + "{NAME}: `{wrapper}`'s only call site is at byte {} and cfl_ac_ss is at {} -- \ | ||
| 47724 | + the call has moved out of the 4:2:0 fallthrough into something that may be \ | ||
| 47725 | + handed a 4:4:4 or 4:2:2 block", | ||
| 47726 | + ats[0], | ||
| 47727 | + cfl_ac_ss_at | ||
| 47728 | + ); | ||
| 47729 | + } | ||
| 47730 | + | ||
| 47731 | + // Inside cfl_ac_ss, the two format tests must come BEFORE both | ||
| 47732 | + // wrapper calls, and the wrappers must be the fallthrough -- a 4:4:4 | ||
| 47733 | + // block returns from the first arm and never reaches either. | ||
| 47734 | + let body_end = decode[cfl_ac_ss_at..] | ||
| 47735 | + .find("\nfn ") | ||
| 47736 | + .expect("cfl_ac_ss must be a top-level fn") | ||
| 47737 | + + cfl_ac_ss_at; | ||
| 47738 | + let body = &decode[cfl_ac_ss_at..body_end]; | ||
| 47739 | + let t444 = body.find("if ss_x == 0 && ss_y == 0 {").expect( | ||
| 47740 | + "cfl_ac_ss lost its 4:4:4 arm -- every 4:4:4 CfL block now falls into the \ | ||
| 47741 | +2:0 average", | ||
| 47742 | + ); | ||
| 47743 | + let t422 = body | ||
| 47744 | + .find("} else if ss_x == 1 && ss_y == 0 {") | ||
| 47745 | + .expect("cfl_ac_ss lost its 4:2:2 arm -- a 4:2:2 block would take the 4:2:0 average"); | ||
| 47746 | + let sq = body | ||
| 47747 | + .find("cfl_ac_q3(y, px, py, bw)") | ||
| 47748 | + .expect("cfl_ac_ss lost its 4:2:0 square fallthrough"); | ||
| 47749 | + let rect = body | ||
| 47750 | + .find("cfl_ac_q3_rect(y, px, py, bw, bh)") | ||
| 47751 | + .expect("cfl_ac_ss lost its 4:2:0 rect fallthrough"); | ||
| 47752 | + assert!( | ||
| 47753 | + t444 < t422 && t422 < sq && sq < rect, | ||
| 47754 | + "{NAME}: cfl_ac_ss's arm order moved (4:4:4 at {t444}, 4:2:2 at {t422}, 4:2:0 square \ | ||
| 47755 | + at {sq}, 4:2:0 rect at {rect}) -- the format-blind 2x2 average must stay the \ | ||
| 47756 | + FALLTHROUGH, after both format tests have had their chance to return" | ||
| 47757 | + ); | ||
| 47758 | + | ||
| 47759 | + // (3) The encoder's colour configs are 4:2:0 only. | ||
| 47760 | + for (src, label) in [ | ||
| 47761 | + (encode, "encode.rs"), | ||
| 47762 | + (include_str!("encoder.rs"), "encoder.rs"), | ||
| 47763 | + ] { | ||
| 47764 | + let n = src.matches("subsampling_x: 0").count(); | ||
| 47765 | + assert_eq!( | ||
| 47766 | + n, 0, | ||
| 47767 | + "{NAME}: {label} now builds a 4:4:4 ColorConfig ({n} site(s)) -- the encoder's \ | ||
| 47768 | + cfl_ac_q3_at call (encode.rs) is a 4:2:0 2x2 average over a half extent and \ | ||
| 47769 | + must thread ss before any encoder can emit one" | ||
| 47770 | + ); | ||
| 47771 | + } | ||
| 47772 | + } | ||
| 47773 | + | ||
| 47774 | + /// lane-av1cfl: per-plane sample-mismatch counts between this decoder's | ||
| 47775 | + /// final stored frames and the instrumented oracle's, summed over every | ||
| 47776 | + /// decode-order frame. Returns `[Y, U, V]`. | ||
| 47777 | + /// | ||
| 47778 | + /// [`decode_all_frames_vs_oracle`] panics on the first differing byte, | ||
| 47779 | + /// which names an offset but not WHICH PLANE the offset falls in -- and | ||
| 47780 | + /// for a chroma-scoped defect the plane split is the whole diagnosis | ||
| 47781 | + /// (luma byte-exact while U and V both diverge is the chroma-sizing | ||
| 47782 | + /// signature; all three diverging is not). | ||
| 47783 | + /// | ||
| 47784 | + /// `plane_samples` is each plane's own sample count in DECODE order | ||
| 47785 | + /// (`[Y, U, V]`) and is read off this decoder's own frame rather than | ||
| 47786 | + /// derived from the dimensions: at 4:2:0 the chroma planes are half-size | ||
| 47787 | + /// and at 4:4:4 full-size, and a helper that assumed one layout would | ||
| 47788 | + /// report every chroma byte as a luma byte. 8-bit only: the dump is one | ||
| 47789 | + /// byte per sample at 8-bit and two at 10/12. | ||
| 47790 | + fn oracle_plane_diffs(stream: &[u8], name: &str, plane_samples: [usize; 3]) -> [usize; 3] { | ||
| 47791 | + let dir = std::env::temp_dir().join(format!("ec-av1-{name}-planes-{}", std::process::id())); | ||
| 47792 | + let _ = std::fs::remove_dir_all(&dir); | ||
| 47793 | + std::fs::create_dir_all(&dir).expect("scratch dir"); | ||
| 47794 | + let obu = dir.join("in.obu"); | ||
| 47795 | + std::fs::write(&obu, stream).expect("writing the stream"); | ||
| 47796 | + let aom_prefix = dir.join("aom"); | ||
| 47797 | + let out = Command::new(aomdec_path()) | ||
| 47798 | + .args(["--codec=av1", "-o"]) | ||
| 47799 | + .arg(dir.join("out.y4m")) | ||
| 47800 | + .arg(&obu) | ||
| 47801 | + .env("EC_AV1_FINAL_DUMP", &aom_prefix) | ||
| 47802 | + .stdin(Stdio::null()) | ||
| 47803 | + .stdout(Stdio::piped()) | ||
| 47804 | + .stderr(Stdio::piped()) | ||
| 47805 | + .output() | ||
| 47806 | + .expect("aomdec failed to run"); | ||
| 47807 | + assert!( | ||
| 47808 | + out.status.success(), | ||
| 47809 | + "{name}: the oracle aomdec refused the stream: {}", | ||
| 47810 | + String::from_utf8_lossy(&out.stderr) | ||
| 47811 | + ); | ||
| 47812 | + let mut oracle_frames = 0usize; | ||
| 47813 | + while std::path::PathBuf::from(format!("{}.f{oracle_frames}", aom_prefix.display())) | ||
| 47814 | + .is_file() | ||
| 47815 | + { | ||
| 47816 | + oracle_frames += 1; | ||
| 47817 | + } | ||
| 47818 | + assert!( | ||
| 47819 | + oracle_frames > 0, | ||
| 47820 | + "{name}: the oracle wrote no EC_AV1_FINAL_DUMP frames -- rung 12 of \ | ||
| 47821 | + scripts/instrument-aom-oracle.sh is missing from {}", | ||
| 47822 | + aomdec_path().display() | ||
| 47823 | + ); | ||
| 47824 | + let ours_prefix = dir.join("ours"); | ||
| 47825 | + set_final_dump_prefix(Some(ours_prefix.display().to_string())); | ||
| 47826 | + let decoded = decode_stream(stream); | ||
| 47827 | + set_final_dump_prefix(None); | ||
| 47828 | + let _ = decoded.expect("the caller already decoded this stream cleanly"); | ||
| 47829 | + let total: usize = plane_samples.iter().sum(); | ||
| 47830 | + // Plane boundaries in the concatenated dump, in DECODE order. | ||
| 47831 | + let mut starts = [0usize; 3]; | ||
| 47832 | + for p in 1..3 { | ||
| 47833 | + starts[p] = starts[p - 1] + plane_samples[p - 1]; | ||
| 47834 | + } | ||
| 47835 | + let mut per_plane = [0usize; 3]; | ||
| 47836 | + for i in 0..oracle_frames { | ||
| 47837 | + let want = | ||
| 47838 | + std::fs::read(format!("{}.f{i}", aom_prefix.display())).expect("oracle dump"); | ||
| 47839 | + let got = std::fs::read(format!("{}.f{i}", ours_prefix.display())).expect("our dump"); | ||
| 47840 | + assert_eq!( | ||
| 47841 | + got.len(), | ||
| 47842 | + total, | ||
| 47843 | + "{name}: decode-order frame {i} is {} bytes, expected {plane_samples:?} at 8-bit", | ||
| 47844 | + got.len() | ||
| 47845 | + ); | ||
| 47846 | + for p in 0..3 { | ||
| 47847 | + let (a, b) = (starts[p], starts[p] + plane_samples[p]); | ||
| 47848 | + per_plane[p] += got[a..b] | ||
| 47849 | + .iter() | ||
| 47850 | + .zip(&want[a..b]) | ||
| 47851 | + .filter(|(x, y)| x != y) | ||
| 47852 | + .count(); | ||
| 47853 | + } | ||
| 47854 | + } | ||
| 47855 | + let _ = std::fs::remove_dir_all(&dir); | ||
| 47856 | + per_plane | ||
| 47857 | + } | ||
| 47858 | + | ||
| 47462 | /// lane-av1444edge r3: the FIRST 4:4:4 superres cell in the crate, and | 47859 | /// lane-av1444edge r3: the FIRST 4:4:4 superres cell in the crate, and |
| 47463 | /// the cell the chroma-format sweep's "4:4:4 superres" row was supposed | 47860 | /// the cell the chroma-format sweep's "4:4:4 superres" row was supposed |
| 47464 | /// to be. | 47861 | /// to be. |
lanes/av1cflac.report.mdadded+390 -0
| @@ -0,0 +1,390 @@ | |||
| 1 | +--- | ||
| 2 | +name: lane-av1cflac | ||
| 3 | +base: 3b691e13 (main at lane start; main has since moved to 3aa16dd1) | ||
| 4 | +branch: lane-av1cflac | ||
| 5 | +worktree: /home/user/.cache/wt/av1cflac | ||
| 6 | +--- | ||
| 7 | + | ||
| 8 | +# lane-av1cflac — `cfl_ac_q3_at` at 4:4:4: **PATH 2, UNREACHABLE.** The | ||
| 9 | +# "188 rung hits on the 4:4:4 set" premise does not reproduce (0 on all 26 | ||
| 10 | +# `*444*` pins), the defect is real but latent, and it is now closed with two | ||
| 11 | +# committed non-vacuous gates instead of a fix. | ||
| 12 | + | ||
| 13 | +**One line, because the whole lane turns on it:** the 4:4:4 CfL path never | ||
| 14 | +reaches `cfl_ac_q3_at`; `cfl_ac_ss` gives 4:4:4 its own libaom-anchored 1x1 | ||
| 15 | +body, so `bw / 2, bh / 2` is correct at every reachable call site and no | ||
| 16 | +behaviour change was made. | ||
| 17 | + | ||
| 18 | +--- | ||
| 19 | + | ||
| 20 | +## 0. Verdict on the inherited premises | ||
| 21 | + | ||
| 22 | +| premise (charter / `lanes/av1chromahalvings.report.md` r3.4, r5.0) | status | evidence | | ||
| 23 | +|---|---|---| | ||
| 24 | +| `cfl_ac_q3_at` has no `fctx`/`ss` and `let (cw, ch) = (bw / 2, bh / 2);` | **TRUE** | `decode.rs:19946-19957` on this branch (definition `19946`, halving `19957`) | | ||
| 25 | +| At 4:4:4 it would be wrong twice — extent, and 2x2-vs-1x1 footprint | **TRUE, latent** | §2 | | ||
| 26 | +| "188 rung hits on the 4:4:4 set" | **FALSE — does not reproduce** | §1: **0 hits on 26/26** `*444*` fixtures | | ||
| 27 | +| "the threading through the CfL call tree is what's missing" | **MOOT** | the tree is already ss-aware: `exec_intra` passes `ss_x(fctx), ss_y(fctx)` into `cfl_ac_ss` (`decode.rs:4423`), and `cfl_ac_ss` dispatches 4:4:4/4:2:2 to their own bodies BEFORE the 4:2:0 fallthrough that owns `cfl_ac_q3_at` (`decode.rs:19898`, `19913`, `19937`, `19940`) | | ||
| 28 | +| the 4:2:2 arm's `(bw >> 1, bh)` is inert at 4:4:4 (do not "fix" it) | **TRUE, and inert everywhere** | §1.3: `CFL_AC_422_HITS == 0` on all 85 pins; 4:2:2 is refused at the sequence header (`stream.rs:1752`) | | ||
| 29 | +| main carries an `EC_HALVSWEEP` rung for `cfl_ac_q3_at` | **FALSE** | main `edffad9e` carries ONE rung, `EC_HALV ibc_owned` (main `decode.rs:16854`; my branch predates that merge, so the rung is absent here); `grep -c 'EC_HALV cfl_ac_q3_at'` on main = 0. The cfl rung lived only on the superseded `lane-chromahalvings-r3` (`19890`). My lane keeps exactly one copy. | | ||
| 30 | + | ||
| 31 | +Also corrected for the ledger: the `stream.rs` hunk in | ||
| 32 | +`/tmp/leak-main-010352.patch` (the moved `FRAMES` assert, the dropped | ||
| 33 | +`rect_narrow_kern_hits()`) is **not mine** — I never opened `stream.rs` for | ||
| 34 | +edit before that leak. The `decode.rs` hunk in it was. | ||
| 35 | + | ||
| 36 | +--- | ||
| 37 | + | ||
| 38 | +## 1. RED-BEFORE: the 188 does not reproduce; the 4:4:4 CfL path is real and goes elsewhere | ||
| 39 | + | ||
| 40 | +### 1.1 The rung, swept over the whole 4:4:4 set | ||
| 41 | + | ||
| 42 | +The env-gated rung was taken from the superseded r3 branch (identical lines), | ||
| 43 | +kept env-gated, and landed at `decode.rs:19953`: | ||
| 44 | + | ||
| 45 | +```rust | ||
| 46 | +pub(crate) fn cfl_ac_q3_at( | ||
| 47 | + px: usize, py: usize, bw: usize, bh: usize, | ||
| 48 | + sample: impl Fn(usize, usize) -> i32, | ||
| 49 | +) -> Vec<i32> { | ||
| 50 | + hit!(CFL_AC_Q3_AT_HITS); | ||
| 51 | + if crate::envflags::env_flag!("EC_HALVSWEEP") { | ||
| 52 | + eprintln!("EC_HALV cfl_ac_q3_at px={px} py={py} bw={bw} bh={bh}"); | ||
| 53 | + } | ||
| 54 | + let (cw, ch) = (bw / 2, bh / 2); | ||
| 55 | +``` | ||
| 56 | + | ||
| 57 | +Commands (lane-private `CARGO_TARGET_DIR`, so no cross-worktree binary | ||
| 58 | +clobber): | ||
| 59 | + | ||
| 60 | +```text | ||
| 61 | +$ cd /home/user/.cache/wt/av1cflac | ||
| 62 | +$ CARGO_TARGET_DIR=/home/user/.cache/tgt/av1cflac cargo build -p ec-av1 --example decode_probe | ||
| 63 | +$ export EC_HALVSWEEP=1 | ||
| 64 | +$ for f in crates/ec-av1/fixtures/*444*.obu; do ... grep -c "EC_HALV cfl_ac_q3_at" ... done | ||
| 65 | +``` | ||
| 66 | + | ||
| 67 | +Raw output — **rung column is 0 on every one**; the bracketed column is the | ||
| 68 | +new per-arm counter, which is what the rung could not see: | ||
| 69 | + | ||
| 70 | +```text | ||
| 71 | +rung=0 444_intrabc_rect4_witness.obu [cfl_ac: 444=72 422=0 420sq=0 420rect=0 q3_at=0] | ||
| 72 | +rung=0 444_leaf8_oob.obu [cfl_ac: 444=72 422=0 420sq=0 420rect=0 q3_at=0] | ||
| 73 | +rung=0 444_lossy_rect4_inter_witness.obu [cfl_ac: 444=8 422=0 420sq=0 420rect=0 q3_at=0] | ||
| 74 | +rung=0 444_lossy_rect4_odd_130x122.obu [cfl_ac: 444=14 422=0 420sq=0 420rect=0 q3_at=0] | ||
| 75 | +rung=0 444_lossy_rect4_wide_256x128.obu [cfl_ac: 444=8 422=0 420sq=0 420rect=0 q3_at=0] | ||
| 76 | +rung=0 444_lossy_superres_256x128_d12.obu [cfl_ac: 444=70 422=0 420sq=0 420rect=0 q3_at=0] | ||
| 77 | +rung=0 444_lossy_superres_256x128_d12_10bit.obu[cfl_ac: 444=86 422=0 420sq=0 420rect=0 q3_at=0] | ||
| 78 | +rung=0 444_lossy_superres_256x128_d12_12bit.obu[cfl_ac: 444=212 422=0 420sq=0 420rect=0 q3_at=0] | ||
| 79 | +rung=0 444_lossy_superres_256x128_d9.obu [cfl_ac: 444=40 422=0 420sq=0 420rect=0 q3_at=0] | ||
| 80 | +rung=0 444_lossy_superres_256x128_d9_12bit.obu [cfl_ac: 444=312 422=0 420sq=0 420rect=0 q3_at=0] | ||
| 81 | +rung=0 444_lossy_superres_mode2_256x128.obu [cfl_ac: 444=64 422=0 420sq=0 420rect=0 q3_at=0] | ||
| 82 | +rung=0 444_lossy_superres_mode2_256x128_10bit.obu [cfl_ac: 444=58 422=0 420sq=0 420rect=0 q3_at=0] | ||
| 83 | +rung=0 444_lossy_superres_mode2_256x128_12bit.obu [cfl_ac: 444=236 422=0 420sq=0 420rect=0 q3_at=0] | ||
| 84 | +rung=0 444_quad_leaf_tx_type.obu [cfl_ac: 444=0 422=0 420sq=0 420rect=0 q3_at=0] | ||
| 85 | +rung=0 444_rect_strip_leaf_tx_type.obu [cfl_ac: 444=0 422=0 420sq=0 420rect=0 q3_at=0] | ||
| 86 | +rung=0 444_sb128rect_lr_witness.obu [cfl_ac: 444=0 422=0 420sq=0 420rect=0 q3_at=0] | ||
| 87 | +rung=0 ll444-lossless-key.obu [cfl_ac: 444=20 422=0 420sq=0 420rect=0 q3_at=0] | ||
| 88 | +rung=0 ll444_128root_lossless.obu [cfl_ac: 444=32 422=0 420sq=0 420rect=0 q3_at=0] | ||
| 89 | +rung=0 ll444_defaultp_inter_strip.obu [cfl_ac: 444=20 422=0 420sq=0 420rect=0 q3_at=0] | ||
| 90 | +rung=0 ll444_ibc_rect.obu [cfl_ac: 444=216 422=0 420sq=0 420rect=0 q3_at=0] | ||
| 91 | +rung=0 ll444_intrabc_rect_l2.obu [cfl_ac: 444=10 422=0 420sq=0 420rect=0 q3_at=0] | ||
| 92 | +rung=0 ll444_minp64_128root_control.obu [cfl_ac: 444=32 422=0 420sq=0 420rect=0 q3_at=0] | ||
| 93 | +rung=0 ll444_minp64_inter.obu [cfl_ac: 444=0 422=0 420sq=0 420rect=0 q3_at=0] | ||
| 94 | +rung=0 ll444_minp8_inter.obu [cfl_ac: 444=0 422=0 420sq=0 420rect=0 q3_at=0] | ||
| 95 | +rung=0 ll444_rect16x4_chroma_reach.obu [cfl_ac: 444=4 422=0 420sq=0 420rect=0 q3_at=0] | ||
| 96 | +rung=0 ll444_sb64_1to4_lossless.obu [cfl_ac: 444=14 422=0 420sq=0 420rect=0 q3_at=0] | ||
| 97 | + | ||
| 98 | +TOTAL 4:4:4-SET RUNG HITS: 0 across 26 fixtures | ||
| 99 | +``` | ||
| 100 | + | ||
| 101 | +**This is the red-before, and it is a negative.** The 4:4:4 CfL path is not | ||
| 102 | +missing: 1834 CfL blocks ran across those 26 streams (arm 0 total = 72+72+8+ | ||
| 103 | +14+8+70+86+212+40+312+64+58+236+0+0+0+20+32+20+216+10+32+0+0+4+14), every one | ||
| 104 | +of them byte-exact against the oracle (§4). The inherited 188 is most likely a | ||
| 105 | +4:2:0 count: the same counter on the 4:2:0 set is **33 752** across 17 fixtures | ||
| 106 | +(§1.2), and the largest single 4:2:0 fixture (`gm_small_side_witness.obu`) | ||
| 107 | +alone reports 11 466. | ||
| 108 | + | ||
| 109 | +### 1.2 The same counter on the 4:2:0 set — the counter is live | ||
| 110 | + | ||
| 111 | +```text | ||
| 112 | +$ for f in crates/ec-av1/fixtures/*.obu; do case 444*) continue;; esac; ... done | ||
| 113 | +420_intrabc_rect4_witness.obu [cfl_ac: 444=0 422=0 420sq=14 420rect=16 q3_at=30] | ||
| 114 | +gm_small_side_witness.obu [cfl_ac: 444=0 422=0 420sq=6208 420rect=5258 q3_at=11466] | ||
| 115 | +grain_cdef_lr_128x128.obu [cfl_ac: 444=0 422=0 420sq=36 420rect=20 q3_at=56] | ||
| 116 | +reelb_arf_witness.obu [cfl_ac: 444=0 422=0 420sq=146 420rect=46 q3_at=192] | ||
| 117 | +reelb_head_mvclamp_witness.obu [cfl_ac: 444=0 422=0 420sq=334 420rect=132 q3_at=466] | ||
| 118 | +reelb_intra14_witness.obu [cfl_ac: 444=0 422=0 420sq=3074 420rect=4074 q3_at=7148] | ||
| 119 | +reelb_kf900.obu [cfl_ac: 444=0 422=0 420sq=2522 420rect=3058 q3_at=5580] | ||
| 120 | +reelb_rect64_intra16x4_witness.obu [cfl_ac: 444=0 422=0 420sq=144 420rect=46 q3_at=190] | ||
| 121 | +reelb_ss300_key_frame.obu [cfl_ac: 444=0 422=0 420sq=448 420rect=484 q3_at=932] | ||
| 122 | +reelb_ss600_key_frame.obu [cfl_ac: 444=0 422=0 420sq=460 420rect=546 q3_at=1006] | ||
| 123 | +intrabc_tx4_chroma_kf.obu [cfl_ac: 444=0 422=0 420sq=474 420rect=0 q3_at=474] | ||
| 124 | +palette_screen_leaf8_witness.obu [cfl_ac: 444=0 422=0 420sq=16 420rect=0 q3_at=16] | ||
| 125 | +sbpart-pin.obu [cfl_ac: 444=0 422=0 420sq=8 420rect=0 q3_at=8] | ||
| 126 | +superres_alltools_sb128_320x180.obu [cfl_ac: 444=0 422=0 420sq=94 420rect=4 q3_at=98] | ||
| 127 | +superres_kf_cdef_lr_64x64.obu [cfl_ac: 444=0 422=0 420sq=24 420rect=2 q3_at=26] | ||
| 128 | +reelc_kf2700.obu [cfl_ac: 444=0 422=0 420sq=1008 420rect=1222 q3_at=2230] | ||
| 129 | +reelc_sb128_inter_witness.obu [cfl_ac: 444=0 422=0 420sq=1516 420rect=2318 q3_at=3834] | ||
| 130 | + 4:2:0 total q3_at = 33752 | ||
| 131 | +``` | ||
| 132 | + | ||
| 133 | +`444` and `q3_at` are **mutually exclusive on every one of the 43 streams that | ||
| 134 | +carry CfL at all.** That is the whole finding. | ||
| 135 | + | ||
| 136 | +### 1.3 The 4:2:2 arm is inert too — the "do not fix it" note, proven not asserted | ||
| 137 | + | ||
| 138 | +`CFL_AC_422_HITS` is 0 on all 85 pins. Two independent reasons, both | ||
| 139 | +structural: `ss_x == 1 && ss_y == 0` (4:2:2) is refused by name at the | ||
| 140 | +sequence header (`stream.rs:1752`), and the pair `(0, 1)` is **structurally | ||
| 141 | +uncodable** — `ec-av1-syntax` reads `subsampling_y` only when | ||
| 142 | +`subsampling_x == 1` (`crates/ec-av1-syntax/src/sequence.rs:481-485`). So | ||
| 143 | +`cfl_ac_ss`'s residual `else` is exactly 4:2:0, by construction and not by | ||
| 144 | +measurement. | ||
| 145 | + | ||
| 146 | +--- | ||
| 147 | + | ||
| 148 | +## 2. Why the defect is latent: the dispatch, and what the reference says | ||
| 149 | + | ||
| 150 | +`cfl_ac_ss` (`decode.rs:19889`) is the whole CfL AC call tree on the decode | ||
| 151 | +side, and its arm order is the guard: | ||
| 152 | + | ||
| 153 | +```rust | ||
| 154 | +fn cfl_ac_ss(y, px, py, bw, bh, ss_x, ss_y) -> Vec<i32> { | ||
| 155 | + if ss_x == 0 && ss_y == 0 { // 19998 4:4:4 | ||
| 156 | + ... ac[row*bw+col] = y[...] << 3; // 1x1, FULL extent | ||
| 157 | + } else if ss_x == 1 && ss_y == 0 { // 19913 4:2:2 | ||
| 158 | + let (cw, ch) = (bw >> 1, bh); // 2x1 horizontal pair, full height | ||
| 159 | + } else if bw == bh { // 19937 4:2:0 square | ||
| 160 | + cfl_ac_q3(y, px, py, bw) // -> cfl_ac_q3_at | ||
| 161 | + } else { // 19940 4:2:0 rect | ||
| 162 | + cfl_ac_q3_rect(y, px, py, bw, bh) // -> cfl_ac_q3_at | ||
| 163 | + } | ||
| 164 | +} | ||
| 165 | +``` | ||
| 166 | + | ||
| 167 | +That is libaom's own dispatch, transcribed: | ||
| 168 | +`cfl_subsampling_lbd` (`~/.cache/aom-oracle/src/av1/common/cfl.c:325-336`) | ||
| 169 | +returns `cfl_luma_subsampling_420/422/444_lbd` on `(sub_x, sub_y)`, and the | ||
| 170 | +three bodies are `cfl.c:230` (2x2 average, `<< 1`), `cfl.c:243` (horizontal | ||
| 171 | +pair, `<< 2`), `cfl.c:257` (1x1, `<< 3`). `cfl_ac_ss` has all three already. | ||
| 172 | +`cfl_ac_q3_at` is only libaom's 420 body, reached only when the two format | ||
| 173 | +tests have already declined. | ||
| 174 | + | ||
| 175 | +The extent arithmetic is not a near-miss either. libaom's subtract-average is | ||
| 176 | +indexed by tx size with `round_offset = num_pel/2` and `num_pel_log2` | ||
| 177 | +(`CFL_SUB_AVG_FN`, `cfl.h:183-221`); our `(sum + num_pel/2) >> num_pel.trailing_zeros()` | ||
| 178 | +is the same identity for every power-of-two block, and the 4:2:0 arms are | ||
| 179 | +byte-identical to it today (§4). | ||
| 180 | + | ||
| 181 | +**So `bw / 2, bh / 2` and the 2x2 footprint are CORRECT at every reachable | ||
| 182 | +call site.** Two independent call-site sets, both enumerated mechanically by | ||
| 183 | +gate 2 below: | ||
| 184 | + | ||
| 185 | +* decode side — `cfl_ac_q3` (`decode.rs:19876`) and `cfl_ac_q3_rect` | ||
| 186 | + (`decode.rs:11613`) have exactly one caller each, `cfl_ac_ss`, and only from | ||
| 187 | + its last two arms; | ||
| 188 | +* encoder side — `encode.rs:6943`, whose every `ColorConfig` in the crate | ||
| 189 | + hardcodes `subsampling_x: 1, subsampling_y: 1` (`encode.rs:2191-2192`, | ||
| 190 | + `encoder.rs:77-78`); `grep -c "subsampling_x: 0"` over both files = 0. | ||
| 191 | + | ||
| 192 | +--- | ||
| 193 | + | ||
| 194 | +## 3. What landed (no behaviour change, no refusal introduced) | ||
| 195 | + | ||
| 196 | +Three files, **+220 / −35** (the −35 are my own intermediate iterations being | ||
| 197 | +replaced; no foreign line is touched — `git diff -U0` hunks are all inside | ||
| 198 | +`decode.rs:5981`, `19899-19953` and `stream.rs:47505-47767`): | ||
| 199 | + | ||
| 200 | +| file | what | | ||
| 201 | +|---|---| | ||
| 202 | +| `crates/ec-av1/src/decode.rs` | five gate counters (`CFL_AC_444/422/420_SQ/420_RECT/Q3_AT_HITS`) + `cfl_ac_arm_hits() -> [usize; 4]` + `cfl_ac_q3_at_hits()`, one `hit!` per `cfl_ac_ss` arm and one at `cfl_ac_q3_at`'s entry, plus the env-gated rung | | ||
| 203 | +| `crates/ec-av1/src/stream.rs` | gate 1 `cfl_ac_444_routes_to_its_own_1x1_luma_body_and_420_to_the_2x2_average`, gate 2 `cfl_ac_q3_at_is_reached_only_through_the_420_fallthrough_of_cfl_ac_ss`, and the helper `oracle_plane_diffs` (per-plane Y/U/V mismatch counts — `decode_all_frames_vs_oracle` names an offset but not a plane, and for a chroma defect the plane split IS the diagnosis) | | ||
| 204 | +| `crates/ec-av1/examples/decode_probe.rs` | one census line so the sweep in §1 is reproducible from outside the crate | | ||
| 205 | + | ||
| 206 | +**Gate 1 — measured, two-sided, with a pixel compare.** Two pinned fixtures, | ||
| 207 | +each asserting the arm its format MUST take is `> 0` (so the `== 0` is a | ||
| 208 | +routing fact, not an absence of CfL), the counter it must NOT touch, and | ||
| 209 | +`0/0/0` per-plane mismatches against the instrumented `aomdec`: | ||
| 210 | + | ||
| 211 | +* 4:4:4 `fixtures/444_lossy_superres_mode2_256x128.obu` — 16620 bytes, fnv | ||
| 212 | + `0x8cbb_36b2_5e0f_07ab`, sha256 | ||
| 213 | + `c18496cf3b7db0feca9aa904024cec2115be80b5b94f87c848ac52f9b32ffd97`, | ||
| 214 | + aomenc `testsrc2=size=256x128:rate=25 -pix_fmt yuv444p --passes=1 | ||
| 215 | + --end-usage=q --cq-level=20 --cpu-used=2 --superres-mode=2 --limit=4 --obu`, | ||
| 216 | + 4 frames; | ||
| 217 | +* 4:2:0 control `fixtures/420_intrabc_rect4_witness.obu` — 890 bytes, fnv | ||
| 218 | + `0x57ec_3da2_a63b_403a`, sha256 | ||
| 219 | + `d01352af5059919cdce733abdcbae8e8240ac3c2a6190fa1bd96d3c6f945b979`, 1 frame, | ||
| 220 | + 640x480. | ||
| 221 | + | ||
| 222 | +Both are already pinned by existing gates; no fixture was added and none was | ||
| 223 | +encoded on the server fleet (there was no witness to hunt for — the claim was | ||
| 224 | +about reachability, and reachability was the thing that turned out to be | ||
| 225 | +false). | ||
| 226 | + | ||
| 227 | +**Gate 2 — the static closure, the way `lane-av1rect8x16` closed its `(4, 8)` | ||
| 228 | +refusal.** Not a comment: a source enumeration that asserts (1) `cfl_ac_q3_at` | ||
| 229 | +has exactly 3 call sites — 2 in `decode.rs`, 1 in `encode.rs`; (2) both | ||
| 230 | +`decode.rs` wrappers have exactly one caller, inside `cfl_ac_ss`; (3) inside | ||
| 231 | +`cfl_ac_ss` the 4:4:4 and 4:2:2 tests come BEFORE both wrapper calls, so the | ||
| 232 | +format-blind average stays the fallthrough; (4) neither `encode.rs` nor | ||
| 233 | +`encoder.rs` contains `subsampling_x: 0`, so the encoder cannot hand it a | ||
| 234 | +4:4:4 block. | ||
| 235 | + | ||
| 236 | +--- | ||
| 237 | + | ||
| 238 | +## 4. Before / after, per plane | ||
| 239 | + | ||
| 240 | +There is no fix, so "before" and "after" are the same tree — that is the | ||
| 241 | +finding, and the numbers are here to be checked rather than believed: | ||
| 242 | + | ||
| 243 | +| fixture | format | CfL blocks | `cfl_ac_q3_at` | Y mismatches | U mismatches | V mismatches | | ||
| 244 | +|---|---|---|---|---|---|---| | ||
| 245 | +| `444_lossy_superres_mode2_256x128.obu` | 4:4:4 | 64 (arm 0) | **0** | 0 / 32768 | 0 / 32768 | 0 / 32768 | | ||
| 246 | +| `420_intrabc_rect4_witness.obu` | 4:2:0 | 30 (arms 2+3: 14 + 16) | 30 | 0 / 307200 | 0 / 76800 | 0 / 76800 | | ||
| 247 | + | ||
| 248 | +The 4:4:4 denominator is the upscaled 256x128 plane; the 4:2:0 denominators are | ||
| 249 | +640x480 luma and 320x240 chroma. Raw gate line, green: | ||
| 250 | + | ||
| 251 | +```text | ||
| 252 | +cfl_ac_444_routes_to_its_own_1x1_luma_body_and_420_to_the_2x2_average: fixtures/444_lossy_superres_mode2_256x128.obu arm0 [64, 0, 0, 0], cfl_ac_q3_at 0, per-plane Y/U/V mismatches vs aomdec 0/0/0 of 256x128; sha256 c18496cf3b7db0feca9aa904024cec2115be80b5b94f87c848ac52f9b32ffd97 | ||
| 253 | +cfl_ac_444_routes_to_its_own_1x1_luma_body_and_420_to_the_2x2_average: fixtures/420_intrabc_rect4_witness.obu arm2 [0, 0, 14, 16], cfl_ac_q3_at 30, per-plane Y/U/V mismatches vs aomdec 0/0/0 of 640x480; sha256 d01352af5059919cdce733abdcbae8e8240ac3c2a6190fa1bd96d3c6f945b979 | ||
| 254 | +ok | ||
| 255 | +``` | ||
| 256 | + | ||
| 257 | +The 4:4:4 arm is byte-exact on much heavier witnesses too, re-quoted unchanged | ||
| 258 | +on this branch: | ||
| 259 | + | ||
| 260 | +```text | ||
| 261 | +a_444_lossy_superres_12bit_d9_stream_decodes_pixel_exact: 4 decode-order frame(s) (0 hidden) byte-exact vs aomdec at 12-bit (256, 128) upscaled from [(9, 228) x4] per frame, 4 upscale(s), 1956 scaled MC block(s) | ||
| 262 | +a_444_lossy_rect4_strip_stream_decodes_pixel_exact_at_odd_and_wide_geometries: fixtures/444_lossy_rect4_odd_130x122.obu 4 decode-order frame(s) byte-exact vs aomdec, 12 own-extent 1:4 chroma gather(s), 28 1:4 inter strip(s) | ||
| 263 | +a_444_lossy_rect4_strip_stream_decodes_pixel_exact_at_odd_and_wide_geometries: fixtures/444_lossy_rect4_wide_256x128.obu 4 decode-order frame(s) byte-exact vs aomdec, 24 own-extent 1:4 chroma gather(s), 76 1:4 inter strip(s) | ||
| 264 | +a_444_lossy_superres_mode2_random_denom_stream_decodes_pixel_exact: 4 decode-order frame(s) byte-exact vs aomdec at (256, 128) upscaled from [(11, 186), (14, 146), (15, 137), (9, 228)], 2265 scaled MC block(s) | ||
| 265 | +``` | ||
| 266 | + | ||
| 267 | +**4:2:0 CfL gates re-quoted unchanged** (all pass on this branch, no edit | ||
| 268 | +touches their code path): | ||
| 269 | + | ||
| 270 | +```text | ||
| 271 | +a_real_libaom_cfl_stream_decodes_pixel_exact .............................. ok | ||
| 272 | +a_real_film_key_frame_with_a_skipped_cfl_block_decodes_pixel_exact ...... ok (pixel-exact, skipped_cfl=1) | ||
| 273 | +the_reelb_ss300_key_frame_skipped_cfl_decodes_pixel_exact ........ ok (1 skipped sub-8x8 CfL chroma block, frame pixel-exact) | ||
| 274 | +``` | ||
| 275 | + | ||
| 276 | +--- | ||
| 277 | + | ||
| 278 | +## 5. Mutation proof — the gate is not a green that survives anything | ||
| 279 | + | ||
| 280 | +Three mutations, each reverted, each with the restore verified byte-identical | ||
| 281 | +(`diff <(git diff) /tmp/av1cflac-green2.patch` → identical). | ||
| 282 | + | ||
| 283 | +**M1 — make the latent defect live (4:4:4 arm calls the 4:2:0 body).** | ||
| 284 | +`decode.rs:19899-19912` replaced with | ||
| 285 | +`cfl_ac_q3_at(px, py, bw, bh, |lx, ly| i32::from(y.data[ly * y.width + lx]))`. | ||
| 286 | +Naive form (half extent, as the defect literally is) does not even reach an | ||
| 287 | +assertion — it is a **hard crash**, which is the honest release framing | ||
| 288 | +(skill `release-invariant-not-debug-assert` §2): | ||
| 289 | + | ||
| 290 | +```text | ||
| 291 | +thread 'stream::tests::cfl_ac_444_routes_to_its_own_1x1_luma_body_and_420_to_the_2x2_average' panicked at crates/ec-av1/src/decode.rs:4455:16: | ||
| 292 | +index out of bounds: the len is 16 but the index is 16 | ||
| 293 | +test result: FAILED. 0 passed; 1 failed | ||
| 294 | +``` | ||
| 295 | + | ||
| 296 | +So the "silent wrongness" framing in the inherited report is wrong twice over: | ||
| 297 | +a live 4:4:4 route would **panic in the reconstruct path**, not silently | ||
| 298 | +mis-colour. Extent-preserving form (`bw*2, bh*2` with a clamped reader, so | ||
| 299 | +the vector length stays right) reds the routing assertion by name: | ||
| 300 | + | ||
| 301 | +```text | ||
| 302 | +panicked at crates/ec-av1/src/stream.rs:47568:17: | ||
| 303 | +assertion `left == right` failed: ... fixtures/444_lossy_superres_mode2_256x128.obu is 4:4:4 and entered the | ||
| 304 | +format-blind cfl_ac_q3_at 64 time(s) -- its extent is bw/2, bh/2 and its footprint is a 2x2 luma average, both wrong | ||
| 305 | +at ss (0,0) (libaom cfl.c:230 vs :257). Arm deltas [64, 0, 0, 0]. Either cfl_ac_ss lost its 4:4:4 arm or a new caller | ||
| 306 | +reached cfl_ac_q3_at directly; both make this site LIVE | ||
| 307 | + left: 64 | ||
| 308 | + right: 0 | ||
| 309 | +test result: FAILED. 0 passed; 1 failed | ||
| 310 | +``` | ||
| 311 | + | ||
| 312 | +**M2 — a fourth call site** (`cfl_ac_q3_at_mutation_probe` delegating to | ||
| 313 | +`cfl_ac_q3_at`, `#[allow(dead_code)]`) reds gate 2's enumeration: | ||
| 314 | + | ||
| 315 | +```text | ||
| 316 | +panicked at crates/ec-av1/src/stream.rs:47681:9: | ||
| 317 | +assertion `left == right` failed: ... cfl_ac_q3_at's call-site set changed -- {"decode.rs": 3, "encode.rs": 1} | ||
| 318 | +against an expected 2 in decode.rs (the cfl_ac_q3 / cfl_ac_q3_rect wrappers) and 1 in encode.rs ... | ||
| 319 | + left: {"decode.rs": 3, "encode.rs": 1} | ||
| 320 | + right: {"decode.rs": 2, "encode.rs": 1} | ||
| 321 | +test result: FAILED. 0 passed; 1 failed | ||
| 322 | +``` | ||
| 323 | + | ||
| 324 | +**Restored green** (`cargo test -p ec-av1 --lib --no-run` clean, then): | ||
| 325 | + | ||
| 326 | +```text | ||
| 327 | +test stream::tests::cfl_ac_444_routes_to_its_own_1x1_luma_body_and_420_to_the_2x2_average ... ok | ||
| 328 | +test stream::tests::cfl_ac_q3_at_is_reached_only_through_the_420_fallthrough_of_cfl_ac_ss ... ok | ||
| 329 | +test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 763 filtered out | ||
| 330 | +``` | ||
| 331 | + | ||
| 332 | +`cargo check -p ec-av1 --all-targets` → `Finished`, 0 warnings. | ||
| 333 | + | ||
| 334 | +--- | ||
| 335 | + | ||
| 336 | +## 6. Boundary note — which files, versus the other lane | ||
| 337 | + | ||
| 338 | +I touched **`crates/ec-av1/src/decode.rs`, `crates/ec-av1/src/stream.rs`, | ||
| 339 | +`crates/ec-av1/examples/decode_probe.rs`, and this report.** Nothing else. | ||
| 340 | + | ||
| 341 | +I did **not** touch `decode_intrabc_owned_rect` (definition `decode.rs:16843` | ||
| 342 | +on this branch, the `let (cw, ch) = (bw / 2, bh / 2);` at `16861`; on post-merge | ||
| 343 | +main the same function is at `16823` with the `EC_HALV ibc_owned` rung at `16854`) — one `git diff -U0` hunk list proves it: my decode.rs hunks are | ||
| 344 | +at `5981` and `19899`, `19919`, `19938`, `19941`, `19953`. That function is the | ||
| 345 | +*other* half of the same latent class and it stays with its owning lane; the | ||
| 346 | +difference is that one is genuinely unreachable (this report) and the other is | ||
| 347 | +reachable-but-refused on a 4:4:4 rect chroma shape pending a `TxbSet` | ||
| 348 | +(`lanes/av1chromahalvings.report.md` r5.2). | ||
| 349 | + | ||
| 350 | +**Edit-path leak, for the next lane (it cost this lane two recoveries).** The | ||
| 351 | +`edit` tool resolved my RELATIVE path `crates/ec-av1/src/stream.rs` against the | ||
| 352 | +session cwd — the MAIN checkout — not the caller's worktree, and put a 249-line | ||
| 353 | +gate into main twice. Detected by `git -C <main> status --porcelain` after | ||
| 354 | +each batch, preserved at `/tmp/av1cflac-gate-leak.patch`, restored with | ||
| 355 | +`git checkout --`, and re-applied inside the lane with | ||
| 356 | +`git apply --3way`. Every edit in this lane after that point used an absolute | ||
| 357 | +`/home/user/.cache/wt/av1cflac/...` header. | ||
| 358 | + | ||
| 359 | +--- | ||
| 360 | + | ||
| 361 | +## 7. Handed back | ||
| 362 | + | ||
| 363 | +The latent-defect row, for whoever makes 4:4:4 rect chroma reachable (the | ||
| 364 | +`ChromaRect32x64` / `ChromaRect64x32` `TxbSet`): | ||
| 365 | + | ||
| 366 | +> **`cfl_ac_q3_at`** (`decode.rs:19946`) computes libaom's **4:2:0** CfL AC: a | ||
| 367 | +> 2x2 luma average per chroma sample (`cfl_luma_subsampling_420_lbd_c`, cfl.c:230) | ||
| 368 | +> over a `bw/2 x bh/2` extent, average-subtracted (`CFL_SUB_AVG_FN`, cfl.h:183). | ||
| 369 | +> It has **no `fctx`/`ss`**, so at `ss (0,0)` it is wrong on **both** counts: | ||
| 370 | +> chroma extent equals luma extent, and the footprint is 1x1 (`<< 3`, cfl.c:257) | ||
| 371 | +> rather than 2x2. It is **unreachable at 4:4:4 today** — `cfl_ac_ss` returns | ||
| 372 | +> 4:4:4 and 4:2:2 from their own bodies before the 4:2:0 fallthrough — and two | ||
| 373 | +> committed gates now say so (`cfl_ac_444_routes_to_its_own_1x1_luma_body_and_420_to_the_2x2_average`, | ||
| 374 | +> `cfl_ac_q3_at_is_reached_only_through_the_420_fallthrough_of_cfl_ac_ss`). | ||
| 375 | +> **When a 4:4:4 rect chroma block can reach it, threading `ss` is the fix and | ||
| 376 | +> the pixel gate is already there** — mutation M1 above is that state, and it | ||
| 377 | +> is a panic, not a colour shift. | ||
| 378 | + | ||
| 379 | +Not done, deliberately: | ||
| 380 | + | ||
| 381 | +* **no `fctx`/`ss` threading.** At every reachable call site the current | ||
| 382 | + arithmetic is right; threading would be an unmeasured change to a shared | ||
| 383 | + helper on a path Main classified as unreachable, and this project does not | ||
| 384 | + take unmeasured decoder changes (same reasoning as | ||
| 385 | + `lanes/av1merge-wave3d.report.md:225`). | ||
| 386 | +* **no new fixture, no server encode.** Nothing to hunt: reachability was the | ||
| 387 | + claim, and it was false. Both gate fixtures are already-pinned aomenc | ||
| 388 | + artifacts. | ||
| 389 | +* **no 4:2:2 arm change.** `(bw >> 1, bh)` in `cfl_ac_ss` is proven inert | ||
| 390 | + (§1.3) and left exactly as found. | ||