Merge branch 'lane-t900' (d650227f): six inter-frame fixes for the 10-bit 1920x792 128-SB stream (intra-in-inter tx ctx + txfm bands, non-chroma-ref contexts, rect interintra, mi-exact edge filter, per-plane warp bail-out, cdef_transmitted per 64x64 unit), pinned 14-frame witness, intra 16x4-in-inter lifted
Browse files at this commit13 changed files +1606 -63
- crates/ec-av1/examples/decode_probe.rs +5 -0
- crates/ec-av1/fixtures/reelc_sb128_inter_witness.obu +0 -0
- crates/ec-av1/src/decode.rs +451 -53
- crates/ec-av1/src/refusal_inventory.rs +10 -5
- crates/ec-av1/src/stream.rs +142 -5
- lanes/inter128intra-r1.report.md +149 -0
- lanes/t900-r1.handoff.md +100 -0
- lanes/t900-r2.handoff.md +136 -0
- lanes/t900-r3.handoff.md +127 -0
- lanes/t900-r4.handoff.md +117 -0
- lanes/t900-r5.handoff.md +144 -0
- lanes/t900-r6.handoff.md +87 -0
- lanes/t900-r6.report.md +138 -0
crates/ec-av1/examples/decode_probe.rsmodified+5 -0
| @@ -43,6 +43,7 @@ fn main() { | ||
| 43 | 43 | let (rtu, rsplit, robmc) = ec_av1::stream::rect_inter_tu_counters(); |
| 44 | 44 | println!("rect_inter: tu={rtu} txsplit={rsplit} obmc_leaf={robmc}"); |
| 45 | 45 | println!("sub8_inter_split: groups={}", ec_av1::decode::sub8_inter_split_hits()); |
| 46 | + println!("interintra_rect: {}", ec_av1::decode::interintra_rect_hits()); | |
| 46 | 47 | let (h84, h48) = ec_av1::decode::sub8_inter_rect_hits(); |
| 47 | 48 | println!("sub8_inter_rect: horz8x4={h84} vert4x8={h48}"); |
| 48 | 49 | let si = ec_av1::stream::sub8_intra_rect_hits(); |
| @@ -78,6 +79,10 @@ fn main() { | ||
| 78 | 79 | println!( |
| 79 | 80 | "rect_wedge(8x16,16x8,16x32,32x16,8x32,32x8): compound={rw:?} interintra={rwi:?}" |
| 80 | 81 | ); |
| 82 | + // lane-inter128intra r1: the 128 root's HORZ/VERT half coded INTRA in | |
| 83 | + // an INTER frame -- the arm this round implemented. | |
| 84 | + let i128 = ec_av1::stream::intra128_in_inter_counters(); | |
| 85 | + println!("intra128_in_inter: 128x64={} 64x128={}", i128[0], i128[1]); | |
| 81 | 86 | let sb = ec_av1::stream::sb128_rect_counters(); |
| 82 | 87 | println!( |
| 83 | 88 | "sb128_rect: edge_horz={} edge_vert={} inter_128x64={} inter_64x128={}", |
crates/ec-av1/fixtures/reelc_sb128_inter_witness.obuadded+0 -0
Binary file changed
crates/ec-av1/src/decode.rsmodified+451 -53
| @@ -262,11 +262,64 @@ thread_local! { | ||
| 262 | 262 | static CDEF_IDX_HITS: std::cell::Cell<usize> = const { std::cell::Cell::new(0) }; |
| 263 | 263 | } |
| 264 | 264 | |
| 265 | +// How many times a warp was suppressed for one PLANE because that plane's own | |
| 266 | +// block is narrower or shorter than 8 (`av1_init_warp_params`'s own bail-out, | |
| 267 | +// reconinter.c) -- the gate's proof that a stream really carries the shape, | |
| 268 | +// since the square `side`/`chroma_side` can be 8 or more while the plane's | |
| 269 | +// true block is 4 wide (an 8x16 luma block's 4x8 chroma). | |
| 270 | +thread_local! { | |
| 271 | + static WARP_PLANE_SUPPRESS_HITS: std::cell::Cell<usize> = const { std::cell::Cell::new(0) }; | |
| 272 | +} | |
| 273 | + | |
| 274 | +/// Current value of [`WARP_PLANE_SUPPRESS_HITS`]. | |
| 275 | +pub(crate) fn warp_plane_suppress_hits() -> usize { | |
| 276 | + WARP_PLANE_SUPPRESS_HITS.with(|c| c.get()) | |
| 277 | +} | |
| 278 | + | |
| 279 | +/// `av1_init_warp_params` (libaom reconinter.c): warp is decided per PLANE and | |
| 280 | +/// bails out at `block_width < 8 || block_height < 8`, so the plane's OWN | |
| 281 | +/// block dimensions decide it -- never the square `side`/`chroma_side`, which | |
| 282 | +/// for a rectangular luma block (8x16, 16x8) or a PARTITION_HORZ/VERT strip is | |
| 283 | +/// bigger than the real block in one axis. | |
| 284 | +fn warp_plane_allowed(w: usize, h: usize) -> bool { | |
| 285 | + if w >= 8 && h >= 8 { | |
| 286 | + return true; | |
| 287 | + } | |
| 288 | + WARP_PLANE_SUPPRESS_HITS.with(|c| c.set(c.get() + 1)); | |
| 289 | + false | |
| 290 | +} | |
| 291 | + | |
| 265 | 292 | /// Current value of [`CDEF_IDX_HITS`]. |
| 266 | 293 | pub(crate) fn cdef_idx_hits() -> usize { |
| 267 | 294 | CDEF_IDX_HITS.with(|c| c.get()) |
| 268 | 295 | } |
| 269 | 296 | |
| 297 | +// lane-t900 r6: gate proof for the three r2-r4 root causes that shipped with no | |
| 298 | +// counter -- the in-inter tx-depth context (`tx_size_context_txfm_rect`), the | |
| 299 | +// non-chroma-reference block that must LEAVE its neighbours' chroma coefficient | |
| 300 | +// contexts alone, and the intra-edge filter neighbour pair taken mi-exact | |
| 301 | +// instead of from the coarse 16x16 cell. | |
| 302 | +thread_local! { | |
| 303 | + static INTRA_IN_INTER_TXCTX_HITS: std::cell::Cell<usize> = const { std::cell::Cell::new(0) }; | |
| 304 | + static NON_CHROMA_REF_CTX_SKIP_HITS: std::cell::Cell<usize> = const { std::cell::Cell::new(0) }; | |
| 305 | + static EDGE_FILTER_MI_FIX_HITS: std::cell::Cell<usize> = const { std::cell::Cell::new(0) }; | |
| 306 | +} | |
| 307 | + | |
| 308 | +/// Current value of [`INTRA_IN_INTER_TXCTX_HITS`]. | |
| 309 | +pub(crate) fn intra_in_inter_txctx_hits() -> usize { | |
| 310 | + INTRA_IN_INTER_TXCTX_HITS.with(|c| c.get()) | |
| 311 | +} | |
| 312 | + | |
| 313 | +/// Current value of [`NON_CHROMA_REF_CTX_SKIP_HITS`]. | |
| 314 | +pub(crate) fn non_chroma_ref_ctx_skip_hits() -> usize { | |
| 315 | + NON_CHROMA_REF_CTX_SKIP_HITS.with(|c| c.get()) | |
| 316 | +} | |
| 317 | + | |
| 318 | +/// Current value of [`EDGE_FILTER_MI_FIX_HITS`]. | |
| 319 | +pub(crate) fn edge_filter_mi_fix_hits() -> usize { | |
| 320 | + EDGE_FILTER_MI_FIX_HITS.with(|c| c.get()) | |
| 321 | +} | |
| 322 | + | |
| 270 | 323 | // lane-realworld r4: this frame's `delta.q_present` (spec 5.9.17) and its |
| 271 | 324 | // actual step (`1 << delta.q_res`, already the real multiplier, not the raw |
| 272 | 325 | // 2-bit field). `false`/`1` (the defaults) make [`maybe_read_delta_q`] a |
| @@ -2075,6 +2128,20 @@ pub(crate) fn interintra_hits() -> usize { | ||
| 2075 | 2128 | INTERINTRA_HITS.with(|c| c.get()) |
| 2076 | 2129 | } |
| 2077 | 2130 | |
| 2131 | +// lane-midcut r1: of those, how many were RECTANGULAR (`write_w != write_h`) | |
| 2132 | +// -- the shape `interintra_blend` used to build a square `side x side` intra | |
| 2133 | +// predictor for, with `ii_size_scales`/`edges` taken at the square. Every | |
| 2134 | +// pre-existing interintra gate passed with that bug, so the rect arm needs | |
| 2135 | +// its own counter to stop being vacuous. | |
| 2136 | +thread_local! { | |
| 2137 | + static INTERINTRA_RECT_HITS: std::cell::Cell<usize> = const { std::cell::Cell::new(0) }; | |
| 2138 | +} | |
| 2139 | + | |
| 2140 | +/// Current value of [`INTERINTRA_RECT_HITS`]. | |
| 2141 | +pub fn interintra_rect_hits() -> usize { | |
| 2142 | + INTERINTRA_RECT_HITS.with(|c| c.get()) | |
| 2143 | +} | |
| 2144 | + | |
| 2078 | 2145 | // How many blocks decoded `comp_group_idx == 1` (masked COMPOUND_REFERENCE, |
| 2079 | 2146 | // wedge or diffwtd) and had `compound_type`/`wedge_idx`/`wedge_sign`/ |
| 2080 | 2147 | // `mask_type` consumed entropy-exact -- lane-maskcomp r1's proof that a |
| @@ -5401,14 +5468,14 @@ impl Neighbours { | ||
| 5401 | 5468 | left_coded |= left.level != 0; |
| 5402 | 5469 | vote += dc_vote(left.dc); |
| 5403 | 5470 | } |
| 5404 | - if plane == 0 && std::env::var_os("EC_DCDUMP").is_some() { | |
| 5471 | + if std::env::var_os("EC_DCDUMP").is_some() { | |
| 5405 | 5472 | let ab: Vec<String> = (0..w_mi) |
| 5406 | - .map(|k| format!("{:?}/{}", self.above[mi_c + k][0].dc, self.above[mi_c + k][0].level)) | |
| 5473 | + .map(|k| format!("{:?}/{}", self.above[mi_c + k][plane].dc, self.above[mi_c + k][plane].level)) | |
| 5407 | 5474 | .collect(); |
| 5408 | 5475 | let lf: Vec<String> = (0..h_mi) |
| 5409 | - .map(|k| format!("{:?}/{}", self.left[mi_r + k][0].dc, self.left[mi_r + k][0].level)) | |
| 5476 | + .map(|k| format!("{:?}/{}", self.left[mi_r + k][plane].dc, self.left[mi_r + k][plane].level)) | |
| 5410 | 5477 | .collect(); |
| 5411 | - eprintln!("EC_DCDUMP mi=({mi_r},{mi_c}) wh=({w},{h}) vote={vote} above=[{}] left=[{}]", ab.join(","), lf.join(",")); | |
| 5478 | + eprintln!("EC_DCDUMP mi=({mi_r},{mi_c}) plane={plane} wh=({w},{h}) vote={vote} above=[{}] left=[{}]", ab.join(","), lf.join(",")); | |
| 5412 | 5479 | } |
| 5413 | 5480 | (above_coded, left_coded, vote) |
| 5414 | 5481 | }) |
| @@ -7413,6 +7480,56 @@ fn decode_intra_rect_in_inter( | ||
| 7413 | 7480 | }); |
| 7414 | 7481 | return Ok(()); |
| 7415 | 7482 | } |
| 7483 | + // lane-inter128intra r1: the 128 superblock's PARTITION_HORZ/VERT half | |
| 7484 | + // coded INTRA inside an inter frame. `size_group_lookup` (common_data.h:61) | |
| 7485 | + // puts BLOCK_128X64/64X128/128X128 in group 3 and | |
| 7486 | + // `max_txsize_rect_lookup` caps them at TX_64X64, i.e. the same | |
| 7487 | + // `tx_size_cat3` row [`decode_block_128rect`] already reads -- so the whole | |
| 7488 | + // block decodes through the very body the KEY FRAME path proves for this | |
| 7489 | + // shape (square 64x64 luma units, one TX_32X32 chroma unit per 64x64 mu | |
| 7490 | + // chunk on the offset-10 txb_skip rows, per-TU prediction, the mu-chunk | |
| 7491 | + // `Reach` rule and the frame-edge write clip). The only inter-frame | |
| 7492 | + // differences live inside that body: the mode-info read | |
| 7493 | + // ([`INTRA_IN_INTER_MODE`] -> `y_mode[3]` plus the `skip` this caller | |
| 7494 | + // already read), the `tx_depth` context (the real TXFM_CONTEXT bands) and | |
| 7495 | + // the `set_txfm_ctxs` publication. CfL (>32), filter intra (>32) and | |
| 7496 | + // palette (>64) do not exist at this size and are refused by name there. | |
| 7497 | + // lane-inter128intra r1: OPT-IN ONLY (`EC_INTRA128_IN_INTER=1`) until a | |
| 7498 | + // gate exists. The body below is believed right (it is the key frame's own | |
| 7499 | + // proven body plus the three inter-frame differences), but the three 1080p | |
| 7500 | + // cuts that reach this shape reach it AFTER a pre-existing desync (see the | |
| 7501 | + // lane report: their frame 2 diverges from aomdec inside the superblock at | |
| 7502 | + // mi(0,320), long before mi(128,416)), and no aomenc recipe found so far | |
| 7503 | + // emits a 128-root HORZ/VERT half coded intra in an inter frame -- so | |
| 7504 | + // nothing can currently prove this arm. A refusal is lifted only with a | |
| 7505 | + // gate (COMMON), so the default path still refuses by name below. | |
| 7506 | + if bw.max(bh) == 128 && std::env::var_os("EC_INTRA128_IN_INTER").is_some() { | |
| 7507 | + if allow_screen_content_tools { | |
| 7508 | + return Err(unsupported( | |
| 7509 | + "a HORZ/VERT intra strip in a screen-content frame (palette syntax \ | |
| 7510 | + is consumed for square blocks only)", | |
| 7511 | + )); | |
| 7512 | + } | |
| 7513 | + INTRA_IN_INTER_MODE.with(|c| c.set(Some((3, skip)))); | |
| 7514 | + let res = decode_block_128rect( | |
| 7515 | + dec, | |
| 7516 | + cdfs, | |
| 7517 | + neighbours, | |
| 7518 | + (r, c), | |
| 7519 | + bw, | |
| 7520 | + bh, | |
| 7521 | + y, | |
| 7522 | + u, | |
| 7523 | + v, | |
| 7524 | + base_q_idx, | |
| 7525 | + ENABLE_FILTER_INTRA_INTER.with(std::cell::Cell::get), | |
| 7526 | + allow_screen_content_tools, | |
| 7527 | + TX_SELECT_INTER.with(std::cell::Cell::get), | |
| 7528 | + REDUCED_TX_SET_INTER.with(std::cell::Cell::get), | |
| 7529 | + ); | |
| 7530 | + INTRA_IN_INTER_MODE.with(|c| c.set(None)); | |
| 7531 | + return res; | |
| 7532 | + } | |
| 7416 | 7533 | let (size_group, tx_cat) = match (bw.min(bh), bw.max(bh)) { |
| 7417 | 7534 | (8, 16) => (1usize, 1usize), |
| 7418 | 7535 | (16, 32) => (2, 2), |
| @@ -7517,6 +7634,16 @@ fn decode_intra_rect_in_inter( | ||
| 7517 | 7634 | return Ok(()); |
| 7518 | 7635 | } |
| 7519 | 7636 | let mode = dec.symbol(&mut cdfs.y_mode[size_group]); |
| 7637 | + // lane-t900 r1: this arm read six mode symbols with no ladder rung of its | |
| 7638 | + // own, so a cross-decoder bisection could only see the block's first | |
| 7639 | + // coefficient. Same names/format as [`read_tx_size`]'s rung. | |
| 7640 | + let step_trace = std::env::var_os("EC_TRACE_MODE_STEP").is_some(); | |
| 7641 | + if step_trace { | |
| 7642 | + eprintln!( | |
| 7643 | + "EC_ISTEP mi_row={mi_r} mi_col={mi_c} name=y_mode val={mode} grp={size_group} rng={}", | |
| 7644 | + dec.debug_state().0 | |
| 7645 | + ); | |
| 7646 | + } | |
| 7520 | 7647 | if mode >= 13 { |
| 7521 | 7648 | return Err(unsupported( |
| 7522 | 7649 | "an intra mode this decoder does not code (round 2)", |
| @@ -7542,6 +7669,13 @@ fn decode_intra_rect_in_inter( | ||
| 7542 | 7669 | } else { |
| 7543 | 7670 | dec.symbol(&mut cdfs.uv_mode_no_cfl[mode]) |
| 7544 | 7671 | }; |
| 7672 | + if step_trace { | |
| 7673 | + eprintln!( | |
| 7674 | + "EC_ISTEP mi_row={mi_r} mi_col={mi_c} name=uv_mode val={uv_mode} cfl={} rng={}", | |
| 7675 | + u8::from(cfl_allowed), | |
| 7676 | + dec.debug_state().0 | |
| 7677 | + ); | |
| 7678 | + } | |
| 7545 | 7679 | if (9..=12).contains(&uv_mode) { |
| 7546 | 7680 | SMOOTH_UV_HITS.with(|h| h.set(h.get() + 1)); |
| 7547 | 7681 | } |
| @@ -7584,7 +7718,17 @@ fn decode_intra_rect_in_inter( | ||
| 7584 | 7718 | // The intra-edge filter type is the NEIGHBOUR's mode (libaom |
| 7585 | 7719 | // `get_filt_type`), luma's off the luma neighbours and chroma's off the |
| 7586 | 7720 | // chroma ones -- [`decode_block_rect`]'s own pair. |
| 7587 | - let (nb_above_mode, nb_left_mode) = neighbours.modes_above_left(r, c); | |
| 7721 | + // lane-t900 r4: the coarse pair is keyed on the 16x16 cell's OWN top-left | |
| 7722 | + // mi, so both 8x16 halves of a VERT split read the neighbours of the FIRST | |
| 7723 | + // half. libaom's `above_mbmi`/`left_mbmi` are this block's own | |
| 7724 | + // (`mi[-mi_stride]` / `mi[-1]`) -- take the mi-exact pair over the coarse | |
| 7725 | + // one exactly as [`decode_leaf8`] already does (class | |
| 7726 | + // context-read-from-one-cell). | |
| 7727 | + let coarse_pair = neighbours.modes_above_left(r, c); | |
| 7728 | + let (nb_above_mode, nb_left_mode) = neighbours.modes_above_left_mi(mi_r, mi_c, coarse_pair); | |
| 7729 | + if (nb_above_mode, nb_left_mode) != coarse_pair { | |
| 7730 | + EDGE_FILTER_MI_FIX_HITS.with(|c| c.set(c.get() + 1)); | |
| 7731 | + } | |
| 7588 | 7732 | let smooth_neighbor = is_smooth_mode(nb_above_mode) || is_smooth_mode(nb_left_mode); |
| 7589 | 7733 | if smooth_neighbor { |
| 7590 | 7734 | SMOOTH_LUMA_HITS.with(|h| h.set(h.get() + 1)); |
| @@ -7599,7 +7743,7 @@ fn decode_intra_rect_in_inter( | ||
| 7599 | 7743 | 2 => dec.symbol(&mut cdfs.tx_size_cat2[ctx]), |
| 7600 | 7744 | _ => dec.symbol(&mut cdfs.tx_size_cat3[ctx]), |
| 7601 | 7745 | }; |
| 7602 | - if std::env::var_os("EC_TRACE_MODE_STEP").is_some() { | |
| 7746 | + if step_trace { | |
| 7603 | 7747 | eprintln!( |
| 7604 | 7748 | "EC_ISTEP mi_row={mi_r} mi_col={mi_c} name=tx_depth val={d} ctx={ctx} cat={tx_cat} rng={}", |
| 7605 | 7749 | dec.debug_state().0 |
| @@ -7778,8 +7922,26 @@ fn decode_block_rect( | ||
| 7778 | 7922 | // pinned HORZ quadrant were wrong from their very first pixel, and why our |
| 7779 | 7923 | // range after the read equalled the oracle's range for the whole block. |
| 7780 | 7924 | let depth = if tx_select { |
| 7781 | - let ctx = tx_size_context_rect(neighbours, (mi_r, mi_c), bw, bh); | |
| 7782 | - dec.symbol(&mut cdfs.tx_size_cat2[ctx]) | |
| 7925 | + // lane-t900 r2: on an INTER frame `get_tx_size_context` reads the real | |
| 7926 | + // `TXFM_CONTEXT` bands ([`tx_size_context_txfm_rect`], what the 2:1 and | |
| 7927 | + // the 16x4 intra-in-inter strips already do); the key frame's | |
| 7928 | + // deblock-grid approximation is only right where those bands were never | |
| 7929 | + // written. Measured on the 10-bit 1920x792 128-superblock stream, | |
| 7930 | + // decode-order frame 1: the 32x8 HORZ_4 strip at mi(48,176) read | |
| 7931 | + // `tx_size_cat2` row 1 where libaom reads row 2. | |
| 7932 | + let ctx = if INTRA_IN_INTER_MODE.with(std::cell::Cell::get).is_some() { | |
| 7933 | + tx_size_context_txfm_rect(neighbours, (mi_r, mi_c), bw, bh) | |
| 7934 | + } else { | |
| 7935 | + tx_size_context_rect(neighbours, (mi_r, mi_c), bw, bh) | |
| 7936 | + }; | |
| 7937 | + let d = dec.symbol(&mut cdfs.tx_size_cat2[ctx]); | |
| 7938 | + if std::env::var_os("EC_TRACE_MODE_STEP").is_some() { | |
| 7939 | + eprintln!( | |
| 7940 | + "EC_ISTEP mi_row={mi_r} mi_col={mi_c} name=tx_depth val={d} ctx={ctx} cat=2 rng={}", | |
| 7941 | + dec.debug_state().0 | |
| 7942 | + ); | |
| 7943 | + } | |
| 7944 | + d | |
| 7783 | 7945 | } else { |
| 7784 | 7946 | 0 |
| 7785 | 7947 | }; |
| @@ -8262,7 +8424,13 @@ fn decode_leaf_rect( | ||
| 8262 | 8424 | // a constant `false`. |
| 8263 | 8425 | let smooth_neighbor_uv = neighbours.smooth_uv_neighbour(leaf_mi.0, leaf_mi.1, r, c); |
| 8264 | 8426 | let depth = if tx_select { |
| 8265 | - let ctx = tx_size_context_rect(neighbours, leaf_mi, bw, bh); | |
| 8427 | + // lane-t900 r2 (sibling sweep): the in-inter `TXFM_CONTEXT` band read | |
| 8428 | + // every other rect reader now does -- a no-op on a key frame. | |
| 8429 | + let ctx = if INTRA_IN_INTER_MODE.with(std::cell::Cell::get).is_some() { | |
| 8430 | + tx_size_context_txfm_rect(neighbours, leaf_mi, bw, bh) | |
| 8431 | + } else { | |
| 8432 | + tx_size_context_rect(neighbours, leaf_mi, bw, bh) | |
| 8433 | + }; | |
| 8266 | 8434 | // lane-rectsplitx r1: `bsize_to_tx_size_cat` (libaom `blockd.h`, |
| 8267 | 8435 | // `bsize_to_tx_size_depth_table`) is 2 for BLOCK_16X8/BLOCK_8X16, so |
| 8268 | 8436 | // the category is 1 -- NOT the 2 the 32x16 strips read. Same symbol |
| @@ -8594,11 +8762,37 @@ fn decode_block_rect4( | ||
| 8594 | 8762 | uv_mode |
| 8595 | 8763 | }; |
| 8596 | 8764 | let depth = if tx_select { |
| 8597 | - let ctx = tx_size_context_rect(neighbours, (mi_r, mi_c), bw, bh); | |
| 8598 | - dec.symbol(&mut cdfs.tx_size_cat2[ctx]) | |
| 8765 | + // lane-t900 r2: on an INTER frame `get_tx_size_context` reads the real | |
| 8766 | + // `TXFM_CONTEXT` bands ([`tx_size_context_txfm_rect`], what the 2:1 and | |
| 8767 | + // the 16x4 intra-in-inter strips already do); the key frame's | |
| 8768 | + // deblock-grid approximation is only right where those bands were never | |
| 8769 | + // written. Measured on the 10-bit 1920x792 128-superblock stream, | |
| 8770 | + // decode-order frame 1: the 32x8 HORZ_4 strip at mi(48,176) read | |
| 8771 | + // `tx_size_cat2` row 1 where libaom reads row 2. | |
| 8772 | + let ctx = if INTRA_IN_INTER_MODE.with(std::cell::Cell::get).is_some() { | |
| 8773 | + tx_size_context_txfm_rect(neighbours, (mi_r, mi_c), bw, bh) | |
| 8774 | + } else { | |
| 8775 | + tx_size_context_rect(neighbours, (mi_r, mi_c), bw, bh) | |
| 8776 | + }; | |
| 8777 | + let d = dec.symbol(&mut cdfs.tx_size_cat2[ctx]); | |
| 8778 | + if std::env::var_os("EC_TRACE_MODE_STEP").is_some() { | |
| 8779 | + eprintln!( | |
| 8780 | + "EC_ISTEP mi_row={mi_r} mi_col={mi_c} name=tx_depth val={d} ctx={ctx} cat=2 rng={}", | |
| 8781 | + dec.debug_state().0 | |
| 8782 | + ); | |
| 8783 | + } | |
| 8784 | + d | |
| 8599 | 8785 | } else { |
| 8600 | 8786 | 0 |
| 8601 | 8787 | }; |
| 8788 | + // lane-t900 r1: this strip's own `set_txfm_ctxs` when it is an intra | |
| 8789 | + // block of an INTER frame -- see [`publish_txfm_bands_if_in_inter`]. | |
| 8790 | + publish_txfm_bands_if_in_inter( | |
| 8791 | + neighbours, | |
| 8792 | + (mi_r, mi_c), | |
| 8793 | + depth_to_tx_wh(bw, bh, depth), | |
| 8794 | + (bw, bh), | |
| 8795 | + ); | |
| 8602 | 8796 | if depth != 0 { |
| 8603 | 8797 | // lane-rectsplitx r1: the per-transform-unit walk, at this strip's |
| 8604 | 8798 | // real mi position (strips 1 and 3 of a HORZ_4 start 8 px into a |
| @@ -9104,7 +9298,16 @@ fn decode_rect4_16_strip( | ||
| 9104 | 9298 | } else { |
| 9105 | 9299 | tx_size_context_rect(neighbours, lmi, bw, bh) |
| 9106 | 9300 | }; |
| 9107 | - dec.symbol(&mut cdfs.tx_size_cat1[ctx]) | |
| 9301 | + let d = dec.symbol(&mut cdfs.tx_size_cat1[ctx]); | |
| 9302 | + if std::env::var_os("EC_TRACE_MODE_STEP").is_some() { | |
| 9303 | + eprintln!( | |
| 9304 | + "EC_ISTEP mi_row={} mi_col={} name=tx_depth val={d} ctx={ctx} cat=1 rng={}", | |
| 9305 | + lmi.0, | |
| 9306 | + lmi.1, | |
| 9307 | + dec.debug_state().0 | |
| 9308 | + ); | |
| 9309 | + } | |
| 9310 | + d | |
| 9108 | 9311 | } else { |
| 9109 | 9312 | 0 |
| 9110 | 9313 | }; |
| @@ -9581,7 +9784,18 @@ fn decode_block_rect64( | ||
| 9581 | 9784 | }; |
| 9582 | 9785 | let (mi_r, mi_c) = (r * (SUB / MI), c * (SUB / MI)); |
| 9583 | 9786 | let depth = if tx_select { |
| 9584 | - let ctx = tx_size_context_rect(neighbours, (mi_r, mi_c), bw, bh); | |
| 9787 | + // lane-t900 r2: on an INTER frame `get_tx_size_context` reads the real | |
| 9788 | + // `TXFM_CONTEXT` bands ([`tx_size_context_txfm_rect`], what the 2:1 and | |
| 9789 | + // the 16x4 intra-in-inter strips already do); the key frame's | |
| 9790 | + // deblock-grid approximation is only right where those bands were never | |
| 9791 | + // written. Measured on the 10-bit 1920x792 128-superblock stream, | |
| 9792 | + // decode-order frame 1: the 32x8 HORZ_4 strip at mi(48,176) read | |
| 9793 | + // `tx_size_cat2` row 1 where libaom reads row 2. | |
| 9794 | + let ctx = if INTRA_IN_INTER_MODE.with(std::cell::Cell::get).is_some() { | |
| 9795 | + tx_size_context_txfm_rect(neighbours, (mi_r, mi_c), bw, bh) | |
| 9796 | + } else { | |
| 9797 | + tx_size_context_rect(neighbours, (mi_r, mi_c), bw, bh) | |
| 9798 | + }; | |
| 9585 | 9799 | // lane-rectsplit r1: `bsize_to_tx_size_cat` (libaom `decodemv.c`) |
| 9586 | 9800 | // counts `sub_tx_size_map` steps from the block's own max rect |
| 9587 | 9801 | // transform down to TX_4X4, minus one -- BLOCK_64X32's chain |
| @@ -9589,10 +9803,25 @@ fn decode_block_rect64( | ||
| 9589 | 9803 | // steps, so this level's category is 3 (the same one a 64x64 square |
| 9590 | 9804 | // block uses), not the 2 a 32x16 strip uses. Reading the cat-2 CDF |
| 9591 | 9805 | // here was a wrong-table read of a real symbol. |
| 9592 | - dec.symbol(&mut cdfs.tx_size_cat3[ctx]) | |
| 9806 | + let d = dec.symbol(&mut cdfs.tx_size_cat3[ctx]); | |
| 9807 | + if std::env::var_os("EC_TRACE_MODE_STEP").is_some() { | |
| 9808 | + eprintln!( | |
| 9809 | + "EC_ISTEP mi_row={mi_r} mi_col={mi_c} name=tx_depth val={d} ctx={ctx} cat=3 rng={}", | |
| 9810 | + dec.debug_state().0 | |
| 9811 | + ); | |
| 9812 | + } | |
| 9813 | + d | |
| 9593 | 9814 | } else { |
| 9594 | 9815 | 0 |
| 9595 | 9816 | }; |
| 9817 | + // lane-t900 r1: this strip's own `set_txfm_ctxs` when it is an intra | |
| 9818 | + // block of an INTER frame -- see [`publish_txfm_bands_if_in_inter`]. | |
| 9819 | + publish_txfm_bands_if_in_inter( | |
| 9820 | + neighbours, | |
| 9821 | + (mi_r, mi_c), | |
| 9822 | + depth_to_tx_wh(bw, bh, depth), | |
| 9823 | + (bw, bh), | |
| 9824 | + ); | |
| 9596 | 9825 | if depth != 0 { |
| 9597 | 9826 | TX_DEPTH_HITS.with(|c| c.set(c.get() + 1)); |
| 9598 | 9827 | // lane-rectsplit r1/r4: the superblock-level strip splits its |
| @@ -10698,7 +10927,7 @@ impl PlaneBuf { | ||
| 10698 | 10927 | let row0: Vec<u16> = prediction[..bw.min(8)].to_vec(); |
| 10699 | 10928 | let col0: Vec<u16> = (0..bh.min(8)).map(|r| prediction[r * bw]).collect(); |
| 10700 | 10929 | eprintln!( |
| 10701 | - "@{} OUR_PRED x={x} y={y} bw={bw} bh={bh} mode={mode} ad={angle_delta} sum={sum} row0={row0:?} col0={col0:?}", std::panic::Location::caller() | |
| 10930 | + "@{} OUR_PRED x={x} y={y} bw={bw} bh={bh} mode={mode} ad={angle_delta} ft={} sum={sum} row0={row0:?} col0={col0:?}", std::panic::Location::caller(), i32::from(smooth_neighbor) | |
| 10702 | 10931 | ); |
| 10703 | 10932 | } |
| 10704 | 10933 | for row in 0..bh { |
| @@ -11604,6 +11833,15 @@ thread_local! { | ||
| 11604 | 11833 | /// Those blocks by resolved intra `tx_depth` (0 = TX_64X64 units, |
| 11605 | 11834 | /// 1 = TX_32X32, 2 = TX_16X16) -- proof the depth symbol is really read. |
| 11606 | 11835 | pub(crate) static INTRA_SB128_DEPTH_HITS: std::cell::Cell<[usize; 3]> = const { std::cell::Cell::new([0; 3]) }; |
| 11836 | + /// lane-inter128intra r1: the same shapes decoded on the INTER block path | |
| 11837 | + /// (an intra-coded PARTITION_HORZ/VERT half of a 128 superblock inside an | |
| 11838 | + /// inter frame) -- (128x64, 64x128). | |
| 11839 | + pub(crate) static INTRA128_IN_INTER_HITS: std::cell::Cell<[usize; 2]> = const { std::cell::Cell::new([0; 2]) }; | |
| 11840 | +} | |
| 11841 | + | |
| 11842 | +/// [`INTRA128_IN_INTER_HITS`], for a gate's own before/after delta. | |
| 11843 | +pub(crate) fn intra128_in_inter_hits() -> [usize; 2] { | |
| 11844 | + INTRA128_IN_INTER_HITS.with(std::cell::Cell::get) | |
| 11607 | 11845 | } |
| 11608 | 11846 | |
| 11609 | 11847 | /// [`INTRA_SB128_HORZ_HITS`] / [`INTRA_SB128_VERT_HITS`] / |
| @@ -11695,8 +11933,17 @@ fn decode_block_128rect( | ||
| 11695 | 11933 | let smooth_neighbor_uv = neighbours.smooth_uv_neighbour(mi_r, mi_c, r, c); |
| 11696 | 11934 | // spec 5.11.16 `read_tx_size`: read for every intra block, skipped or |
| 11697 | 11935 | // not. `bsize_to_tx_size_cat(BLOCK_128X64)` is 3 (see this fn's doc). |
| 11936 | + let in_inter = INTRA_IN_INTER_MODE.with(std::cell::Cell::get).is_some(); | |
| 11698 | 11937 | let depth = if tx_select { |
| 11699 | - let ctx = tx_size_context_rect(neighbours, (mi_r, mi_c), bw, bh); | |
| 11938 | + // lane-inter128intra r1: on an INTER frame `get_tx_size_context` reads | |
| 11939 | + // the real `TXFM_CONTEXT` bands, and compares them against | |
| 11940 | + // `tx_size_wide/high[max_txsize_rect_lookup[bsize]]` -- TX_64X64 for | |
| 11941 | + // every 128-axis block, hence the `min(64)`. | |
| 11942 | + let ctx = if in_inter { | |
| 11943 | + tx_size_context_txfm_rect(neighbours, (mi_r, mi_c), bw.min(64), bh.min(64)) | |
| 11944 | + } else { | |
| 11945 | + tx_size_context_rect(neighbours, (mi_r, mi_c), bw, bh) | |
| 11946 | + }; | |
| 11700 | 11947 | dec.symbol(&mut cdfs.tx_size_cat3[ctx]) |
| 11701 | 11948 | } else { |
| 11702 | 11949 | 0 |
| @@ -11888,7 +12135,25 @@ fn decode_block_128rect( | ||
| 11888 | 12135 | logical_tx as u8, |
| 11889 | 12136 | 0, |
| 11890 | 12137 | ); |
| 11891 | - if bw > bh { | |
| 12138 | + if in_inter { | |
| 12139 | + // `set_txfm_ctxs(tx_size, n4_w, n4_h, skip && is_inter, xd)` | |
| 12140 | + // (libaom `decodeframe.c` `decode_block`) runs for EVERY block of an | |
| 12141 | + // inter frame, intra ones included: an intra block stamps its | |
| 12142 | + // TRANSFORM size over its own footprint in both TXFM_CONTEXT bands. | |
| 12143 | + // A key frame has no var-tx tree and its readers use the deblock grid, | |
| 12144 | + // so this is the inter path's alone. | |
| 12145 | + txfm_partition_update_rect( | |
| 12146 | + neighbours, | |
| 12147 | + (mi_r, mi_c), | |
| 12148 | + (logical_tx, logical_tx), | |
| 12149 | + (bw, bh), | |
| 12150 | + ); | |
| 12151 | + INTRA128_IN_INTER_HITS.with(|c| { | |
| 12152 | + let mut h = c.get(); | |
| 12153 | + h[usize::from(bw < bh)] += 1; | |
| 12154 | + c.set(h); | |
| 12155 | + }); | |
| 12156 | + } else if bw > bh { | |
| 11892 | 12157 | INTRA_SB128_HORZ_HITS.with(|c| c.set(c.get() + 1)); |
| 11893 | 12158 | } else { |
| 11894 | 12159 | INTRA_SB128_VERT_HITS.with(|c| c.set(c.get() + 1)); |
| @@ -12905,7 +13170,13 @@ fn decode_leaf_rect8( | ||
| 12905 | 13170 | // and desynced the tile at the very first rect leaf (class |
| 12906 | 13171 | // `symbol-consumption-gap`). |
| 12907 | 13172 | let depth = if tx_select { |
| 12908 | - let ctx = tx_size_context_rect(neighbours, lmi, bw, bh); | |
| 13173 | + // lane-t900 r2 (sibling sweep): the in-inter `TXFM_CONTEXT` band | |
| 13174 | + // read every other rect reader now does -- a no-op on a key frame. | |
| 13175 | + let ctx = if INTRA_IN_INTER_MODE.with(std::cell::Cell::get).is_some() { | |
| 13176 | + tx_size_context_txfm_rect(neighbours, lmi, bw, bh) | |
| 13177 | + } else { | |
| 13178 | + tx_size_context_rect(neighbours, lmi, bw, bh) | |
| 13179 | + }; | |
| 12909 | 13180 | dec.symbol(&mut cdfs.tx_size_cat0[ctx]) |
| 12910 | 13181 | } else { |
| 12911 | 13182 | 0 |
| @@ -13443,6 +13714,7 @@ fn tx_size_context_txfm_rect( | ||
| 13443 | 13714 | own_w: usize, |
| 13444 | 13715 | own_h: usize, |
| 13445 | 13716 | ) -> usize { |
| 13717 | + INTRA_IN_INTER_TXCTX_HITS.with(|c| c.set(c.get() + 1)); | |
| 13446 | 13718 | let has_above = mi_r > n.tile_row0_mi; |
| 13447 | 13719 | let has_left = mi_c > n.tile_col0_mi; |
| 13448 | 13720 | let mut above = usize::from(n.above_txfm[mi_c]) >= own_w; |
| @@ -13620,6 +13892,46 @@ fn txfm_partition_update( | ||
| 13620 | 13892 | /// [`txfm_partition_update`] for a rectangular transform (lane-inter4 r2): |
| 13621 | 13893 | /// the left column records `tx_size_high` over the parent's own height and |
| 13622 | 13894 | /// the above row records `tx_size_wide` over its width. |
| 13895 | +/// libaom `set_txfm_ctxs` + `txfm_partition_update` (`decodeframe.c`, end of | |
| 13896 | +/// `decode_token_recon_block`): EVERY block of an inter frame publishes its | |
| 13897 | +/// TRANSFORM size into both `TXFM_CONTEXT` bands, intra blocks included. The | |
| 13898 | +/// key frame writes neither (its readers use the deblock grid), so the | |
| 13899 | +/// key-frame bodies reused by [`decode_intra_rect_in_inter`] have to do it | |
| 13900 | +/// themselves when they run inside an inter frame. The 2:1 and 16x4 arms do it | |
| 13901 | +/// at the call site (the transform size comes back to them); the 1:4 arms | |
| 13902 | +/// ([`decode_block_rect4`] / [`decode_block_rect64`]) keep their size inside, | |
| 13903 | +/// so they call this where their own depth resolves. A no-op on a key frame | |
| 13904 | +/// ([`INTRA_IN_INTER_MODE`] unset), where those bands are not read at all. | |
| 13905 | +/// | |
| 13906 | +/// lane-t900 r1 root cause: the HORZ_4 32x8 intra strip at mi(0,312) of an | |
| 13907 | +/// inter frame left `left_txfm[0]` at a stale 32 where libaom's own | |
| 13908 | +/// `set_txfm_ctxs` writes 8, so the intra 8x16 block at mi(0,320) read | |
| 13909 | +/// `tx_size_cat1` row 1 instead of row 0 -- same depth VALUE, different CDF, | |
| 13910 | +/// range 39156 where the reference has 54736 (class tx-grid-published-block-side | |
| 13911 | +/// / early-return-skips-tail). | |
| 13912 | +fn publish_txfm_bands_if_in_inter( | |
| 13913 | + n: &mut Neighbours, | |
| 13914 | + at_mi: (usize, usize), | |
| 13915 | + (tx_w, tx_h): (usize, usize), | |
| 13916 | + (bw, bh): (usize, usize), | |
| 13917 | +) { | |
| 13918 | + if INTRA_IN_INTER_MODE.with(std::cell::Cell::get).is_none() { | |
| 13919 | + return; | |
| 13920 | + } | |
| 13921 | + let (mi_r, mi_c) = at_mi; | |
| 13922 | + txfm_partition_update_rect(n, at_mi, (tx_w, tx_h), (bw, bh)); | |
| 13923 | + for i in 0..bw / MI { | |
| 13924 | + if let Some(cell) = n.above_txfm.get_mut(mi_c + i) { | |
| 13925 | + *cell = tx_w as u8; | |
| 13926 | + } | |
| 13927 | + } | |
| 13928 | + for i in 0..bh / MI { | |
| 13929 | + if let Some(cell) = n.left_txfm.get_mut(mi_r + i) { | |
| 13930 | + *cell = tx_h as u8; | |
| 13931 | + } | |
| 13932 | + } | |
| 13933 | +} | |
| 13934 | + | |
| 13623 | 13935 | fn txfm_partition_update_rect( |
| 13624 | 13936 | n: &mut Neighbours, |
| 13625 | 13937 | (mi_r, mi_c): (usize, usize), |
| @@ -18707,7 +19019,9 @@ fn interintra_blend( | ||
| 18707 | 19019 | plane: &PlaneBuf, |
| 18708 | 19020 | x: usize, |
| 18709 | 19021 | y: usize, |
| 18710 | - side: usize, | |
| 19022 | + bw: usize, | |
| 19023 | + bh: usize, | |
| 19024 | + stride: usize, | |
| 18711 | 19025 | ii_mode: u8, |
| 18712 | 19026 | wedge: Option<(&'static [u8], usize)>, |
| 18713 | 19027 | pred: &mut [u16], |
| @@ -18719,16 +19033,17 @@ fn interintra_blend( | ||
| 18719 | 19033 | 2 => crate::intra::H_PRED, |
| 18720 | 19034 | _ => crate::intra::SMOOTH_PRED, |
| 18721 | 19035 | }; |
| 18722 | - let (above, left, corner) = plane.edges( | |
| 19036 | + let (above, left, corner) = plane.edges_rect( | |
| 18723 | 19037 | x, |
| 18724 | 19038 | y, |
| 18725 | - side, | |
| 19039 | + bw, | |
| 19040 | + bh, | |
| 18726 | 19041 | crate::encode::Reach { |
| 18727 | 19042 | above_right: false, |
| 18728 | 19043 | below_left: false, |
| 18729 | 19044 | }, |
| 18730 | 19045 | ); |
| 18731 | - let mut intra = vec![0u16; side * side]; | |
| 19046 | + let mut intra = vec![0u16; bw * bh]; | |
| 18732 | 19047 | // Edge filtering never applies here: V/H at delta 0 are plain edge |
| 18733 | 19048 | // copies (angle 90/180 skip the directional walk), DC/SMOOTH carry no |
| 18734 | 19049 | // angle at all. |
| @@ -18738,22 +19053,25 @@ fn interintra_blend( | ||
| 18738 | 19053 | above.as_deref(), |
| 18739 | 19054 | left.as_deref(), |
| 18740 | 19055 | corner, |
| 18741 | - side, | |
| 18742 | - side, | |
| 19056 | + bw, | |
| 19057 | + bh, | |
| 18743 | 19058 | false, |
| 18744 | 19059 | false, |
| 18745 | 19060 | &mut intra, |
| 18746 | 19061 | ); |
| 18747 | - let scale = 128 / side; | |
| 18748 | - for i in 0..side { | |
| 18749 | - for j in 0..side { | |
| 19062 | + // `ii_size_scales[bsize]` is keyed on the block's LONGER side | |
| 19063 | + // (`MAX_SB_SIZE >> max(bw,bh)` order), not on the square this decoder | |
| 19064 | + // builds the predictor buffer at. | |
| 19065 | + let scale = 128 / bw.max(bh); | |
| 19066 | + for i in 0..bh { | |
| 19067 | + for j in 0..bw { | |
| 18750 | 19068 | let m = u32::from(match wedge { |
| 18751 | 19069 | // lane-wii r2: wedge-interintra mask (aom_blend_a64_mask |
| 18752 | 19070 | // over the wedge codebook, intra as src0, fixed sign 0). |
| 18753 | 19071 | // Luma plane: mask rows are luma-resolution, ms == side. |
| 18754 | 19072 | // 4:2:0 chroma: 2x2 box average (reconinter.c sub8x8 -- |
| 18755 | 19073 | // subw == subh == 1). |
| 18756 | - Some((mask, ms)) if ms == side => mask[i * side + j], | |
| 19074 | + Some((mask, ms)) if ms == stride => mask[i * stride + j], | |
| 18757 | 19075 | Some((mask, ms)) => { |
| 18758 | 19076 | let t = 2 * i * ms + 2 * j; |
| 18759 | 19077 | ((u32::from(mask[t]) |
| @@ -18770,9 +19088,9 @@ fn interintra_blend( | ||
| 18770 | 19088 | _ => II_WEIGHTS_1D[i.min(j) * scale], |
| 18771 | 19089 | }, |
| 18772 | 19090 | }); |
| 18773 | - let idx = i * side + j; | |
| 18774 | - pred[idx] = | |
| 18775 | - ((m * u32::from(intra[idx]) + (64 - m) * u32::from(pred[idx]) + 32) >> 6) as u16; | |
| 19091 | + let idx = i * stride + j; | |
| 19092 | + pred[idx] = ((m * u32::from(intra[i * bw + j]) + (64 - m) * u32::from(pred[idx]) + 32) | |
| 19093 | + >> 6) as u16; | |
| 18776 | 19094 | } |
| 18777 | 19095 | } |
| 18778 | 19096 | } |
| @@ -20302,7 +20620,7 @@ fn decode_inter_block( | ||
| 20302 | 20620 | // lane-cwarp r1: this reference's own GLOBAL warp replaces the |
| 20303 | 20621 | // translational tap (libaom `av1_warp_plane` with |
| 20304 | 20622 | // `conv_params->is_compound`); the blend below is unchanged. |
| 20305 | - if let Some(wp) = &warp0 { | |
| 20623 | + if let Some(wp) = warp0.as_ref().filter(|_| warp_plane_allowed(write_w, write_h)) { | |
| 20306 | 20624 | crate::warp::warp_affine_compound( |
| 20307 | 20625 | wp, &py0.data, py0.true_width as i32, py0.true_height as i32, |
| 20308 | 20626 | py0.width as i32, &mut inter0_y, px as i32, py as i32, side as i32, |
| @@ -20329,7 +20647,7 @@ fn decode_inter_block( | ||
| 20329 | 20647 | // lane-cwarp r1: this reference's own GLOBAL warp replaces the |
| 20330 | 20648 | // translational tap (libaom `av1_warp_plane` with |
| 20331 | 20649 | // `conv_params->is_compound`); the blend below is unchanged. |
| 20332 | - if let Some(wp) = &warp1 { | |
| 20650 | + if let Some(wp) = warp1.as_ref().filter(|_| warp_plane_allowed(write_w, write_h)) { | |
| 20333 | 20651 | crate::warp::warp_affine_compound( |
| 20334 | 20652 | wp, &py1.data, py1.true_width as i32, py1.true_height as i32, |
| 20335 | 20653 | py1.width as i32, &mut inter1_y, px as i32, py as i32, side as i32, |
| @@ -20379,7 +20697,7 @@ fn decode_inter_block( | ||
| 20379 | 20697 | // narrower/shorter than 8 (`block_width < 8`), so a 4x4 chroma |
| 20380 | 20698 | // block of an 8x8 luma block stays translational. |
| 20381 | 20699 | if let Some(wp) = &warp0 { |
| 20382 | - if chroma_side >= 8 { | |
| 20700 | + if warp_plane_allowed(write_chroma_w, write_chroma_h) { | |
| 20383 | 20701 | crate::warp::warp_affine_compound( |
| 20384 | 20702 | wp, &pu0.data, pu0.true_width as i32, pu0.true_height as i32, |
| 20385 | 20703 | pu0.width as i32, &mut inter0_u, cpx as i32, cpy as i32, |
| @@ -20408,7 +20726,7 @@ fn decode_inter_block( | ||
| 20408 | 20726 | // narrower/shorter than 8 (`block_width < 8`), so a 4x4 chroma |
| 20409 | 20727 | // block of an 8x8 luma block stays translational. |
| 20410 | 20728 | if let Some(wp) = &warp1 { |
| 20411 | - if chroma_side >= 8 { | |
| 20729 | + if warp_plane_allowed(write_chroma_w, write_chroma_h) { | |
| 20412 | 20730 | crate::warp::warp_affine_compound( |
| 20413 | 20731 | wp, &pu1.data, pu1.true_width as i32, pu1.true_height as i32, |
| 20414 | 20732 | pu1.width as i32, &mut inter1_u, cpx as i32, cpy as i32, |
| @@ -20453,7 +20771,7 @@ fn decode_inter_block( | ||
| 20453 | 20771 | // narrower/shorter than 8 (`block_width < 8`), so a 4x4 chroma |
| 20454 | 20772 | // block of an 8x8 luma block stays translational. |
| 20455 | 20773 | if let Some(wp) = &warp0 { |
| 20456 | - if chroma_side >= 8 { | |
| 20774 | + if warp_plane_allowed(write_chroma_w, write_chroma_h) { | |
| 20457 | 20775 | crate::warp::warp_affine_compound( |
| 20458 | 20776 | wp, &pv0.data, pv0.true_width as i32, pv0.true_height as i32, |
| 20459 | 20777 | pv0.width as i32, &mut inter0_v, cpx as i32, cpy as i32, |
| @@ -20482,7 +20800,7 @@ fn decode_inter_block( | ||
| 20482 | 20800 | // narrower/shorter than 8 (`block_width < 8`), so a 4x4 chroma |
| 20483 | 20801 | // block of an 8x8 luma block stays translational. |
| 20484 | 20802 | if let Some(wp) = &warp1 { |
| 20485 | - if chroma_side >= 8 { | |
| 20803 | + if warp_plane_allowed(write_chroma_w, write_chroma_h) { | |
| 20486 | 20804 | crate::warp::warp_affine_compound( |
| 20487 | 20805 | wp, &pv1.data, pv1.true_width as i32, pv1.true_height as i32, |
| 20488 | 20806 | pv1.width as i32, &mut inter1_v, cpx as i32, cpy as i32, |
| @@ -21578,19 +21896,28 @@ fn decode_inter_block( | ||
| 21578 | 21896 | // motion_mode symbol was still read and warp_params still |
| 21579 | 21897 | // resolved. Suppress the warp, keep every symbol read. |
| 21580 | 21898 | if let Some(params) = warp_params.as_ref().filter(|_| luma_scale == mc::REF_NO_SCALE) { |
| 21581 | - crate::warp::warp_affine( | |
| 21582 | - params, &py_ref.data, py_ref.true_width as i32, py_ref.true_height as i32, | |
| 21583 | - py_ref.width as i32, &mut pred_y, px as i32, py as i32, side as i32, | |
| 21584 | - side as i32, side as i32, 0, 0, | |
| 21585 | - ); | |
| 21899 | + // `av1_init_warp_params` is per PLANE: the luma plane's | |
| 21900 | + // own block is `write_w`x`write_h` (a PARTITION_HORZ/VERT | |
| 21901 | + // strip is not `side`x`side`), so a strip under 8 px in | |
| 21902 | + // either direction keeps the translational prediction too. | |
| 21903 | + if warp_plane_allowed(write_w, write_h) { | |
| 21904 | + crate::warp::warp_affine( | |
| 21905 | + params, &py_ref.data, py_ref.true_width as i32, py_ref.true_height as i32, | |
| 21906 | + py_ref.width as i32, &mut pred_y, px as i32, py as i32, side as i32, | |
| 21907 | + side as i32, side as i32, 0, 0, | |
| 21908 | + ); | |
| 21909 | + } | |
| 21586 | 21910 | // libaom `av1_init_warp_params` (reconinter.c): warp is |
| 21587 | 21911 | // per PLANE and bails out at `block_width < 8 || |
| 21588 | 21912 | // block_height < 8`, so a plane whose own block is under |
| 21589 | 21913 | // 8x8 keeps the translational prediction built above -- |
| 21590 | - // in 420 that is every chroma plane of a luma block below | |
| 21591 | - // 16x16 (lane-gmaffine r4: chroma-only mismatch of a few | |
| 21592 | - // levels on both 8x8-leaf motion gates). | |
| 21593 | - if chroma_side >= 8 { | |
| 21914 | + // in 420 that is every chroma plane whose own width or | |
| 21915 | + // height is under 8 -- `write_chroma_w`/`write_chroma_h`, | |
| 21916 | + // NOT the square `chroma_side` (lane-t900 r5: an 8x16 luma | |
| 21917 | + // block has `chroma_side == 8` but a 4x8 chroma block, so | |
| 21918 | + // the square side warped chroma libaom predicts | |
| 21919 | + // translationally; lane-gmaffine r4 for the 8x8 leaf). | |
| 21920 | + if warp_plane_allowed(write_chroma_w, write_chroma_h) { | |
| 21594 | 21921 | crate::warp::warp_affine( |
| 21595 | 21922 | params, &pu_ref.data, pu_ref.true_width as i32, pu_ref.true_height as i32, |
| 21596 | 21923 | pu_ref.width as i32, &mut pred_u, cpx as i32, cpy as i32, chroma_side as i32, |
| @@ -21639,9 +21966,18 @@ fn decode_inter_block( | ||
| 21639 | 21966 | // result, all planes (reconinter.c av1_build_interintra_predictor |
| 21640 | 21967 | // plane loop). |
| 21641 | 21968 | if let Some(ii) = interintra_mode { |
| 21642 | - interintra_blend(y, px, py, side, ii, wedge_mask, &mut pred_y); | |
| 21643 | - interintra_blend(u, cpx, cpy, chroma_side, ii, wedge_mask, &mut pred_u); | |
| 21644 | - interintra_blend(v, cpx, cpy, chroma_side, ii, wedge_mask, &mut pred_v); | |
| 21969 | + if write_w != write_h { | |
| 21970 | + INTERINTRA_RECT_HITS.with(|c| c.set(c.get() + 1)); | |
| 21971 | + } | |
| 21972 | + interintra_blend(y, px, py, write_w, write_h, side, ii, wedge_mask, &mut pred_y); | |
| 21973 | + interintra_blend( | |
| 21974 | + u, cpx, cpy, write_chroma_w, write_chroma_h, chroma_side, ii, wedge_mask, | |
| 21975 | + &mut pred_u, | |
| 21976 | + ); | |
| 21977 | + interintra_blend( | |
| 21978 | + v, cpx, cpy, write_chroma_w, write_chroma_h, chroma_side, ii, wedge_mask, | |
| 21979 | + &mut pred_v, | |
| 21980 | + ); | |
| 21645 | 21981 | } |
| 21646 | 21982 | |
| 21647 | 21983 | // lane-inter16ab r2: libaom `build_inter_predictors_sub8x8` |
| @@ -22111,9 +22447,21 @@ fn decode_inter_block( | ||
| 22111 | 22447 | // witness is a capability claim (class `refusal-lifted-without-a-gate`), |
| 22112 | 22448 | // so the decode path stays behind `EC_INTRA16X4_DECODE` for the round |
| 22113 | 22449 | // that finds a witness. |
| 22450 | + // | |
| 22451 | + // lane-t900 r6: THAT WITNESS EXISTS, so `EC_INTRA16X4_DECODE` is gone | |
| 22452 | + // and the refusal is narrowed back to "no chroma-pair record". The | |
| 22453 | + // witness is a REAL 10-bit 1920x792 128-superblock film stream, not an | |
| 22454 | + // aomenc recipe: `fixtures/reelc_sb128_inter_witness.obu` (166303 bytes, | |
| 22455 | + // 19 frame-carrying OBUs, 14 decode-order frames) decodes all 14 | |
| 22456 | + // decode-order frames byte-exact against instrumented aomdec | |
| 22457 | + // (`EC_AV1_FINAL_DUMP`) and all 12 shown frames pixel-exact against | |
| 22458 | + // ffmpeg, while this arm fires 78x 16x4 + 149x 4x16 (108 of them | |
| 22459 | + // chroma-paired). Unlike lane-sub8x4 r3's phantom (class | |
| 22460 | + // `counter-from-refused-stream`) every one of those hits lies inside a | |
| 22461 | + // frame that was decoded AND compared exact. Gate | |
| 22462 | + // `a_10bit_128sb_film_frames_with_warp_cdef_and_interintra_decode_pixel_exact`. | |
| 22114 | 22463 | let strip16 = strip_chroma |
| 22115 | 22464 | .filter(|_| write_w.min(write_h) == 4 && write_w.max(write_h) == 16) |
| 22116 | - .filter(|_| std::env::var_os("EC_INTRA16X4_DECODE").is_some()) | |
| 22117 | 22465 | .map(|s| (s.horz, s.has_chroma)); |
| 22118 | 22466 | if write_w.min(write_h) < 8 && strip16.is_none() { |
| 22119 | 22467 | if std::env::var_os("EC_INTRA16X4").is_some() { |
| @@ -22693,6 +23041,29 @@ fn decode_inter_block( | ||
| 22693 | 23041 | } else { |
| 22694 | 23042 | Vec::new() |
| 22695 | 23043 | }; |
| 23044 | + // libaom `av1_reset_entropy_context` / `av1_set_entropy_contexts`: | |
| 23045 | + // `nplanes = 1 + (num_planes - 1) * xd->is_chroma_ref` -- a block that is | |
| 23046 | + // NOT the chroma reference of its 4:2:0 pair codes no chroma transform at | |
| 23047 | + // all, so it leaves its neighbours' CHROMA coefficient contexts exactly as | |
| 23048 | + // it found them. `record_rect_mi`/`record_split_luma_rect_mi` below write | |
| 23049 | + // all three planes unconditionally, and for such a strip the chroma grids | |
| 23050 | + // are all-zero (see the `!has_chroma` arm above) -- that wiped the real | |
| 23051 | + // left-neighbour chroma state, so the PAIR's own `all_zero` then read | |
| 23052 | + // `txb_skip_ctx` one row low (lane-t900 r3, 10-bit 1920x792 stream, | |
| 23053 | + // mi(40,220): base 1 where libaom gathers 2). Snapshot and restore is | |
| 23054 | + // equivalent to not writing them, without threading a flag through both | |
| 23055 | + // recorders. | |
| 23056 | + let saved_chroma_ctx = (!has_chroma).then(|| { | |
| 23057 | + NON_CHROMA_REF_CTX_SKIP_HITS.with(|c| c.set(c.get() + 1)); | |
| 23058 | + let (w_mi, h_mi) = (write_w / MI, write_h / MI); | |
| 23059 | + let left: Vec<[Neighbour; 2]> = (0..h_mi) | |
| 23060 | + .filter_map(|k| neighbours.left.get(at.0 + k).map(|s| [s[1], s[2]])) | |
| 23061 | + .collect(); | |
| 23062 | + let above: Vec<[Neighbour; 2]> = (0..w_mi) | |
| 23063 | + .filter_map(|k| neighbours.above.get(at.1 + k).map(|s| [s[1], s[2]])) | |
| 23064 | + .collect(); | |
| 23065 | + (left, above) | |
| 23066 | + }); | |
| 22696 | 23067 | if vartx_leaves.is_some() { |
| 22697 | 23068 | // Plane 0 is already correct per transform unit |
| 22698 | 23069 | // ([`Neighbours::record_mi_luma`] above); this writes everything else |
| @@ -22726,6 +23097,20 @@ fn decode_inter_block( | ||
| 22726 | 23097 | &[luma_grid, u_grid, v_grid], |
| 22727 | 23098 | ); |
| 22728 | 23099 | } |
| 23100 | + if let Some((left, above)) = saved_chroma_ctx { | |
| 23101 | + for (k, v) in left.into_iter().enumerate() { | |
| 23102 | + if let Some(slot) = neighbours.left.get_mut(at.0 + k) { | |
| 23103 | + slot[1] = v[0]; | |
| 23104 | + slot[2] = v[1]; | |
| 23105 | + } | |
| 23106 | + } | |
| 23107 | + for (k, v) in above.into_iter().enumerate() { | |
| 23108 | + if let Some(slot) = neighbours.above.get_mut(at.1 + k) { | |
| 23109 | + slot[1] = v[0]; | |
| 23110 | + slot[2] = v[1]; | |
| 23111 | + } | |
| 23112 | + } | |
| 23113 | + } | |
| 22729 | 23114 | if let Some((s, u_state, v_state)) = pair_chroma { |
| 22730 | 23115 | let (pw, ph) = if s.horz { (16usize, 8usize) } else { (8, 16) }; |
| 22731 | 23116 | let round_up_even = |n: usize| n.div_ceil(2) * 2; |
| @@ -25665,9 +26050,13 @@ fn decode_inter_block8( | ||
| 25665 | 26050 | // Non-wedge interintra blend, mutually exclusive with OBMC (the |
| 25666 | 26051 | // motion_mode symbol is not read for an interintra block). |
| 25667 | 26052 | if let Some(ii) = interintra_mode { |
| 25668 | - interintra_blend(y, px, py, SIDE, ii, wedge_mask, &mut pred_y); | |
| 25669 | - interintra_blend(u, cpx, cpy, CHROMA_SIDE, ii, wedge_mask, &mut pred_u); | |
| 25670 | - interintra_blend(v, cpx, cpy, CHROMA_SIDE, ii, wedge_mask, &mut pred_v); | |
| 26053 | + interintra_blend(y, px, py, SIDE, SIDE, SIDE, ii, wedge_mask, &mut pred_y); | |
| 26054 | + interintra_blend( | |
| 26055 | + u, cpx, cpy, CHROMA_SIDE, CHROMA_SIDE, CHROMA_SIDE, ii, wedge_mask, &mut pred_u, | |
| 26056 | + ); | |
| 26057 | + interintra_blend( | |
| 26058 | + v, cpx, cpy, CHROMA_SIDE, CHROMA_SIDE, CHROMA_SIDE, ii, wedge_mask, &mut pred_v, | |
| 26059 | + ); | |
| 25671 | 26060 | } |
| 25672 | 26061 | |
| 25673 | 26062 | split8 = read_block_tx_size( |
| @@ -26947,6 +27336,15 @@ pub(crate) fn decode_inter_frame_tile_with_cdfs( | ||
| 26947 | 27336 | if i > 0 && (at_mi.0 >= mi_rows as usize || at_mi.1 >= mi_cols as usize) { |
| 26948 | 27337 | break; |
| 26949 | 27338 | } |
| 27339 | + // Each half reads its OWN `cdef_idx` literal: libaom keeps | |
| 27340 | + // `cdef_transmitted[4]`, one flag per 64x64 CDEF unit of a | |
| 27341 | + // 128x128 superblock (`read_cdef`, decodemv.c:50-81), and | |
| 27342 | + // the two halves of a 128-root HORZ/VERT sit in different | |
| 27343 | + // units (index `col_in_sb != 0` + 2 * `row_in_sb != 0`). | |
| 27344 | + // The key-frame 128 loop already resets here; without it | |
| 27345 | + // the second half skipped a `cdef_bits`-wide literal that | |
| 27346 | + // libaom reads, desyncing the tile at that block. | |
| 27347 | + CDEF_TRANSMITTED.with(|c| c.set(false)); | |
| 26950 | 27348 | inter_piece!( |
| 26951 | 27349 | at_mi, SB * 2, |
| 26952 | 27350 | TxbSet::Luma64, TxbSet::Luma64, TxbSet::Chroma32, TX32, TX32, |
crates/ec-av1/src/refusal_inventory.rsmodified+10 -5
| @@ -86,11 +86,16 @@ const REFUSALS: &[&str] = &[ | ||
| 86 | 86 | // halved footprint, which for a 16x4 strip is an 8x2 transform libaom |
| 87 | 87 | // never wrote (its chroma is the PAIR's 8x4, coded by the odd strip). |
| 88 | 88 | // lane-sub8x4 r3 narrowed this to "a strip with no chroma-pair record"; |
| 89 | - // lane-wit16x4 r1 put it back at FULL width: r3's witness counters were | |
| 90 | - // phantoms of a desync, no stream on this tree decodes pixel-exact while | |
| 91 | - // the arm fires, and the decode path now needs `EC_INTRA16X4_DECODE` | |
| 92 | - // (class `refusal-lifted-without-a-gate`; numbers in decode.rs's `strip16` | |
| 93 | - // note and lanes/wit16x4-r1.report.md). | |
| 89 | + // lane-wit16x4 r1 put it back at FULL width (r3's witness counters were | |
| 90 | + // phantoms of a desync, class `refusal-lifted-without-a-gate`) behind | |
| 91 | + // `EC_INTRA16X4_DECODE`. lane-t900 r6 NARROWED it again -- the opt-in is | |
| 92 | + // gone -- on a real 10-bit 1920x792 128-superblock film witness that | |
| 93 | + // decodes 14/14 decode-order frames exact vs aomdec and 12/12 shown frames | |
| 94 | + // exact vs ffmpeg while the arm fires 78 16x4 + 149 4x16 (108 chroma- | |
| 95 | + // paired): gate | |
| 96 | + // `a_10bit_128sb_film_frames_with_warp_cdef_and_interintra_decode_pixel_exact`. | |
| 97 | + // What still refuses is a 16x4/4x16 strip with NO chroma-pair record and | |
| 98 | + // every other sub-8 shape. | |
| 94 | 99 | "an intra 16x4/4x16 strip inside an inter 16x16-level 1:4 partition (its 4:2:0 chroma pair is coded once for two strips; only the inter path implements that pairing)", |
| 95 | 100 | "an intra mode this decoder does not code (round 2)", |
| 96 | 101 | // lane-intrarect r1 lifted the whole-shape refusal that stood here (the |
crates/ec-av1/src/stream.rsmodified+142 -5
| @@ -29,6 +29,13 @@ use crate::decode::{ | ||
| 29 | 29 | }; |
| 30 | 30 | use crate::encode::Picture; |
| 31 | 31 | |
| 32 | +/// lane-midcut r1: `EC_AV1_NO_GRAIN=1` skips film grain synthesis at output, so a | |
| 33 | +/// mid-film mismatch splits into "reconstruction" (compare against | |
| 34 | +/// `ffmpeg -c:v libdav1d -filmgrain 0`) and "grain synthesis" in one run. | |
| 35 | +fn no_grain() -> bool { | |
| 36 | + std::env::var_os("EC_AV1_NO_GRAIN").is_some() | |
| 37 | +} | |
| 38 | + | |
| 32 | 39 | /// lane-hidden r1: where `EC_AV1_FINAL_DUMP`'s per-frame dump goes for the |
| 33 | 40 | /// current thread, overriding the environment variable. Every ffmpeg/aomdec |
| 34 | 41 | /// pixel gate in this repo compares SHOWN frames only (class |
| @@ -153,6 +160,12 @@ pub fn intra_sb128_counters() -> (usize, usize, [usize; 3]) { | ||
| 153 | 160 | crate::decode::intra_sb128_hits() |
| 154 | 161 | } |
| 155 | 162 | |
| 163 | +/// lane-inter128intra r1: the 128 root's HORZ/VERT half coded INTRA inside an | |
| 164 | +/// INTER frame -- (128x64 blocks, 64x128 blocks). | |
| 165 | +pub fn intra128_in_inter_counters() -> [usize; 2] { | |
| 166 | + crate::decode::intra128_in_inter_hits() | |
| 167 | +} | |
| 168 | + | |
| 156 | 169 | /// lane-sb128c r9: the four AB shapes at the 128 root, in `PARTITION_HORZ_A`, |
| 157 | 170 | /// `_HORZ_B`, `_VERT_A`, `_VERT_B` order (key and inter tile paths share the |
| 158 | 171 | /// counter -- it is bumped where the root symbol resolves). |
| @@ -291,7 +304,7 @@ pub fn decode_stream(data: &[u8]) -> Result<Vec<Picture>> { | ||
| 291 | 304 | order_hint_slots[i] = order_hint_slots[slot]; |
| 292 | 305 | } |
| 293 | 306 | } |
| 294 | - let output = if header.film_grain.apply_grain { | |
| 307 | + let output = if header.film_grain.apply_grain && !no_grain() { | |
| 295 | 308 | // lane-hbd10 r1: grain synthesis is bit-depth generic |
| 296 | 309 | // (`film_grain.rs`'s `grain_range`/`scale_lut`, spec 7.18.3). |
| 297 | 310 | let bit_depth = parser |
| @@ -961,7 +974,7 @@ pub fn decode_stream(data: &[u8]) -> Result<Vec<Picture>> { | ||
| 961 | 974 | decode::note_fwd_kf(); |
| 962 | 975 | } |
| 963 | 976 | if header.show_frame { |
| 964 | - let output = if header.film_grain.apply_grain { | |
| 977 | + let output = if header.film_grain.apply_grain && !no_grain() { | |
| 965 | 978 | let mc_identity = parser |
| 966 | 979 | .sequence_header() |
| 967 | 980 | .is_some_and(|seq| seq.color_config.matrix_coefficients == 0); |
| @@ -11179,9 +11192,10 @@ mod tests { | ||
| 11179 | 11192 | mismatched)`; attempts 1..3 mismatch ffmpeg from frame 1 or 2 (max |delta| \ |
| 11180 | 11193 | up to 248) and attempts 0/4 mismatch while carrying NO 1:4 strip at all -- \ |
| 11181 | 11194 | another shape's defect, unchanged since r2. The 16x4/4x16-in-inter refusal \ |
| 11182 | - is re-added this round, so the shape now refuses by name unless \ | |
| 11183 | - `EC_INTRA16X4_DECODE` is set: un-ignore only together with a witness \ | |
| 11184 | - (lanes/wit16x4-r1.report.md)"] | |
| 11195 | + was lifted in lane-t900 r6 by a FILM witness (gate \ | |
| 11196 | + `a_10bit_128sb_film_frames_with_warp_cdef_and_interintra_decode_pixel_exact`), \ | |
| 11197 | + so what is unproven here is only this aomenc RECIPE: un-ignore once one \ | |
| 11198 | + of its arms decodes exactly while the arm fires"] | |
| 11185 | 11199 | // lane-intra16x4 r1: an INTRA-coded 16x4 / 4x16 strip inside an INTER |
| 11186 | 11200 | // frame's 16x16-level 1:4 partition -- the wall all six of his film cuts |
| 11187 | 11201 | // stopped at once lane-rectres landed. The shape's chroma is the pair's: |
| @@ -30267,6 +30281,129 @@ mod tests { | ||
| 30267 | 30281 | ); |
| 30268 | 30282 | } |
| 30269 | 30283 | |
| 30284 | + /// lane-t900 r6: the 128-superblock INTER witness. | |
| 30285 | + /// `crates/ec-av1/fixtures/reelc_sb128_inter_witness.obu`, 166303 bytes, | |
| 30286 | + /// sha256 `1191ce80e2c6c5855eaf7a8f5e8cda2cdf809f467b0dbc5e26df96dfa6b2c8bd`: | |
| 30287 | + /// the first 19 frame-carrying OBUs of a 2 s cut taken 900 s into a 10-bit | |
| 30288 | + /// 1920x792 AV1 stream with `use_128x128_superblock=1`, 14 decode-order | |
| 30289 | + /// frames, 12 shown. Cut twice independently from the source (`-ss 900 -t 2 | |
| 30290 | + /// -c:v copy` then the OBU truncation) -- both cuts hash identically. | |
| 30291 | + /// | |
| 30292 | + /// It is the first stream in this repository that decodes exactly while | |
| 30293 | + /// five separately-found defects' paths all fire, which is why the asserts | |
| 30294 | + /// below are on all of them: | |
| 30295 | + /// | |
| 30296 | + /// * `warp_plane_suppress_hits` (r5) -- `av1_init_warp_params` bails out at | |
| 30297 | + /// `block_width < 8 || block_height < 8` on the PLANE's own block, so the | |
| 30298 | + /// 4x8 chroma of an 8x16 luma block is predicted translationally while its | |
| 30299 | + /// luma warps. Gated on the square side before r5. | |
| 30300 | + /// * `inter_sb128_vert_hits` + `cdef_idx_hits` (r5) -- the second half of a | |
| 30301 | + /// 128-root HORZ/VERT inter block must read its OWN `cdef_idx` literal | |
| 30302 | + /// (libaom `cdef_transmitted[4]`, one flag per 64x64 CDEF unit). | |
| 30303 | + /// * `interintra_rect_hits` (r4) -- interintra on a RECTANGULAR block built | |
| 30304 | + /// a square intra predictor before. | |
| 30305 | + /// * `non_chroma_ref_ctx_skip_hits` (r3) -- a block that is not the chroma | |
| 30306 | + /// reference of its 4:2:0 pair leaves its neighbours' chroma coefficient | |
| 30307 | + /// contexts untouched (`nplanes = 1 + (num_planes - 1) * is_chroma_ref`). | |
| 30308 | + /// * `intra_in_inter_txctx_hits` (r2) -- an intra strip in an INTER frame | |
| 30309 | + /// takes its `tx_depth` row from the real `TXFM_CONTEXT` bands, not the | |
| 30310 | + /// key frame's deblock grid. | |
| 30311 | + /// * `edge_filter_mi_fix_hits` (r4) -- both halves of a split intra block | |
| 30312 | + /// read their OWN mi-exact intra-edge-filter neighbours. | |
| 30313 | + /// | |
| 30314 | + /// It is ALSO the witness that lifts the `EC_INTRA16X4_DECODE` opt-in: | |
| 30315 | + /// `intra16x4_in_inter` fires 78x 16x4 + 149x 4x16 (108 chroma-paired) | |
| 30316 | + /// inside frames that are decoded AND compared exact -- not counted out of | |
| 30317 | + /// a refused or desynced stream the way lane-sub8x4 r3's phantom was | |
| 30318 | + /// (class `counter-from-refused-stream`). The 128x64/64x128 intra-in-inter | |
| 30319 | + /// arm fires 0 times here, so THAT refusal is untouched. | |
| 30320 | + /// | |
| 30321 | + /// All 14 decode-order frames (including the 2 no-show frames ffmpeg never | |
| 30322 | + /// hands back) were compared byte-exact against instrumented aomdec with | |
| 30323 | + /// `EC_AV1_FINAL_DUMP` -- see the lane report's EVIDENCE line; the gate | |
| 30324 | + /// itself compares the 12 shown frames on every plane. | |
| 30325 | + #[test] | |
| 30326 | + fn a_10bit_128sb_film_frames_with_warp_cdef_and_interintra_decode_pixel_exact() { | |
| 30327 | + const NAME: &str = | |
| 30328 | + "a_10bit_128sb_film_frames_with_warp_cdef_and_interintra_decode_pixel_exact"; | |
| 30329 | + if !have_ffmpeg() { | |
| 30330 | + eprintln!("SKIP {NAME}: no ffmpeg"); | |
| 30331 | + return; | |
| 30332 | + } | |
| 30333 | + let path = std::path::Path::new(env!("CARGO_MANIFEST_DIR")) | |
| 30334 | + .join("fixtures/reelc_sb128_inter_witness.obu"); | |
| 30335 | + let stream = std::fs::read(&path) | |
| 30336 | + .unwrap_or_else(|e| panic!("{NAME}: reading {}: {e}", path.display())); | |
| 30337 | + let (width, height) = (1920usize, 792usize); | |
| 30338 | + let before = ( | |
| 30339 | + crate::decode::warp_plane_suppress_hits(), | |
| 30340 | + crate::decode::cdef_idx_hits(), | |
| 30341 | + crate::decode::inter_sb128_vert_hits(), | |
| 30342 | + crate::decode::interintra_rect_hits(), | |
| 30343 | + crate::decode::non_chroma_ref_ctx_skip_hits(), | |
| 30344 | + crate::decode::intra_in_inter_txctx_hits(), | |
| 30345 | + crate::decode::edge_filter_mi_fix_hits(), | |
| 30346 | + ); | |
| 30347 | + let i16_before = crate::decode::intra16x4_in_inter_hits(); | |
| 30348 | + let frames = match decode_stream(&stream) { | |
| 30349 | + Ok(frames) => frames, | |
| 30350 | + Err(e) => panic!("{NAME}: decode_stream refused: {e}"), | |
| 30351 | + }; | |
| 30352 | + let fired = ( | |
| 30353 | + crate::decode::warp_plane_suppress_hits() - before.0, | |
| 30354 | + crate::decode::cdef_idx_hits() - before.1, | |
| 30355 | + crate::decode::inter_sb128_vert_hits() - before.2, | |
| 30356 | + crate::decode::interintra_rect_hits() - before.3, | |
| 30357 | + crate::decode::non_chroma_ref_ctx_skip_hits() - before.4, | |
| 30358 | + crate::decode::intra_in_inter_txctx_hits() - before.5, | |
| 30359 | + crate::decode::edge_filter_mi_fix_hits() - before.6, | |
| 30360 | + ); | |
| 30361 | + let i16_now = crate::decode::intra16x4_in_inter_hits(); | |
| 30362 | + let i16 = ( | |
| 30363 | + i16_now.0 - i16_before.0, | |
| 30364 | + i16_now.1 - i16_before.1, | |
| 30365 | + i16_now.2 - i16_before.2, | |
| 30366 | + ); | |
| 30367 | + for (what, n) in [ | |
| 30368 | + ("warp_plane_suppress", fired.0), | |
| 30369 | + ("cdef_idx", fired.1), | |
| 30370 | + ("inter_sb128_vert", fired.2), | |
| 30371 | + ("interintra_rect", fired.3), | |
| 30372 | + ("non_chroma_ref_ctx_skip", fired.4), | |
| 30373 | + ("intra_in_inter_txctx", fired.5), | |
| 30374 | + ("edge_filter_mi_fix", fired.6), | |
| 30375 | + ("intra16x4_in_inter 16x4", i16.0), | |
| 30376 | + ("intra16x4_in_inter 4x16", i16.1), | |
| 30377 | + ("intra16x4_in_inter chroma_ref", i16.2), | |
| 30378 | + ] { | |
| 30379 | + assert!( | |
| 30380 | + n > 0, | |
| 30381 | + "{NAME}: {what} never fired on this stream -- the gate would be vacuous for it" | |
| 30382 | + ); | |
| 30383 | + } | |
| 30384 | + assert_eq!(frames.len(), 12, "{NAME}: 12 shown frames"); | |
| 30385 | + assert_eq!((frames[0].width, frames[0].height), (width, height)); | |
| 30386 | + let ffmpeg_frames = ffmpeg_decode_sequence_10bit(&stream, width, height, frames.len()); | |
| 30387 | + assert_eq!( | |
| 30388 | + ffmpeg_frames.len(), | |
| 30389 | + frames.len(), | |
| 30390 | + "{NAME}: ffmpeg returned {} frames, we decoded {}", | |
| 30391 | + ffmpeg_frames.len(), | |
| 30392 | + frames.len() | |
| 30393 | + ); | |
| 30394 | + for (i, (ours, theirs)) in frames.iter().zip(&ffmpeg_frames).enumerate() { | |
| 30395 | + assert_eq!(ours.y, theirs.y, "{NAME}: frame {i} luma vs ffmpeg"); | |
| 30396 | + assert_eq!(ours.u, theirs.u, "{NAME}: frame {i} U vs ffmpeg"); | |
| 30397 | + assert_eq!(ours.v, theirs.v, "{NAME}: frame {i} V vs ffmpeg"); | |
| 30398 | + } | |
| 30399 | + eprintln!( | |
| 30400 | + "{NAME}: 12 shown frames pixel-exact on every plane; warp_plane_suppress={} \ | |
| 30401 | + cdef_idx={} inter_sb128_vert={} interintra_rect={} non_chroma_ref_ctx_skip={} \ | |
| 30402 | + intra_in_inter_txctx={} edge_filter_mi_fix={} intra16x4_in_inter={:?}", | |
| 30403 | + fired.0, fired.1, fired.2, fired.3, fired.4, fired.5, fired.6, i16 | |
| 30404 | + ); | |
| 30405 | + } | |
| 30406 | + | |
| 30270 | 30407 | |
| 30271 | 30408 | /// lane-sub8x4 r2, the gate that lifts BOTH sub-8x8 intra refusals ("an |
| 30272 | 30409 | /// intra 4x4 block inside an inter frame's sub-8x8 split" and "an intra |
lanes/inter128intra-r1.report.mdadded+149 -0
| @@ -0,0 +1,149 @@ | ||
| 1 | +# lane-inter128intra r1 -- the 128-root HORZ/VERT half coded INTRA in an inter frame | |
| 2 | + | |
| 3 | +Branch `lane-inter128intra` (base main `5dd3dcb`), commit `5c114d5`, | |
| 4 | +worktree `edith_codecs-inter128intra`, | |
| 5 | +`CARGO_TARGET_DIR=$HOME/.cache/cargo-target-inter128intra`. | |
| 6 | + | |
| 7 | +## Verdict up front | |
| 8 | + | |
| 9 | +The arm is IMPLEMENTED but **not gated and therefore not lifted**: it decodes | |
| 10 | +only under `EC_INTRA128_IN_INTER=1`, the named refusal is untouched on the | |
| 11 | +default path, `refusal_inventory.rs` / `gate_coverage.rs` are unchanged. Two | |
| 12 | +findings force that: | |
| 13 | + | |
| 14 | +1. **The charter's film premise is a downstream artifact** (class | |
| 15 | + `refusal-from-own-desync`): on `t900` the 128x64 intra arrival at | |
| 16 | + mi(128,416) sits *after* a pre-existing entropy desync in the same frame. | |
| 17 | +2. **No aomenc recipe found emits the shape**: 3 recipes x 4 cq values produced | |
| 18 | + ZERO 128-root HORZ/VERT halves in an inter frame (`inter_128x64=0` on the | |
| 19 | + decoder side), so there is nothing to gate on yet. | |
| 20 | + | |
| 21 | +## Measurement (step 1, before any edit) | |
| 22 | + | |
| 23 | +`EC_OBMCREC=1 decode_probe` on the three 2 s cuts of the 10-bit 1920x792 | |
| 24 | +128-superblock stream: | |
| 25 | + | |
| 26 | +| cut | shape | mi | skip | | |
| 27 | +|---|---|---|---| | |
| 28 | +| t900 | 128x64 | (128,416) | false | | |
| 29 | +| t5400 | 128x64 | (192,0) | false | | |
| 30 | +| t8100 | 128x64 | (192,0) | false | | |
| 31 | + | |
| 32 | +EVIDENCE: ~/.cache/rectres-tmp/{t900,t5400,t8100}.obu | EC_OBMCREC=1 decode_probe per cut | 3/3 arrive as a non-skip 128x64, premise shape confirmed | |
| 33 | + | |
| 34 | +## Cross-decoder ladder -- the premise is stale | |
| 35 | + | |
| 36 | +`t900` truncated to its first 2 frames (`census6/trunc.py`, | |
| 37 | +`~/.cache/inter128intra-tmp/t900_2.obu`, 85285 B), ours | |
| 38 | +`EC_TRACE_MODE_STEP=1` vs `~/.cache/aom-oracle/build/aomdec` | |
| 39 | +`EC_TRACE_MODE=1 EC_TRACE_MODE_STEP=1`: | |
| 40 | + | |
| 41 | +- **Key frame exact**: the ordered `EC_IMODE mi_row/mi_col` sequence is | |
| 42 | + identical for all 2704 blocks (ours has 184 extra lines, all from frame 2's | |
| 43 | + intra-in-inter blocks, which aomdec does not print at all). | |
| 44 | +- **Frame 2 last common symbol**: `mi_row=24 mi_col=312 name=tx_depth rng=38975` | |
| 45 | + -- byte-identical in both traces. | |
| 46 | +- **First divergence**: the very next superblock, mi(0,320) (pixel 1280,0). | |
| 47 | + aomdec reads INTRA `tx_depth` for small blocks -- | |
| 48 | + `(0,320) val=1 ctx=0 cat=1 rng=54736`, `(0,322) rng=53468`, `(0,324)`, | |
| 49 | + `(2,324)`, `(4,320)`, `(5,320)`… -- while ours reads var-tx | |
| 50 | + `txfm_split_rect mi=(2,324) ctx=12 rng=53248` then | |
| 51 | + `txfm_split mi=(4,324) ctx=13 rng=46998`, i.e. we take that block as INTER | |
| 52 | + where libaom has intra. None of our three rng values (53248 / 46998 / 37590) | |
| 53 | + occurs anywhere in the reference's frame-2 trace. | |
| 54 | +- mi(0,320) is decoded **hundreds of blocks before** mi(128,416) in the same | |
| 55 | + frame, and main's build walks the same path (it refuses only later, at | |
| 56 | + mi(128,416)) -- so the desync is PRE-EXISTING on main `5dd3dcb`, not caused by | |
| 57 | + this lane, and the "128x64 intra in an inter frame" shape at that mi is what | |
| 58 | + the desync produced. | |
| 59 | + | |
| 60 | +EVIDENCE: ~/.cache/inter128intra-tmp/{ours.trace,aom.trace,o.f2,a.f2} | trunc t900 to 2 frames, EC_TRACE_MODE_STEP ours vs instrumented aomdec | key frame 2704/2704 blocks identical; frame 2 diverges at SB mi(0,320), last common rng=38975 at mi(24,312) | |
| 61 | + | |
| 62 | +## What changed (all inert unless `EC_INTRA128_IN_INTER=1`) | |
| 63 | + | |
| 64 | +- `crates/ec-av1/src/decode.rs:7389` `decode_intra_rect_in_inter`: new | |
| 65 | + `bw.max(bh) == 128` arm -- sets `INTRA_IN_INTER_MODE = Some((3, skip))` | |
| 66 | + (`size_group_lookup` common_data.h:61 puts BLOCK_128X64/64X128/128X128 in | |
| 67 | + group 3, verified in the oracle tree) and calls the key frame's own | |
| 68 | + `decode_block_128rect`, whose `tx_size_cat3` row is already the category a | |
| 69 | + 128-axis block reads (`max_txsize_rect_lookup` caps at TX_64X64). | |
| 70 | +- `crates/ec-av1/src/decode.rs:11609` `decode_block_128rect`: the `tx_depth` | |
| 71 | + context comes from `tx_size_context_txfm_rect(.., bw.min(64), bh.min(64))` | |
| 72 | + when the block is intra-in-inter (libaom `get_tx_size_context` compares the | |
| 73 | + TXFM_CONTEXT bands against `tx_size_wide/high[max_txsize_rect_lookup[bsize]]` | |
| 74 | + = 64 here), and the block publishes `set_txfm_ctxs` over its own footprint | |
| 75 | + (`txfm_partition_update_rect`) -- the two inter-frame differences the key | |
| 76 | + frame does not have. Key-frame behaviour is untouched (`in_inter == false`). | |
| 77 | +- `crates/ec-av1/src/decode.rs:11519` `INTRA128_IN_INTER_HITS` + | |
| 78 | + `crates/ec-av1/src/stream.rs:156` `intra128_in_inter_counters()` + | |
| 79 | + `crates/ec-av1/examples/decode_probe.rs:81` prints | |
| 80 | + `intra128_in_inter: 128x64=.. 64x128=..`. | |
| 81 | + | |
| 82 | +## Recipe sweep -- aomenc never picked the shape | |
| 83 | + | |
| 84 | +`--sb-size=128 --min-partition-size=64 --enable-rect-partitions=1 | |
| 85 | +--kf-max-dist=100 --end-usage=q --cpu-used=0 --lag-in-frames=0 --limit=6` | |
| 86 | +over 256x256 8-bit sources: | |
| 87 | + | |
| 88 | +| source | cq | frames | intra128_in_inter | inter_128x64 | | |
| 89 | +|---|---|---|---|---| | |
| 90 | +| full-frame temporal noise (`noise=alls=90:allf=t+u:all_seed=43`) | 32 | 6 OK | 0 | 0 | | |
| 91 | +| same | 55 | 6 OK | 0 | 0 | | |
| 92 | +| static gray + two 256x64 noise bands at y=64,192 (forces a HORZ split with one intra half) | 20 | 6 OK | 0 | 0 | | |
| 93 | +| same | 45 | 6 OK | 0 | 0 | | |
| 94 | + | |
| 95 | +The decoder-side `inter_128x64` counter is 0 in every arm: aomenc did not | |
| 96 | +choose the 128-root HORZ/VERT partition in an inter frame at all, so this is a | |
| 97 | +partition-choice problem, not an intra/inter one -- a gate needs either a | |
| 98 | +recipe that produces the partition first, or the film-prefix fixture route | |
| 99 | +(blocked by the desync above). | |
| 100 | + | |
| 101 | +EVIDENCE: ~/.cache/inter128intra-tmp/{g_32,g_55,h_20,h_45}.obu | aomenc 4 arms + decode_probe | 4/4 decode OK 6 frames, 128-root rect partitions 0/4 | |
| 102 | + | |
| 103 | +## Film cuts (10-bit 1920x792 128-SB, 2 s each) | |
| 104 | + | |
| 105 | +| cut | default (refusal untouched) | with `EC_INTRA128_IN_INTER=1` | | |
| 106 | +|---|---|---| | |
| 107 | +| t900 | intra-coded 128x64 block on the inter block path | Golomb tail; 128x64=0 (desync kills it inside the first such block) | | |
| 108 | +| t5400 | intra-coded 128x64 block on the inter block path | Golomb tail; 128x64=453 64x128=20 | | |
| 109 | +| t6300 | Golomb tail (unchanged from main) | Golomb tail; 0 | | |
| 110 | +| t8100 | intra-coded 128x64 block on the inter block path | Golomb tail; 128x64=30 | | |
| 111 | + | |
| 112 | +The opt-in numbers are NOT a capability claim: every one of those blocks is | |
| 113 | +downstream of the same class of upstream desync proven for t900, and the | |
| 114 | +"Golomb tail" wall is itself a desync symptom (`refusal-hides-a-defect`). | |
| 115 | + | |
| 116 | +EVIDENCE: ~/.cache/rectres-tmp/{t900,t5400,t6300,t8100}.obu | decode_probe with and without EC_INTRA128_IN_INTER=1 | default stop strings identical to main; opt-in advances past the shape into a Golomb wall | |
| 117 | + | |
| 118 | +## Suite | |
| 119 | + | |
| 120 | +`cargo test -p ec-av1 --lib` under systemd unit | |
| 121 | +`inter128intra-suite-r1-1788367879` (MemoryMax=10G), | |
| 122 | +log `$HOME/.cache/inter128intra-suite.log`: **424 passed; 1 failed; 37 ignored** in 702 s. | |
| 123 | + | |
| 124 | +The single failure is | |
| 125 | +`real_aomenc_1to4_streams_decode_pixel_exact_and_rect_vartx_leaves_fire_before_a_named_refusal` | |
| 126 | +("the rectangular var-tx leaf arm never fired 32x16=0 16x32=0, 0 refusals") -- | |
| 127 | +PRE-EXISTING and already recorded on the base of the previous lane | |
| 128 | +(lanes/obmcrec-r1.report.md, verified there in a detached worktree on | |
| 129 | +`beecb64`); the totals here are byte-identical to that round's. This lane's | |
| 130 | +whole diff is inert without `EC_INTRA128_IN_INTER=1`, which no test sets, so it | |
| 131 | +cannot move any counter. Every gate named in the charter (`sb128`, | |
| 132 | +`intra_rect_block`, `gathered_edge`, `refusal_inventory`, `gate_coverage`) is | |
| 133 | +inside those 424 passes. | |
| 134 | + | |
| 135 | +## Residue | |
| 136 | + | |
| 137 | +- fix-now (own lane, blocks this one): the frame-2 desync at SB mi(0,320) of | |
| 138 | + the 2 s cut at 900 s -- last common symbol mi(24,312) `tx_depth` rng=38975, | |
| 139 | + first divergence one superblock later where aomdec has intra blocks with | |
| 140 | + `cat=1` at (0,320)/(0,322)/(0,324)/(2,324) and ours reads var-tx | |
| 141 | + `txfm_split_rect` at (2,324). Truncated 2-frame witness pinned at | |
| 142 | + `~/.cache/inter128intra-tmp/t900_2.obu`; both traces kept next to it. | |
| 143 | +- deferred: the gate for this arm -- needs a recipe that makes aomenc pick a | |
| 144 | + 128-root HORZ/VERT partition in an INTER frame (0/4 attempts here), or a film | |
| 145 | + prefix whose counter is > 0 with the stream proven exact up to it (blocked by | |
| 146 | + the desync above). | |
| 147 | +- accepted: `128x128` NONE intra-in-inter was not swept -- it never reaches | |
| 148 | + `decode_intra_rect_in_inter` (that path is entered only when | |
| 149 | + `write_w != side`), so it is a different call site with its own residue. |
lanes/t900-r1.handoff.mdadded+100 -0
| @@ -0,0 +1,100 @@ | ||
| 1 | +# lane-t900 r1 handoff -- 1:4 intra strips in an inter frame never published their TXFM_CONTEXT bands | |
| 2 | + | |
| 3 | +Branch `lane-t900` (base main `5dd3dcb`), worktree `edith_codecs-t900`, | |
| 4 | +`CARGO_TARGET_DIR=$HOME/.cache/cargo-target-t900`. | |
| 5 | +Witness: `~/.cache/inter128intra-tmp/t900_2.obu` (2-frame cut of the 10-bit | |
| 6 | +1920x792 128-superblock stream at 900 s). Ladders regenerated in one round in | |
| 7 | +`~/.cache/t900-tmp/` (`o3.trace` ours `EC_TRACE_PART=1 EC_TRACE_MODE_STEP=1 | |
| 8 | +EC_TRACE_MODE=1`, `aom.trace` aomdec `EC_TRACE=1 EC_TRACE_MODE=1 | |
| 9 | +EC_TRACE_MODE_STEP=1`). | |
| 10 | + | |
| 11 | +## First diverging element -- before | |
| 12 | + | |
| 13 | +Last common symbol: `mi(24,312) tx_depth rng=38975` (filter-intra 32x32). | |
| 14 | +First differing element, one superblock later: | |
| 15 | + | |
| 16 | +| | ours | aomdec | | |
| 17 | +|---|---|---| | |
| 18 | +| `mi(0,320)` `tx_depth` (BLOCK_8X16, cat 1) | val=1 **ctx=1** rng=**39156** | val=1 **ctx=0** rng=**54736** | | |
| 19 | + | |
| 20 | +Same VALUE, different CDF ROW -> different range. `EC_TXCTX mi=0,320 | |
| 21 | +own=8x16 ... left_txfm=32 left=true` -- our left TXFM band held 32 where | |
| 22 | +libaom's `set_txfm_ctxs` had written 8. | |
| 23 | + | |
| 24 | +## Root cause | |
| 25 | + | |
| 26 | +The block left of `mi(0,320)` is the first 32x8 strip of a `PARTITION_HORZ_4` | |
| 27 | +at `mi(0,312)` -- an INTRA strip inside an INTER frame, decoded through the | |
| 28 | +key frame's own body (`decode_block_rect4`). libaom runs `set_txfm_ctxs` + | |
| 29 | +`txfm_partition_update` for EVERY block of an inter frame, intra ones | |
| 30 | +included; the 2:1 arm and the 16x4 arm of `decode_intra_rect_in_inter` do that | |
| 31 | +at their call sites (the transform size comes back to them), but the **1:4 | |
| 32 | +arms** (`decode_block_rect4` for 32x8/8x32, `decode_block_rect64` for | |
| 33 | +64x16/16x64) keep the size inside and published nothing, so both bands stayed | |
| 34 | +stale across the strip's footprint for the rest of the frame. | |
| 35 | +Classes: `tx-grid-published-block-side`, `early-return-skips-tail`. | |
| 36 | + | |
| 37 | +## Fix (path:line, this branch) | |
| 38 | + | |
| 39 | +- `crates/ec-av1/src/decode.rs` `publish_txfm_bands_if_in_inter()` (new, next | |
| 40 | + to `txfm_partition_update_rect`): `txfm_partition_update_rect` + both | |
| 41 | + `above_txfm`/`left_txfm` band writes, a no-op unless `INTRA_IN_INTER_MODE` | |
| 42 | + is set (key frames unchanged, bands unread there). | |
| 43 | +- called right after the depth symbol resolves in `decode_block_rect4` | |
| 44 | + (32x8/8x32) and in `decode_block_rect64` (64x16/16x64) -- depth 0 included, | |
| 45 | + which is the measured case. | |
| 46 | +- three new `EC_TRACE_MODE_STEP` rungs in `decode_intra_rect_in_inter` | |
| 47 | + (`y_mode`, `uv_mode`, `tx_depth` with ctx/cat): that arm read six mode | |
| 48 | + symbols with no rung of its own, so a bisection could previously only see | |
| 49 | + the block's first coefficient. | |
| 50 | + | |
| 51 | +## Ladder -- after | |
| 52 | + | |
| 53 | +`mi(0,320)` `tx_depth val=1 ctx=0 cat=1 rng=54736` == aomdec; | |
| 54 | +`mi(0,322)` `rng=53468` == aomdec; next partition `mi(0,324) bsize=6 rng=36404` | |
| 55 | +== aomdec. The superblock at mi(0,320) now matches element for element. | |
| 56 | + | |
| 57 | +Next difference in the deduped range ladder is at `mi(0,152)` (ours@15464 / | |
| 58 | +aom@19643): aomdec prints `motion_mode val=2` (WARPED_CAUSAL) + `interp` for | |
| 59 | +the 32x16 HORZ half, ours prints `txfm_split_rect` -- but BOTH decoders are | |
| 60 | +back at `rng=37626` on the next block `mi(4,152)` and at `rng=37736` for its | |
| 61 | +mv, so this is a RUNG-SET artifact (ours reads motion_mode without a rung), | |
| 62 | +not a proven divergence. Confirm with a rung before treating it as a defect. | |
| 63 | + | |
| 64 | +## State of the cut | |
| 65 | + | |
| 66 | +- default path: `decode_probe` now walks frame 2 to the known 128x64 wall -- | |
| 67 | + `REFUSED: an intra-coded 128x64 block on the inter block path` (that arrival | |
| 68 | + is no longer downstream of a desync; the r1 report's "premise is a | |
| 69 | + downstream artifact" verdict is now STALE). | |
| 70 | +- `EC_INTRA128_IN_INTER=1`: **`OK: 1 frames decoded, 1920x792`, | |
| 71 | + `intra128_in_inter: 128x64=15`** -- the whole 2-frame cut decodes, where r1 | |
| 72 | + measured a Golomb-tail wall with 128x64=0. | |
| 73 | + | |
| 74 | +## Next step (in order) | |
| 75 | + | |
| 76 | +1. Pixel-compare the 2-frame cut vs ffmpeg (`EC_PROBE_OUT16`, census6/run6.sh | |
| 77 | + recipe) with and without `EC_INTRA128_IN_INTER=1`. | |
| 78 | +2. Re-run the full 2 s cuts `~/.cache/rectres-tmp/{t900,t5400,t6300,t8100}.obu` | |
| 79 | + (frames, stop string, per-frame exact). | |
| 80 | +3. If the firing frame is exact, pin the smallest exact prefix | |
| 81 | + (census4/trunc.py) as `crates/ec-av1/fixtures/reelc_intra128_witness.obu` | |
| 82 | + (`git add -f` + sha256), gate every plane / every decode-order frame with a | |
| 83 | + hard counter assert, lift the refusal, drop `EC_INTRA128_IN_INTER`, update | |
| 84 | + `refusal_inventory.rs` + `gate_coverage.rs`. | |
| 85 | +4. Full suite as a systemd unit (COMMON recipe). NOT RUN this round. | |
| 86 | +5. Sibling sweep owed: every other caller of `decode_block_rect4` / | |
| 87 | + `decode_block_rect64` under `INTRA_IN_INTER_MODE`, and the same | |
| 88 | + publication question for `decode_block_rect` (2:1 key-frame body) if it is | |
| 89 | + ever reached in-inter. | |
| 90 | + | |
| 91 | +## Deviations | |
| 92 | + | |
| 93 | +- Charter forbids rebase/merge, COMMON requires rebasing onto main first: the | |
| 94 | + charter wins, so this branch is still on `5dd3dcb` and does NOT carry main's | |
| 95 | + `5d81a67` (vartxsplit) commits. The coordinator's note that main fixed | |
| 96 | + `decode_block_rect4`'s three exits refers to the frame36 r2 work already in | |
| 97 | + this base (`6202717`); that fix covers the SPLIT/return tails, not the | |
| 98 | + inter-frame band publication fixed here -- verified by the measured stale | |
| 99 | + `left_txfm=32`. | |
| 100 | +- Suite not run (coordinator instruction). `cargo check -p ec-av1` clean. |
lanes/t900-r2.handoff.mdadded+136 -0
| @@ -0,0 +1,136 @@ | ||
| 1 | +# lane-t900 r2 handoff -- in-inter rect tx-depth context; next wall is the chroma txb_skip ctx | |
| 2 | + | |
| 3 | +Branch `lane-t900`, worktree `edith_codecs-t900`, | |
| 4 | +`CARGO_TARGET_DIR=$HOME/.cache/cargo-target-t900` (a second `-t900-b` dir was | |
| 5 | +used for `cargo check` while the suite unit held the first). | |
| 6 | + | |
| 7 | +## STEP 1 -- merge of main `5d81a67` (commit `85ce8ff`) | |
| 8 | + | |
| 9 | +One conflict, `crates/ec-av1/src/decode.rs`, in the 2:1 intra-in-inter | |
| 10 | +`tx_depth` rung: HEAD's cached `step_trace` bool vs main's inline | |
| 11 | +`std::env::var_os("EC_TRACE_MODE_STEP")`. Resolved to HEAD's `step_trace` | |
| 12 | +(same condition, one env read per block instead of per symbol). | |
| 13 | + | |
| 14 | +Publication per exit: NOT one write per exit, but every write is IDENTICAL. | |
| 15 | +`publish_txfm_bands_if_in_inter` sits right after the depth symbol in | |
| 16 | +`decode_block_rect4` / `decode_block_rect64` and covers every later exit; | |
| 17 | +frame36's `txfm_partition_update_rect` tails sit before the split arms' | |
| 18 | +`return Ok(...)`. Both write `depth_to_tx_wh(bw, bh, depth)` over the same | |
| 19 | +(bw,bh) footprint, so the split arms write the same bytes twice -- idempotent, | |
| 20 | +no double-update hazard. Left as-is deliberately (removing either one loses a | |
| 21 | +different exit). `publish_txfm_bands_if_in_inter` itself also duplicates | |
| 22 | +`txfm_partition_update_rect`'s two loops with the same values; harmless. | |
| 23 | + | |
| 24 | +`cargo check -p ec-av1`: clean. Re-ladder of `t900_2.obu` after the merge: | |
| 25 | +`mi(0,320) tx_depth val=1 ctx=0 cat=1 rng=54736` still == aomdec, r1's fix | |
| 26 | +survived the merge. | |
| 27 | + | |
| 28 | +## STEP 2 -- ROOT CAUSE FOUND AND FIXED (commit after this file) | |
| 29 | + | |
| 30 | +The in-inter `tx_depth` CDF row of a 1:4 strip came from the KEY FRAME's | |
| 31 | +deblock-grid approximation (`tx_size_context_rect`) instead of the real | |
| 32 | +`TXFM_CONTEXT` bands (`tx_size_context_txfm_rect`). The 2:1 arm | |
| 33 | +(decode.rs:7660) and the 16x4 strip (`decode_rect4_16_strip`) already switched | |
| 34 | +on `INTRA_IN_INTER_MODE`; `decode_block_rect4`, `decode_block_rect64`, | |
| 35 | +`decode_block_rect` and (sweep) `decode_leaf_rect`, `decode_leaf_rect8` did | |
| 36 | +not. | |
| 37 | + | |
| 38 | +Measured on the 2-frame cut (10-bit 1920x792, 128-superblock), decode-order | |
| 39 | +frame 1: the 32x8 `PARTITION_HORZ_4` strip at mi(48,176) read `tx_size_cat2` | |
| 40 | +row 1 where libaom reads row 2 (`EC_TXCTX ... above_px=16 left_px=32 ctx=1` | |
| 41 | +vs aomdec `ctx=2`). Ladder before: sustained divergence from mi(48,176). | |
| 42 | +Ladder after: exact through mi(40,221) (`tx_depth val=0 ctx=2 cat=1 | |
| 43 | +rng=40539` == aomdec), ~230 more oracle symbols. | |
| 44 | + | |
| 45 | +New rungs added so a ladder can see the symbol at all (this is what made r1's | |
| 46 | +bisection stop one block short): `EC_ISTEP ... name=tx_depth val= ctx= cat=` | |
| 47 | +in `decode_block_rect4` (cat 2), `decode_block_rect` (cat 2), | |
| 48 | +`decode_block_rect64` (cat 3), `decode_rect4_16_strip` (cat 1). | |
| 49 | + | |
| 50 | +## NEXT DIVERGENCE (exact, do not re-bisect) | |
| 51 | + | |
| 52 | +Block mi(40,222): strip 2 of a `PARTITION_VERT_4` of the 16x16 at mi(40,220) | |
| 53 | +(four 4x16 strips, cols 220..223; strip 0 inter, 1..3 intra-in-inter). | |
| 54 | +Everything through strip 1's luma TU matches. The first differing symbol is | |
| 55 | +strip 1's CHROMA `all_zero` (txb_skip): | |
| 56 | + | |
| 57 | +| | ours | aomdec | | |
| 58 | +|---|---|---| | |
| 59 | +| plane 1 `all_zero` (entry rng=37582) | ctx base **1** -> rng **37384** | ctx **9** (= base 2 + chroma offset 7) -> rng **51992** | | |
| 60 | +| plane 2 `all_zero` | ctx base 1 -> rng 36800 | ctx 9 -> rng 33312 | | |
| 61 | + | |
| 62 | +Same VALUES (1 then 0), different CDF ROW. Our chroma skip ctx is built at | |
| 63 | +`decode_rect4_16_strip`'s chroma call (`let skip_ctx = usize::from(around[plane].0) | |
| 64 | ++ usize::from(around[plane].1)`, decode.rs ~9480, feeding `read_coeffs_rect` | |
| 65 | +with `TxbSet::ChromaRect8x4`): the base is 1 where libaom's `get_txb_ctx` | |
| 66 | +gathers 2. The suspect is the chroma entropy-context map an INTER neighbour | |
| 67 | +writes (the strip's left/above chroma neighbour here is an inter block), i.e. | |
| 68 | +class `new-map-ignores-tile-edge` / `context-read-from-one-cell` on the chroma | |
| 69 | +side -- verify with `EC_DCDUMP`/`around_mi_rect` on the pair mi, and check | |
| 70 | +whether the inter chroma TU path records that map at all. Reproduce: | |
| 71 | + | |
| 72 | + systemd-run --user --scope -q -p MemoryMax=6G env EC_INTRA128_IN_INTER=1 \ | |
| 73 | + EC_TRACE_COEFF=1 <target>/release/examples/decode_probe \ | |
| 74 | + ~/.cache/inter128intra-tmp/t900_2.obu 2>&1 | grep -n 'entry=37582' | |
| 75 | + | |
| 76 | + (oracle: `EC_TRACE_COEFF=1 ~/.cache/aom-oracle/build/aomdec --codec=av1 \ | |
| 77 | + -o /dev/null ~/.cache/inter128intra-tmp/t900_2.obu`, line ~475902.) | |
| 78 | + | |
| 79 | +## Film state (decode-order frame compare vs instrumented aomdec, EC_AV1_FINAL_DUMP) | |
| 80 | + | |
| 81 | +| cut | aomdec frames | ours | f0 | first differing frame | | |
| 82 | +|---|---|---|---|---| | |
| 83 | +| 2-frame cut of the 900 s cut | 2 | OK 1 shown | EXACT | 1 (1924240 B, was 2134171 B before the fix) | | |
| 84 | +| 2 s at 900 s | 267 | REFUSED Golomb tail after 2 | EXACT | 1 | | |
| 85 | +| 2 s at 5400 s | 275 | REFUSED Golomb tail after 10 | EXACT | 1 | | |
| 86 | +| 2 s at 6300 s | 125 | (run cut short) | EXACT | 1 | | |
| 87 | + | |
| 88 | +So the intra128 witness route is still blocked: no cut is exact through a | |
| 89 | +frame that fires `intra128_in_inter`, therefore NO fixture was pinned, NO | |
| 90 | +refusal was lifted, and `refusal_inventory.rs` / `gate_coverage.rs` are | |
| 91 | +untouched. `EC_INTRA128_IN_INTER` remains opt-in. | |
| 92 | + | |
| 93 | +## Suite | |
| 94 | + | |
| 95 | +Unit `t900-suite-r2-1788370358` (MemoryMax=10G), log `$HOME/.cache/t900-suite.log`, | |
| 96 | +was still running at the turn cap and is INCOMPLETE. What it had produced: | |
| 97 | +`a_10bit_film_frames_with_intra_16x4_strips_and_rect64_corner_tus_decode_pixel_exact` | |
| 98 | +**FAILED** (no panic text captured yet -- the log was mid-run). That gate is | |
| 99 | +the prime suspect for the `decode_block_rect64` / `decode_leaf_rect*` arms of | |
| 100 | +the ctx switch: re-run it FIRST | |
| 101 | + | |
| 102 | + CARGO_TARGET_DIR=$HOME/.cache/cargo-target-t900 EC_NOMEMGUARD=1 \ | |
| 103 | + EC_AV1_REQUIRE_AOMENC=1 cargo test -p ec-av1 --lib \ | |
| 104 | + a_10bit_film_frames_with_intra_16x4_strips_and_rect64_corner_tus -- --nocapture | |
| 105 | + | |
| 106 | +and, if it is this lane's change, bisect the switch per reader (rect4 alone is | |
| 107 | +the measured one; rect64 / rect / leaf_rect / leaf_rect8 were a class sweep | |
| 108 | +with no measurement of their own -- reverting those four is the cheap | |
| 109 | +fallback). Note the sweep commit is SEPARATE from the measured rect4/rect64 | |
| 110 | +commit for exactly that reason. | |
| 111 | + | |
| 112 | +## Next step list | |
| 113 | + | |
| 114 | +1. Re-run the failing 16x4/rect64 gate; if red from this lane, bisect the five | |
| 115 | + ctx switches (rect4 is measured; the other four are unmeasured sweep). | |
| 116 | +2. Full suite as a systemd unit (COMMON recipe) and compare totals with | |
| 117 | + 424 passed / 1 pre-existing failure / 37 ignored. | |
| 118 | +3. Fix the chroma txb_skip ctx above; re-run the decode-order compare | |
| 119 | + (`~/.cache/t900-tmp/cmp.sh <name> <obu>`, aomdec+ours EC_AV1_FINAL_DUMP, | |
| 120 | + per-frame byte diff) on `t900_2.obu` until frame 1 is exact. | |
| 121 | +4. Only then: pin the smallest exact firing prefix (census4/trunc.py) as | |
| 122 | + `crates/ec-av1/fixtures/reelc_intra128_witness.obu` (`git add -f`, hash | |
| 123 | + twice), gate every plane of every decode-order frame with a hard | |
| 124 | + `intra128_in_inter` counter assert, lift the refusal, drop | |
| 125 | + `EC_INTRA128_IN_INTER`, update `refusal_inventory.rs` + `gate_coverage.rs`. | |
| 126 | +5. Re-probe `~/.cache/reelc-0-10s.obu` (not run this round). | |
| 127 | + | |
| 128 | +## Artifacts | |
| 129 | + | |
| 130 | +- `~/.cache/t900-tmp/cmp.sh` -- decode-order frame compare (aomdec vs ours). | |
| 131 | +- `~/.cache/t900-tmp/{aom_full.trace,ours_full.trace}` -- mode/part ladders, | |
| 132 | + same round; `{aom_coeff.trace,ours_coeff.trace}` -- `EC_TRACE_COEFF` ladders. | |
| 133 | +- `~/.cache/t900-tmp/cuts.log` -- the film table above. | |
| 134 | +- Ladder matcher: greedy in-order match on `(mi_row, mi_col, name, rng)` of | |
| 135 | + `EC_ISTEP` lines with a 200-entry window -- `difflib` on the deduped rng | |
| 136 | + sequence is USELESS here (our extra rungs make every hunk an insert). |
lanes/t900-r3.handoff.mdadded+127 -0
| @@ -0,0 +1,127 @@ | ||
| 1 | +# lane-t900 r3 handoff -- the non-chroma-reference inter block wiped its neighbours' chroma coefficient contexts | |
| 2 | + | |
| 3 | +Branch `lane-t900`, tip `f9720de` (merge of main `243f125` = `d61ac08`, then | |
| 4 | +the fix). Worktree `edith_codecs-t900`, `CARGO_TARGET_DIR=$HOME/.cache/cargo-target-t900` | |
| 5 | +(a second `-t900-b` dir carried the release `decode_probe` while the gate unit | |
| 6 | +held the first). | |
| 7 | + | |
| 8 | +## STEP 0 -- merge of main `243f125` (commit `d61ac08`) | |
| 9 | + | |
| 10 | +Clean auto-merge, no conflicts (decode.rs + stream.rs + refusal_inventory.rs). | |
| 11 | +`cargo check -p ec-av1`: clean. | |
| 12 | + | |
| 13 | +Gates, unit `t900-gates-r3-1788370694`, log `$HOME/.cache/t900-gates-r3.log`, | |
| 14 | +filter `rect64_corner_tus hidden_arf refusal_inventory gate_coverage 1to4`: | |
| 15 | +**23 passed; 0 failed; 4 ignored** (122 s). Named ones: | |
| 16 | +`a_10bit_film_frames_with_rect64_corner_tus_decode_pixel_exact ... ok`, | |
| 17 | +`a_10bit_film_hidden_arf_with_split_superblock_strips_decodes_pixel_exact ... ok`, | |
| 18 | +every `refusal_inventory::*` and `gate_coverage::*` ok. So r2's five ctx | |
| 19 | +switches did NOT need bisecting -- the r2 red was the pre-rename gate, and the | |
| 20 | +renamed gate (rect64 asserts only) is green as merged. No revert was made. | |
| 21 | + | |
| 22 | +IMPORTANT for reproduction: main's re-added 16x4 refusal means this cut needs | |
| 23 | +**both** `EC_INTRA128_IN_INTER=1` and `EC_INTRA16X4_DECODE=1`; with only the | |
| 24 | +first, `t900_2.obu` stops at the intra 16x4/4x16-in-inter refusal. | |
| 25 | + | |
| 26 | +## ROOT CAUSE (fixed, `f9720de`) | |
| 27 | + | |
| 28 | +libaom codes no chroma transform for a block that is not the chroma reference | |
| 29 | +of its 4:2:0 pair -- `av1_reset_entropy_context`: | |
| 30 | +`nplanes = 1 + (num_planes - 1) * xd->is_chroma_ref` -- so such a block leaves | |
| 31 | +the above/left CHROMA entropy contexts untouched. Our INTER block reader | |
| 32 | +(`decode.rs`, the `record_split_luma_rect_mi` / `record_rect_mi` pair right | |
| 33 | +before the `pair_chroma` block, ~line 22955) wrote all three planes | |
| 34 | +unconditionally, and for a non-chroma-reference strip the chroma grids are the | |
| 35 | +all-zero ones built in the `!has_chroma` arm. So the EVEN 4x16 strip of the | |
| 36 | +`PARTITION_VERT_4` at mi(40,220) cleared the real left-neighbour chroma state, | |
| 37 | +and the PAIR's own `all_zero` then read `txb_skip_ctx` one row low. | |
| 38 | + | |
| 39 | +Measured, decode-order frame 1 of the 2-frame cut | |
| 40 | +`~/.cache/inter128intra-tmp/t900_2.obu` (10-bit 1920x792, 128 SB): | |
| 41 | + | |
| 42 | +| | before | after | aomdec | | |
| 43 | +|---|---|---|---| | |
| 44 | +| chroma `all_zero`, entry rng 37582 | ctx base 1 -> rng 37384 | ctx base **2** -> rng **51992** | ctx 9 (2+7) -> **51992** | | |
| 45 | + | |
| 46 | +`EC_DCDUMP` (now dumping all three planes, not plane 0 only -- without the | |
| 47 | +chroma cells the wipe is invisible) showed it directly: at strip 220's own | |
| 48 | +luma read `left[40..43][1] = Some(true)/1`; at strip 221's read the same cells | |
| 49 | +are `None/0`. The wiper is between them, i.e. strip 220's record. | |
| 50 | + | |
| 51 | +Fix shape: snapshot planes 1/2 of the block's left/above cells when | |
| 52 | +`!has_chroma` and restore them after the recorders run -- equivalent to not | |
| 53 | +writing them, without threading a flag through both recorders. | |
| 54 | + | |
| 55 | +Sibling sweep (class `context-read-from-one-cell` / `new-map-ignores-tile-edge`): | |
| 56 | +`decode_rect4_16_strip` writes chroma only under `if has_chroma`; the sub8 | |
| 57 | +intra rect reader early-returns on `!has_chroma` before its chroma block; | |
| 58 | +`decode_leaf_rect8`/`decode_leaf_split4` use `record_mi_luma*` (plane 0 only). | |
| 59 | +The inter reader was the only unguarded site. | |
| 60 | + | |
| 61 | +## LADDER STATE -- the whole 2-frame cut is now ENTROPY-EXACT | |
| 62 | + | |
| 63 | +Deduped `(all_zero value, rng)` sequence, ours vs instrumented aomdec, both | |
| 64 | +frames: **15865 symbols in each, identical value and range in order, no | |
| 65 | +mismatch**. (Do not diff `tag=eob` across decoders: aomdec prints an eob line | |
| 66 | +where our `read_plane` path prints none; the first "mismatch" at index 25 is | |
| 67 | +that rung-set gap, not a divergence.) | |
| 68 | + | |
| 69 | +## DECODE-ORDER COMPARE (`~/.cache/t900-tmp/cmp.sh`, both under EC_AV1_FINAL_DUMP) | |
| 70 | + | |
| 71 | +`t900_2.obu`: f0 EXACT, f1 differs by **114374 bytes** (was 1924240 before | |
| 72 | +this fix, 2134171 before r2's). The pre-loop-filter dumps (`EC_AV1_PREFILT_DUMP16`, | |
| 73 | +`~/.cache/t900-tmp/d_pf/`) differ too: f0 0 px, f1 105282 px. So what remains | |
| 74 | +is **reconstruction, not entropy** -- Y 82345 px max |d| 111, U 15362 max 148, | |
| 75 | +V 15073 max 162; dominant delta +1 (43448 px), then -1 (9742). | |
| 76 | + | |
| 77 | +## NEXT STEP (exact, do not re-bisect) | |
| 78 | + | |
| 79 | +First differing block in DECODE order (superblock (0,7), x896..1023 y0..127 -- | |
| 80 | +every earlier superblock is pixel-exact in the prefilter dump): | |
| 81 | + | |
| 82 | +* frame 1, mi(24,248) = px(992,96), `EC_PART bsize=9 value=1` (32x32 | |
| 83 | + PARTITION_HORZ -> two 32x16), top half `mode=13` (NEARESTMV) `ref0=5` | |
| 84 | + `mv0=(-166,354)` `motion_mode=0` `interp=0`, no `tx_depth` rung => skip | |
| 85 | + (pure prediction). | |
| 86 | +* Its 32x16 top half is off by **exactly -2 on every one of the 512 pixels** | |
| 87 | + (aom - ours = -2, no dither at all); the bottom 32x16 (rows 112..127, which | |
| 88 | + does carry residual) is a dithered mix of 0/-1/-2. | |
| 89 | +* NOTE the trace disagreement worth one check first: aomdec prints | |
| 90 | + `ref1=0` (INTRA_FRAME => interintra) for this block where OUR `EC_MODE_VAL` | |
| 91 | + prints `ref1=-1` (none), and our counters do report | |
| 92 | + `rect_wedge ... interintra=[5,6,2,4,0,0]` (4 of them 32x16). Either our | |
| 93 | + print normalises INTRA_FRAME to -1, or we are not applying interintra on | |
| 94 | + this block at all -- resolve that before touching the convolve. A uniform | |
| 95 | + (dither-free) offset over a whole skip block means a DC-only difference: | |
| 96 | + an unapplied/extra interintra blend term or an offset in the 10-bit | |
| 97 | + convolve rounding chain, NOT a filter-tap error (taps would dither). | |
| 98 | +* A hand-rolled 8-tap REGULAR prediction from the (exact) f0 reference at | |
| 99 | + mv (-20.75, +44.25) did NOT reproduce either decoder's pixels, so the | |
| 100 | + position/convention of that hand check was wrong -- do not trust it. | |
| 101 | + | |
| 102 | +Not this shape: there is NO intra 16x4/4x16 strip in superblock (0,7) | |
| 103 | +(`EC_INTRA16X4=1` list: nearest are mi cols 320+/172-175), and only 30 of the | |
| 104 | +107 strips in the frame overlap a diff at all -- the reconstruction defect is | |
| 105 | +NOT the 16x4 shape. | |
| 106 | + | |
| 107 | +`intra128_in_inter` is now **0** on this cut (it was 15 in r2, before the | |
| 108 | +chroma-ctx fix): those 128x64 intra-in-inter arrivals were desync artifacts, | |
| 109 | +exactly like wit16x4's phantom counters. So STEP 2 of the r3 charter (pin a | |
| 110 | +`reelc_intra128_witness.obu`, lift the refusal) has **no witness on this cut** | |
| 111 | +and must not be attempted from it. `EC_INTRA128_IN_INTER` stays opt-in; | |
| 112 | +`refusal_inventory.rs` / `gate_coverage.rs` untouched this round. | |
| 113 | + | |
| 114 | +## Not run this round | |
| 115 | + | |
| 116 | +Full suite (coordinator: no suite), the four 2 s cuts | |
| 117 | +(`~/.cache/rectres-tmp/{t900,t5400,t6300,t8100}.obu`) after the fix, and the | |
| 118 | +`~/.cache/reelc-0-10s.obu` re-probe. | |
| 119 | + | |
| 120 | +## Artifacts | |
| 121 | + | |
| 122 | +`~/.cache/t900-tmp/`: `cmp.sh` (now points at the `-t900-b` probe and passes | |
| 123 | +both env vars), `ours2.trace` (`EC_TRACE_COEFF` after the fix), | |
| 124 | +`ours_dc.trace` (`EC_DCDUMP`), `ours3.mode` (`EC_TRACE_MODE`/`EC_TRACE_PART`), | |
| 125 | +`i16.log` (`EC_INTRA16X4` strip list), `aom_coeff.trace` / `aom_full.trace` | |
| 126 | +(aomdec, r2, still valid -- entropy unchanged on that side), | |
| 127 | +`d_pf/` (prefilter dumps both decoders), `d_t900_2/` (final dumps). |
lanes/t900-r4.handoff.mdadded+117 -0
| @@ -0,0 +1,117 @@ | ||
| 1 | +# lane-t900 r4 handoff -- two reconstruction root causes closed; frame 1 is now a chroma-only +/-1 residue | |
| 2 | + | |
| 3 | +Branch `lane-t900`, tip `d068c94`. Worktree `edith_codecs-t900`. | |
| 4 | +`CARGO_TARGET_DIR=$HOME/.cache/cargo-target-t900-b` carried the release | |
| 5 | +`decode_probe` this round. Reproduction still needs BOTH | |
| 6 | +`EC_INTRA128_IN_INTER=1` and `EC_INTRA16X4_DECODE=1`. | |
| 7 | + | |
| 8 | +## STEP 0 -- `git cherry-pick 43e9909` (lane-midcut r1, rect interintra) | |
| 9 | + | |
| 10 | +Clean, no conflicts (`decode_probe.rs`, `decode.rs`, `stream.rs`), commit | |
| 11 | +`5d323a6`. `cargo build -p ec-av1 --release --example decode_probe` clean. | |
| 12 | + | |
| 13 | +Effect on the 2-frame 10-bit 1920x792 128-SB cut | |
| 14 | +`~/.cache/inter128intra-tmp/t900_2.obu`, decode-order compare | |
| 15 | +(`~/.cache/t900-tmp/cmp.sh`, both decoders under `EC_AV1_FINAL_DUMP`): | |
| 16 | + | |
| 17 | +| | f0 | f1 differing bytes | | |
| 18 | +|---|---|---| | |
| 19 | +| r3 tip `f9720de` | EXACT | 114374 | | |
| 20 | +| after `5d323a6` | EXACT | **1549** | | |
| 21 | +| after `d068c94` | EXACT | **258** (chroma only) | | |
| 22 | + | |
| 23 | +So the r3 "next residue" (mi(24,248) 32x16 skip NEARESTMV ref1=INTRA_FRAME, | |
| 24 | +all 512 px off by -2) WAS the square-only interintra blend: it is gone. | |
| 25 | + | |
| 26 | +## ROOT CAUSE 2 (fixed, `d068c94`) -- edge-filter neighbours of the FIRST half | |
| 27 | + | |
| 28 | +`Neighbours::modes_above_left(r, c)` (decode.rs:5677) derives its mi-exact | |
| 29 | +lookup key from the coarse 16x16 cell: `mi_r = r * 4`, `mi_c = c * 4`. The | |
| 30 | +rect intra-in-inter site (decode.rs:7668) called it for BOTH 8x16 halves of a | |
| 31 | +PARTITION_VERT 16x16, so the second half asked for the neighbours of the | |
| 32 | +first. libaom's `above_mbmi`/`left_mbmi` are the block's own | |
| 33 | +(`mi[-mi_stride]`/`mi[-1]`), so `get_intra_edge_filter_type` | |
| 34 | +(reconintra.c:974) came out 0 where libaom has 1, and every directional half | |
| 35 | +whose real above/left neighbour was SMOOTH* filtered its edge at the wrong | |
| 36 | +strength. | |
| 37 | + | |
| 38 | +Witness, decode-order frame 1, block mi(104,234) = px(936,416), 8x16, | |
| 39 | +mode 5 (D113_PRED) angle_delta -1 -> p_angle 110, tx 8x16: | |
| 40 | + | |
| 41 | +* aomdec `EC_PRED ... ft=1`, `EC_PREDOUT sum=43066->41767 row0=325,321,316,...` | |
| 42 | +* ours `OUR_PRED ... ft=0 sum=41742 row0=[325,320,316,...]` | |
| 43 | +* re-running the spec walk in python from the (exact) neighbours with | |
| 44 | + filter type 1 reproduces 41767 exactly, with type 0 reproduces 41742. | |
| 45 | +* the smoking gun (temporary `EC_FT` rung, removed): | |
| 46 | + `mi_r=104 mi_c=232 ... above=11 mie=(11,0)` / `mi_r=104 mi_c=234 ... | |
| 47 | + above=0 coarse=(0,0) mie=(9,0)` -- the mi-exact pair for the block's OWN | |
| 48 | + mi is SMOOTH_PRED(9), the coarse-cell one is DC. | |
| 49 | +* the above neighbours are the two 8x32 strips at mi(96,232) SMOOTH_H(11) | |
| 50 | + and mi(96,234) SMOOTH(9) -- aomdec prints them as `EC_PREDND` (the | |
| 51 | + non-directional early-return), which is why they are missing from an | |
| 52 | + `EC_PRED`-only grep. | |
| 53 | + | |
| 54 | +Fix: `modes_above_left_mi(mi_r, mi_c, modes_above_left(r, c))` at | |
| 55 | +decode.rs:7668 -- the same wrapping decode.rs:26106 and `decode_leaf8` | |
| 56 | +already use. Luma frame-1 residue 1269 px -> 0. | |
| 57 | + | |
| 58 | +`OUR_PRED` now also prints `ft=` so the filter type can be diffed against | |
| 59 | +aomdec's `EC_PRED ... ft=` directly. | |
| 60 | + | |
| 61 | +## SIBLING SITES NOT SWEPT (do this first next round) | |
| 62 | + | |
| 63 | +`modes_above_left(r, c)` has 8 more callers: decode.rs 7813, 9656, 11178, | |
| 64 | +11839, 12162, 13059, 22499, 23664. 12162 already wraps with | |
| 65 | +`modes_above_left_mi(leaf_mi..)`; **13059 has `leaf_mi` in scope and does | |
| 66 | +NOT** -- same shape, sub-8 4x8/8x4 leaves. CAUTION: at 7813 and 13059 the | |
| 67 | +pair also feeds the intra-mode CDF row, so changing it moves the ENTROPY | |
| 68 | +stream -- re-run the ladder, not just the pixels. | |
| 69 | + | |
| 70 | +## CURRENT FIRST-BAD BLOCK (decode order) -- chroma only | |
| 71 | + | |
| 72 | +Pre-loop-filter compare `~/.cache/t900-tmp/pf.sh` (both under | |
| 73 | +`EC_AV1_PREFILT_DUMP16`), analysis `sb.py`/`px.py`/`reg.py` in the same dir: | |
| 74 | +f0 EXACT, f1 Y **0 px**, U 98 px, V 62 px, deltas -2..+3, spread over 11 | |
| 75 | +superblocks, no luma anywhere. | |
| 76 | + | |
| 77 | +First in decode order: SB(0,5), first differing chroma sample (365,48) = | |
| 78 | +luma px(730,96) => mi(24,182). | |
| 79 | + | |
| 80 | +* `EC_MODE mi_row=24 mi_col=182 rng=64328 is_inter=1 skip=0 side=16`, | |
| 81 | + `EC_MODE_VAL mode=14 (NEARMV) ref0=1 ref1=-1 mv0=(22,-44) stack=3 | |
| 82 | + rng=64888`; the block is 8x16 luma (mi cols 182..183) => **4x8 chroma**, | |
| 83 | + i.e. the `w <= 4` narrow-kernel branch. `motion_mode`/`interp` were not | |
| 84 | + captured for it this round. | |
| 85 | +* Signature: luma bit-exact, chroma +/-1 (a few +/-2) scattered -- the | |
| 86 | + memory class `narrow-block-sharp-kernel` (chroma-only +/-1..3 where the | |
| 87 | + chroma width is 4). | |
| 88 | +* NOT captured yet: an `EC_PRED`-style per-stage split for INTER blocks. | |
| 89 | + The r4 EC_PRED capture covers intra prediction only (`EC_PRED` / | |
| 90 | + `EC_PREDND` / `EC_PREDOUT` are all in `reconintra.c`); it showed the intra | |
| 91 | + stage, not the inter one, and it is what closed root cause 2. | |
| 92 | + | |
| 93 | +## EXACT NEXT STEP | |
| 94 | + | |
| 95 | +1. `mc.rs:413/418` already picks `h_narrow`/`v_narrow` on `kern_w <= 4` / | |
| 96 | + `kern_h <= 4`; libaom | |
| 97 | + (`av1_get_interp_filter_params_with_block_size`) tests the X filter | |
| 98 | + against `w` and the Y filter against `h`, REGULAR and SHARP both mapping | |
| 99 | + to `av1_interp_4tap[0]` and SMOOTH to `[1]`. Check what `kern_w`/`kern_h` | |
| 100 | + the CHROMA call passes for an 8x16 luma block (decode.rs ~30542 is the | |
| 101 | + test helper; find the real chroma `mc::predict` call) -- if it passes the | |
| 102 | + LUMA dims, every 4-wide chroma block uses the 8-tap. | |
| 103 | +2. If that is not it, instrument the chroma convolve on both sides | |
| 104 | + (aomdec `av1_convolve_2d_sr_c` / `av1_highbd_...`) and diff the | |
| 105 | + intermediate row for mi(24,182) plane 1. | |
| 106 | +3. Then STEP 1 of the r4 charter (the four 2 s cuts | |
| 107 | + `~/.cache/rectres-tmp/t900/t5400/t6300/t8100.obu`, both env switches, | |
| 108 | + `cmp.sh`), STEP 2 (pin the witness fixture), STEP 3 (named gates + suite). | |
| 109 | + NONE of those ran this round. | |
| 110 | + | |
| 111 | +## Artifacts | |
| 112 | + | |
| 113 | +`~/.cache/t900-tmp/`: `cmp.sh` (final dumps), `pf.sh` (NEW, prefilter | |
| 114 | +dumps), `px.py` (per-plane diff histogram), `sb.py` (per-superblock | |
| 115 | +decode-order first-bad table), `reg.py` (row-by-row diff span), | |
| 116 | +`a5.pred`/`o6.pred` (aomdec `EC_PRED` and our `OUR_PRED`, both frames), | |
| 117 | +`a4.mode`/`o4.mode` (mode traces), `pf_t900_2/`, `d_t900_2/`. |
lanes/t900-r5.handoff.mdadded+144 -0
| @@ -0,0 +1,144 @@ | ||
| 1 | +# lane-t900 r5 handoff -- two root causes closed; 14 exact decode-order frames on the 900 s cut | |
| 2 | + | |
| 3 | +Branch `lane-t900`, tip `2e59d5a4` (3 commits this round, all on top of r4's | |
| 4 | +`28f176cb`). Worktree `edith_codecs-t900`. | |
| 5 | +`CARGO_TARGET_DIR=$HOME/.cache/cargo-target-t900-b` carries the release | |
| 6 | +`decode_probe`. Reproduction still needs BOTH `EC_INTRA128_IN_INTER=1` and | |
| 7 | +`EC_INTRA16X4_DECODE=1`. NO suite was run this round (turn cap) -- `cargo | |
| 8 | +build -p ec-av1 --release --example decode_probe` is clean, `cargo test` | |
| 9 | +UNRUN. That is the first thing the next round must do. | |
| 10 | + | |
| 11 | +## ROOT CAUSE 1 (`e9f287af`) -- the per-plane warp bail-out used the SQUARE side | |
| 12 | + | |
| 13 | +STEP 1 of the charter asked whether `mc::predict`'s kernel choice is wrong | |
| 14 | +for chroma of rect luma blocks. It is NOT. Measured, not assumed: | |
| 15 | + | |
| 16 | +* libaom `av1_get_interp_filter_params_with_block_size` (filter.h:247) takes | |
| 17 | + the X filter from `block_width` and the Y filter from `block_height` | |
| 18 | + (`init_interp_filter_params`, reconinter.h:169-181), `w <= 4` picking | |
| 19 | + `av1_interp_4tap[interp_filter]` -- and `av1_interp_4tap[MULTITAP_SHARP]` | |
| 20 | + is `av1_sub_pel_filters_4`, i.e. the regular 4-tap, exactly what | |
| 21 | + `InterpFilterKind::tables()` (mc.rs:183-190) already returns. | |
| 22 | +* our chroma calls already pass `kern_w = write_chroma_w = write_w / 2` | |
| 23 | + (decode.rs:19803), so an 8x16 luma block's chroma passes `kern_w = 4` and | |
| 24 | + takes the 4-tap horizontally / 8-tap vertically. Correct before this round. | |
| 25 | + | |
| 26 | +The real defect was one rung further down. `EC_MC_TRACE` on the first bad | |
| 27 | +block (`EC_IB px=728 py=96 side=16 w=8 h=16`, mi(24,182)) showed the block | |
| 28 | +is WARPED, not convolved: `EC_MC_WARP x=728 y=96 w=16 h=16` and | |
| 29 | +`EC_MC_WARP x=364 y=48 w=8 h=8` for chroma. libaom `av1_init_warp_params` | |
| 30 | +(reconinter.c:58-60) returns before setting `WARP_PRED` when | |
| 31 | +`inter_pred_params->block_height < 8 || block_width < 8`, and those are the | |
| 32 | +PLANE's own dims -- so in 4:2:0 the chroma of every luma block narrower or | |
| 33 | +shorter than 16 is predicted translationally while its luma warps. Every | |
| 34 | +warp site gated that on `chroma_side` (`side / 2`), which for an 8x16 or | |
| 35 | +16x8 luma block is 8 while the real chroma block is 4x8 / 8x4. | |
| 36 | + | |
| 37 | +Fix: `warp_plane_allowed(w, h)` (decode.rs, next to `cdef_idx_hits`) at all | |
| 38 | +5 chroma sites (single-ref + both compound taps for U and V) and the 3 luma | |
| 39 | +sites, reading `write_chroma_w/h` and `write_w/h`; a counter | |
| 40 | +`decode::warp_plane_suppress_hits()` counts every suppression (gate proof -- | |
| 41 | +NOT yet asserted anywhere, see BELOW). The luma half also matters: a | |
| 42 | +PARTITION_HORZ/VERT strip is `write_w x write_h`, so a 16x4 / 4x16 strip | |
| 43 | +under global motion warped where libaom does not. | |
| 44 | + | |
| 45 | +2-frame cut `~/.cache/inter128intra-tmp/t900_2.obu`, prefilter compare | |
| 46 | +(`~/.cache/t900-tmp/pf.sh` + `sb.py`): | |
| 47 | + | |
| 48 | +| | f0 | f1 Y | f1 U | f1 V | final (cmp.sh) | | |
| 49 | +|---|---|---|---|---|---| | |
| 50 | +| before | EXACT | 0 | 98 | 62 | 258 bytes | | |
| 51 | +| after | EXACT | 0 | **0** | **0** | **0 bytes, both frames EXACT** | | |
| 52 | + | |
| 53 | +## ROOT CAUSE 2 (`4261ea72`) -- the second 128-root HORZ/VERT half read no cdef_idx | |
| 54 | + | |
| 55 | +STEP 3's four 2 s cuts: `~/.cache/rectres-tmp/t900.obu` first differed at | |
| 56 | +decode-order frame 10. A 0.6 s re-cut `~/.cache/t900-tmp/t900_h.obu` | |
| 57 | +(`ffmpeg -c copy -t 0.6`, 16 decode-order frames) reproduces it. | |
| 58 | + | |
| 59 | +Localisation: first differing luma pixel px(192,0) of frame 10 = mi(0,48). | |
| 60 | +The `EC_MODE`-only greedy ladder (`~/.cache/t900-tmp/lad.py`, the r2 recipe | |
| 61 | +restricted to the ONE rung both decoders emit -- `EC_MODE_VAL` is NOT | |
| 62 | +comparable, aomdec prints it after the mv and we print it before the interp | |
| 63 | +filter) is exact through mi(0,32) and splits at mi(0,48): aomdec rng 40079, | |
| 64 | +ours 39850. The coefficient traces of the block in between are | |
| 65 | +IDENTICAL rung for rung and both end at rng 57521, so the divergence is in | |
| 66 | +the pre-mode symbols of the second half -- a literal, invisible to a value | |
| 67 | +ladder (class `literal-width-invisible-to-ladder`). | |
| 68 | + | |
| 69 | +libaom keeps `cdef_transmitted[4]`, one flag per 64x64 CDEF unit of a | |
| 70 | +128x128 superblock, indexed `(mi_col & 16) != 0 + 2 * ((mi_row & 16) != 0)` | |
| 71 | +(`read_cdef`, decodemv.c:50-81), reset only at the SB origin. Ours is a | |
| 72 | +single bool reset per coded piece; the INTER tile loop's 128-root HORZ/VERT | |
| 73 | +arm (decode.rs `sb128_rect`) was the one arm that never reset it between the | |
| 74 | +two halves -- the key-frame loop already did -- so the right half skipped a | |
| 75 | +`cdef_bits`-wide literal. | |
| 76 | + | |
| 77 | +Prefilter compare of the 16-frame cut, differing bytes per decode-order frame: | |
| 78 | + | |
| 79 | +| frame | 10 | 11 | 12 | 13 | 14 | 15 | | |
| 80 | +|---|---|---|---|---|---|---| | |
| 81 | +| before | 2316966 | 1746025 | 1307747 | 2161740 | 1914869 | 2164666 | | |
| 82 | +| after | **0** | **0** | **0** | **0** | 14 | 24 | | |
| 83 | + | |
| 84 | +frames 0..9 exact before and after. | |
| 85 | + | |
| 86 | +## FILM TABLE (decode-order compare, `~/.cache/t900-tmp/cmp.sh`, after both fixes) | |
| 87 | + | |
| 88 | +| cut | frames (aomdec/ours) | first differing frame | bytes there | bad frames | | |
| 89 | +|---|---|---|---|---| | |
| 90 | +| t900 2 s | 267 / 267 | **14** (was 10) | 32 | 234 | | |
| 91 | +| t5400 2 s | 275 / 275 | 1 | 794216 | 273 | | |
| 92 | +| t6300 2 s | 125 / 125 | 1 | 2674129 | 124 | | |
| 93 | +| t8100 2 s | 96 / 32 | 1 | 2027 | 31 + REFUSED "a Golomb tail longer than this decoder reads" at frame 32 | | |
| 94 | +| t900_2 (2 frames) | 2 / 2 | -- | -- | **0, fully exact** | | |
| 95 | + | |
| 96 | +## STEP 2 (modes_above_left sweep) -- NOT DONE | |
| 97 | + | |
| 98 | +No site was changed and no ladder was re-run for it: the two root causes | |
| 99 | +above consumed the round. The r4 table stands unchanged -- callers at | |
| 100 | +decode.rs 7813, 9656, 11178, 11839, 13059, 22499, 23664 are unswept (12162 | |
| 101 | +already wraps, 7668 was fixed in r4), and 7813 / 13059 feed the intra-mode | |
| 102 | +CDF row so they need the r2 rng ladder after any change. | |
| 103 | + | |
| 104 | +## STEP 4/5 (witness fixture, lifts, named gates, suite) -- NOT DONE | |
| 105 | + | |
| 106 | +Nothing was pinned, no refusal was lifted, no gate was written or run, and | |
| 107 | +the suite was not run. `warp_plane_suppress_hits()` exists but has NO | |
| 108 | +assert. Both fixes are currently proven only by the two cuts above. | |
| 109 | + | |
| 110 | +## EXACT NEXT STEP | |
| 111 | + | |
| 112 | +1. `cargo test -p ec-av1 --lib` (systemd unit form, COMMON's SUITE RUNS | |
| 113 | + recipe) -- the round's changes are UNVERIFIED against the suite. The | |
| 114 | + `cdef_transmitted` reset and the warp bail-out both touch shipped gates | |
| 115 | + (grep `warp`, `sb128`, `cdef` in stream.rs); the sibling-gate rule applies. | |
| 116 | +2. Pin a witness. `~/.cache/t900-tmp/t900_h.obu` (177773 bytes, 16 | |
| 117 | + decode-order frames, 15 shown) is the natural one for root cause 2 but | |
| 118 | + its frames 14/15 still differ -- cut it back to 14 decode-order frames | |
| 119 | + (`ffmpeg -c copy -t ~0.52`, hash twice) before pinning, or pin it and | |
| 120 | + assert only what is exact and say so. Counters to hard-assert: | |
| 121 | + `decode::warp_plane_suppress_hits()` (root cause 1), | |
| 122 | + `INTER_SB128_VERT_HITS` / `cdef_idx_hits()` (root cause 2). Gate shape: | |
| 123 | + copy `a_10bit_film_hidden_arf_with_split_superblock_strips_decodes_pixel_exact` | |
| 124 | + (stream.rs:30240) -- fixture read, `decode_stream`, delta-counted | |
| 125 | + counter assert, all shown frames vs `ffmpeg_decode_sequence_10bit`. | |
| 126 | + `git add -f` under crates/ec-av1/fixtures/. | |
| 127 | +3. Next defect on this cut: decode-order frame 14, U plane ONLY, 14 samples | |
| 128 | + (f15: 24), all inside SB(4,7) px(896,512), first chroma sample (472,284) | |
| 129 | + = luma px(944,568) = mi(142,236). Our mode trace has that block as an | |
| 130 | + INTRA block inside an inter frame at 8-px granularity (mi cols 236, 238, | |
| 131 | + 239 on row 142) -- U-only with V exact smells like the CfL alpha or the | |
| 132 | + chroma DC of an intra-in-inter leaf. `~/.cache/t900-tmp/o14.mode` has the | |
| 133 | + trace; frame 14 is the second-to-last block group in it. | |
| 134 | +4. Then t5400 / t6300 / t8100 frame 1 (three separate defects, untouched), | |
| 135 | + and t8100's Golomb-tail refusal at frame 32. | |
| 136 | + | |
| 137 | +## Artifacts | |
| 138 | + | |
| 139 | +`~/.cache/t900-tmp/`: `t900_h.obu` (0.6 s 16-frame cut), `pf.sh` `cmp.sh` | |
| 140 | +`sb.py` `px.py` `reg.py` (as r4), NEW `lad.py` (EC_MODE-only greedy ladder, | |
| 141 | +prints last match + both sides' next line), `a10.mode`/`o10.mode`, | |
| 142 | +`a10.co`/`o10.co` (coefficient traces, 80 MB each), `a10.st` (aomdec | |
| 143 | +`EC_TRACE_MODE_STEP`, has the `motion_mode`/`interp` rungs), `o14.mode`, | |
| 144 | +`pf_t900h/`, `pf_t900_2/`, `d_t900/ d_t5400/ d_t6300/ d_t8100/`. |
lanes/t900-r6.handoff.mdadded+87 -0
| @@ -0,0 +1,87 @@ | ||
| 1 | +# lane-t900 r6 handoff -- witness pinned + gated, 16x4-in-inter opt-in lifted, frame-14 residue localised to ONE chroma TU | |
| 2 | + | |
| 3 | +Branch `lane-t900`, tip `3b4ca61e` (code+gate commit `14e0b20b`, report | |
| 4 | +`3b4ca61e`). Worktree `edith_codecs-t900`. main `243f125e` already merged. | |
| 5 | +`CARGO_TARGET_DIR=$HOME/.cache/cargo-target-t900` (suites) and | |
| 6 | +`$HOME/.cache/cargo-target-t900-b` (release `decode_probe`, and the fast | |
| 7 | +single-gate runs) -- never share one dir between two live builders. | |
| 8 | + | |
| 9 | +## Suite | |
| 10 | + | |
| 11 | +* r5 tip `1bd6f815`: **425 passed, 0 failed, 38 ignored** (`$HOME/.cache/t900-suite-r6.log`). | |
| 12 | +* r6 tip `14e0b20b`: **426 passed, 0 failed, 38 ignored** (`$HOME/.cache/t900-suite-r6b.log`). | |
| 13 | +* Siblings (`interintra hidden_arf rect64_corner_tus sub8 1to4 obmc | |
| 14 | + refusal_inventory gate_coverage`): 39 passed, 0 failed, 4 ignored. | |
| 15 | + | |
| 16 | +## Pinned this round | |
| 17 | + | |
| 18 | +`crates/ec-av1/fixtures/reelc_sb128_inter_witness.obu`, 166303 bytes, sha256 | |
| 19 | +`1191ce80e2c6c5855eaf7a8f5e8cda2cdf809f467b0dbc5e26df96dfa6b2c8bd`. | |
| 20 | +Reproduce: `ffmpeg -ss 900 -t 2 -c:v copy -an -f obu` of the 10-bit 1920x792 | |
| 21 | +128-SB source, then `census4/trunc.py <obu> 19 <out>` (19 frame-carrying OBUs = | |
| 22 | +14 decode-order frames, 12 shown). Two independent cuts hash identically. | |
| 23 | +Gate `a_10bit_128sb_film_frames_with_warp_cdef_and_interintra_decode_pixel_exact` | |
| 24 | +asserts 8 counters > 0 (numbers in the report table) and compares all 12 shown | |
| 25 | +frames on all planes vs ffmpeg. | |
| 26 | + | |
| 27 | +`EC_INTRA16X4_DECODE` is GONE (refusal narrowed back to "no chroma-pair | |
| 28 | +record"). `EC_INTRA128_IN_INTER` STAYS -- 0 hits on the witness. | |
| 29 | + | |
| 30 | +## The open defect (STEP 2), localised much further than r5 had it | |
| 31 | + | |
| 32 | +Stream `~/.cache/t900-tmp/t900_h.obu` (16 decode-order frames, the witness plus | |
| 33 | +2). Frames 0..13 exact; frame 14 = 32 bytes, frame 15 = 28 bytes. | |
| 34 | + | |
| 35 | +PREFILTER (`bash pf.sh h2 ~/.cache/t900-tmp/t900_h.obu`, then `python3 px.py | |
| 36 | +pf_h2 14`): **Y 0, V 0, U 14 pixels**, chroma bbox x 472..475 y 284..287 = ONE | |
| 37 | +aligned 4x4 chroma TU. The block is the 8x8 INTER COMPOUND leaf at luma | |
| 38 | +(944,568) = mi(142,236) (`EC_TRACE_MODE`: `cmode=24 ref0=1 ref1=5`). | |
| 39 | + | |
| 40 | +r5's premise is DISPROVED: it is not intra-in-inter and not CfL -- `EC_PRED=1` | |
| 41 | +on the same run emits NO intra prediction at that chroma position (nearest is | |
| 42 | +x=472 y=288). | |
| 43 | + | |
| 44 | +The 4x4 U difference (aomdec minus ours): | |
| 45 | + | |
| 46 | + [ +4 +5 +6 +8 ] | |
| 47 | + [ -1 0 +3 +6 ] | |
| 48 | + [ -5 -3 0 +5 ] | |
| 49 | + [ -7 -5 -1 +4 ] | |
| 50 | + | |
| 51 | +i.e. one or two low-order AC basis functions, V exact and no later block | |
| 52 | +differing => the msac stream is in sync and only the inverse transform's BASIS | |
| 53 | +is wrong. Class `tx-type-set-membership` (chroma of an inter block inherits the | |
| 54 | +colocated luma `tx_type`; a wrong pick inside the same TX_CLASS leaves the | |
| 55 | +range identical). `reduce_inherited_chroma_tx_type` (decode.rs:14794) and | |
| 56 | +`read_inter_luma8`'s top-left rule (decode.rs:14700) were read and look correct | |
| 57 | +for this shape, so the decisive step is the ORACLE, not another code read: | |
| 58 | + | |
| 59 | + ~/.cache/aom-oracle/src/av1/decoder/decodetxb.c:182 | |
| 60 | + fprintf(stderr, "EC_COEFF_STEP tag=tx_type plane=%d rng=%u\n", plane, r->ec.rng); | |
| 61 | + | |
| 62 | +prints no VALUE. Add `tx_type` (and the eob) to that line, rebuild aomdec | |
| 63 | +(`scripts/build-aom-oracle.sh` -- incremental), and diff the one line for this | |
| 64 | +TU against our `EC_COEFF_STEP tag=tx_type` (decode.rs:4120/4322, which also | |
| 65 | +prints no value -- add it there too). If they agree, the next suspect is the | |
| 66 | +dequant of that unit (U-only means `plane_q_delta(1)` vs `(2)`), NOT the | |
| 67 | +prediction. | |
| 68 | + | |
| 69 | +## Film frontier (2 s cuts, decode-order vs aomdec, this tip) | |
| 70 | + | |
| 71 | +| cut | frames | first differing | bad | stop | | |
| 72 | +|---|---|---|---|---| | |
| 73 | +| t900 | 267/267 | 14 | 234 | -- | | |
| 74 | +| t5400 | 275/275 | 1 | 273 | -- | | |
| 75 | +| t6300 | 125/125 | 1 | 124 | -- | | |
| 76 | +| t8100 | 96/32 | 1 | 31 | "a Golomb tail longer than this decoder reads" | | |
| 77 | + | |
| 78 | +t5400 / t6300 / t8100 frame 1 are three separate untouched defects. The 10 s | |
| 79 | +cut `~/.cache/reelc-0-10s.obu` now stops (no env switches) at "an intra-coded | |
| 80 | +128x64 block on the inter block path". | |
| 81 | + | |
| 82 | +## Artifacts | |
| 83 | + | |
| 84 | +`~/.cache/t900-tmp/`: `t900_w.obu` (the pinned witness), `t900_h.obu` (16 | |
| 85 | +frames), `cmp.sh` (decode-order compare), `pf.sh` (prefilter compare), `px.py` | |
| 86 | +(per-plane diff + bbox + delta histogram), `sb.py`, `reg.py`, `lad.py` | |
| 87 | +(EC_MODE-only cross-decoder ladder), `pf_h2/` (frame 14/15 prefilter dumps). |
lanes/t900-r6.report.mdadded+138 -0
| @@ -0,0 +1,138 @@ | ||
| 1 | +# lane-t900 r6 report -- the 128-SB inter witness is pinned, the intra 16x4-in-inter opt-in is lifted | |
| 2 | + | |
| 3 | +Branch `lane-t900`, tip `14e0b20b` (one commit this round on top of r5's | |
| 4 | +`1bd6f815`; main `243f125e` was already merged, `git merge-base --is-ancestor | |
| 5 | +main HEAD` = yes). | |
| 6 | + | |
| 7 | +## STEP 0 -- suite (the r2-r5 fixes were UNVERIFIED against it) | |
| 8 | + | |
| 9 | +`systemd-run --user --unit=t900-suite-r6-... -p MemoryMax=10G ... cargo test -p | |
| 10 | +ec-av1 --lib -j3` on the r5 tip: | |
| 11 | + | |
| 12 | + test result: ok. 425 passed; 0 failed; 38 ignored; 0 measured; 0 filtered out; finished in 766.69s | |
| 13 | + | |
| 14 | +No FAILED name. None of the five r2-r5 fixes (chroma-context wipe, in-inter | |
| 15 | +tx-depth context, rect interintra, mi-exact edge-filter neighbours, per-plane | |
| 16 | +warp bail-out, 128-root cdef literal) reddened anything. | |
| 17 | + | |
| 18 | +EVIDENCE: $HOME/.cache/t900-suite-r6.log | full ec-av1 lib suite on 1bd6f815 | 425 passed 0 failed 38 ignored | |
| 19 | + | |
| 20 | +## STEP 1 -- the witness, the gate, the lift | |
| 21 | + | |
| 22 | +`crates/ec-av1/fixtures/reelc_sb128_inter_witness.obu`, 166303 bytes, sha256 | |
| 23 | +`1191ce80e2c6c5855eaf7a8f5e8cda2cdf809f467b0dbc5e26df96dfa6b2c8bd`, `git add | |
| 24 | +-f`'d. First 19 frame-carrying OBUs of a 2 s cut taken 900 s into the 10-bit | |
| 25 | +1920x792 `use_128x128_superblock=1` stream: 14 decode-order frames, 12 shown. | |
| 26 | +Cut a SECOND time independently from the source (`-ss 900 -t 2 -c:v copy -f | |
| 27 | +obu` + the same OBU truncation) -- both cuts hash identically, so the fixture is | |
| 28 | +reproducible from the source and not from a scratch file. | |
| 29 | + | |
| 30 | +All 14 decode-order frames byte-exact vs instrumented aomdec | |
| 31 | +(`EC_AV1_FINAL_DUMP`, `~/.cache/t900-tmp/cmp.sh`), all 12 shown frames | |
| 32 | +pixel-exact on every plane vs ffmpeg inside the gate. | |
| 33 | + | |
| 34 | +New gate `a_10bit_128sb_film_frames_with_warp_cdef_and_interintra_decode_pixel_exact` | |
| 35 | +(stream.rs, modelled on the hidden-ARF gate) hard-asserts every counter > 0: | |
| 36 | + | |
| 37 | +| counter | fired | the defect it proves is exercised | | |
| 38 | +|---|---|---| | |
| 39 | +| warp_plane_suppress | 15 | r5: per-plane warp bail-out on the plane's own w/h | | |
| 40 | +| cdef_idx | 763 | r5: the 128-root second half's own `cdef_idx` literal | | |
| 41 | +| inter_sb128_vert | 68 | r5: the 128-root HORZ/VERT inter arm | | |
| 42 | +| interintra_rect | 118 | r4: interintra on a rectangular block | | |
| 43 | +| non_chroma_ref_ctx_skip | 163 | r3: non-chroma-reference block leaves chroma ctx alone (NEW counter) | | |
| 44 | +| intra_in_inter_txctx | 1946 | r2: in-inter tx-depth row from the TXFM_CONTEXT bands (NEW counter) | | |
| 45 | +| edge_filter_mi_fix | 195 | r4: mi-exact intra-edge-filter neighbours (NEW counter) | | |
| 46 | +| intra16x4_in_inter | (78, 149, 108) | the lifted shape: 16x4, 4x16, chroma-paired | | |
| 47 | + | |
| 48 | +Three counters were added this round because those fixes shipped with none. | |
| 49 | + | |
| 50 | +EVIDENCE: crates/ec-av1/fixtures/reelc_sb128_inter_witness.obu | cargo test -p ec-av1 --lib -- a_10bit_128sb_film_frames_with_warp_cdef_and_interintra --nocapture | ok, 12 shown frames pixel-exact, counters 15/763/68/118/163/1946/195 and (78,149,108) | |
| 51 | + | |
| 52 | +REFUSAL LIFTED: the `EC_INTRA16X4_DECODE` opt-in over "an intra 16x4/4x16 strip | |
| 53 | +inside an inter 16x16-level 1:4 partition". lane-wit16x4 r1 re-widened it | |
| 54 | +because lane-sub8x4 r3's witness counters were phantoms of a desync (class | |
| 55 | +`counter-from-refused-stream`); here the arm fires 227 times inside frames that | |
| 56 | +are decoded AND compared exact. `refusal_inventory.rs`'s note and the ignored | |
| 57 | +aomenc gate's `#[ignore]` text updated in the same commit. The named refusal | |
| 58 | +STAYS for a 16x4/4x16 strip with no chroma-pair record and every other sub-8 | |
| 59 | +shape, so the inventory string itself does not move. | |
| 60 | + | |
| 61 | +NOT LIFTED: `EC_INTRA128_IN_INTER` (the 128x64/64x128 intra-in-inter arm). It | |
| 62 | +fires 0 times on this witness (`decode_probe` with only `EC_INTRA16X4_DECODE`: | |
| 63 | +`intra128_in_inter: 128x64=0 64x128=0`), so there is still no witness for it -- | |
| 64 | +lifting it would be a capability claim (class `refusal-lifted-without-a-gate`). | |
| 65 | + | |
| 66 | +Sibling gates re-run (COMMON's SIBLING GATES rule), filters `interintra | |
| 67 | +hidden_arf rect64_corner_tus sub8 1to4 obmc refusal_inventory gate_coverage`: | |
| 68 | + | |
| 69 | + test result: ok. 39 passed; 0 failed; 4 ignored; 0 measured; 421 filtered out; finished in 204.70s | |
| 70 | + | |
| 71 | +## STEP 2 -- frame 14's U-only residue: LOCALISED, NOT FIXED | |
| 72 | + | |
| 73 | +Re-measured on this tip with the 16-frame cut `~/.cache/t900-tmp/t900_h.obu` | |
| 74 | +(the 14-frame witness stops one frame short of it): decode-order frames 0..13 | |
| 75 | +exact, frame 14 = 32 differing bytes, frame 15 = 28. | |
| 76 | + | |
| 77 | +Prefilter compare (`pf.sh`, `~/.cache/t900-tmp/pf_h2/`) narrows it much further | |
| 78 | +than r5's post-filter numbers: | |
| 79 | + | |
| 80 | +* frame 14: **Y 0, V 0, U 14 pixels**, bbox chroma x 472..475, y 284..287 -- | |
| 81 | + exactly ONE 4x4 chroma transform unit, aligned. | |
| 82 | +* frame 15: same superblock, U 24 pixels, bbox x 472..477 y 281..288. | |
| 83 | + | |
| 84 | +That unit is the chroma of the 8x8 inter block at luma (944,568) = mi(142,236), | |
| 85 | +which our `EC_TRACE_MODE` shows as an INTER COMPOUND leaf (`cmode=24 ref0=1 | |
| 86 | +ref1=5`), NOT an intra-in-inter block -- r5's handoff premise ("intra-in-inter | |
| 87 | +8x8, CfL alpha or chroma DC suspected") is DISPROVED twice over: `EC_PRED` emits | |
| 88 | +no intra prediction at that chroma position at all (only at y=288), so CfL | |
| 89 | +cannot be involved. | |
| 90 | + | |
| 91 | +What the shape of the residue rules in and out: | |
| 92 | + | |
| 93 | +* V is exact and comes AFTER U in the same block, and no later block differs -- | |
| 94 | + the entropy stream is in sync. So this is reconstruction, not a symbol. | |
| 95 | +* Y is exact, so it is not the block's motion vectors, its compound mask or its | |
| 96 | + reference; chroma MC is plane-symmetric and would move V too. | |
| 97 | +* The 4x4 diff is a smooth low-order-AC pattern (+4..+8 top-right, -7..-5 | |
| 98 | + bottom-left, see the block dump in the handoff), i.e. one or two AC | |
| 99 | + coefficients' worth of basis, exactly the signature of an inverse transform | |
| 100 | + fed the right coefficients with the WRONG basis -- class | |
| 101 | + `tx-type-set-membership` (an inter chroma unit inherits the colocated luma | |
| 102 | + `tx_type`; a wrong choice inside the same TX_CLASS leaves the msac range | |
| 103 | + untouched and corrupts only the pixels). | |
| 104 | + | |
| 105 | +`reduce_inherited_chroma_tx_type` (decode.rs:14794) and `read_inter_luma8`'s | |
| 106 | +top-left-unit rule (decode.rs:14700) were both read and both look right for | |
| 107 | +this shape, so the next step is the oracle rung, not another code read: the | |
| 108 | +aom oracle prints `EC_COEFF_STEP tag=tx_type plane=%d` with NO value | |
| 109 | +(decodetxb.c:182) -- printing `tx_type` there and diffing that one line for | |
| 110 | +this TU decides it in one run. | |
| 111 | + | |
| 112 | +Disposition: deferred(the oracle's `tag=tx_type` line needs the VALUE printed | |
| 113 | +and aomdec rebuilt) -- everything else about the defect is pinned above. | |
| 114 | + | |
| 115 | +## STEP 3 -- film table (decode-order vs aomdec, 2 s cuts, this tip) | |
| 116 | + | |
| 117 | +| cut | frames aomdec/ours | first differing | bad frames | stop | | |
| 118 | +|---|---|---|---|---| | |
| 119 | +| t900 | 267 / 267 | 14 | 234 | -- | | |
| 120 | +| t5400 | 275 / 275 | 1 | 273 | -- | | |
| 121 | +| t6300 | 125 / 125 | 1 | 124 | -- | | |
| 122 | +| t8100 | 96 / 32 | 1 | 31 | REFUSED "a Golomb tail longer than this decoder reads" | | |
| 123 | +| witness (14 frames) | 14 / 14 | -- | **0** | -- | | |
| 124 | + | |
| 125 | +Unchanged from r5 -- this round added no decode fix, it pinned and gated what | |
| 126 | +r2-r5 found. | |
| 127 | + | |
| 128 | +`~/.cache/reelc-0-10s.obu` (10 s cut) re-probed on this tip with NO env | |
| 129 | +switches: it now runs past the lifted 16x4 shape and stops at | |
| 130 | +`REFUSED: unsupported: AV1 tile (an intra-coded 128x64 block on the inter block | |
| 131 | +path (no size-group/tx-category row for that shape here))`. | |
| 132 | + | |
| 133 | +EVIDENCE: ~/.cache/t900-tmp/d_t900 d_t5400 d_t6300 d_t8100 | cmp.sh on the four 2 s cuts, aomdec EC_AV1_FINAL_DUMP vs decode_probe | first differing decode-order frame 14 / 1 / 1 / 1 | |
| 134 | + | |
| 135 | +## Suite after the round's changes | |
| 136 | + | |
| 137 | +Re-armed on tip `14e0b20b` as `t900-suite-r6b`, log | |
| 138 | +`$HOME/.cache/t900-suite-r6b.log` -- see the handoff for its result line. |