Merge branch 'lane-kf1200' (bee8ec0): the 16x4/4x16 chroma pair's edge-filter type comes from the pair's base mi, and a chroma-carrying gate source to prove it
Browse files at this commit6 changed files +491 -19
- crates/ec-av1/fixtures/reelb_ss300_key_frame.obu +0 -0
- crates/ec-av1/src/decode.rs +54 -12
- crates/ec-av1/src/stream.rs +76 -7
- lanes/kf1200-r1.report.md +106 -0
- lanes/kf1200-r2.handoff.md +72 -0
- lanes/kf1200-r2.report.md +183 -0
crates/ec-av1/fixtures/reelb_ss300_key_frame.obuadded+0 -0
Binary file changed
crates/ec-av1/src/decode.rsmodified+54 -12
| @@ -2197,6 +2197,26 @@ thread_local! { | |||
| 2197 | static RECT4_16_CHROMA_HITS: std::cell::Cell<usize> = const { std::cell::Cell::new(0) }; | 2197 | static RECT4_16_CHROMA_HITS: std::cell::Cell<usize> = const { std::cell::Cell::new(0) }; |
| 2198 | static RECT4_16_COEFF_HITS: std::cell::Cell<usize> = const { std::cell::Cell::new(0) }; | 2198 | static RECT4_16_COEFF_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) }; | 2199 | static RECT4_16_SPLIT_HITS: std::cell::Cell<usize> = const { std::cell::Cell::new(0) }; |
| 2200 | + /// lane-kf1200: pairs whose chroma edge-filter type read from the PAIR's | ||
| 2201 | + /// base mi differs from what the strip's own (odd) mi would have said -- | ||
| 2202 | + /// the shape that made 4 chroma samples of the ReelB `-ss 1200` | ||
| 2203 | + /// key frame miss by 1. Zero here means a gate never exercised the fix. | ||
| 2204 | + static RECT4_16_UV_PAIR_FILT_HITS: std::cell::Cell<usize> = const { std::cell::Cell::new(0) }; | ||
| 2205 | + /// lane-kf1200 r2: sub-8x8 chroma blocks that are `skip_txfm` AND | ||
| 2206 | + /// `UV_CFL_PRED` -- the arm that used to drop the CfL alpha entirely. | ||
| 2207 | + static SKIP_CFL_HITS: std::cell::Cell<usize> = const { std::cell::Cell::new(0) }; | ||
| 2208 | +} | ||
| 2209 | + | ||
| 2210 | +/// How many skipped sub-8x8 chroma blocks carried a CfL alpha (the shape | ||
| 2211 | +/// that reconstructed as flat DC before lane-kf1200 r2). | ||
| 2212 | +pub fn skip_cfl_hits() -> usize { | ||
| 2213 | + SKIP_CFL_HITS.with(|c| c.get()) | ||
| 2214 | +} | ||
| 2215 | + | ||
| 2216 | +/// How many 16x4/4x16 chroma pairs took a different `intra_edge_filter_type` | ||
| 2217 | +/// from the pair's base mi than the strip's own mi would have given. | ||
| 2218 | +pub fn rect4_16_uv_pair_filt_hits() -> usize { | ||
| 2219 | + RECT4_16_UV_PAIR_FILT_HITS.with(|c| c.get()) | ||
| 2200 | } | 2220 | } |
| 2201 | 2221 | ||
| 2202 | // lane-reelckf r1: the two chroma defects ReelC's key frames exposed -- | 2222 | // lane-reelckf r1: the two chroma defects ReelC's key frames exposed -- |
| @@ -7731,14 +7751,22 @@ fn decode_rect4_16( | |||
| 7731 | RECT4_16_CHROMA_DIR_HITS.with(|h| h.set(h.get() + 1)); | 7751 | RECT4_16_CHROMA_DIR_HITS.with(|h| h.set(h.get() + 1)); |
| 7732 | } | 7752 | } |
| 7733 | let pair_reach = Reach::of_rect(pw, ph, ppx, ppy, y.width, y.height); | 7753 | let pair_reach = Reach::of_rect(pw, ph, ppx, ppy, y.width, y.height); |
| 7734 | - // libaom `get_intra_edge_filter_type` reads `chroma_above_mbmi` / | 7754 | + // lane-kf1200 r1: the chroma edge-filter type reads the neighbours |
| 7735 | - // `chroma_left_mbmi` -- the neighbours of the CHROMA REFERENCE | 7755 | + // of the CHROMA block, which for a 16x4/4x16 pair is `pair_mi`'s |
| 7736 | - // position, not of the closing strip. At `lmi` the above cell is | 7756 | + // 16x8/8x16 region -- libaom builds `chroma_above_mbmi`/ |
| 7737 | - // the pair's own first strip, so the mi-exact map missed and the | 7757 | + // `chroma_left_mbmi` from `mi[-((mi_row & ss_y) * stride + (mi_col |
| 7738 | - // coarse fallback answered; the filter type then flipped the | 7758 | + // & ss_x))]` (`set_mi_offsets`, av1/common/blockd.h ~1050), i.e. |
| 7739 | - // `use_intra_edge_upsample` decision (blk_wh 12 <= 16 for type 0, | 7759 | + // the pair's top-left luma mi, never this leaf's odd row/column. |
| 7740 | - // no upsample for type 1) on directional chroma. | 7760 | + // Reading `lmi` here named the leaf directly above (a non-chroma |
| 7741 | - let smooth_neighbor_uv = neighbours.smooth_uv_neighbour(pair_mi.0, pair_mi.1, r, c); | 7761 | + // -reference 4-row block, `uv_mode == UV_DC_PRED`) and so lost a |
| 7762 | + // SMOOTH neighbour: filt_type 0 instead of 1 turned | ||
| 7763 | + // `av1_use_intra_edge_upsample` on (blk_wh 12 <= 16) for a | ||
| 7764 | + // directional chroma strip, moving 4 samples by 1. | ||
| 7765 | + let smooth_neighbor_uv = | ||
| 7766 | + neighbours.smooth_uv_neighbour(pair_mi.0, pair_mi.1, r, c); | ||
| 7767 | + if smooth_neighbor_uv != neighbours.smooth_uv_neighbour(lmi.0, lmi.1, r, c) { | ||
| 7768 | + RECT4_16_UV_PAIR_FILT_HITS.with(|h| h.set(h.get() + 1)); | ||
| 7769 | + } | ||
| 7742 | let (u_levels, v_levels) = if skip { | 7770 | let (u_levels, v_levels) = if skip { |
| 7743 | let zeros = vec![0i32; cw * ch]; | 7771 | let zeros = vec![0i32; cw * ch]; |
| 7744 | // libaom `predict_and_reconstruct_intra_block` (decodeframe.c | 7772 | // libaom `predict_and_reconstruct_intra_block` (decodeframe.c |
| @@ -10551,11 +10579,18 @@ fn decode_leaf_split4( | |||
| 10551 | neighbours.left_uv_mode[r] = uv_predict_mode; | 10579 | neighbours.left_uv_mode[r] = uv_predict_mode; |
| 10552 | neighbours.record_uv_mode_mi(leaf_mi.0, leaf_mi.1, 2, 2, uv_predict_mode); | 10580 | neighbours.record_uv_mode_mi(leaf_mi.0, leaf_mi.1, 2, 2, uv_predict_mode); |
| 10553 | let (u_grid, v_grid): (Vec<i32>, Vec<i32>) = if leaf_skips[3] { | 10581 | let (u_grid, v_grid): (Vec<i32>, Vec<i32>) = if leaf_skips[3] { |
| 10554 | - // As the rect4 pair above: a skipped block still predicts, and CfL is | 10582 | + // A skipped chroma block still gets its CfL contribution: libaom's |
| 10555 | - // prediction (libaom `predict_and_reconstruct_intra_block`). | 10583 | + // `predict_and_reconstruct_intra_block` calls `cfl_predict_block` |
| 10584 | + // from `av1_predict_intra_block_facade` (av1/common/reconintra.c:1719) | ||
| 10585 | + // whenever `mbmi->uv_mode == UV_CFL_PRED`, before any residual is | ||
| 10586 | + // added -- `skip_txfm` only drops the residual, never the alpha. | ||
| 10587 | + // lane-reelckf and lane-kf1200 fixed THIS SAME arm independently; the | ||
| 10588 | + // merge keeps one fix and feeds both lanes' counters so neither of | ||
| 10589 | + // their gates goes vacuous. | ||
| 10556 | let ac = alpha.map(|_| cfl_ac_q3(y, gpx, gpy, 8)); | 10590 | let ac = alpha.map(|_| cfl_ac_q3(y, gpx, gpy, 8)); |
| 10557 | if alpha.is_some() { | 10591 | if alpha.is_some() { |
| 10558 | CHROMA_SKIP_CFL_HITS.with(|h| h.set(h.get() + 1)); | 10592 | CHROMA_SKIP_CFL_HITS.with(|h| h.set(h.get() + 1)); |
| 10593 | + SKIP_CFL_HITS.with(|c| c.set(c.get() + 1)); | ||
| 10559 | } | 10594 | } |
| 10560 | 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); | 10595 | 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); |
| 10561 | 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); | 10596 | 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); |
| @@ -10910,11 +10945,18 @@ fn decode_leaf_rect8( | |||
| 10910 | neighbours.left_uv_mode[r] = uv_predict_mode; | 10945 | neighbours.left_uv_mode[r] = uv_predict_mode; |
| 10911 | neighbours.record_uv_mode_mi(leaf_mi.0, leaf_mi.1, 2, 2, uv_predict_mode); | 10946 | neighbours.record_uv_mode_mi(leaf_mi.0, leaf_mi.1, 2, 2, uv_predict_mode); |
| 10912 | let (u_grid, v_grid): (Vec<i32>, Vec<i32>) = if leaf_skips[1] { | 10947 | let (u_grid, v_grid): (Vec<i32>, Vec<i32>) = if leaf_skips[1] { |
| 10913 | - // As the rect4 pair above: a skipped block still predicts, and CfL is | 10948 | + // A skipped chroma block still gets its CfL contribution: libaom's |
| 10914 | - // prediction (libaom `predict_and_reconstruct_intra_block`). | 10949 | + // `predict_and_reconstruct_intra_block` calls `cfl_predict_block` |
| 10950 | + // from `av1_predict_intra_block_facade` (av1/common/reconintra.c:1719) | ||
| 10951 | + // whenever `mbmi->uv_mode == UV_CFL_PRED`, before any residual is | ||
| 10952 | + // added -- `skip_txfm` only drops the residual, never the alpha. | ||
| 10953 | + // lane-reelckf and lane-kf1200 fixed THIS SAME arm independently; the | ||
| 10954 | + // merge keeps one fix and feeds both lanes' counters so neither of | ||
| 10955 | + // their gates goes vacuous. | ||
| 10915 | let ac = alpha.map(|_| cfl_ac_q3(y, gpx, gpy, 8)); | 10956 | let ac = alpha.map(|_| cfl_ac_q3(y, gpx, gpy, 8)); |
| 10916 | if alpha.is_some() { | 10957 | if alpha.is_some() { |
| 10917 | CHROMA_SKIP_CFL_HITS.with(|h| h.set(h.get() + 1)); | 10958 | CHROMA_SKIP_CFL_HITS.with(|h| h.set(h.get() + 1)); |
| 10959 | + SKIP_CFL_HITS.with(|c| c.set(c.get() + 1)); | ||
| 10918 | } | 10960 | } |
| 10919 | 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); | 10961 | 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); |
| 10920 | 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); | 10962 | 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); |
crates/ec-av1/src/stream.rsmodified+76 -7
| @@ -3031,6 +3031,47 @@ mod tests { | |||
| 3031 | eprintln!("{NAME}: pixel-exact, skipped_cfl={skip_cfl}"); | 3031 | eprintln!("{NAME}: pixel-exact, skipped_cfl={skip_cfl}"); |
| 3032 | } | 3032 | } |
| 3033 | 3033 | ||
| 3034 | + /// lane-kf1200 r2: the same film's `-ss 300` key frame, pinned because no | ||
| 3035 | + /// aomenc recipe reaches its shape -- a SKIPPED sub-8x8 chroma block whose | ||
| 3036 | + /// `uv_mode` is `UV_CFL_PRED`. (lane-reelckf r1 burned 20 recipes across cq | ||
| 3037 | + /// 40..63 and nine lavfi sources hunting exactly this block and never got | ||
| 3038 | + /// one; ledger dead-end "never produced a SKIPPED 1:4 or sub-8x8 CfL | ||
| 3039 | + /// block".) Before the fix the two sub-8x8 skip arms passed `None` for the | ||
| 3040 | + /// CfL argument, so the block reconstructed as flat DC and 463 bytes of | ||
| 3041 | + /// this frame's chroma were wrong. HARD-asserts `skip_cfl_hits` moved, so | ||
| 3042 | + /// the fixture cannot silently stop exercising the arm. | ||
| 3043 | + #[test] | ||
| 3044 | + fn the_reelb_ss300_key_frame_skipped_cfl_decodes_pixel_exact() { | ||
| 3045 | + const NAME: &str = "the_reelb_ss300_key_frame_skipped_cfl_decodes_pixel_exact"; | ||
| 3046 | + if !have_ffmpeg() { | ||
| 3047 | + eprintln!("SKIP {NAME}: no ffmpeg"); | ||
| 3048 | + return; | ||
| 3049 | + } | ||
| 3050 | + let path = std::path::Path::new(env!("CARGO_MANIFEST_DIR")) | ||
| 3051 | + .join("fixtures/reelb_ss300_key_frame.obu"); | ||
| 3052 | + let stream = std::fs::read(&path) | ||
| 3053 | + .unwrap_or_else(|e| panic!("{NAME}: reading {}: {e}", path.display())); | ||
| 3054 | + let (width, height) = (3840usize, 1608usize); | ||
| 3055 | + let before = crate::decode::skip_cfl_hits(); | ||
| 3056 | + let frames = match decode_stream(&stream) { | ||
| 3057 | + Ok(frames) => frames, | ||
| 3058 | + Err(e) => panic!("{NAME}: decode_stream refused: {e}"), | ||
| 3059 | + }; | ||
| 3060 | + let skipped_cfl = crate::decode::skip_cfl_hits() - before; | ||
| 3061 | + assert!( | ||
| 3062 | + skipped_cfl > 0, | ||
| 3063 | + "{NAME}: zero skipped sub-8x8 CfL blocks -- the fixture no longer \ | ||
| 3064 | + exercises the arm this test exists for" | ||
| 3065 | + ); | ||
| 3066 | + assert_eq!(frames.len(), 1, "{NAME}: one key frame"); | ||
| 3067 | + assert_eq!((frames[0].width, frames[0].height), (width, height)); | ||
| 3068 | + let ffmpeg_frames = ffmpeg_decode_sequence_10bit(&stream, width, height, 1); | ||
| 3069 | + assert_eq!(frames[0].y, ffmpeg_frames[0].y, "{NAME}: luma vs ffmpeg"); | ||
| 3070 | + assert_eq!(frames[0].u, ffmpeg_frames[0].u, "{NAME}: U vs ffmpeg"); | ||
| 3071 | + assert_eq!(frames[0].v, ffmpeg_frames[0].v, "{NAME}: V vs ffmpeg"); | ||
| 3072 | + eprintln!("{NAME}: {skipped_cfl} skipped sub-8x8 CfL chroma blocks, frame pixel-exact"); | ||
| 3073 | + } | ||
| 3074 | + | ||
| 3034 | /// lane-hbd10 r1: a real `aomenc --bit-depth=10 --superres-mode=1 | 3075 | /// lane-hbd10 r1: a real `aomenc --bit-depth=10 --superres-mode=1 |
| 3035 | /// --superres-denominator=12` key frame, decoded pixel-exact against | 3076 | /// --superres-denominator=12` key frame, decoded pixel-exact against |
| 3036 | /// ffmpeg's own 10-bit decode. Proves `superres::upscale_row`'s | 3077 | /// ffmpeg's own 10-bit decode. Proves `superres::upscale_row`'s |
| @@ -21173,6 +21214,11 @@ mod tests { | |||
| 21173 | let (mut horz_proved, mut vert_proved) = (0usize, 0usize); | 21214 | let (mut horz_proved, mut vert_proved) = (0usize, 0usize); |
| 21174 | let (mut chroma_proved, mut coeff_proved) = (0usize, 0usize); | 21215 | let (mut chroma_proved, mut coeff_proved) = (0usize, 0usize); |
| 21175 | let mut split_proved = 0usize; | 21216 | let mut split_proved = 0usize; |
| 21217 | + // lane-kf1200: chroma pairs whose intra-edge filter type comes out | ||
| 21218 | + // different when read from the PAIR's base mi (libaom's | ||
| 21219 | + // `chroma_above_mbmi`) rather than the odd strip mi -- the shape | ||
| 21220 | + // that was silently wrong by 1 on the ReelB key frames. | ||
| 21221 | + let mut pair_filt_proved = 0usize; | ||
| 21176 | let (mut out_of_scope, mut out_of_scope_mismatch) = (0u32, 0u32); | 21222 | let (mut out_of_scope, mut out_of_scope_mismatch) = (0u32, 0u32); |
| 21177 | // The second half of the window turns `--enable-tx-size-search` on: | 21223 | // The second half of the window turns `--enable-tx-size-search` on: |
| 21178 | // that is what makes a 16x4 strip SPLIT its transform (depth 1 = | 21224 | // that is what makes a 16x4 strip SPLIT its transform (depth 1 = |
| @@ -21185,11 +21231,26 @@ mod tests { | |||
| 21185 | let axis = if attempt % 2 == 0 { "Y" } else { "X" }; | 21231 | let axis = if attempt % 2 == 0 { "Y" } else { "X" }; |
| 21186 | let step = 67 + (attempt / 2) * 12; | 21232 | let step = 67 + (attempt / 2) * 12; |
| 21187 | let noise = 6 + (attempt % 4) * 3; | 21233 | let noise = 6 + (attempt % 4) * 3; |
| 21188 | - let source = format!( | 21234 | + // lane-kf1200: the odd attempts carry CHROMA content. The |
| 21189 | - "color=c=gray:s={width}x{height}:d={duration}:r=25,format=gray,\ | 21235 | + // original gray source leaves both chroma planes constant, so |
| 21190 | - geq=lum='mod(floor({axis}/4)*{step},256)',\ | 21236 | + // every `uv_mode` is DC and a pair's edge-filter type can never |
| 21191 | - noise=alls={noise}:all_seed={seed},format=yuv420p" | 21237 | + // differ from its strip's -- the shape that shipped wrong for |
| 21192 | - ); | 21238 | + // months. A smooth chroma gradient makes aomenc pick SMOOTH / |
| 21239 | + // directional `uv_mode`s next to each other. | ||
| 21240 | + let source = if attempt % 2 == 0 { | ||
| 21241 | + format!( | ||
| 21242 | + "color=c=gray:s={width}x{height}:d={duration}:r=25,format=gray,\ | ||
| 21243 | + geq=lum='mod(floor({axis}/4)*{step},256)',\ | ||
| 21244 | + noise=alls={noise}:all_seed={seed},format=yuv420p" | ||
| 21245 | + ) | ||
| 21246 | + } else { | ||
| 21247 | + format!( | ||
| 21248 | + "color=c=black:s={width}x{height}:d={duration}:r=25,format=yuv420p,\ | ||
| 21249 | + geq=lum='mod(floor({axis}/4)*{step},256)'\ | ||
| 21250 | + :cb='128+100*sin((X+Y)/23)':cr='128+100*cos(X/19)',\ | ||
| 21251 | + noise=alls={noise}:all_seed={seed}" | ||
| 21252 | + ) | ||
| 21253 | + }; | ||
| 21193 | let cq_level = format!("--cq-level={}", 24 + (attempt % 4) * 8); | 21254 | let cq_level = format!("--cq-level={}", 24 + (attempt % 4) * 8); |
| 21194 | let pix_fmt = if bit_depth == 10 { "yuv420p10le" } else { "yuv420p" }; | 21255 | let pix_fmt = if bit_depth == 10 { "yuv420p10le" } else { "yuv420p" }; |
| 21195 | let y4m = Command::new("ffmpeg") | 21256 | let y4m = Command::new("ffmpeg") |
| @@ -21268,6 +21329,7 @@ mod tests { | |||
| 21268 | ); | 21329 | ); |
| 21269 | let stream = out.stdout; | 21330 | let stream = out.stdout; |
| 21270 | let before = crate::decode::rect4_16_counters(); | 21331 | let before = crate::decode::rect4_16_counters(); |
| 21332 | + let pair_filt_before = crate::decode::rect4_16_uv_pair_filt_hits(); | ||
| 21271 | let frames = match decode_stream(&stream) { | 21333 | let frames = match decode_stream(&stream) { |
| 21272 | Err(e) => { | 21334 | Err(e) => { |
| 21273 | let msg = e.to_string(); | 21335 | let msg = e.to_string(); |
| @@ -21336,6 +21398,7 @@ mod tests { | |||
| 21336 | vert_proved += vert; | 21398 | vert_proved += vert; |
| 21337 | chroma_proved += chroma; | 21399 | chroma_proved += chroma; |
| 21338 | coeff_proved += coeff; | 21400 | coeff_proved += coeff; |
| 21401 | + pair_filt_proved += crate::decode::rect4_16_uv_pair_filt_hits() - pair_filt_before; | ||
| 21339 | split_proved += split; | 21402 | split_proved += split; |
| 21340 | matched += 1; | 21403 | matched += 1; |
| 21341 | } | 21404 | } |
| @@ -21368,11 +21431,17 @@ mod tests { | |||
| 21368 | "{NAME}: {bit_depth}-bit compared attempts never split a strip's transform -- \ | 21431 | "{NAME}: {bit_depth}-bit compared attempts never split a strip's transform -- \ |
| 21369 | the `--enable-tx-size-search=1` half of the window proved nothing" | 21432 | the `--enable-tx-size-search=1` half of the window proved nothing" |
| 21370 | ); | 21433 | ); |
| 21434 | + assert!( | ||
| 21435 | + pair_filt_proved > 0, | ||
| 21436 | + "{NAME}: {bit_depth}-bit compared attempts never decoded a chroma pair whose \ | ||
| 21437 | + edge-filter type differs between the pair's base mi and the strip's own mi -- \ | ||
| 21438 | + the lane-kf1200 fix is unexercised, so this gate would pass with it reverted" | ||
| 21439 | + ); | ||
| 21371 | eprintln!( | 21440 | eprintln!( |
| 21372 | "{NAME}: {bit_depth}-bit {matched} compared attempts, {horz_proved} 16x4 / \ | 21441 | "{NAME}: {bit_depth}-bit {matched} compared attempts, {horz_proved} 16x4 / \ |
| 21373 | {vert_proved} 4x16 strips, {chroma_proved} chroma pairs, {coeff_proved} coded \ | 21442 | {vert_proved} 4x16 strips, {chroma_proved} chroma pairs, {coeff_proved} coded \ |
| 21374 | - units, {split_proved} split-transform strips, {named_refusals} refusals, \ | 21443 | + units, {split_proved} split-transform strips, {pair_filt_proved} pair-base \ |
| 21375 | - {out_of_scope} out of scope" | 21444 | + filt-type flips, {named_refusals} refusals, {out_of_scope} out of scope" |
| 21376 | ); | 21445 | ); |
| 21377 | } | 21446 | } |
| 21378 | } | 21447 | } |
lanes/kf1200-r1.report.mdadded+106 -0
| @@ -0,0 +1,106 @@ | |||
| 1 | +# lane-kf1200 r1 — the 16x4/4x16 chroma pair read its edge-filter type from the wrong mi | ||
| 2 | + | ||
| 3 | +## Defect (census4 premise, re-measured on this branch) | ||
| 4 | + | ||
| 5 | +ReelB `-ss 1200` key frame (1 frame, `3840x1608 yuv420p10le`), our | ||
| 6 | +`EC_PROBE_OUT16` vs `ffmpeg -pix_fmt yuv420p10le`: **12 U samples at ±1, Y and V exact**. | ||
| 7 | +Stage bisect (`EC_AV1_PREFILT_DUMP16` ours vs aomdec's): **13 U samples already wrong | ||
| 8 | +before the loop filter** — a reconstruction defect, not deblock/CDEF/LR/film grain, and | ||
| 9 | +not an entropy desync (lane-kf900's shape). | ||
| 10 | + | ||
| 11 | +## Root cause | ||
| 12 | + | ||
| 13 | +Block: chroma `(x=352, y=356)`, `8x4`, `uv_mode = H_PRED`, `angle_delta_uv = -2` | ||
| 14 | +(`p_angle = 174`), the chroma half of a `16x8` **`PARTITION_HORZ_4` pair** at | ||
| 15 | +luma mi `(178,176)`, strip mi `(179,176)`. | ||
| 16 | +Its prediction differed from aomdec's by 4 samples of the last row | ||
| 17 | +(`OUR_PRED sum=16208` vs `EC_PREDOUT sum=16212`); row 0 and column 0 identical. | ||
| 18 | + | ||
| 19 | +`decode.rs:7683` asked for the chroma edge-filter type at the **strip's own mi** | ||
| 20 | +(`lmi = (179,176)`). libaom builds `chroma_above_mbmi`/`chroma_left_mbmi` from | ||
| 21 | +`mi[-((mi_row & ss_y) * mi_stride + (mi_col & ss_x))]` (`set_mi_offsets`, | ||
| 22 | +`av1/common/blockd.h`), i.e. from the **pair's base mi** `(178,176)`, and | ||
| 23 | +`get_intra_edge_filter_type` (`av1/common/reconintra.c:974`) reads that block's | ||
| 24 | +`uv_mode`. The mi directly above the strip, `(178,176)`, is a non-chroma-reference | ||
| 25 | +4-row block whose `uv_mode` is `UV_DC_PRED`; the mi above the PAIR, `(177,176)`, | ||
| 26 | +coded `uv_mode = SMOOTH` (aomdec `EC_IMODE_VAL mi_row=177 mi_col=176 uv_mode=9`). | ||
| 27 | + | ||
| 28 | +So we computed `filt_type = 0` where libaom has `1` (aomdec `EC_PRED ... ft=1`). | ||
| 29 | +With `filt_type = 0`, `av1_use_intra_edge_upsample(4, 8, -6, 0)` is TRUE | ||
| 30 | +(`blk_wh = 12 <= 16`) instead of false — the left edge was upsampled before the | ||
| 31 | +z2 walk, moving 4 samples by 1. The strength/upsample/z2 code itself is correct: | ||
| 32 | +recomputing z2 by hand from the (identical) neighbour pixels reproduces aomdec's | ||
| 33 | +row exactly (`scratchpad/kf1200`, brute force over dy/offsets). | ||
| 34 | + | ||
| 35 | +## Change | ||
| 36 | + | ||
| 37 | +- `crates/ec-av1/src/decode.rs:7683` — `smooth_uv_neighbour(pair_mi.0, pair_mi.1, ...)` | ||
| 38 | + instead of `(lmi.0, lmi.1, ...)`, with the libaom citation. | ||
| 39 | +- `crates/ec-av1/src/decode.rs:2196` — new `RECT4_16_UV_PAIR_FILT_HITS` counter + | ||
| 40 | + `rect4_16_uv_pair_filt_hits()`: pairs where the pair-base answer DIFFERS from the | ||
| 41 | + strip-mi answer, i.e. the blocks the fix changes. | ||
| 42 | +- `crates/ec-av1/src/stream.rs` gate | ||
| 43 | + `a_real_aomenc_stream_with_a_16_level_1to4_partition_decodes_pixel_exact` — the odd | ||
| 44 | + attempts now use a **chroma-carrying** source (smooth `cb`/`cr` gradients); the gray | ||
| 45 | + source left both chroma planes constant, so every `uv_mode` was DC and the shape was | ||
| 46 | + unreachable. New hard assert: `pair_filt_proved > 0` per bit-depth arm. | ||
| 47 | + | ||
| 48 | +No refusal lifted, so `refusal_inventory.rs`/`gate_coverage.rs` are unchanged. | ||
| 49 | + | ||
| 50 | +## EVIDENCE | ||
| 51 | + | ||
| 52 | +EVIDENCE: /tmp/.../scratchpad/kf1200/{ours16,ref.yuv} | ffmpeg -ss 1200 -t 0.4 -c:v copy -f obu, trunc.py to 1 frame (sha256 b4b92873d0329964 twice), decode_probe EC_PROBE_OUT16 vs ffmpeg yuv420p10le | U samples differing 12 -> 0, Y/V 0 (Y 0, U 0, V 0 after fix) | ||
| 53 | +EVIDENCE: /tmp/.../scratchpad/kf1200/{pre.f0,apre.f0} | EC_AV1_PREFILT_DUMP16 ours vs aomdec on the same 1-frame stream | 13 U samples differ pre-loop-filter => reconstruction, not filters/grain | ||
| 54 | +EVIDENCE: /tmp/.../scratchpad/kf1200/{opred.txt,apred.txt} | EC_PRED=1 on both decoders | block (352,356) 8x4 mode=2 ad=-2: ours sum=16208 vs EC_PREDOUT sum=16212, oracle EC_PRED ft=1 | ||
| 55 | +EVIDENCE: gate run `cargo test -p ec-av1 --lib a_real_aomenc_stream_with_a_16_level_1to4_partition_decodes_pixel_exact -- --nocapture` | real aomenc, 8-bit and 10-bit arms | 8-bit: 16 compared attempts, 232 16x4 / 244 4x16, 238 chroma pairs, 13 pair-base filt-type flips, PASS; 10-bit: 15 attempts, 198 pairs, 8 flips, PASS | ||
| 56 | +EVIDENCE: same gate with the fix reverted (pair_mi -> lmi) | one-line revert, rebuild, rerun | FAILED "frame 0 U vs ffmpeg (8-bit, seed 43)" -- the gate is decisive, not vacuous | ||
| 57 | +EVIDENCE: $HOME/.cache/kf1200-census.log | 24 HG key frames, 1-frame truncation, EC_PROBE_OUT16 vs ffmpeg, each stream sha256'd twice (identical) | see table | ||
| 58 | + | ||
| 59 | +## 24 key-frame census (bytes differing, 1 frame each) | ||
| 60 | + | ||
| 61 | +| -ss | before (census4) | after | | ||
| 62 | +|----:|-----------------:|------:| | ||
| 63 | +| 0 | 0 | 0 | | ||
| 64 | +| 300 | 463 | 463 | | ||
| 65 | +| 600 | 48771 | 48771 | | ||
| 66 | +| 900 | 14057195 | 14057191 | | ||
| 67 | +| **1200** | **14** | **0** | | ||
| 68 | +| 1500 | 16649701 | 16649650 | | ||
| 69 | +| **1800** | **248** | **0** | | ||
| 70 | +| 2100 | 15147518 | 15147782 | | ||
| 71 | +| 2400 | 42343 | 42343 | | ||
| 72 | +| 2700 | 7726287 | 7726287 | | ||
| 73 | +| 3000 | 0 | 0 | | ||
| 74 | +| 3300 | 44500 | **39971** | | ||
| 75 | +| **3600** | **1** | **0** | | ||
| 76 | +| 3900 | 7554020 | 7554023 | | ||
| 77 | +| 4200 | 0 | 0 | | ||
| 78 | +| 4500 | 0 | 0 | | ||
| 79 | +| 4800 | 2348 | 2348 | | ||
| 80 | +| 5100 | 0 | 0 | | ||
| 81 | +| 5400 | 0 | 0 | | ||
| 82 | +| 5700 | 16375 | 16375 | | ||
| 83 | +| 6000 | 15450360 | 15449720 | | ||
| 84 | +| 6300 | 15410936 | 15410864 | | ||
| 85 | +| 6600 | 15181681 | 15181688 | | ||
| 86 | +| 6900 | 0 | 0 | | ||
| 87 | + | ||
| 88 | +(The census4 numbers were taken with the same recipe; note census4 measured frame 0 of a | ||
| 89 | +segment that then refused later frames, and this run truncates to 1 frame identically. | ||
| 90 | +The multi-million counts are lane-kf900's entropy-desync territory, unchanged here.) | ||
| 91 | + | ||
| 92 | +## Residue | ||
| 93 | + | ||
| 94 | +- deferred: `-ss 300` (463 bytes) — a DIFFERENT shape, also chroma-only and also | ||
| 95 | + pre-loop-filter, but block-constant offsets of +1/+2 over a ~16x16 chroma region at | ||
| 96 | + chroma (412,384) (`EC_AV1_PREFILT_DUMP16` diff, this branch) — reads like CfL alpha or | ||
| 97 | + a chroma DC/dequant defect, not an edge-filter type. Unblocked by: localising that | ||
| 98 | + block's `uv_mode`/CfL alpha the same way (EC_IMODE_VAL + EC_PRED at mi (206,192)). | ||
| 99 | +- deferred: `-ss 600 / 2400 / 4800 / 5700 / 3300` (48771 / 42343 / 2348 / 16375 / 39971) — | ||
| 100 | + larger residuals, not triaged in this round. | ||
| 101 | +- accepted: the multi-million-byte segments are entropy desyncs owned by lane-kf900. | ||
| 102 | + | ||
| 103 | +## Suite | ||
| 104 | + | ||
| 105 | +`cargo test -p ec-av1 --lib` (systemd unit, `EC_AV1_REQUIRE_AOMENC=1`, log `$HOME/.cache/kf1200-suite-r1.log`): | ||
| 106 | +**370 passed / 0 failed / 32 ignored**, 1546 s. | ||
lanes/kf1200-r2.handoff.mdadded+72 -0
| @@ -0,0 +1,72 @@ | |||
| 1 | +# lane-kf1200 r2 HANDOFF | ||
| 2 | + | ||
| 3 | +## Merge state | ||
| 4 | +Branch `lane-kf1200`, tip `385b745`. `git merge main` (85887c7 = lane-mvtwin + | ||
| 5 | +lane-sb128b) landed clean at `d85d7d2`; cdf.rs byte-identical to main's; r1's | ||
| 6 | +pair-mi chroma edge-filter fix survives at decode.rs:7747. main contains | ||
| 7 | +NEITHER lane-reelckf NOR lane-kf900 (`git log --oneline main | grep` empty for | ||
| 8 | +both), so no duplicate-implementation resolution was needed and the | ||
| 9 | +multi-million-byte census rows are still kf900's. | ||
| 10 | +Do NOT commit `lanes/COMMON-20260901.md` — another agent edits it in this | ||
| 11 | +worktree; it is intentionally left unstaged. (It is currently modified.) | ||
| 12 | + | ||
| 13 | +## Per-segment findings (ReelB, 1-frame truncation, EC_PROBE_OUT16 vs ffmpeg 10-bit) | ||
| 14 | +- **-ss 300 — FIXED (463 -> 0 bytes).** Plane: U+V only, Y exact. First bad | ||
| 15 | + sample chroma (412,384). Stage: PRE-loop-filter (EC_AV1_PREFILT_DUMP16), | ||
| 16 | + 16x16 chroma region at (384,412). Block: the 4x4 chroma block of the | ||
| 17 | + BLOCK_4X4 2x2 group at luma mi (206,192); chroma-ref mi (207,193), | ||
| 18 | + `uv_mode=13` (UV_CFL_PRED), `skip=1`. Root cause: both sub-8x8 leaf decoders | ||
| 19 | + passed literal `None` for the CfL argument in their `skip_txfm` arm | ||
| 20 | + (decode.rs:10554/10555 4-leaf, :10916/10917 2-leaf), so the block | ||
| 21 | + reconstructed as flat DC. libaom `av1_predict_intra_block_facade` | ||
| 22 | + (av1/common/reconintra.c:1719) calls `cfl_predict_block` whenever | ||
| 23 | + `mbmi->uv_mode == UV_CFL_PRED`; `skip_txfm` drops only the residual. | ||
| 24 | + Fix: compute `cfl_ac_q3(y, gpx, gpy, 8)` and pass `alpha.zip(ac)` in both | ||
| 25 | + arms + `SKIP_CFL_HITS` counter (decode.rs:2207, `skip_cfl_hits()`). | ||
| 26 | + Effect: -ss 300 pixel-exact; -ss 4800 2348 -> 34 bytes as a side effect. | ||
| 27 | +- **-ss 600 / 2400 / 3300 / 5700 — ONE class, open.** 48771 / 42343 / 39971 / | ||
| 28 | + 16375 bytes. All planes. Final-picture damage rows Y 1595..1607, chroma | ||
| 29 | + 796..803. Stage: PRE-loop-filter damage is EXACTLY luma rows 1600..1607, | ||
| 30 | + cols 192..3839 (rows 1595..1599 are deblock spill across the y=1600 edge). | ||
| 31 | + Frame is 1608 rows = 25 full 64-px SB rows + an 8-row remainder, so this is | ||
| 32 | + the bottom PARTIAL superblock row; its first three superblocks (cols 0..191) | ||
| 33 | + are pixel-exact. Block: our prediction trace matches aomdec block-for-block | ||
| 34 | + through mi (400,47) (mi 44 four TX_4X4 in an 8x8, mi 46 an 8x8). First | ||
| 35 | + divergence is the FIRST block of superblock #3: | ||
| 36 | + aomdec `EC_PRED mi_row=400 mi_col=48 txw=16 txh=8 mode=2 p_angle=180 bsize=5 part=1 ft=1` | ||
| 37 | + ours `OUR_PRED x=192 y=1600 bw=32 bh=16 mode=0 ad=0` (decode.rs:6511) | ||
| 38 | + i.e. a PARTITION-SYMBOL divergence at the root of a partial-height | ||
| 39 | + superblock (`has_rows == false`, 2 of 16 mi rows present). Not prediction, | ||
| 40 | + not caused by the preceding block. Root cause NOT yet identified. | ||
| 41 | +- **-ss 4800 — open, small.** 34 bytes (was 2348). Chroma only, luma exact, | ||
| 42 | + PRE-loop-filter: U 25 + V 3 samples in an 8x4 chroma patch rows 540..543 | ||
| 43 | + cols 1200..1207, |d| <= 6. Luma mi ~ (270,600). Same geometry as r1's | ||
| 44 | + 16x8 PARTITION_HORZ_4 pair defect -> likely a sibling of the pair-mi bug. | ||
| 45 | +- Accepted (kf900's): 900, 1500, 2100, 2700, 3900, 6000, 6300, 6600. | ||
| 46 | + | ||
| 47 | +## Gate state | ||
| 48 | +- New: `the_reelb_ss300_key_frame_skipped_cfl_decodes_pixel_exact` | ||
| 49 | + (crates/ec-av1/src/stream.rs), pins | ||
| 50 | + `crates/ec-av1/fixtures/reelb_ss300_key_frame.obu` (139201 B, sha256 | ||
| 51 | + 7e3ddf0d602f9496b2f7eb11f051fd4a045020e094d5bc02f83825e2c494ef12, one | ||
| 52 | + 3840x1608 yuv420p10le key frame, `git add -f`, confirmed in `git ls-files`). | ||
| 53 | + HARD-asserts `skip_cfl_hits > 0` (it fires exactly ONCE in the whole frame) | ||
| 54 | + then Y/U/V vs ffmpeg. Fixture used because lane-reelckf r1's ledger dead-end | ||
| 55 | + records 20 aomenc recipes that never produced a skipped sub-8x8 CfL block. | ||
| 56 | +- r1's `a_real_aomenc_stream_with_a_16_level_1to4_partition_decodes_pixel_exact` | ||
| 57 | + (chroma-carrying source + `pair_filt_proved > 0`) unchanged and green. | ||
| 58 | +- No refusal lifted; refusal_inventory.rs / gate_coverage.rs untouched. | ||
| 59 | +- Suite: 378 passed / 0 failed / 33 ignored (794.95 s), | ||
| 60 | + `$HOME/.cache/kf1200-suite-r2.log`. | ||
| 61 | + | ||
| 62 | +## Exact next step | ||
| 63 | +Range-ladder the partition symbols of superblock (mi_row=400, mi_col=48) on | ||
| 64 | +`scratchpad/kf1200/s600_f1.obu` (1 frame, sha256 36de46676ed7de70… stable | ||
| 65 | +twice): both decoders are still in sync at mi (400,47), so start the ladder | ||
| 66 | +there and compare aomdec's `r->ec.rng` at each `EC_IMODE`/partition read | ||
| 67 | +against ours element by element (compare RANGE, never tell()). The suspect is | ||
| 68 | +the `has_rows == false` forced-partition path at a 64x64 root with only 2 mi | ||
| 69 | +rows left — we take a 32x16 where libaom takes 16x8. Artifacts already on disk | ||
| 70 | +in scratchpad/kf1200: s600_f1.obu, a600p.trace (aomdec EC_PRED), o600.trace | ||
| 71 | +(our OUR_PRED), pre600.f0 / apre600.f0 (prefilter dumps), d1.py (plane differ), | ||
| 72 | +census.sh (24-frame census, debug probe path). | ||
lanes/kf1200-r2.report.mdadded+183 -0
| @@ -0,0 +1,183 @@ | |||
| 1 | +# lane-kf1200 r2 — a skipped sub-8x8 chroma block dropped its CfL alpha | ||
| 2 | + | ||
| 3 | +## 1. Merge | ||
| 4 | + | ||
| 5 | +`git merge --no-commit main` (main `85887c7`, lane-mvtwin + lane-sb128b) — clean | ||
| 6 | +auto-merge, no conflicts. `crates/ec-av1/src/cdf.rs` byte-identical to main's | ||
| 7 | +(`cmp <(git show main:.../cdf.rs) .../cdf.rs` → identical). r1's pair-mi chroma | ||
| 8 | +edge-filter fix and its counter survive at `decode.rs:7747`. Commit `d85d7d2`. | ||
| 9 | +main contains neither lane-reelckf nor lane-kf900 (`git log --oneline main | grep` | ||
| 10 | +→ empty for both), so no duplicate-implementation resolution was needed and the | ||
| 11 | +multi-million-byte census rows are still lane-kf900's territory. | ||
| 12 | + | ||
| 13 | +## 2. Defect found and fixed: `-ss 300`, 463 bytes → 0 | ||
| 14 | + | ||
| 15 | +Re-measured premise on this branch (1-frame truncation, hash stable twice): | ||
| 16 | +U 219 / V 220 samples wrong, Y exact. `EC_AV1_PREFILT_DUMP16` ours vs aomdec's: | ||
| 17 | +227 U + 227 V wrong **before the loop filter**, in a 16x16 chroma region at | ||
| 18 | +chroma `(384,412)` — reconstruction, not filters. | ||
| 19 | + | ||
| 20 | +First bad sample chroma `(412,384)` = the 4x4 chroma block of the `BLOCK_4X4` | ||
| 21 | +2x2 group at luma mi `(206,192)`. aomdec `EC_TRACE_MODE`: | ||
| 22 | +`EC_IMODE_VAL mi_row=207 mi_col=193 mode=4 uv_mode=13 skip=1` — `uv_mode = 13` | ||
| 23 | +is `UV_CFL_PRED`, `skip_txfm = 1`. Our `OUR_PRED x=384 y=412 side=4 mode=0 | ||
| 24 | +sum=8240 row0=[515,515,515,515]` is flat: DC with **no CfL term at all** | ||
| 25 | +(aomdec's own prediction sums to 8241 with a bottom-left ramp). | ||
| 26 | + | ||
| 27 | +Root cause: both sub-8x8 leaf decoders passed a literal `None` for the CfL | ||
| 28 | +argument in their `skip_txfm` arm — | ||
| 29 | + | ||
| 30 | +- `crates/ec-av1/src/decode.rs:10554/10555` (the 4-leaf `BLOCK_4X4` group) | ||
| 31 | +- `crates/ec-av1/src/decode.rs:10916/10917` (the 2-leaf group) | ||
| 32 | + | ||
| 33 | +libaom's `av1_predict_intra_block_facade` (`av1/common/reconintra.c:1719`) calls | ||
| 34 | +`cfl_predict_block` whenever `mbmi->uv_mode == UV_CFL_PRED`; `skip_txfm` only | ||
| 35 | +suppresses the residual, never the alpha. Both arms now compute | ||
| 36 | +`cfl_ac_q3(y, gpx, gpy, 8)` and pass `alpha.zip(ac)`, exactly like the | ||
| 37 | +non-skip arm two lines below and like the rect skip arms already did. | ||
| 38 | + | ||
| 39 | +### Class sweep | ||
| 40 | + | ||
| 41 | +Every chroma `reconstruct` / `reconstruct_rect` call site in `decode.rs` was | ||
| 42 | +parsed and its cfl argument printed (script in the r2 scratchpad). The rect | ||
| 43 | +skip arms (`6015`, `6519`, `8078`) already pass `alpha.zip(ac)`; the only other | ||
| 44 | +literal `None` is `20284/20296`, which sits directly behind the refusal | ||
| 45 | +"a non-DC chroma mode on an 8x8 inter-frame leaf" (`decode.rs:20212`), so | ||
| 46 | +`uv_mode == DC_PRED` is guaranteed there. No other instance of the class. | ||
| 47 | + | ||
| 48 | +### Counter + gate | ||
| 49 | + | ||
| 50 | +- `decode.rs:2207` `SKIP_CFL_HITS` / `pub fn skip_cfl_hits()` — skipped sub-8x8 | ||
| 51 | + chroma blocks that carried a CfL alpha. | ||
| 52 | +- `crates/ec-av1/src/stream.rs` | ||
| 53 | + `the_reelb_ss300_key_frame_skipped_cfl_decodes_pixel_exact` — pins | ||
| 54 | + `crates/ec-av1/fixtures/reelb_ss300_key_frame.obu` (139 201 B, sha256 | ||
| 55 | + `7e3ddf0d602f9496b2f7eb11f051fd4a045020e094d5bc02f83825e2c494ef12`, one | ||
| 56 | + 3840x1608 yuv420p10le key frame), decodes it, HARD-asserts | ||
| 57 | + `skip_cfl_hits > 0`, then compares Y/U/V against ffmpeg's own 10-bit decode. | ||
| 58 | + `git add -f` was used (bare `fixtures` in .gitignore); `git ls-files` confirms | ||
| 59 | + it is tracked. | ||
| 60 | + | ||
| 61 | +Why a fixture and not an aomenc recipe: lane-reelckf r1's ledger dead-end — | ||
| 62 | +20 recipes (cq 40..63 × nine lavfi sources, min/max-partition sweeps, sb-size | ||
| 63 | +64 and 128) never produced a **skipped** sub-8x8 CfL block (`skip_cfl` counter | ||
| 64 | +0 in all). The shape fires exactly **once** in a whole 4K key frame, which is | ||
| 65 | +why no synthetic source reaches it. | ||
| 66 | + | ||
| 67 | +No refusal lifted → `refusal_inventory.rs` / `gate_coverage.rs` unchanged. | ||
| 68 | + | ||
| 69 | +## 3. Remaining residuals — triaged, one class | ||
| 70 | + | ||
| 71 | +`-ss 600 / 2400 / 3300 / 5700` (48771 / 42343 / 39971 / 16375 bytes) are ONE | ||
| 72 | +defect class, not four: in every one of them the damage is confined to the | ||
| 73 | +**last 8 luma rows** of the frame. | ||
| 74 | + | ||
| 75 | +| -ss | Y rows wrong | U/V rows | first bad Y sample | | ||
| 76 | +|----:|---|---|---| | ||
| 77 | +| 600 | 1595..1607 | 796..803 | (1595, 2916) | | ||
| 78 | +| 2400 | 1595..1607 | 796..803 | (1595, 2445) | | ||
| 79 | +| 3300 | 1595..1607 | 796..803 | (1595, 1235) | | ||
| 80 | +| 5700 | 1596..1607 | 796..803 | (1596, 3039) | | ||
| 81 | + | ||
| 82 | +`EC_AV1_PREFILT_DUMP16` on `-ss 600` narrows it further: pre-loop-filter the | ||
| 83 | +damage is exactly rows **1600..1607**, columns **192..3839** (rows 1595..1599 | ||
| 84 | +in the final picture are deblock spill across the y=1600 edge). The frame is | ||
| 85 | +1608 rows = 25 full 64-px superblock rows + one 8-row remainder, so this is the | ||
| 86 | +bottom **partial** superblock row, and the first three superblocks of it | ||
| 87 | +(columns 0..191) are pixel-exact. | ||
| 88 | + | ||
| 89 | +Divergence localised to a single block. Through luma mi `(400,47)` our | ||
| 90 | +prediction trace matches aomdec's block for block (mi 44: four TX_4X4 in an | ||
| 91 | +8x8; mi 46: 8x8 — `EC_PRED mi_row=400 mi_col=46 txw=8 txh=8`). At the very | ||
| 92 | +first block of superblock #3: | ||
| 93 | + | ||
| 94 | +- aomdec: `EC_PRED mi_row=400 mi_col=48 txw=16 txh=8 mode=2 p_angle=180 bsize=5 part=1 ft=1` | ||
| 95 | +- ours: `OUR_PRED x=192 y=1600 bw=32 bh=16 mode=0 ad=0` (decode.rs:6511) | ||
| 96 | + | ||
| 97 | +i.e. we read a 32x16 `PARTITION_HORZ` where libaom reads a 16x8, and the mode | ||
| 98 | +differs too — a **partition-symbol divergence at the root of a partial-height | ||
| 99 | +superblock** (`has_rows == false`, only 2 of 16 mi rows present), not a | ||
| 100 | +prediction bug and not caused by the preceding block. Everything after it in | ||
| 101 | +that row is garbage because the row never re-syncs (it is the last row, so | ||
| 102 | +nothing propagates downward). | ||
| 103 | + | ||
| 104 | +`-ss 4800` (2348 bytes in r1, **34 bytes** after this round's CfL fix) is a | ||
| 105 | +different, much smaller shape: chroma only, | ||
| 106 | +U 29 + V 5 samples in the final picture. `EC_AV1_PREFILT_DUMP16` puts it | ||
| 107 | +**pre-loop-filter** too — U 25 + V 3 samples in an **8x4 chroma patch** at | ||
| 108 | +rows 540..543, cols 1200..1207 (`|d| <= 6`), luma exact. That is the same | ||
| 109 | +geometry as r1's defect (an 8x4 chroma block = the chroma half of a 16x8 | ||
| 110 | +`PARTITION_HORZ_4` pair) at luma mi ~`(270,600)`, so it is a strong candidate | ||
| 111 | +for a sibling of the pair-mi bug rather than a new class. | ||
| 112 | + | ||
| 113 | +## 4. Disposition | ||
| 114 | + | ||
| 115 | +- fix-now (done): `-ss 300` skipped-CfL, fixed + gated + swept. | ||
| 116 | +- deferred: the bottom partial-superblock partition divergence (`-ss 600`, | ||
| 117 | + 2400, 3300, 5700). Unblocked by: a range ladder over the partition symbols | ||
| 118 | + of superblock `(mi_row=400, mi_col=48)` in `s600_f1.obu` comparing aomdec's | ||
| 119 | + `r->ec.rng` at `EC_IMODE` against ours — the first three superblocks of the | ||
| 120 | + same row are exact, so the ladder starts already in sync at mi 400/47. | ||
| 121 | +- deferred: `-ss 4800` (34 B, down from 2348) — stage-attributed (pre-loop-filter, chroma-only, | ||
| 122 | + 8x4 patch at chroma (540,1200), luma mi ~(270,600)); the per-block | ||
| 123 | + `EC_IMODE_VAL`/`EC_PRED` comparison at that mi is the next step. | ||
| 124 | +- accepted: `-ss 900 / 1500 / 2100 / 2700 / 3900 / 6000 / 6300 / 6600` | ||
| 125 | + (multi-million bytes) are lane-kf900's entropy desyncs, not merged into main. | ||
| 126 | + | ||
| 127 | +## 5. 24 key-frame census (bytes differing vs ffmpeg, 1 truncated frame each) | ||
| 128 | + | ||
| 129 | +Recipe: `$HOME/.cache/kf1200-census-r2.log` (script `census.sh` in the r2 | ||
| 130 | +scratchpad) — `ffmpeg -ss S -t 0.4 -c:v copy -f obu`, `trunc.py … 1`, each | ||
| 131 | +stream sha256'd twice (identical in all 24 rows), `EC_PROBE_OUT16` vs | ||
| 132 | +`ffmpeg -pix_fmt yuv420p10le`. | ||
| 133 | + | ||
| 134 | +| -ss | r1 (after pair-mi fix) | r2 (after skipped-CfL fix) | | ||
| 135 | +|----:|-----------------------:|---------------------------:| | ||
| 136 | +| 0 | 0 | 0 | | ||
| 137 | +| **300** | **463** | **0** | | ||
| 138 | +| 600 | 48771 | 48771 | | ||
| 139 | +| 900 | 14057191 | 14057191 | | ||
| 140 | +| 1200 | 0 | 0 | | ||
| 141 | +| 1500 | 16649650 | 16649650 | | ||
| 142 | +| 1800 | 0 | 0 | | ||
| 143 | +| 2100 | 15147782 | 15148697 | | ||
| 144 | +| 2400 | 42343 | 42343 | | ||
| 145 | +| 2700 | 7726287 | 7726168 | | ||
| 146 | +| 3000 | 0 | 0 | | ||
| 147 | +| 3300 | 39971 | 39971 | | ||
| 148 | +| 3600 | 0 | 0 | | ||
| 149 | +| 3900 | 7554023 | 7554023 | | ||
| 150 | +| 4200 | 0 | 0 | | ||
| 151 | +| 4500 | 0 | 0 | | ||
| 152 | +| **4800** | **2348** | **34** | | ||
| 153 | +| 5100 | 0 | 0 | | ||
| 154 | +| 5400 | 0 | 0 | | ||
| 155 | +| 5700 | 16375 | 16375 | | ||
| 156 | +| 6000 | 15449720 | 15449720 | | ||
| 157 | +| 6300 | 15410864 | 15410664 | | ||
| 158 | +| 6600 | 15181688 | 15180826 | | ||
| 159 | +| 6900 | 0 | 0 | | ||
| 160 | + | ||
| 161 | +**11 of 24 key frames now decode pixel-exact** (was 10). `-ss 300` is exact; | ||
| 162 | +`-ss 4800` fell 2348 → 34 bytes (its remaining 8x4 chroma patch is the residue | ||
| 163 | +described in §3). Rows differing by a few hundred bytes inside the | ||
| 164 | +multi-million-byte segments are the usual desync churn of lane-kf900's | ||
| 165 | +territory, not a regression: none of them changed sign or magnitude class. | ||
| 166 | + | ||
| 167 | +## 6. Suite | ||
| 168 | + | ||
| 169 | +`cargo test -p ec-av1 --lib` under `systemd-run --user --unit=kf1200-suite-r2b | ||
| 170 | +-p MemoryMax=10G`, `EC_AV1_REQUIRE_AOMENC=1 EC_NOMEMGUARD=1 -j3`, log | ||
| 171 | +`$HOME/.cache/kf1200-suite-r2.log`: | ||
| 172 | +**378 passed / 0 failed / 33 ignored**, 794.95 s. | ||
| 173 | + | ||
| 174 | +## EVIDENCE | ||
| 175 | + | ||
| 176 | +EVIDENCE: $HOME/.cache/kf1200-suite-r2.log | systemd unit kf1200-suite-r2b, EC_AV1_REQUIRE_AOMENC=1, cargo test -p ec-av1 --lib -j3 | test result: ok. 378 passed; 0 failed; 33 ignored; 794.95s | ||
| 177 | +EVIDENCE: scratchpad/kf1200/{o300,r300} | 1-frame -ss 300 truncation (sha256 7e3ddf0d602f9496 twice), EC_PROBE_OUT16 vs ffmpeg -pix_fmt yuv420p10le | before fix Y 0 / U 219 / V 220 samples differ; after fix Y 0 / U 0 / V 0 | ||
| 178 | +EVIDENCE: scratchpad/kf1200/{pre300.f0,apre300.f0} | EC_AV1_PREFILT_DUMP16 ours vs aomdec, same stream | 227 U + 227 V wrong PRE-loop-filter in a 16x16 chroma region at (384,412) => reconstruction | ||
| 179 | +EVIDENCE: scratchpad/kf1200/{o300.trace,a300.trace} | EC_PRED=1 ours, EC_TRACE_MODE=1 EC_PRED=1 aomdec | aomdec EC_IMODE_VAL mi_row=207 mi_col=193 uv_mode=13 (UV_CFL_PRED) skip=1; ours OUR_PRED x=384 y=412 side=4 mode=0 sum=8240 flat (no CfL term) | ||
| 180 | +EVIDENCE: gate run `cargo test -p ec-av1 --lib the_reelb_ss300 -- --nocapture` | pinned 1-frame fixture + ffmpeg 10-bit reference | "1 skipped sub-8x8 CfL chroma blocks, frame pixel-exact", 1 passed / 0 failed | ||
| 181 | +EVIDENCE: scratchpad/kf1200/{pre600.f0,apre600.f0} | EC_AV1_PREFILT_DUMP16 ours vs aomdec on the -ss 600 1-frame stream | damage exactly luma rows 1600..1607, cols 192..3839 = the bottom partial (8-row) superblock row from superblock #3 on | ||
| 182 | +EVIDENCE: scratchpad/kf1200/{o600.trace,a600p.trace} | EC_PRED both decoders | mi (400,44) and (400,46) match block for block; at mi (400,48) aomdec txw=16 txh=8 mode=2 bsize=5 vs ours bw=32 bh=16 mode=0 => partition divergence at the partial-SB root | ||
| 183 | +EVIDENCE: $HOME/.cache/kf1200-census-r2.log | census.sh, 24 key frames, each stream hashed twice | 11/24 pixel-exact (was 10); -ss 300 463->0, -ss 4800 2348->34 | ||