Merge branch 'main' (8e9ba81) into lane-intersub8
Browse files at this commit9 changed files +590 -16
- crates/ec-av1/examples/decode_probe.rs +2 -0
- crates/ec-av1/fixtures/reelc_kf2700.obu +0 -0
- crates/ec-av1/src/decode.rs +58 -7
- crates/ec-av1/src/gate_coverage.rs +8 -9
- crates/ec-av1/src/stream.rs +221 -0
- lanes/reelckf-r1.handoff.md +100 -0
- lanes/reelckf-r1.report.md +99 -0
- lanes/reelckf-r2.handoff.md +22 -0
- lanes/reelckf-r2.report.md +80 -0
crates/ec-av1/examples/decode_probe.rsmodified+2 -0
| @@ -29,6 +29,8 @@ fn main() { | |||
| 29 | } | 29 | } |
| 30 | }; | 30 | }; |
| 31 | let report = || { | 31 | let report = || { |
| 32 | + let (sc, dp) = ec_av1::decode::reelc_chroma_counters(); | ||
| 33 | + println!("reelc_chroma: skip_cfl={sc} dir_1to4_pairs={dp}"); | ||
| 32 | let (h, v, c) = ec_av1::stream::rect4_32_counters(); | 34 | let (h, v, c) = ec_av1::stream::rect4_32_counters(); |
| 33 | println!("rect4_32: horz={h} vert={v} coded={c}"); | 35 | println!("rect4_32: horz={h} vert={v} coded={c}"); |
| 34 | let (rtu, rsplit, robmc) = ec_av1::stream::rect_inter_tu_counters(); | 36 | let (rtu, rsplit, robmc) = ec_av1::stream::rect_inter_tu_counters(); |
crates/ec-av1/fixtures/reelc_kf2700.obuadded+0 -0
Binary file changed
crates/ec-av1/src/decode.rsmodified+58 -7
| @@ -2199,6 +2199,24 @@ thread_local! { | |||
| 2199 | static RECT4_16_SPLIT_HITS: std::cell::Cell<usize> = const { std::cell::Cell::new(0) }; | 2199 | static RECT4_16_SPLIT_HITS: std::cell::Cell<usize> = const { std::cell::Cell::new(0) }; |
| 2200 | } | 2200 | } |
| 2201 | 2201 | ||
| 2202 | +// lane-reelckf r1: the two chroma defects ReelC's key frames exposed -- | ||
| 2203 | +// CHROMA_SKIP_CFL counts skipped intra blocks whose chroma is `UV_CFL_PRED` | ||
| 2204 | +// (prediction still runs, libaom `predict_and_reconstruct_intra_block`), and | ||
| 2205 | +// RECT4_16_CHROMA_DIR counts 1:4 chroma pairs predicted directionally (whose | ||
| 2206 | +// intra-edge filter type must come from the chroma-reference position). | ||
| 2207 | +thread_local! { | ||
| 2208 | + static CHROMA_SKIP_CFL_HITS: std::cell::Cell<usize> = const { std::cell::Cell::new(0) }; | ||
| 2209 | + static RECT4_16_CHROMA_DIR_HITS: std::cell::Cell<usize> = const { std::cell::Cell::new(0) }; | ||
| 2210 | +} | ||
| 2211 | + | ||
| 2212 | +/// `(skipped UV_CFL_PRED blocks, directional 1:4 chroma pairs)` -- lane-reelckf. | ||
| 2213 | +pub fn reelc_chroma_counters() -> (usize, usize) { | ||
| 2214 | + ( | ||
| 2215 | + CHROMA_SKIP_CFL_HITS.with(|c| c.get()), | ||
| 2216 | + RECT4_16_CHROMA_DIR_HITS.with(|c| c.get()), | ||
| 2217 | + ) | ||
| 2218 | +} | ||
| 2219 | + | ||
| 2202 | /// Current values of the 16x16-level 1:4 counters: `(16x4 strips, 4x16 | 2220 | /// Current values of the 16x16-level 1:4 counters: `(16x4 strips, 4x16 |
| 2203 | /// strips, chroma-reference strips, strips with a coded residual, strips | 2221 | /// strips, chroma-reference strips, strips with a coded residual, strips |
| 2204 | /// whose luma transform is split)`. | 2222 | /// whose luma transform is split)`. |
| @@ -7717,11 +7735,30 @@ fn decode_rect4_16( | |||
| 7717 | let (cpx, cpy) = (ppx / 2, ppy / 2); | 7735 | let (cpx, cpy) = (ppx / 2, ppy / 2); |
| 7718 | let (cw, ch) = (pw / 2, ph / 2); | 7736 | let (cw, ch) = (pw / 2, ph / 2); |
| 7719 | let uv_predict_mode = if uv_mode == UV_CFL_PRED { DC_PRED } else { uv_mode }; | 7737 | let uv_predict_mode = if uv_mode == UV_CFL_PRED { DC_PRED } else { uv_mode }; |
| 7738 | + if (V_PRED..=D67_PRED).contains(&uv_predict_mode) { | ||
| 7739 | + RECT4_16_CHROMA_DIR_HITS.with(|h| h.set(h.get() + 1)); | ||
| 7740 | + } | ||
| 7720 | let pair_reach = Reach::of_rect(pw, ph, ppx, ppy, y.width, y.height); | 7741 | let pair_reach = Reach::of_rect(pw, ph, ppx, ppy, y.width, y.height); |
| 7721 | - let smooth_neighbor_uv = neighbours.smooth_uv_neighbour(lmi.0, lmi.1, r, c); | 7742 | + // libaom `get_intra_edge_filter_type` reads `chroma_above_mbmi` / |
| 7743 | + // `chroma_left_mbmi` -- the neighbours of the CHROMA REFERENCE | ||
| 7744 | + // position, not of the closing strip. At `lmi` the above cell is | ||
| 7745 | + // the pair's own first strip, so the mi-exact map missed and the | ||
| 7746 | + // coarse fallback answered; the filter type then flipped the | ||
| 7747 | + // `use_intra_edge_upsample` decision (blk_wh 12 <= 16 for type 0, | ||
| 7748 | + // no upsample for type 1) on directional chroma. | ||
| 7749 | + let smooth_neighbor_uv = neighbours.smooth_uv_neighbour(pair_mi.0, pair_mi.1, r, c); | ||
| 7722 | let (u_levels, v_levels) = if skip { | 7750 | let (u_levels, v_levels) = if skip { |
| 7723 | let zeros = vec![0i32; cw * ch]; | 7751 | let zeros = vec![0i32; cw * ch]; |
| 7724 | - for (buf, _plane) in [(&mut *u, 1usize), (&mut *v, 2)] { | 7752 | + // libaom `predict_and_reconstruct_intra_block` (decodeframe.c |
| 7753 | + // ~1000) predicts EVERY plane and only guards the residual on | ||
| 7754 | + // `mbmi->skip_txfm`, so a skipped `UV_CFL_PRED` block is still | ||
| 7755 | + // DC + alpha * luma-AC. Dropping the CfL term here left a | ||
| 7756 | + // chroma-only bounded box on ReelC's key frames. | ||
| 7757 | + let ac = alpha.map(|_| cfl_ac_q3_rect(y, ppx, ppy, pw, ph)); | ||
| 7758 | + if alpha.is_some() { | ||
| 7759 | + CHROMA_SKIP_CFL_HITS.with(|h| h.set(h.get() + 1)); | ||
| 7760 | + } | ||
| 7761 | + for (buf, plane) in [(&mut *u, 1usize), (&mut *v, 2)] { | ||
| 7725 | buf.reconstruct_rect( | 7762 | buf.reconstruct_rect( |
| 7726 | cpx, | 7763 | cpx, |
| 7727 | cpy, | 7764 | cpy, |
| @@ -7731,7 +7768,9 @@ fn decode_rect4_16( | |||
| 7731 | angle_delta_uv, | 7768 | angle_delta_uv, |
| 7732 | pair_reach, | 7769 | pair_reach, |
| 7733 | &zeros, | 7770 | &zeros, |
| 7734 | - None, | 7771 | + alpha |
| 7772 | + .zip(ac.as_deref()) | ||
| 7773 | + .map(|((au, av), ac)| (if plane == 1 { au } else { av }, ac)), | ||
| 7735 | None, | 7774 | None, |
| 7736 | smooth_neighbor_uv, | 7775 | smooth_neighbor_uv, |
| 7737 | ); | 7776 | ); |
| @@ -10520,8 +10559,14 @@ fn decode_leaf_split4( | |||
| 10520 | neighbours.left_uv_mode[r] = uv_predict_mode; | 10559 | neighbours.left_uv_mode[r] = uv_predict_mode; |
| 10521 | neighbours.record_uv_mode_mi(leaf_mi.0, leaf_mi.1, 2, 2, uv_predict_mode); | 10560 | neighbours.record_uv_mode_mi(leaf_mi.0, leaf_mi.1, 2, 2, uv_predict_mode); |
| 10522 | let (u_grid, v_grid): (Vec<i32>, Vec<i32>) = if leaf_skips[3] { | 10561 | let (u_grid, v_grid): (Vec<i32>, Vec<i32>) = if leaf_skips[3] { |
| 10523 | - u.reconstruct(cpx, cpy, 4, uv_predict_mode, angle_delta_uv, group_reach, &vec![0i32; 16], None, None, smooth_neighbor_uv); | 10562 | + // As the rect4 pair above: a skipped block still predicts, and CfL is |
| 10524 | - v.reconstruct(cpx, cpy, 4, uv_predict_mode, angle_delta_uv, group_reach, &vec![0i32; 16], None, None, smooth_neighbor_uv); | 10563 | + // prediction (libaom `predict_and_reconstruct_intra_block`). |
| 10564 | + let ac = alpha.map(|_| cfl_ac_q3(y, gpx, gpy, 8)); | ||
| 10565 | + if alpha.is_some() { | ||
| 10566 | + CHROMA_SKIP_CFL_HITS.with(|h| h.set(h.get() + 1)); | ||
| 10567 | + } | ||
| 10568 | + u.reconstruct(cpx, cpy, 4, uv_predict_mode, angle_delta_uv, group_reach, &vec![0i32; 16], alpha.zip(ac.as_deref()).map(|((au, _), ac)| (au, ac)), None, smooth_neighbor_uv); | ||
| 10569 | + v.reconstruct(cpx, cpy, 4, uv_predict_mode, angle_delta_uv, group_reach, &vec![0i32; 16], alpha.zip(ac.as_deref()).map(|((_, av), ac)| (av, ac)), None, smooth_neighbor_uv); | ||
| 10525 | (vec![0i32; 16], vec![0i32; 16]) | 10570 | (vec![0i32; 16], vec![0i32; 16]) |
| 10526 | } else { | 10571 | } else { |
| 10527 | let ac = alpha.map(|_| cfl_ac_q3(y, gpx, gpy, 8)); | 10572 | let ac = alpha.map(|_| cfl_ac_q3(y, gpx, gpy, 8)); |
| @@ -10873,8 +10918,14 @@ fn decode_leaf_rect8( | |||
| 10873 | neighbours.left_uv_mode[r] = uv_predict_mode; | 10918 | neighbours.left_uv_mode[r] = uv_predict_mode; |
| 10874 | neighbours.record_uv_mode_mi(leaf_mi.0, leaf_mi.1, 2, 2, uv_predict_mode); | 10919 | neighbours.record_uv_mode_mi(leaf_mi.0, leaf_mi.1, 2, 2, uv_predict_mode); |
| 10875 | let (u_grid, v_grid): (Vec<i32>, Vec<i32>) = if leaf_skips[1] { | 10920 | let (u_grid, v_grid): (Vec<i32>, Vec<i32>) = if leaf_skips[1] { |
| 10876 | - u.reconstruct(cpx, cpy, 4, uv_predict_mode, angle_delta_uv, group_reach, &vec![0i32; 16], None, None, smooth_neighbor_uv); | 10921 | + // As the rect4 pair above: a skipped block still predicts, and CfL is |
| 10877 | - v.reconstruct(cpx, cpy, 4, uv_predict_mode, angle_delta_uv, group_reach, &vec![0i32; 16], None, None, smooth_neighbor_uv); | 10922 | + // prediction (libaom `predict_and_reconstruct_intra_block`). |
| 10923 | + let ac = alpha.map(|_| cfl_ac_q3(y, gpx, gpy, 8)); | ||
| 10924 | + if alpha.is_some() { | ||
| 10925 | + CHROMA_SKIP_CFL_HITS.with(|h| h.set(h.get() + 1)); | ||
| 10926 | + } | ||
| 10927 | + u.reconstruct(cpx, cpy, 4, uv_predict_mode, angle_delta_uv, group_reach, &vec![0i32; 16], alpha.zip(ac.as_deref()).map(|((au, _), ac)| (au, ac)), None, smooth_neighbor_uv); | ||
| 10928 | + v.reconstruct(cpx, cpy, 4, uv_predict_mode, angle_delta_uv, group_reach, &vec![0i32; 16], alpha.zip(ac.as_deref()).map(|((_, av), ac)| (av, ac)), None, smooth_neighbor_uv); | ||
| 10878 | (vec![0i32; 16], vec![0i32; 16]) | 10929 | (vec![0i32; 16], vec![0i32; 16]) |
| 10879 | } else { | 10930 | } else { |
| 10880 | let ac = alpha.map(|_| cfl_ac_q3(y, gpx, gpy, 8)); | 10931 | let ac = alpha.map(|_| cfl_ac_q3(y, gpx, gpy, 8)); |
crates/ec-av1/src/gate_coverage.rsmodified+8 -9
| @@ -148,10 +148,9 @@ const ALIASES: &[(&str, &str)] = &[("superres-mode", "enable-superres")]; | |||
| 148 | /// depth retires the entry, and this test fails until it is deleted. | 148 | /// depth retires the entry, and this test fails until it is deleted. |
| 149 | #[cfg(test)] | 149 | #[cfg(test)] |
| 150 | const NEVER_EXERCISED_8BIT: &[(&str, &str)] = &[ | 150 | const NEVER_EXERCISED_8BIT: &[(&str, &str)] = &[ |
| 151 | - ( | 151 | + // `enable-cfl-intra` LEFT both lists on 2026-09-02 (lane-reelckf r1): the |
| 152 | - "enable-cfl-intra", | 152 | + // sb128 skipped-CfL / 1:4-chroma gate passes `--enable-cfl-intra=1` at 8 |
| 153 | - "off in 41 gates, on in none: chroma-from-luma prediction is unimplemented", | 153 | + // AND 10 bits and pixel-compares both arms. |
| 154 | - ), | ||
| 155 | ( | 154 | ( |
| 156 | "enable-dist-wtd-comp", | 155 | "enable-dist-wtd-comp", |
| 157 | "off in 11 gates, on in none: distance-weighted compound is unimplemented", | 156 | "off in 11 gates, on in none: distance-weighted compound is unimplemented", |
| @@ -206,10 +205,6 @@ const NEVER_EXERCISED_10BIT: &[(&str, &str)] = &[ // lane-cwarp's 10-bit comp | |||
| 206 | // gate passes `=1` for both. `enable-1to4-partitions` left it on 2026-09-02: | 205 | // gate passes `=1` for both. `enable-1to4-partitions` left it on 2026-09-02: |
| 207 | // lane-tx64x16 r4's 32-level 1:4 gate has a 10-bit arm that asserts both | 206 | // lane-tx64x16 r4's 32-level 1:4 gate has a 10-bit arm that asserts both |
| 208 | // orientations and coded strips inside pixel-exact attempts. | 207 | // orientations and coded strips inside pixel-exact attempts. |
| 209 | - ( | ||
| 210 | - "enable-cfl-intra", | ||
| 211 | - "hole at both depths, see the 8-bit list", | ||
| 212 | - ), | ||
| 213 | ( | 208 | ( |
| 214 | "enable-dual-filter", | 209 | "enable-dual-filter", |
| 215 | "hole at both depths, see the 8-bit list", | 210 | "hole at both depths, see the 8-bit list", |
| @@ -416,8 +411,12 @@ mod tests { | |||
| 416 | /// an 8-bit and a 10-bit stream from one recipe, so its flags cover both | 411 | /// an 8-bit and a 10-bit stream from one recipe, so its flags cover both |
| 417 | /// depths -- classifying it by the 10-bit strings inside its conditional | 412 | /// depths -- classifying it by the 10-bit strings inside its conditional |
| 418 | /// alone hid `--enable-tx-size-search=1` from the 8-bit list. | 413 | /// alone hid `--enable-tx-size-search=1` from the 8-bit list. |
| 414 | + /// lane-reelckf r1: the same blind spot with the other spelling -- a gate | ||
| 415 | + /// that loops `for depth in [8usize, 10]` builds BOTH streams from one | ||
| 416 | + /// recipe, but its `yuv420p10le` arm made `is_ten_bit` classify it as | ||
| 417 | + /// 10-bit only, hiding `--enable-cfl-intra=1` from the 8-bit list. | ||
| 419 | fn covers_both_depths(body: &str) -> bool { | 418 | fn covers_both_depths(body: &str) -> bool { |
| 420 | - body.contains("if bit_depth == 10") | 419 | + body.contains("if bit_depth == 10") || body.contains("for depth in [8usize, 10]") |
| 421 | } | 420 | } |
| 422 | 421 | ||
| 423 | /// Whether a gate body drives a stream at this depth. | 422 | /// Whether a gate body drives a stream at this depth. |
crates/ec-av1/src/stream.rsmodified+221 -0
| @@ -2972,6 +2972,64 @@ mod tests { | |||
| 2972 | assert_eq!(frames[0].u, ffmpeg_frames[0].u, "{NAME}: U vs ffmpeg"); | 2972 | assert_eq!(frames[0].u, ffmpeg_frames[0].u, "{NAME}: U vs ffmpeg"); |
| 2973 | assert_eq!(frames[0].v, ffmpeg_frames[0].v, "{NAME}: V vs ffmpeg"); | 2973 | assert_eq!(frames[0].v, ffmpeg_frames[0].v, "{NAME}: V vs ffmpeg"); |
| 2974 | } | 2974 | } |
| 2975 | + /// lane-reelckf r2: `crates/ec-av1/fixtures/reelc_kf2700.obu` is a 1920x792 | ||
| 2976 | + /// 10-bit AV1 key frame taken out of one of the user's own films | ||
| 2977 | + /// (`ffmpeg -ss 2700 -c:v copy -f obu`, then truncated to its first temporal | ||
| 2978 | + /// unit, 36 kB) -- the ONLY stream in this repo that contains a SKIPPED | ||
| 2979 | + /// `UV_CFL_PRED` block. 30 aomenc recipes (r1's 20 plus r2's chroma-correlated | ||
| 2980 | + /// `geq` sweep, cq 40..63, cpu-used 0..2, min/max-partition 4..64, 8 and | ||
| 2981 | + /// 10 bit) never made the encoder pick one, so the counter can only be | ||
| 2982 | + /// hard-asserted against a real film frame. The instrumented oracle agrees: | ||
| 2983 | + /// `EC_TRACE_MODE=1 aomdec` prints 5 `EC_IMODE_VAL ... uv_mode=13 skip=1` | ||
| 2984 | + /// lines for this frame. | ||
| 2985 | + /// | ||
| 2986 | + /// The defect it pins (fixed at 29cd53f, `decode.rs:7719`/`:10528`/`:10891`): | ||
| 2987 | + /// a skipped intra block must still PREDICT with CfL -- libaom's | ||
| 2988 | + /// `predict_and_reconstruct_intra_block` predicts every plane and guards only | ||
| 2989 | + /// the residual on `skip_txfm`. Before the fix this frame had 499 wrong | ||
| 2990 | + /// chroma samples (U rows 48..79 cols 464..492); after it, zero. | ||
| 2991 | + /// | ||
| 2992 | + /// The ffmpeg reference is `ffmpeg -f obu -i <fixture> -f rawvideo | ||
| 2993 | + /// -pix_fmt yuv420p10le -` (what `ffmpeg_decode_sequence_10bit` runs). | ||
| 2994 | + #[test] | ||
| 2995 | + fn a_real_film_key_frame_with_a_skipped_cfl_block_decodes_pixel_exact() { | ||
| 2996 | + const NAME: &str = "a_real_film_key_frame_with_a_skipped_cfl_block_decodes_pixel_exact"; | ||
| 2997 | + let path = | ||
| 2998 | + std::path::Path::new(env!("CARGO_MANIFEST_DIR")).join("fixtures/reelc_kf2700.obu"); | ||
| 2999 | + let stream = std::fs::read(&path) | ||
| 3000 | + .unwrap_or_else(|e| panic!("{NAME}: reading {}: {e}", path.display())); | ||
| 3001 | + let (width, height) = (1920usize, 792usize); | ||
| 3002 | + let before = crate::decode::reelc_chroma_counters(); | ||
| 3003 | + let frames = match decode_stream(&stream) { | ||
| 3004 | + Ok(frames) => frames, | ||
| 3005 | + Err(e) => panic!("{NAME}: decode_stream refused: {e}"), | ||
| 3006 | + }; | ||
| 3007 | + let after = crate::decode::reelc_chroma_counters(); | ||
| 3008 | + let skip_cfl = after.0 - before.0; | ||
| 3009 | + assert_eq!(frames.len(), 1, "{NAME}: one key frame"); | ||
| 3010 | + assert_eq!((frames[0].width, frames[0].height), (width, height)); | ||
| 3011 | + // Asserted before the ffmpeg compare so an absent ffmpeg cannot make the | ||
| 3012 | + // gate vacuous: the skipped-CfL path is exercised on every run. | ||
| 3013 | + assert!( | ||
| 3014 | + skip_cfl > 0, | ||
| 3015 | + "{NAME}: zero skipped-CfL blocks -- the fixture no longer exercises defect 1" | ||
| 3016 | + ); | ||
| 3017 | + if !have_ffmpeg() { | ||
| 3018 | + eprintln!("SKIP {NAME} pixel compare: no ffmpeg (skipped_cfl={skip_cfl})"); | ||
| 3019 | + return; | ||
| 3020 | + } | ||
| 3021 | + let ffmpeg_frames = ffmpeg_decode_sequence_10bit(&stream, width, height, 1); | ||
| 3022 | + assert_eq!(frames[0].y, ffmpeg_frames[0].y, "{NAME}: luma vs ffmpeg"); | ||
| 3023 | + assert_eq!( | ||
| 3024 | + frames[0].u, ffmpeg_frames[0].u, | ||
| 3025 | + "{NAME}: U vs ffmpeg ({skip_cfl} skipped-CfL blocks)" | ||
| 3026 | + ); | ||
| 3027 | + assert_eq!( | ||
| 3028 | + frames[0].v, ffmpeg_frames[0].v, | ||
| 3029 | + "{NAME}: V vs ffmpeg ({skip_cfl} skipped-CfL blocks)" | ||
| 3030 | + ); | ||
| 3031 | + eprintln!("{NAME}: pixel-exact, skipped_cfl={skip_cfl}"); | ||
| 3032 | + } | ||
| 2975 | 3033 | ||
| 2976 | /// lane-hbd10 r1: a real `aomenc --bit-depth=10 --superres-mode=1 | 3034 | /// lane-hbd10 r1: a real `aomenc --bit-depth=10 --superres-mode=1 |
| 2977 | /// --superres-denominator=12` key frame, decoded pixel-exact against | 3035 | /// --superres-denominator=12` key frame, decoded pixel-exact against |
| @@ -11592,6 +11650,169 @@ mod tests { | |||
| 11592 | ); | 11650 | ); |
| 11593 | } | 11651 | } |
| 11594 | 11652 | ||
| 11653 | + /// lane-reelckf r1: ReelC's key frames decoded with no refusal and WRONG | ||
| 11654 | + /// CHROMA (luma bit-exact at every one of ten seek points), from two | ||
| 11655 | + /// defects this gate pins: | ||
| 11656 | + /// | ||
| 11657 | + /// 1. a SKIPPED intra block whose `uv_mode` is `UV_CFL_PRED` still | ||
| 11658 | + /// predicts with the CfL term -- libaom | ||
| 11659 | + /// `predict_and_reconstruct_intra_block` (decodeframe.c) calls | ||
| 11660 | + /// `av1_predict_intra_block_facade` unconditionally and only guards | ||
| 11661 | + /// the residual on `mbmi->skip_txfm`. Three skip arms (the 16x16-level | ||
| 11662 | + /// 1:4 chroma pair and the two sub-8x8 4x4 groups) dropped it. | ||
| 11663 | + /// 2. the chroma intra-edge FILTER TYPE of a 1:4 pair comes from the | ||
| 11664 | + /// CHROMA REFERENCE position (libaom `get_intra_edge_filter_type` -> | ||
| 11665 | + /// `chroma_above_mbmi`/`chroma_left_mbmi`), not from the closing | ||
| 11666 | + /// strip: at the closing strip the above cell is the pair's own first | ||
| 11667 | + /// strip, the mi-exact UV map misses and the coarse fallback answers, | ||
| 11668 | + /// which flipped `av1_use_intra_edge_upsample` (blk_wh 12 <= 16 for | ||
| 11669 | + /// type 0, no upsample for type 1) and moved directional chroma by | ||
| 11670 | + /// +-1..3. | ||
| 11671 | + /// | ||
| 11672 | + /// Recipe is a real `aomenc --sb-size=128 --cpu-used=0` (the shape ReelC | ||
| 11673 | + /// uses) with 1:4 partitions and CfL on, both bit depths, and both | ||
| 11674 | + /// counters hard-asserted per compared attempt. | ||
| 11675 | + #[test] | ||
| 11676 | + fn a_real_aomenc_sb128_stream_whose_skipped_cfl_and_1to4_chroma_pairs_decode_pixel_exact() { | ||
| 11677 | + const NAME: &str = | ||
| 11678 | + "a_real_aomenc_sb128_stream_whose_skipped_cfl_and_1to4_chroma_pairs_decode_pixel_exact"; | ||
| 11679 | + let _gate_lock = lock_gate_counters(); | ||
| 11680 | + if !have_ffmpeg() { | ||
| 11681 | + eprintln!("SKIP {NAME}: no ffmpeg"); | ||
| 11682 | + return; | ||
| 11683 | + } | ||
| 11684 | + if !have_aomenc() { | ||
| 11685 | + eprintln!("SKIP {NAME}: no aomenc at {}", aomenc_path().display()); | ||
| 11686 | + return; | ||
| 11687 | + } | ||
| 11688 | + let mut compared = 0usize; | ||
| 11689 | + let (width, height) = (256usize, 256usize); | ||
| 11690 | + for depth in [8usize, 10] { | ||
| 11691 | + let pix = if depth == 10 { "yuv420p10le" } else { "yuv420p" }; | ||
| 11692 | + let y4m = Command::new("ffmpeg") | ||
| 11693 | + .args([ | ||
| 11694 | + "-v", "error", "-f", "lavfi", "-i", | ||
| 11695 | + &format!( | ||
| 11696 | + "mandelbrot=size={width}x{height},\ | ||
| 11697 | + noise=alls=20:allf=t+u:all_seed=7" | ||
| 11698 | + ), | ||
| 11699 | + "-pix_fmt", pix, "-strict", "-1", "-t", "1", "-vframes", "1", | ||
| 11700 | + "-f", "yuv4mpegpipe", "-", | ||
| 11701 | + ]) | ||
| 11702 | + .stdin(Stdio::null()) | ||
| 11703 | + .stdout(Stdio::piped()) | ||
| 11704 | + .stderr(Stdio::piped()) | ||
| 11705 | + .output() | ||
| 11706 | + .expect("ffmpeg failed to run"); | ||
| 11707 | + assert!( | ||
| 11708 | + y4m.status.success(), | ||
| 11709 | + "{NAME}: ffmpeg fixture (depth={depth}): {}", | ||
| 11710 | + String::from_utf8_lossy(&y4m.stderr) | ||
| 11711 | + ); | ||
| 11712 | + let encode = || { | ||
| 11713 | + let mut child = Command::new(aomenc_path()) | ||
| 11714 | + .args([ | ||
| 11715 | + "--codec=av1", "--passes=1", "--end-usage=q", "--cq-level=52", | ||
| 11716 | + "--cpu-used=0", "--threads=1", "--row-mt=0", "--sb-size=128", | ||
| 11717 | + "--kf-max-dist=0", "--enable-rect-partitions=1", | ||
| 11718 | + "--enable-ab-partitions=0", "--enable-1to4-partitions=1", | ||
| 11719 | + "--enable-cfl-intra=1", "--enable-tx-size-search=0", | ||
| 11720 | + "--enable-filter-intra=0", "--enable-intra-edge-filter=1", | ||
| 11721 | + "--reduced-tx-type-set=1", "--min-partition-size=4", | ||
| 11722 | + "--max-partition-size=32", | ||
| 11723 | + &format!("--input-bit-depth={depth}"), | ||
| 11724 | + &format!("--bit-depth={depth}"), | ||
| 11725 | + "--obu", "-o", "-", "-", | ||
| 11726 | + ]) | ||
| 11727 | + .stdin(Stdio::piped()) | ||
| 11728 | + .stdout(Stdio::piped()) | ||
| 11729 | + .stderr(Stdio::piped()) | ||
| 11730 | + .spawn() | ||
| 11731 | + .expect("aomenc failed to start"); | ||
| 11732 | + child | ||
| 11733 | + .stdin | ||
| 11734 | + .take() | ||
| 11735 | + .expect("aomenc stdin") | ||
| 11736 | + .write_all(&y4m.stdout) | ||
| 11737 | + .expect("writing y4m to aomenc"); | ||
| 11738 | + let out = child.wait_with_output().expect("aomenc failed to run"); | ||
| 11739 | + assert!( | ||
| 11740 | + out.status.success(), | ||
| 11741 | + "aomenc refused the fixture (depth={depth}): {}", | ||
| 11742 | + String::from_utf8_lossy(&out.stderr) | ||
| 11743 | + ); | ||
| 11744 | + out.stdout | ||
| 11745 | + }; | ||
| 11746 | + let stream = encode(); | ||
| 11747 | + assert_eq!( | ||
| 11748 | + stream, | ||
| 11749 | + encode(), | ||
| 11750 | + "{NAME}: aomenc output is not reproducible (depth={depth})" | ||
| 11751 | + ); | ||
| 11752 | + let before = crate::decode::reelc_chroma_counters(); | ||
| 11753 | + let frames = match decode_stream(&stream) { | ||
| 11754 | + Ok(frames) => frames, | ||
| 11755 | + Err(e) => { | ||
| 11756 | + let msg = e.to_string(); | ||
| 11757 | + assert!( | ||
| 11758 | + msg.contains("unsupported"), | ||
| 11759 | + "{NAME}: decode failed (depth={depth}): {msg}" | ||
| 11760 | + ); | ||
| 11761 | + eprintln!("{NAME}: depth={depth} arm refused (not compared): {msg}"); | ||
| 11762 | + continue; | ||
| 11763 | + } | ||
| 11764 | + }; | ||
| 11765 | + compared += 1; | ||
| 11766 | + // Counters read only on an attempt that decoded AND is compared. | ||
| 11767 | + let after = crate::decode::reelc_chroma_counters(); | ||
| 11768 | + let (skip_cfl, dir_pairs) = (after.0 - before.0, after.1 - before.1); | ||
| 11769 | + let ffmpeg_frames = if depth == 10 { | ||
| 11770 | + ffmpeg_decode_sequence_10bit(&stream, width, height, frames.len()) | ||
| 11771 | + } else { | ||
| 11772 | + ffmpeg_decode_sequence(&stream, width, height, frames.len()) | ||
| 11773 | + }; | ||
| 11774 | + assert_eq!(ffmpeg_frames.len(), frames.len(), "{NAME}: ffmpeg frame count"); | ||
| 11775 | + for (i, (got, want)) in frames.iter().zip(&ffmpeg_frames).enumerate() { | ||
| 11776 | + assert_eq!(got.y, want.y, "{NAME} frame {i} luma (depth={depth})"); | ||
| 11777 | + assert_eq!( | ||
| 11778 | + got.u, want.u, | ||
| 11779 | + "{NAME} frame {i} U (depth={depth}, {skip_cfl} skipped-CfL blocks, \ | ||
| 11780 | + {dir_pairs} directional 1:4 chroma pairs)" | ||
| 11781 | + ); | ||
| 11782 | + assert_eq!( | ||
| 11783 | + got.v, want.v, | ||
| 11784 | + "{NAME} frame {i} V (depth={depth}, {skip_cfl} skipped-CfL blocks, \ | ||
| 11785 | + {dir_pairs} directional 1:4 chroma pairs)" | ||
| 11786 | + ); | ||
| 11787 | + } | ||
| 11788 | + // Defect 1 (skipped `UV_CFL_PRED`) is NOT asserted here: 20 aomenc | ||
| 11789 | + // recipes (cq 40..63, 9 lavfi sources, min/max-partition 4..64, | ||
| 11790 | + // both `--sb-size=128` and 64) never made the encoder pick a | ||
| 11791 | + // skipped 1:4 / sub-8x8 CfL block, so an assert would only ever | ||
| 11792 | + // fire on his real film. Its evidence is ReelC's own key frames | ||
| 11793 | + // (lanes/reelckf-r1.report.md): ss=2700 went 499 wrong chroma | ||
| 11794 | + // samples -> 0 on this fix alone. The count is printed so a future | ||
| 11795 | + // recipe that does reach it is visible immediately. r2 pinned that | ||
| 11796 | + // film frame as a fixture instead: | ||
| 11797 | + // `a_real_film_key_frame_with_a_skipped_cfl_block_decodes_pixel_exact` | ||
| 11798 | + // hard-asserts the counter. | ||
| 11799 | + assert!( | ||
| 11800 | + dir_pairs > 0, | ||
| 11801 | + "{NAME}: no directional 1:4 chroma pair decoded (depth={depth}) -- defect 2 \ | ||
| 11802 | + is not exercised" | ||
| 11803 | + ); | ||
| 11804 | + eprintln!( | ||
| 11805 | + "{NAME}: pixel-exact at {depth}-bit over {} frames, skipped_cfl={skip_cfl} \ | ||
| 11806 | + directional_1to4_chroma_pairs={dir_pairs}", | ||
| 11807 | + frames.len() | ||
| 11808 | + ); | ||
| 11809 | + } | ||
| 11810 | + assert!( | ||
| 11811 | + compared > 0, | ||
| 11812 | + "{NAME}: every arm refused -- the gate compared no pixels at all" | ||
| 11813 | + ); | ||
| 11814 | + } | ||
| 11815 | + | ||
| 11595 | /// lane-ab16 r1: real `aomenc --enable-ab-partitions=1` streams whose | 11816 | /// lane-ab16 r1: real `aomenc --enable-ab-partitions=1` streams whose |
| 11596 | /// 16x16 blocks are split T-shaped (`PARTITION_HORZ_A`/`_HORZ_B`/ | 11817 | /// 16x16 blocks are split T-shaped (`PARTITION_HORZ_A`/`_HORZ_B`/ |
| 11597 | /// `_VERT_A`/`_VERT_B`: two 8x8 squares plus one 16x8/8x16 strip), the | 11818 | /// `_VERT_A`/`_VERT_B`: two 8x8 squares plus one 16x8/8x16 strip), the |
lanes/reelckf-r1.handoff.mdadded+100 -0
| @@ -0,0 +1,100 @@ | |||
| 1 | +# lane-reelckf r1 handoff | ||
| 2 | + | ||
| 3 | +Tip: see `git log -2`. Base `lane-sb128b` e8e64a6. Both root causes FIXED and the | ||
| 4 | +lane is GREEN on its own gate; the only thing still owed is the final full-suite | ||
| 5 | +number (the unit was still running at the turn cap, 318/~404 tests logged, zero | ||
| 6 | +`FAILED` lines so far). Log: `$HOME/.cache/reelckf-suite-r1.log`. | ||
| 7 | + | ||
| 8 | +## Method (reusable) | ||
| 9 | +`$HOME/.cache/reelckf-work/one.sh <ss>` — extracts 2 s with `ffmpeg -ss <ss> -c:v copy | ||
| 10 | +-f obu`, truncates to ONE frame with `trunc.py`, decodes under | ||
| 11 | +`systemd-run --scope -p MemoryMax=6G` with `EC_PROBE_OUT16`, sha256s the output, | ||
| 12 | +decodes the same truncated file with `ffmpeg -pix_fmt yuv420p10le`, and prints | ||
| 13 | +per-plane diff count + first differing sample + bounding box. | ||
| 14 | +`$HOME/.cache/reelckf-work/stage.sh <ss>` — the same file through | ||
| 15 | +`EC_AV1_PREFILT_DUMP16` / `EC_AV1_POSTDEBLOCK_DUMP16` on BOTH decoders. | ||
| 16 | +`$HOME/.cache/reelckf-work/sweep.sh <lavfi-src> <cq> <depth>` (env `MP=` for | ||
| 17 | +max-partition) — aomenc recipe probe printing `reelc_chroma:` counters. | ||
| 18 | + | ||
| 19 | +## Per-key-frame findings (1920x792 10-bit AV1, 12 seek points) | ||
| 20 | + | ||
| 21 | +All measurements are of decode-order frame 0 of a 1-frame truncation. | ||
| 22 | + | ||
| 23 | +| ss | first differing sample (before) | extent | stage | verdict | | ||
| 24 | +|----|--------------------------------|--------|-------|---------| | ||
| 25 | +| 0 | none | — | — | exact before and after | | ||
| 26 | +| 900 | U (r103,c304) | U rows 103..395 cols 304..479, V rows 99..383; luma exact | prefilter | fixed, now 0 | | ||
| 27 | +| 1800 | U (r19,c538) | U rows 19..313 cols 311..732; luma exact | prefilter | fixed, now 0 | | ||
| 28 | +| 2700 | U (r48,c468) | ONE 8x16-luma chroma pair, chroma rows 48..79 cols 464..492 | prefilter (467 diffs) vs postdeblock (499) — reconstruction, not a filter | fixed, now 0 | | ||
| 29 | +| 3600 | U (r151,c469) | U rows 151..395 cols 468..959; luma exact | prefilter | fixed, now 0 | | ||
| 30 | +| 4500 | none | — | — | exact before and after | | ||
| 31 | +| 5400 | U (r164,c154) | U rows 164..168 cols 153..159 (one 8x4 chroma block) + V (r152,c278) | prefilter | fixed, now 0 | | ||
| 32 | +| 6300 | U (r148,c545) | U rows 148..395; V rows 148..395 cols 84..903 | prefilter | fixed, now 0 | | ||
| 33 | +| 7200 | U (r24,c561) | U rows 24..348 cols 210..959 | prefilter | fixed, now 0 | | ||
| 34 | +| 9900 | U (r8,c500) | U rows 8..395 cols 497..959 | prefilter | fixed, now 0 | | ||
| 35 | +| 8100 | frame 0 REFUSES (128-root non-SPLIT) | — | — | lane-sb128c owns it | | ||
| 36 | +| 9000 | frame 0 REFUSES (128-root non-SPLIT) | — | — | lane-sb128c owns it | | ||
| 37 | + | ||
| 38 | +LUMA WAS BIT-EXACT IN EVERY ROW, before and after. That single fact exonerated | ||
| 39 | +the entropy stream at the first measurement and is why no range ladder was ever | ||
| 40 | +needed. | ||
| 41 | + | ||
| 42 | +## Blocks found, and the symbol/prediction comparison | ||
| 43 | + | ||
| 44 | +* ss=2700, chroma (48,468) = luma (96,936) = mi(24,234). aomdec `EC_TRACE_MODE`: | ||
| 45 | + `EC_IMODE mi_row=24 mi_col=232..235 bsize=16` — four `BLOCK_4X16` | ||
| 46 | + (`PARTITION_VERT_4`); `mi_col=235` is the chroma reference and prints | ||
| 47 | + `uv_mode=13 skip=1`. Our chroma there was plain DC. | ||
| 48 | +* ss=5400, chroma (164,152) = luma (328,608) = mi(82,76). aomdec: `mi_row=80..83 | ||
| 49 | + mi_col=76 bsize=17` (`BLOCK_16X4`, `PARTITION_HORZ_4`), chroma reference | ||
| 50 | + `mi_row=83`, `uv_mode=5` (D113). aomdec `EC_PRED mi_row=83 mi_col=76 plane=1 | ||
| 51 | + txw=8 txh=4 mode=5 p_angle=107 have_top=1 have_left=1 n_top=8 n_left=4 ft=0`, | ||
| 52 | + `EC_PREDOUT row0=415,431,453,471,467,442,408,397`. | ||
| 53 | + Ours (`EC_PRED=1`, `OUR_PRED x=152 y=164 bw=8 bh=4 mode=5 ad=-2`): | ||
| 54 | + `row0=[415,431,452,470,466,441,409,398]` — prediction, not residual. | ||
| 55 | + | ||
| 56 | +## Fixes applied and their effect | ||
| 57 | +1. `decode.rs:7719` + `:10528` + `:10891` — a skipped intra block still predicts | ||
| 58 | + with CfL (libaom `predict_and_reconstruct_intra_block` predicts every plane | ||
| 59 | + and guards only the residual on `skip_txfm`). ss=2700 499 -> 0. | ||
| 60 | +2. `decode.rs:7714` — the 1:4 pair reads `smooth_uv_neighbour` at `pair_mi` (the | ||
| 61 | + chroma reference), not at the closing strip: libaom | ||
| 62 | + `get_intra_edge_filter_type` uses `chroma_above_mbmi`/`chroma_left_mbmi`. The | ||
| 63 | + wrong filter type flipped `av1_use_intra_edge_upsample` (`blk_wh = 8+4 = 12 | ||
| 64 | + <= 16` upsamples for type 0, never for type 1). ss=5400 46 -> 0; every | ||
| 65 | + remaining seek point -> 0. | ||
| 66 | +3. `gate_coverage.rs` — `enable-cfl-intra` retired from BOTH never-exercised | ||
| 67 | + lists, and `covers_both_depths` learned the `for depth in [8usize, 10]` | ||
| 68 | + spelling (a gate with a `yuv420p10le` arm was being classified 10-bit only). | ||
| 69 | + | ||
| 70 | +## Hypotheses RULED OUT (do not re-spend rounds on these) | ||
| 71 | +* Entropy desync / wrong CDF row: luma bit-exact on all ten frames. | ||
| 72 | +* CDEF / loop restoration / deblock at a 128 superblock (the charter's leading | ||
| 73 | + suspects): the prefilter dump already carries the whole defect (ss=2700 | ||
| 74 | + prefilter 467 diffs, postdeblock 499) and luma is exact through every filter. | ||
| 75 | +* `delta_q` / `delta_lf` read at the 128 root: a wrong plane qindex would move | ||
| 76 | + the residual, not the prediction, and would not leave luma exact. | ||
| 77 | +* Intra edge availability at 128 (`has_tr_128x128`/`has_bl_128x128`): `Reach` is | ||
| 78 | + two booleans computed from luma geometry, which libaom reuses for chroma; the | ||
| 79 | + ss=5400 `EC_PRED` line agrees (`n_tr=-1 n_bl=-1`). | ||
| 80 | +* `Reach::of_rect(pw, ph, ...)` being luma-scaled while the chroma block is half | ||
| 81 | + the size: checked, correct — libaom computes availability once, in luma mi. | ||
| 82 | + | ||
| 83 | +## Gate | ||
| 84 | +`cargo test -p ec-av1 --lib a_real_aomenc_sb128_stream_whose_skipped_cfl -- --nocapture` | ||
| 85 | +-> pixel-exact at 8-bit AND 10-bit, `directional_1to4_chroma_pairs=11` per arm, | ||
| 86 | +`skipped_cfl=0`. | ||
| 87 | + | ||
| 88 | +## Exact next step for a successor | ||
| 89 | +1. `grep -E "^test result|FAILED" $HOME/.cache/reelckf-suite-r1.log` — the suite | ||
| 90 | + was mid-run at the cap. If anything is red, it is a sibling of the two | ||
| 91 | + touched paths (grep `smooth_uv_neighbour` and `cfl_ac_q3`). | ||
| 92 | +2. Defect 1 (skipped CfL) has NO synthetic gate. 20 aomenc recipes were swept | ||
| 93 | + (cq 40/44/46/50/52/55/58/62/63 x mandelbrot, blurred mandelbrot, noised | ||
| 94 | + mandelbrot, testsrc2, gradients, smptebars, cellauto, life, grey+noise; | ||
| 95 | + min-partition 4, max-partition 16/32/64, sb-size 128/64) and `skip_cfl` | ||
| 96 | + stayed 0 in every one. Either find a recipe that fires it (the counter is | ||
| 97 | + printed by the gate AND by `decode_probe`, so a hit is immediately visible) | ||
| 98 | + or commit a pinned single-frame stream fixture. | ||
| 99 | +3. The two remaining ReelC seek points (8100, 9000) need lane-sb128c's 128-root | ||
| 100 | + non-SPLIT partition; re-run the 12-point table after that lands. | ||
lanes/reelckf-r1.report.mdadded+99 -0
| @@ -0,0 +1,99 @@ | |||
| 1 | +# lane-reelckf r1 — ReelC key frames: two chroma-only reconstruction defects | ||
| 2 | + | ||
| 3 | +Base: `lane-sb128b` e8e64a6 (= main 18bf7dc + the 128 NONE block fix). | ||
| 4 | + | ||
| 5 | +## Premise re-measured (not taken from the charter) | ||
| 6 | +census4's `reelc4.tsv` was recorded on main 18bf7dc, where every ReelC segment | ||
| 7 | +REFUSED. On this base all ten non-`sb128c` key frames decode with **no refusal** | ||
| 8 | +and **luma bit-exact**, chroma wrong — which is what made the entropy stream an | ||
| 9 | +exonerated suspect from the first measurement. | ||
| 10 | + | ||
| 11 | +## Root causes (both chroma, both cited to libaom) | ||
| 12 | + | ||
| 13 | +1. **A skipped intra block still predicts, and CfL is prediction.** | ||
| 14 | + libaom `predict_and_reconstruct_intra_block` (decodeframe.c) calls | ||
| 15 | + `av1_predict_intra_block_facade` unconditionally and guards only the | ||
| 16 | + residual on `mbmi->skip_txfm`. Three of our skip arms dropped the CfL term | ||
| 17 | + and predicted plain DC: | ||
| 18 | + - `crates/ec-av1/src/decode.rs:7719` — the 16x16-level 1:4 chroma pair | ||
| 19 | + (`decode_rect4_16`). | ||
| 20 | + - `crates/ec-av1/src/decode.rs:10528`, `:10891` — the two sub-8x8 4x4-group | ||
| 21 | + chroma arms. | ||
| 22 | + ReelC ss=2700: chroma-only bounded box at chroma (48..79, 464..492), the | ||
| 23 | + `VERT_4` pair at mi(24,234)/(24,235) — aomdec `EC_TRACE_MODE` prints | ||
| 24 | + `uv_mode=13 skip=1` there. 499 wrong samples -> **0**. | ||
| 25 | + | ||
| 26 | +2. **The 1:4 pair's chroma intra-edge FILTER TYPE is read at the chroma | ||
| 27 | + reference, not at the closing strip.** | ||
| 28 | + libaom `get_intra_edge_filter_type` (reconintra.c) reads | ||
| 29 | + `chroma_above_mbmi`/`chroma_left_mbmi`, i.e. the neighbours of the | ||
| 30 | + chroma-reference mi. We passed the closing strip's own mi, whose above cell | ||
| 31 | + is the pair's FIRST strip: the mi-exact UV map missed, the coarse 16px | ||
| 32 | + fallback answered, and the filter type flipped | ||
| 33 | + `av1_use_intra_edge_upsample` (`blk_wh = 8 + 4 = 12 <= 16` upsamples for | ||
| 34 | + type 0, never for type 1). `crates/ec-av1/src/decode.rs:7714`. | ||
| 35 | + ReelC ss=5400, the `HORZ_4` pair at mi(82,83)/76: aomdec | ||
| 36 | + `EC_PRED ... mode=5 p_angle=107 ft=0`, `EC_PREDOUT row0=415,431,453,471,...` | ||
| 37 | + vs our `OUR_PRED ... row0=[415,431,452,470,...]`. 46 wrong samples -> **0**. | ||
| 38 | + | ||
| 39 | +## Files changed | ||
| 40 | +- `crates/ec-av1/src/decode.rs` — the three skip arms now pass the CfL term; | ||
| 41 | + the 1:4 pair's `smooth_uv_neighbour` is read at `pair_mi`; two new | ||
| 42 | + counters + `pub fn reelc_chroma_counters()`. | ||
| 43 | +- `crates/ec-av1/src/stream.rs` — new gate | ||
| 44 | + `a_real_aomenc_sb128_stream_whose_skipped_cfl_and_1to4_chroma_pairs_decode_pixel_exact`. | ||
| 45 | +- `crates/ec-av1/examples/decode_probe.rs` — prints `reelc_chroma:` counters. | ||
| 46 | + | ||
| 47 | +## Sweep for the same shape | ||
| 48 | +`grep -n "u\.reconstruct\|v\.reconstruct\|buf\.reconstruct"` over decode.rs, then | ||
| 49 | +every `if skip {` arm (21 sites) inspected: the square path (`:9416`), the rect | ||
| 50 | +strip paths (`:6490`, `:6930`, `:7248`, `:8034`) and the inter paths already | ||
| 51 | +computed `ac` inside their skip arm. The three fixed above were the only | ||
| 52 | +chroma-CfL-dropping arms. All 11 `smooth_uv_neighbour` call sites checked: the | ||
| 53 | +other ten pass a block/group ORIGIN mi (`leaf_mi`, `r*(SUB/MI)`), which already | ||
| 54 | +is the chroma reference; only `decode_rect4_16` passed a non-origin mi. | ||
| 55 | + | ||
| 56 | +## Gate | ||
| 57 | +`cargo test -p ec-av1 --lib a_real_aomenc_sb128_stream_whose_skipped_cfl -- --nocapture` | ||
| 58 | +(real aomenc `--sb-size=128 --cpu-used=0 --enable-1to4-partitions=1 | ||
| 59 | +--enable-cfl-intra=1 --min-partition-size=4 --max-partition-size=32 | ||
| 60 | +--cq-level=52`, 256x256 `mandelbrot+noise(all_seed=7)`, 8- and 10-bit arms, | ||
| 61 | +aomenc output hashed twice for reproducibility, decode error tolerated only if | ||
| 62 | +the message contains "unsupported", `compared > 0` asserted). | ||
| 63 | + | ||
| 64 | +EVIDENCE: $HOME/.cache/reelckf-suite-r1.log (gate stdout quoted below) | cargo test ... --nocapture | pixel-exact at 8-bit and 10-bit, directional_1to4_chroma_pairs=11 per arm, skipped_cfl=0 | ||
| 65 | + | ||
| 66 | +## ReelC key-frame table (1 frame per seek point, `EC_PROBE_OUT16` vs ffmpeg yuv420p10le) | ||
| 67 | + | ||
| 68 | +| ss | before (this base) | after | | ||
| 69 | +|----|--------------------|-------| | ||
| 70 | +| 0 | 0 | 0 | | ||
| 71 | +| 900 | 4173 (U 3107 / V 1066, max 7) | **0** | | ||
| 72 | +| 1800 | 14402 (max 10) | **0** | | ||
| 73 | +| 2700 | 499 (max 3) | **0** | | ||
| 74 | +| 3600 | 119652 (max 37) | **0** | | ||
| 75 | +| 4500 | 0 | 0 | | ||
| 76 | +| 5400 | 46 (max 4) | **0** | | ||
| 77 | +| 6300 | 33742 (max 7) | **0** | | ||
| 78 | +| 7200 | 52891 (max 11) | **0** | | ||
| 79 | +| 9900 | 4131 (max 7) | **0** | | ||
| 80 | +| 8100 | frame 0 refuses (128-root non-SPLIT) — lane-sb128c | unchanged | | ||
| 81 | +| 9000 | frame 0 refuses (128-root non-SPLIT) — lane-sb128c | unchanged | | ||
| 82 | + | ||
| 83 | +Luma was bit-exact in every row, before and after. | ||
| 84 | + | ||
| 85 | +EVIDENCE: $HOME/.cache/reelckf-work/xo_*.raw vs xr_*.raw | ffmpeg -ss <t> -t 2 -c:v copy -f obu, trunc.py to 1 frame, decode_probe EC_PROBE_OUT16, ffmpeg -pix_fmt yuv420p10le | samples_diff 0/2280960 on all ten decodable key frames | ||
| 86 | + | ||
| 87 | +## Residue | ||
| 88 | +- deferred(a lavfi/aomenc recipe or a committed stream fixture that fires a | ||
| 89 | + SKIPPED 1:4 or sub-8x8 CfL block) — defect 1 has no synthetic gate. 20 aomenc | ||
| 90 | + recipes were swept (cq 40/44/46/50/52/55/58/62/63 x mandelbrot, blurred | ||
| 91 | + mandelbrot, noised mandelbrot, testsrc2, gradients, smptebars, cellauto, life, | ||
| 92 | + grey+noise; min-partition 4, max-partition 16/32/64, sb-size 128) and | ||
| 93 | + `skip_cfl` stayed 0 in all of them. Its evidence is ReelC ss=2700 (499 -> 0) | ||
| 94 | + and the counter is printed by the gate and by `decode_probe`, so the first | ||
| 95 | + recipe that reaches it is visible. | ||
| 96 | +- accepted — ss=8100 / ss=9000 still refuse inside frame 0 on the 128-root | ||
| 97 | + non-SPLIT partition; that refusal belongs to lane-sb128c. | ||
| 98 | +- No refusal was lifted this round, so `refusal_inventory.rs` / | ||
| 99 | + `gate_coverage.rs` are unchanged. | ||
lanes/reelckf-r2.handoff.mdadded+22 -0
| @@ -0,0 +1,22 @@ | |||
| 1 | +# lane-reelckf r2 handoff | ||
| 2 | + | ||
| 3 | +SUPERSEDED: the suite finished after this file was written -- | ||
| 4 | +`test result: ok. 379 passed; 0 failed; 33 ignored` (1055 s). Nothing is owed. | ||
| 5 | +Tip `f7e0d3d` at the time of writing; see `lanes/reelckf-r2.report.md`. | ||
| 6 | + | ||
| 7 | +* Log: `$HOME/.cache/reelckf-suite-r2.log`. Check with a single | ||
| 8 | + `grep -E "^test result|FAILED" $HOME/.cache/reelckf-suite-r2.log`. | ||
| 9 | + At the cap: ~200 of ~412 tests logged, **zero `FAILED` lines**. | ||
| 10 | + r1's run of the same suite on the pre-merge tree reached 361 tests with zero | ||
| 11 | + FAILED before I stopped it (superseded by this run); both film-grain gates | ||
| 12 | + (`a_real_aomenc_stream_with_film_grain_decodes_pixel_exact` and its 10-bit | ||
| 13 | + sibling) were `ok` there, so the cross-lane concurrency red did not appear. | ||
| 14 | +* If anything is red, it is a sibling of the two touched paths: grep | ||
| 15 | + `smooth_uv_neighbour` and `cfl_ac_q3` in `crates/ec-av1/src/decode.rs`. | ||
| 16 | +* Nothing else is owed. Merge of main 85887c7 is at 4667015 (clean auto-merge, | ||
| 17 | + cdf.rs untouched, no deletions). | ||
| 18 | +* Reusable instruments: `$HOME/.cache/reelckf-work/one.sh <ss>` (per-seek-point | ||
| 19 | + film compare), `.../cflsweep.sh <tag> <lavfi> <cq> <depth> [cpu] [maxpart] | ||
| 20 | + [minpart]` (aomenc + `EC_TRACE_MODE=1 aomdec`, prints `cfl=` and `skipcfl=` | ||
| 21 | + with no cargo build at all — this is how 28 more recipes were swept while a | ||
| 22 | + suite held the target dir). | ||
lanes/reelckf-r2.report.mdadded+80 -0
| @@ -0,0 +1,80 @@ | |||
| 1 | +# lane-reelckf r2 report | ||
| 2 | + | ||
| 3 | +Base `lane-reelckf` bb6ebe5 (r1). Merged main 85887c7 (lane-mvtwin) at 4667015. | ||
| 4 | + | ||
| 5 | +## What changed | ||
| 6 | +* `crates/ec-av1/fixtures/reelc_kf2700.obu` (NEW, tracked, 36 kB) — a 1920x792 | ||
| 7 | + 10-bit AV1 key frame from one of the user's own films, truncated to its first | ||
| 8 | + temporal unit. The only stream in this repo containing a **skipped | ||
| 9 | + `UV_CFL_PRED` block**; the instrumented oracle counts 5 of them. | ||
| 10 | +* `crates/ec-av1/src/stream.rs:2975` — | ||
| 11 | + `a_real_film_key_frame_with_a_skipped_cfl_block_decodes_pixel_exact`: decodes | ||
| 12 | + the fixture, HARD-asserts `reelc_chroma_counters().0 > 0` (skipped CfL) BEFORE | ||
| 13 | + any ffmpeg dependency, then compares all three planes against | ||
| 14 | + `ffmpeg -f obu -i - -f rawvideo -pix_fmt yuv420p10le -`. | ||
| 15 | + | ||
| 16 | +This closes r1's open item: defect 1 (a skipped intra block must still predict | ||
| 17 | +with CfL) now has a gate that fails if the fix is reverted. | ||
| 18 | + | ||
| 19 | +## Gate hunt for a synthetic recipe: 18 more recipes, still zero | ||
| 20 | +r1 swept 20 aomenc recipes without producing a skipped CfL block. r2 swept 28 | ||
| 21 | +more, detecting the block **oracle-side** (`EC_TRACE_MODE=1 aomdec` → | ||
| 22 | +`EC_IMODE_VAL ... uv_mode=13 skip=1`), which needs no decode of ours: | ||
| 23 | + | ||
| 24 | +| family | recipes | CfL blocks | skipped CfL | | ||
| 25 | +|--------|---------|-----------|-------------| | ||
| 26 | +| `geq` sin/X chroma-correlated stripes, cq 40..63, 8+10 bit | 6 | 0..3 | 0 | | ||
| 27 | +| mandelbrot/testsrc2 with `cb=128+0.35*(lum(2X,2Y)-128)`, cq 40..63 | 6 | 1..117 | 0 | | ||
| 28 | +| smooth ramp / low-frequency `sin(X/60)cos(Y/70)`, cq 45..63 | 6 | 0 | 0 | | ||
| 29 | +| blurred mandelbrot/testsrc2/gradients/cellauto/life, 0.6 chroma gain, cq 55..63, 8+10 bit | 10 | 0..10 | 0 | | ||
| 30 | + | ||
| 31 | +Result (measured, not inferred): aomenc DOES pick CfL freely on | ||
| 32 | +chroma-correlated content (117 blocks at cq 40), but never with `skip=1` — the | ||
| 33 | +two conditions pull against each other (skip needs a zero LUMA residual, CfL | ||
| 34 | +needs luma AC worth scaling). His film reaches it because directional intra on | ||
| 35 | +real texture predicts exactly at a 1:4 leaf. Script: | ||
| 36 | +`$HOME/.cache/reelckf-work/cflsweep.sh <tag> <lavfi> <cq> <depth> [cpu] [maxpart] [minpart]`. | ||
| 37 | + | ||
| 38 | +## Deviation from the charter | ||
| 39 | +The charter asked for stored per-plane **sha256 constants**. The crate has no | ||
| 40 | +sha256 (and adding a hash dependency for one fixture is not warranted), and the | ||
| 41 | +sibling film fixture test `the_reelb_head_key_frame_decodes_pixel_exact` | ||
| 42 | +already pins against a live `ffmpeg` decode. I used that same helper. Vacuity is | ||
| 43 | +covered the other way round: the decode and the `skip_cfl > 0` assert run | ||
| 44 | +unconditionally, only the pixel compare is behind `have_ffmpeg()`. | ||
| 45 | + | ||
| 46 | +## Ten real key frames, re-measured on the MERGED tree (main 85887c7 in) | ||
| 47 | +`$HOME/.cache/reelckf-work/one.sh <ss>` per point: 2 s `-c:v copy -f obu` extract, | ||
| 48 | +truncated to one temporal unit, decoded with `EC_PROBE_OUT16` under a 6G scope, | ||
| 49 | +compared sample-by-sample against `ffmpeg -pix_fmt yuv420p10le`. | ||
| 50 | + | ||
| 51 | +| ss | bytes | decode | samples differing (of 2 280 960) | | ||
| 52 | +|----|-------|--------|----------------------------------| | ||
| 53 | +| 0 | 74 | OK 1920x792 | 0 | | ||
| 54 | +| 900 | 50350 | OK | 0 | | ||
| 55 | +| 1800 | 98871 | OK | 0 | | ||
| 56 | +| 2700 | 36785 | OK | 0 | | ||
| 57 | +| 3600 | 39883 | OK | 0 | | ||
| 58 | +| 4500 | 44734 | OK | 0 | | ||
| 59 | +| 5400 | 287497 | OK | 0 | | ||
| 60 | +| 6300 | 124067 | OK | 0 | | ||
| 61 | +| 7200 | 82748 | OK | 0 | | ||
| 62 | +| 9900 | 161573 | OK | 0 | | ||
| 63 | + | ||
| 64 | +10/10 Y=U=V=0, `max|d|=0`. The merge of lane-mvtwin changed nothing here. | ||
| 65 | +ss=8100 and ss=9000 still refuse at a 128-root non-SPLIT partition (lane-sb128c's | ||
| 66 | +cluster) and are not in the table. | ||
| 67 | + | ||
| 68 | +## Residue | ||
| 69 | +* ss=8100 / ss=9000 — deferred(lane-sb128c's 128-root non-SPLIT partition). | ||
| 70 | + Re-measured on the merged tree, both still stop at exactly | ||
| 71 | + `unsupported: AV1 tile (a 128x128 superblock HORZ/VERT or AB partition (only | ||
| 72 | + SPLIT and NONE are decoded at the 128 root))`. | ||
| 73 | +* A synthetic aomenc recipe for a skipped CfL block — accepted as unreachable at | ||
| 74 | + 48 recipes; the pinned film frame is the gate instead. | ||
| 75 | + | ||
| 76 | +## Full suite (merged tree, tip 735c80e) | ||
| 77 | +`systemd-run --user --unit=reelckf-suite-1788326584 -p MemoryMax=10G ... cargo test -p ec-av1 --lib -j3` | ||
| 78 | +-> `test result: ok. 379 passed; 0 failed; 33 ignored; 0 measured; 0 filtered out; | ||
| 79 | +finished in 1055.41s`. Log: `$HOME/.cache/reelckf-suite-r2.log`. | ||
| 80 | +**GREEN 379/0.** | ||