av1: the per-unit bit-interval ladder, and the second 4:4:4 intra-BC witness at full exactness
Browse files at this commita4597ea7f0d82ec33e5af03a5e21a64c31bdfddfParent: 5e5d9ea4 changed files +564 -3
- crates/ec-av1/src/decode.rs +129 -0
- crates/ec-av1/src/msac.rs +9 -0
- crates/ec-av1/src/stream.rs +124 -3
- lanes/av1ibcfork.report.md +302 -0
crates/ec-av1/src/decode.rsmodified+129 -0
| @@ -2388,6 +2388,90 @@ fn census_unit( | |||
| 2388 | ); | 2388 | ); |
| 2389 | } | 2389 | } |
| 2390 | 2390 | ||
| 2391 | +/// lane-av1ibcfork: this decoder's half of the per-unit BIT INTERVAL -- the | ||
| 2392 | +/// exact mirror of the oracle's `EC_ECDUMP_IN` / `EC_ECDUMP_OUT` / | ||
| 2393 | +/// `EC_ECDUMP_END` triple (`aom-oracle2/src/av1/decoder/decodetxb.c`: one | ||
| 2394 | +/// print in `read_coeffs_txb` before and after its `aom_read_symbol`, one in | ||
| 2395 | +/// the single caller `av1_read_coeffs_txb` after the whole unit). | ||
| 2396 | +/// | ||
| 2397 | +/// Why three prints and not one `EC_CENSUS_UNIT`: a COUNT is not a key. The | ||
| 2398 | +/// two sides can walk a different NUMBER of units and still be paired, because | ||
| 2399 | +/// the interval is what a unit CONSUMED. Entry position alone drifts the moment | ||
| 2400 | +/// one side consumes a different number of bits, and list index is invalid the | ||
| 2401 | +/// moment one side misses a unit -- both were measured here and both | ||
| 2402 | +/// mis-attribute. `post_bit` after the `txb_skip` read is the same | ||
| 2403 | +/// `aom_reader_tell` the oracle prints there; `end_bit` is the end of the whole | ||
| 2404 | +/// unit including the optional luma `tx_type`, the eob, the base/BR passes and | ||
| 2405 | +/// the sign/Golomb loop, so a unit that reads the right symbols in the wrong | ||
| 2406 | +/// ORDER is caught too. | ||
| 2407 | +/// | ||
| 2408 | +/// `bit` counts the bits this decoder has pulled out of its window, so it sits | ||
| 2409 | +/// at a CONSTANT offset from the oracle's tell (the OBU header libaom counts | ||
| 2410 | +/// before `aom_reader_init`). The offset is measured per fixture, never | ||
| 2411 | +/// assumed: +14 on `444_intrabc_rect4_witness.obu`. | ||
| 2412 | +#[inline] | ||
| 2413 | +fn unit_iv_on() -> bool { | ||
| 2414 | + crate::envflags::env_flag!("EC_UNITIV") | ||
| 2415 | +} | ||
| 2416 | + | ||
| 2417 | +/// The unit's ENTRY position. Returns it so the caller can pass the same value | ||
| 2418 | +/// to [`unit_iv_skip`] and [`unit_iv_end`] without reading the decoder again. | ||
| 2419 | +#[inline] | ||
| 2420 | +#[track_caller] | ||
| 2421 | +fn unit_iv_in(plane: usize, w: usize, h: usize, ctx: usize, dec: &SymbolDecoder) -> usize { | ||
| 2422 | + if !unit_iv_on() { | ||
| 2423 | + return 0; | ||
| 2424 | + } | ||
| 2425 | + let bit = dec.debug_bitpos(); | ||
| 2426 | + let (mi_r, mi_c) = SymbolDecoder::symr_mi(); | ||
| 2427 | + eprintln!( | ||
| 2428 | + "EC_UNITIV_IN side=ours plane={plane} mi=({mi_r},{mi_c}) w={w} h={h} ctx={ctx} bit={bit} at {}", | ||
| 2429 | + std::panic::Location::caller() | ||
| 2430 | + ); | ||
| 2431 | + bit | ||
| 2432 | +} | ||
| 2433 | + | ||
| 2434 | +/// The position immediately after this unit's `txb_skip` read. `bit_in == | ||
| 2435 | +/// post_bit` means the read consumed ZERO bits (a CDF row already at a | ||
| 2436 | +/// boundary), so this is also the real-read filter: the reader logs a step | ||
| 2437 | +/// either way, and counting raw lines overstates the symbol count ~2x (measured | ||
| 2438 | +/// on `444_intrabc_rect4_witness.obu`: 2395 lines, 512 real reads, against the | ||
| 2439 | +/// oracle's 513 -- not the "~1069 fewer" an earlier round reported). | ||
| 2440 | +#[inline] | ||
| 2441 | +fn unit_iv_skip( | ||
| 2442 | + dec: &SymbolDecoder, | ||
| 2443 | + bit_in: usize, | ||
| 2444 | + plane: usize, | ||
| 2445 | + w: usize, | ||
| 2446 | + h: usize, | ||
| 2447 | + ctx: usize, | ||
| 2448 | + all_zero: bool, | ||
| 2449 | +) { | ||
| 2450 | + if !unit_iv_on() { | ||
| 2451 | + return; | ||
| 2452 | + } | ||
| 2453 | + let (mi_r, mi_c) = SymbolDecoder::symr_mi(); | ||
| 2454 | + eprintln!( | ||
| 2455 | + "EC_UNITIV_SKIP side=ours plane={plane} mi=({mi_r},{mi_c}) w={w} h={h} ctx={ctx} az={} bit={bit_in} post_bit={}", | ||
| 2456 | + all_zero as i32, | ||
| 2457 | + dec.debug_bitpos() | ||
| 2458 | + ); | ||
| 2459 | +} | ||
| 2460 | + | ||
| 2461 | +/// The position after the WHOLE unit. One call per successful read, on both | ||
| 2462 | +/// the all-zero early return and the full coefficient walk. | ||
| 2463 | +#[inline] | ||
| 2464 | +fn unit_iv_end(dec: &SymbolDecoder, plane: usize, w: usize, h: usize, ctx: usize) { | ||
| 2465 | + if !unit_iv_on() { | ||
| 2466 | + return; | ||
| 2467 | + } | ||
| 2468 | + let (mi_r, mi_c) = SymbolDecoder::symr_mi(); | ||
| 2469 | + eprintln!( | ||
| 2470 | + "EC_UNITIV_END side=ours plane={plane} mi=({mi_r},{mi_c}) w={w} h={h} ctx={ctx} end_bit={}", | ||
| 2471 | + dec.debug_bitpos() | ||
| 2472 | + ); | ||
| 2473 | +} | ||
| 2474 | + | ||
| 2391 | // As [`FILTER_INTRA_RECT_HITS`], counting only the strips BELOW 16x16 | 2475 | // As [`FILTER_INTRA_RECT_HITS`], counting only the strips BELOW 16x16 |
| 2392 | // (8x16/16x8 leaves of a 16x16 HORZ/VERT partition, lane-fistrip r1) -- the | 2476 | // (8x16/16x8 leaves of a 16x16 HORZ/VERT partition, lane-fistrip r1) -- the |
| 2393 | // shapes whose `use_filter_intra` symbol had no CDF class before this round. | 2477 | // shapes whose `use_filter_intra` symbol had no CDF class before this round. |
| @@ -4023,6 +4107,7 @@ fn push_mc( | |||
| 4023 | 4107 | ||
| 4024 | /// [`PlaneBuf::reconstruct_mc_rect`], recorded (lane-wave1 step (i)). | 4108 | /// [`PlaneBuf::reconstruct_mc_rect`], recorded (lane-wave1 step (i)). |
| 4025 | #[allow(clippy::too_many_arguments)] | 4109 | #[allow(clippy::too_many_arguments)] |
| 4110 | +#[track_caller] | ||
| 4026 | fn push_mc_rect( | 4111 | fn push_mc_rect( |
| 4027 | plane: usize, | 4112 | plane: usize, |
| 4028 | x: usize, | 4113 | x: usize, |
| @@ -4034,6 +4119,21 @@ fn push_mc_rect( | |||
| 4034 | residual: &[i32], | 4119 | residual: &[i32], |
| 4035 | fctx: &crate::decode::FrameCtx, | 4120 | fctx: &crate::decode::FrameCtx, |
| 4036 | ) { | 4121 | ) { |
| 4122 | + // lane-av1ibcfork: the PUSH site of an MC/inter write. The executed rung | ||
| 4123 | + // (`EC_MCWR`, in `reconstruct_mc_rect`) can only name the dispatch, so | ||
| 4124 | + // this is what names the block decoder that asked for the write -- the | ||
| 4125 | + // only thing that distinguishes two writes of the same shape. It is what | ||
| 4126 | + // localized a 4:4:4 intra-BC SKIP block committing its chroma plane block | ||
| 4127 | + // at `(px/2, py/2)` instead of the ss origin, clobbering a neighbouring | ||
| 4128 | + // block's reconstruction (lanes/av1ibcfork.report.md). | ||
| 4129 | + if crate::envflags::env_flag!("EC_MCPUSH") { | ||
| 4130 | + eprintln!( | ||
| 4131 | + "EC_MCPUSH plane={plane} x={x} y={y} stride={stride} w={w} h={h} \ | ||
| 4132 | + res_len={} at {}", | ||
| 4133 | + residual.len(), | ||
| 4134 | + std::panic::Location::caller() | ||
| 4135 | + ); | ||
| 4136 | + } | ||
| 4037 | let (src, stride) = match prediction.inline(stride) { | 4137 | let (src, stride) = match prediction.inline(stride) { |
| 4038 | Some(v) => v, | 4138 | Some(v) => v, |
| 4039 | None => { | 4139 | None => { |
| @@ -7961,6 +8061,12 @@ fn read_coeffs( | |||
| 7961 | // (which prints `r->ec.rng` before the same `txb_skip` read). | 8061 | // (which prints `r->ec.rng` before the same `txb_skip` read). |
| 7962 | let census_entry_rng = dec.debug_state().0; | 8062 | let census_entry_rng = dec.debug_state().0; |
| 7963 | let (census_w, census_h) = rect_shape.unwrap_or((side, side)); | 8063 | let (census_w, census_h) = rect_shape.unwrap_or((side, side)); |
| 8064 | + // lane-av1ibcfork: the per-unit BIT INTERVAL, the twin of the oracle's | ||
| 8065 | + // `EC_ECDUMP_IN` / `_OUT` / `_END`. The census plane, not a fresh label: | ||
| 8066 | + // it is the same source `census_unit` reads, so the interval line and the | ||
| 8067 | + // census line can never disagree about which plane a unit is on. | ||
| 8068 | + let iv_plane = CENSUS_PLANE.with(|c| c.get()).min(2); | ||
| 8069 | + let iv_bit = unit_iv_in(iv_plane, census_w, census_h, skip_ctx, dec); | ||
| 7964 | if crate::envflags::env_flag!("EC_AV1_EOBPT_CDF") { | 8070 | if crate::envflags::env_flag!("EC_AV1_EOBPT_CDF") { |
| 7965 | let (range, value) = dec.debug_state(); | 8071 | let (range, value) = dec.debug_state(); |
| 7966 | eprintln!("EC_AV1_STATE_BEFORE_TXBSKIP range={range} value={value}"); | 8072 | eprintln!("EC_AV1_STATE_BEFORE_TXBSKIP range={range} value={value}"); |
| @@ -7983,6 +8089,9 @@ fn read_coeffs( | |||
| 7983 | 0 | 8089 | 0 |
| 7984 | }; | 8090 | }; |
| 7985 | let all_zero = dec.symbol(&mut coding.txb_skip[skip_ctx]) == 1; | 8091 | let all_zero = dec.symbol(&mut coding.txb_skip[skip_ctx]) == 1; |
| 8092 | + unit_iv_skip( | ||
| 8093 | + dec, iv_bit, iv_plane, census_w, census_h, skip_ctx, all_zero, | ||
| 8094 | + ); | ||
| 7986 | // lane-ibc444c: this reader logs an `all_zero` step even for a read that | 8095 | // lane-ibc444c: this reader logs an `all_zero` step even for a read that |
| 7987 | // consumes ZERO bits, so `post_bit == bit` means "no symbol was read" -- | 8096 | // consumes ZERO bits, so `post_bit == bit` means "no symbol was read" -- |
| 7988 | // filter on it before pairing anything against the oracle. | 8097 | // filter on it before pairing anything against the oracle. |
| @@ -8029,6 +8138,7 @@ fn read_coeffs( | |||
| 8029 | census_entry_rng, | 8138 | census_entry_rng, |
| 8030 | dec, | 8139 | dec, |
| 8031 | ); | 8140 | ); |
| 8141 | + unit_iv_end(dec, iv_plane, census_w, census_h, skip_ctx); | ||
| 8032 | return Ok((Grid::Zero(side * side), TxType::DctDct)); | 8142 | return Ok((Grid::Zero(side * side), TxType::DctDct)); |
| 8033 | } | 8143 | } |
| 8034 | let mut grid = vec![0i32; side * side]; | 8144 | let mut grid = vec![0i32; side * side]; |
| @@ -8246,6 +8356,7 @@ fn read_coeffs( | |||
| 8246 | census_entry_rng, | 8356 | census_entry_rng, |
| 8247 | dec, | 8357 | dec, |
| 8248 | ); | 8358 | ); |
| 8359 | + unit_iv_end(dec, iv_plane, census_w, census_h, skip_ctx); | ||
| 8249 | Ok((Grid::Own(grid), tx_type)) | 8360 | Ok((Grid::Own(grid), tx_type)) |
| 8250 | } | 8361 | } |
| 8251 | 8362 | ||
| @@ -8289,7 +8400,9 @@ fn read_coeffs_rect( | |||
| 8289 | set_census_plane(plane); | 8400 | set_census_plane(plane); |
| 8290 | let ibctx_on = crate::envflags::env_flag!("EC_IBCTX"); | 8401 | let ibctx_on = crate::envflags::env_flag!("EC_IBCTX"); |
| 8291 | let entry_bit = if ibctx_on { dec.debug_bitpos() } else { 0 }; | 8402 | let entry_bit = if ibctx_on { dec.debug_bitpos() } else { 0 }; |
| 8403 | + let iv_bit = unit_iv_in(plane, w, h, skip_ctx, dec); | ||
| 8292 | let all_zero = dec.symbol(&mut coding.txb_skip[skip_ctx]) == 1; | 8404 | let all_zero = dec.symbol(&mut coding.txb_skip[skip_ctx]) == 1; |
| 8405 | + unit_iv_skip(dec, iv_bit, plane, w, h, skip_ctx, all_zero); | ||
| 8293 | if rect_trace { | 8406 | if rect_trace { |
| 8294 | eprintln!( | 8407 | eprintln!( |
| 8295 | "EC_COEFF_STEP tag=all_zero plane={plane} ctx={skip_ctx} entry={entry_rng} all_zero={} rng={} bit={entry_bit} post_bit={}", | 8408 | "EC_COEFF_STEP tag=all_zero plane={plane} ctx={skip_ctx} entry={entry_rng} all_zero={} rng={} bit={entry_bit} post_bit={}", |
| @@ -8313,6 +8426,7 @@ fn read_coeffs_rect( | |||
| 8313 | } | 8426 | } |
| 8314 | if all_zero { | 8427 | if all_zero { |
| 8315 | census_unit(w, h, TxType::DctDct, 0, true, entry_rng, dec); | 8428 | census_unit(w, h, TxType::DctDct, 0, true, entry_rng, dec); |
| 8429 | + unit_iv_end(dec, plane, w, h, skip_ctx); | ||
| 8316 | return Ok((Grid::Zero(w * h), TxType::DctDct)); | 8430 | return Ok((Grid::Zero(w * h), TxType::DctDct)); |
| 8317 | } | 8431 | } |
| 8318 | let mut grid = vec![0i32; w * h]; | 8432 | let mut grid = vec![0i32; w * h]; |
| @@ -8517,6 +8631,7 @@ fn read_coeffs_rect( | |||
| 8517 | ); | 8631 | ); |
| 8518 | } | 8632 | } |
| 8519 | census_unit(w, h, tx_type, eob, false, entry_rng, dec); | 8633 | census_unit(w, h, tx_type, eob, false, entry_rng, dec); |
| 8634 | + unit_iv_end(dec, plane, w, h, skip_ctx); | ||
| 8520 | Ok((Grid::Own(grid), tx_type)) | 8635 | Ok((Grid::Own(grid), tx_type)) |
| 8521 | } | 8636 | } |
| 8522 | 8637 | ||
| @@ -36598,6 +36713,7 @@ impl PlaneBuf<'_> { | |||
| 36598 | /// but only its own true `w`x`h` footprint is committed to the plane, so | 36713 | /// but only its own true `w`x`h` footprint is committed to the plane, so |
| 36599 | /// two strips sharing a square's coordinate origin never clobber each | 36714 | /// two strips sharing a square's coordinate origin never clobber each |
| 36600 | /// other's real pixels. | 36715 | /// other's real pixels. |
| 36716 | + #[track_caller] | ||
| 36601 | fn reconstruct_mc_rect( | 36717 | fn reconstruct_mc_rect( |
| 36602 | &mut self, | 36718 | &mut self, |
| 36603 | x: usize, | 36719 | x: usize, |
| @@ -36623,6 +36739,19 @@ impl PlaneBuf<'_> { | |||
| 36623 | // three row bases are computed once per row instead of a | 36739 | // three row bases are computed once per row instead of a |
| 36624 | // multiply-add per sample (the samples themselves are unchanged). | 36740 | // multiply-add per sample (the samples themselves are unchanged). |
| 36625 | let max = crate::decode::sample_max(fctx); | 36741 | let max = crate::decode::sample_max(fctx); |
| 36742 | + | ||
| 36743 | + // lane-av1ibcfork: the MC/inter write's own origin and shape. The intra | ||
| 36744 | + // side's `EC_PRED` rung prints the PREDICTION, so a region whose | ||
| 36745 | + // prediction is byte-identical to the oracle's and whose committed | ||
| 36746 | + // samples are not can only be a DIFFERENT WRITE -- and this is the | ||
| 36747 | + // only write path with no rung of its own. | ||
| 36748 | + if crate::envflags::env_flag!("EC_MCWR") { | ||
| 36749 | + eprintln!( | ||
| 36750 | + "EC_MCWR x={x} y={y} side={side} w={w} h={h} empty_res={} at {}", | ||
| 36751 | + residual.is_empty(), | ||
| 36752 | + std::panic::Location::caller() | ||
| 36753 | + ); | ||
| 36754 | + } | ||
| 36626 | // lane-recoparse: an all-zero residual (60% of the units) is a plain | 36755 | // lane-recoparse: an all-zero residual (60% of the units) is a plain |
| 36627 | // prediction copy -- the same arithmetic with `r == 0`, without | 36756 | // prediction copy -- the same arithmetic with `r == 0`, without |
| 36628 | // reading `side * h` zeros out of [`ZERO_RESIDUAL`]. | 36757 | // reading `side * h` zeros out of [`ZERO_RESIDUAL`]. |
crates/ec-av1/src/msac.rsmodified+9 -0
| @@ -437,6 +437,15 @@ impl<'a> SymbolDecoder<'a> { | |||
| 437 | SYMR_MI.with(|c| c.set((mi_r, mi_c))); | 437 | SYMR_MI.with(|c| c.set((mi_r, mi_c))); |
| 438 | } | 438 | } |
| 439 | 439 | ||
| 440 | + /// The `(mi_row, mi_col)` the enclosing block reader last stamped, READ | ||
| 441 | + /// back. `set_symr_mi` only writes; a per-unit interval rung needs to print | ||
| 442 | + /// the mi, and a coefficient read carries none of its own -- without this a | ||
| 443 | + /// ladder cannot be attributed to the block that read it. A copy, not a | ||
| 444 | + /// borrow: the rungs call it from a `&SymbolDecoder`. | ||
| 445 | + pub(crate) fn symr_mi() -> (i64, i64) { | ||
| 446 | + SYMR_MI.with(std::cell::Cell::get) | ||
| 447 | + } | ||
| 448 | + | ||
| 440 | /// `EC_SYMR=1` dumps every symbol read's PRE state (before the read and | 449 | /// `EC_SYMR=1` dumps every symbol read's PRE state (before the read and |
| 441 | /// before the adaptation) together with the symbol and the post-read | 450 | /// before the adaptation) together with the symbol and the post-read |
| 442 | /// range, so a divergence against a reference decoder can be bisected | 451 | /// range, so a divergence against a reference decoder can be bisected |
crates/ec-av1/src/stream.rsmodified+124 -3
| @@ -21373,9 +21373,9 @@ pub(crate) mod tests { | |||
| 21373 | /// leaf push back behind `if side > 64` (the pre-`6c33f204` state) turns | 21373 | /// leaf push back behind `if side > 64` (the pre-`6c33f204` state) turns |
| 21374 | /// it red with the same 777 bytes. | 21374 | /// it red with the same 777 bytes. |
| 21375 | #[test] | 21375 | #[test] |
| 21376 | - fn the_pinned_444_quadrant_witness_is_the_single_reference_arms_and_not_only_the_compound_arms() { | 21376 | + fn the_pinned_444_quadrant_witness_is_the_single_reference_arms_and_not_only_the_compound_arms() |
| 21377 | - const NAME: &str = | 21377 | + { |
| 21378 | - "the_pinned_444_quadrant_witness_is_the_single_reference_arms_and_not_only_the_compound_arms"; | 21378 | + const NAME: &str = "the_pinned_444_quadrant_witness_is_the_single_reference_arms_and_not_only_the_compound_arms"; |
| 21379 | const FIXTURE_LEN: usize = 27933; | 21379 | const FIXTURE_LEN: usize = 27933; |
| 21380 | const FIXTURE_FNV: u64 = 0x85fa_830b_8800_90df; | 21380 | const FIXTURE_FNV: u64 = 0x85fa_830b_8800_90df; |
| 21381 | let _gate_lock = lock_gate_counters(); | 21381 | let _gate_lock = lock_gate_counters(); |
| @@ -49614,6 +49614,127 @@ pub(crate) mod tests { | |||
| 49614 | let _ = std::fs::remove_dir_all(&dir); | 49614 | let _ = std::fs::remove_dir_all(&dir); |
| 49615 | } | 49615 | } |
| 49616 | 49616 | ||
| 49617 | + /// lane-av1ibcfork: the SECOND 4:4:4 intra-BC witness, and the one the | ||
| 49618 | + /// entropy investigation was chartered against. `444_intrabc_rect4_witness.obu` | ||
| 49619 | + /// reaches `decode_intrabc_owned_rect`'s SKIP arm once -- the 64x32 block at | ||
| 49620 | + /// mi (40,80) -- and is byte-exact on all three planes. | ||
| 49621 | + /// | ||
| 49622 | + /// Why a second witness and not a repeat of | ||
| 49623 | + /// `a_444_intrabc_owned_rect_strip_sizes_its_chroma_plane_block_and_decodes` | ||
| 49624 | + /// (which pins `r512.obu`): the skip arm's defect was a wrong PLACE, not a | ||
| 49625 | + /// wrong size, and the two shapes produce DIFFERENT symptoms. `r512.obu`'s | ||
| 49626 | + /// 128-root strips fail as a sizing error inside the coefficient walk; this | ||
| 49627 | + /// witness's 64x32 skip block read no coefficient at all, so the only | ||
| 49628 | + /// symptom was pixels -- a 32x16 window committed at (px/2, py/2) = | ||
| 49629 | + /// (160,80) over a region another block had already reconstructed, and its | ||
| 49630 | + /// own 64x32 footprint at (320,160) left unwritten. Measured before the | ||
| 49631 | + /// ss correction: U 72945 / V 64865 of 307200 wrong, first at (160,80) on | ||
| 49632 | + /// both planes, luma byte-exact; the two 8x8-cell difference components | ||
| 49633 | + /// were 8 cells at x[160,192) y[80,96) and 1182 cells over the whole | ||
| 49634 | + /// x[320,640) y[160,480) quadrant -- one wrong-place write, not two. | ||
| 49635 | + /// | ||
| 49636 | + /// Full byte-exactness, not a prefix. That is possible only because | ||
| 49637 | + /// `lane-av1chromarect` (the ss-derived extent and origins, this function | ||
| 49638 | + /// included -- the skip arm was where the defect was first reached) and | ||
| 49639 | + /// `lane-av1chromadc` (the per-unit windowed chroma override) both landed; | ||
| 49640 | + /// before them this witness carried the open tail | ||
| 49641 | + /// `lanes/ibc444c.report.md` r2 recorded. The 4:2:0 twin is asserted | ||
| 49642 | + /// byte-exact in the same run, where `>> ss_x` IS `/ 2`. | ||
| 49643 | + #[test] | ||
| 49644 | + fn a_444_intrabc_rect4_witness_is_byte_exact_after_the_skip_arm_footprint() { | ||
| 49645 | + const NAME: &str = "a_444_intrabc_rect4_witness_is_byte_exact_after_the_skip_arm_footprint"; | ||
| 49646 | + const F444: &str = "444_intrabc_rect4_witness.obu"; | ||
| 49647 | + const F444_LEN: usize = 1016; | ||
| 49648 | + const F420: &str = "420_intrabc_rect4_witness.obu"; | ||
| 49649 | + const F420_LEN: usize = 890; | ||
| 49650 | + const PLANE: usize = 640 * 480; | ||
| 49651 | + let read = |file: &str, len: usize| -> Vec<u8> { | ||
| 49652 | + let path = std::path::PathBuf::from(env!("CARGO_MANIFEST_DIR")) | ||
| 49653 | + .join(format!("fixtures/{file}")); | ||
| 49654 | + let data = | ||
| 49655 | + std::fs::read(&path).unwrap_or_else(|e| panic!("{NAME}: reading {file}: {e}")); | ||
| 49656 | + assert_eq!(data.len(), len, "{NAME}: {file} is pinned at {len} bytes"); | ||
| 49657 | + data | ||
| 49658 | + }; | ||
| 49659 | + let stream444 = read(F444, F444_LEN); | ||
| 49660 | + let stream420 = read(F420, F420_LEN); | ||
| 49661 | + assert_444_header(&stream444, NAME, 8); | ||
| 49662 | + | ||
| 49663 | + let _guard = lock_gate_counters(); | ||
| 49664 | + if !aomdec_available(NAME) { | ||
| 49665 | + eprintln!("{NAME}: SKIP -- no aomdec; run scripts/build-aom-oracle.sh"); | ||
| 49666 | + return; | ||
| 49667 | + } | ||
| 49668 | + // 4:2:0 identity FIRST and in full: `>> ss_x` is `/ 2` at ss=1, so | ||
| 49669 | + // this arm is the measurement, not a claim about it. | ||
| 49670 | + decode_all_frames_vs_oracle(&stream420, &format!("{NAME}-420")); | ||
| 49671 | + | ||
| 49672 | + crate::decode::reset_ibc_owned_rect_chroma_footprint_444_hits(); | ||
| 49673 | + let dir = std::env::temp_dir().join(format!("ec-av1-{NAME}-{}", std::process::id())); | ||
| 49674 | + let _ = std::fs::remove_dir_all(&dir); | ||
| 49675 | + std::fs::create_dir_all(&dir).expect("scratch dir"); | ||
| 49676 | + let in_obu = dir.join("in.obu"); | ||
| 49677 | + std::fs::write(&in_obu, &stream444).expect("writing the stream"); | ||
| 49678 | + let aom_prefix = dir.join("aom"); | ||
| 49679 | + let out = Command::new(aomdec_path()) | ||
| 49680 | + .args(["--codec=av1", "-o"]) | ||
| 49681 | + .arg(dir.join("out.y4m")) | ||
| 49682 | + .arg(&in_obu) | ||
| 49683 | + .env("EC_AV1_FINAL_DUMP", &aom_prefix) | ||
| 49684 | + .stdin(Stdio::null()) | ||
| 49685 | + .stdout(Stdio::piped()) | ||
| 49686 | + .stderr(Stdio::piped()) | ||
| 49687 | + .output() | ||
| 49688 | + .expect("aomdec failed to run"); | ||
| 49689 | + assert!( | ||
| 49690 | + out.status.success(), | ||
| 49691 | + "{NAME}: the oracle aomdec refused the stream: {}", | ||
| 49692 | + String::from_utf8_lossy(&out.stderr) | ||
| 49693 | + ); | ||
| 49694 | + let ours_prefix = dir.join("ours"); | ||
| 49695 | + set_final_dump_prefix(Some(ours_prefix.display().to_string())); | ||
| 49696 | + let _ = decode_stream(&stream444).expect("second decode"); | ||
| 49697 | + set_final_dump_prefix(None); | ||
| 49698 | + let hits = crate::decode::ibc_owned_rect_chroma_footprint_444_hits(); | ||
| 49699 | + assert!( | ||
| 49700 | + hits > 0, | ||
| 49701 | + "{NAME}: no rect intra-BC block committed a 4:4:4 chroma plane block -- the \ | ||
| 49702 | + ss-derived footprint never ran, so this gate is measuring a hardcoded halving \ | ||
| 49703 | + (class gate-blind-to-feature)" | ||
| 49704 | + ); | ||
| 49705 | + let aom_dump = std::fs::read(format!("{}.f0", aom_prefix.display())).expect("oracle dump"); | ||
| 49706 | + let our_dump = std::fs::read(format!("{}.f0", ours_prefix.display())).expect("our dump"); | ||
| 49707 | + assert_eq!(aom_dump.len(), 3 * PLANE, "{NAME}: 8-bit 4:4:4 640x480"); | ||
| 49708 | + assert_eq!( | ||
| 49709 | + our_dump.len(), | ||
| 49710 | + aom_dump.len(), | ||
| 49711 | + "{NAME}: our frame is {} bytes, the oracle's is {}", | ||
| 49712 | + our_dump.len(), | ||
| 49713 | + aom_dump.len() | ||
| 49714 | + ); | ||
| 49715 | + for (plane, name) in [(0usize, "Y"), (1, "U"), (2, "V")] { | ||
| 49716 | + let at = plane * PLANE; | ||
| 49717 | + if our_dump[at..at + PLANE] == aom_dump[at..at + PLANE] { | ||
| 49718 | + continue; | ||
| 49719 | + } | ||
| 49720 | + let first = (0..PLANE) | ||
| 49721 | + .find(|&s| our_dump[at + s] != aom_dump[at + s]) | ||
| 49722 | + .unwrap_or(PLANE); | ||
| 49723 | + panic!( | ||
| 49724 | + "{NAME}: plane {name} diverges from the oracle at sample {first} of {PLANE} \ | ||
| 49725 | + (x={}, y={}) -- this gate pins FULL byte-exactness on all three planes", | ||
| 49726 | + first % 640, | ||
| 49727 | + first / 640 | ||
| 49728 | + ); | ||
| 49729 | + } | ||
| 49730 | + let _ = std::fs::remove_dir_all(&dir); | ||
| 49731 | + eprintln!( | ||
| 49732 | + "{NAME}: {hits} rect intra-BC block(s) committed a 4:4:4 chroma plane block; \ | ||
| 49733 | + 4:2:0 twin byte-exact; 4:4:4 byte-exact on all three planes \ | ||
| 49734 | + (307200 samples each)" | ||
| 49735 | + ); | ||
| 49736 | + } | ||
| 49737 | + | ||
| 49617 | /// lane-av1chromadc: a SKIPPED 64x64 square block at 4:4:4 has a 64x64 | 49738 | /// lane-av1chromadc: a SKIPPED 64x64 square block at 4:4:4 has a 64x64 |
| 49618 | /// chroma plane block, which libaom walks as a 2x2 grid of `TX_32X32` units | 49739 | /// chroma plane block, which libaom walks as a 2x2 grid of `TX_32X32` units |
| 49619 | /// (`get_vartx_max_txsize`: `av1_get_adjusted_tx_size(TX_64X64) = | 49740 | /// (`get_vartx_max_txsize`: `av1_get_adjusted_tx_size(TX_64X64) = |
lanes/av1ibcfork.report.mdadded+302 -0
| @@ -0,0 +1,302 @@ | |||
| 1 | +# lane-av1ibcfork — the 4:4:4 intra-BC chroma fork at mi (20,40): NOT an entropy fork | ||
| 2 | + | ||
| 3 | +Branch `lane-av1ibcfork`, **rebased onto `79b2a73f`** (was `edffad9e`). | ||
| 4 | +`backup-av1ibcfork` holds the pre-rebase commit `e0a7b744`, which carried a fix | ||
| 5 | +that main had already landed in a more general form — see §6. | ||
| 6 | + | ||
| 7 | +**Headline: the count asymmetry in the ticket does not exist. The ladder is | ||
| 8 | +bit-exact. The fork is a wrong-PLACE chroma write, and on current main it is | ||
| 9 | +already fixed — this branch lands the instrument that proved it, plus a gate | ||
| 10 | +that pins the second witness at full byte-exactness.** | ||
| 11 | + | ||
| 12 | +--- | ||
| 13 | + | ||
| 14 | +## 1. The count asymmetry, re-measured (and it is not there) | ||
| 15 | + | ||
| 16 | +Fixture `crates/ec-av1/fixtures/444_intrabc_rect4_witness.obu`, 1016 B, | ||
| 17 | +sha256 `7fe888edf18caa74bdb415f0de643dc59963e87e0255d77191200b7a62eb2542` | ||
| 18 | +(4:4:4, 8-bit, 640x480, frame 0). Oracle | ||
| 19 | +`~/.cache/aom-oracle2/build/aomdec --codec=av1`, env `EC_ECDUMP_IN=1`. | ||
| 20 | + | ||
| 21 | +``` | ||
| 22 | +$ grep -c ^EC_ECDUMP_IN oracle.err -> 2395 | ||
| 23 | +$ grep -c ^EC_ECDUMP_OUT oracle.err -> 2395 | ||
| 24 | +$ grep -c ^EC_ECDUMP_END oracle.err -> 2395 | ||
| 25 | +$ grep -c ^EC_UNITIV_IN rebuilt.err -> 2395 | ||
| 26 | +$ grep -c ^EC_UNITIV_SKIP rebuilt.err -> 2395 | ||
| 27 | +$ grep -c ^EC_UNITIV_END rebuilt.err -> 2395 | ||
| 28 | +``` | ||
| 29 | + | ||
| 30 | +Real reads only (`post_bit != bit` ours, `tell` changed oracle): | ||
| 31 | + | ||
| 32 | +``` | ||
| 33 | +ours all_zero reads that consumed bits 512 | ||
| 34 | +oracle all_zero reads that consumed bits 513 | ||
| 35 | +``` | ||
| 36 | + | ||
| 37 | +**512 vs 513, not 1326 vs 2395.** The `~1069 fewer` figure in | ||
| 38 | +`lanes/ibc444c.report.md` r2 and in the ticket is an artifact of the | ||
| 39 | +instrument: the rungs fire once per unit *including* the 1883 reads that | ||
| 40 | +consume zero bits, and r2's own correction warned about exactly this while | ||
| 41 | +applying the filter to one side only. | ||
| 42 | + | ||
| 43 | +## 2. The oracle rung: ALREADY THERE, and proven present in the binary | ||
| 44 | + | ||
| 45 | +The ticket's unblock was already landed by `lane-av1oraclepost` in the private | ||
| 46 | +`aom-oracle2` clone: | ||
| 47 | + | ||
| 48 | +- `decodetxb.c:149` `EC_ECDUMP_IN` — entry + `tell=` | ||
| 49 | +- `decodetxb.c:172` `EC_ECDUMP_OUT` — `az=` + post-read `tell=` | ||
| 50 | +- `decodetxb.c:459` `EC_ECDUMP_END` — end of the whole unit + `tell=` | ||
| 51 | + | ||
| 52 | +Not assumed — a lane proved a rung can be absent from a staged run: | ||
| 53 | + | ||
| 54 | +``` | ||
| 55 | +$ strings ~/.cache/aom-oracle2/build/aomdec | grep -oE "EC_ECDUMP_(IN|OUT|END)" | sort -u | ||
| 56 | +EC_ECDUMP_END / EC_ECDUMP_IN / EC_ECDUMP_OUT | ||
| 57 | +$ stat -c '%y %n' decodetxb.c build/aomdec | ||
| 58 | +2026-09-29 04:49:25 src/av1/decoder/decodetxb.c (source) | ||
| 59 | +2026-09-29 05:09:35 build/aomdec (binary, LATER) | ||
| 60 | +``` | ||
| 61 | + | ||
| 62 | +No rebuild needed; the shared oracle checkout was never touched. | ||
| 63 | + | ||
| 64 | +## 3. What this branch lands (the instrument, not the fix) | ||
| 65 | + | ||
| 66 | +`EC_UNITIV` — the field-for-field twin of the oracle's triple, three prints per | ||
| 67 | +unit, both coefficient readers (`read_coeffs`, `read_coeffs_rect`), on **both** | ||
| 68 | +exits (the all-zero early return and the full walk): | ||
| 69 | + | ||
| 70 | +``` | ||
| 71 | +EC_UNITIV_IN side=ours plane=.. mi=(..) w=.. h=.. ctx=.. bit=.. at <caller> | ||
| 72 | +EC_UNITIV_SKIP side=ours plane=.. mi=(..) w=.. h=.. ctx=.. az=.. bit=.. post_bit=.. | ||
| 73 | +EC_UNITIV_END side=ours plane=.. mi=(..) w=.. h=.. ctx=.. end_bit=.. | ||
| 74 | +``` | ||
| 75 | + | ||
| 76 | +`EC_MCWR` (in `reconstruct_mc_rect`) and `EC_MCPUSH` (in `push_mc_rect`, with | ||
| 77 | +`#[track_caller]` on both). These two exist because the intra side had | ||
| 78 | +`EC_PRED` (the prediction) and the **MC/inter write path had no rung at all** — | ||
| 79 | +so a region whose prediction matched the oracle and whose committed samples did | ||
| 80 | +not was unattributable. That gap is what the fix turned on; see §5. | ||
| 81 | + | ||
| 82 | +`SymbolDecoder::symr_mi()` in `msac.rs`: a per-unit rung needs a mi and a | ||
| 83 | +symbol read carries none. `set_symr_mi` only wrote it; the rungs need to read | ||
| 84 | +it back, from a `&SymbolDecoder`. | ||
| 85 | + | ||
| 86 | +## 4. Bit-interval pairing WORKS — and it is demonstrably NOT index/rng pairing | ||
| 87 | + | ||
| 88 | +Three keys on the same 2395-unit frame, oracle vs ours: | ||
| 89 | + | ||
| 90 | +| key | result | | ||
| 91 | +|---|---| | ||
| 92 | +| list index | **breaks at index 8** (a rect unit whose `bit=0` because the rung was off) | | ||
| 93 | +| coder `rng` | unusable at this scale; `ibc444c` r1 measured 2519 non-equal blocks and an 80-run "match" at an unrelated mi — their figure, quoted as such, not re-run | | ||
| 94 | +| **bit interval `(bit_in, post_bit, end_bit)`** | **exact on all 2365 in-stream units** | | ||
| 95 | + | ||
| 96 | +Offset **K = +14**, measured from unit 0 and then asserted constant for every | ||
| 97 | +later unit (our `bit` counts bits pulled from the window; the oracle's `tell` | ||
| 98 | +counts the same plus the OBU header libaom counts before `aom_reader_init`; | ||
| 99 | +`ibc444c` r1 saw +15 on a different fixture — so it is measured, never assumed): | ||
| 100 | + | ||
| 101 | +``` | ||
| 102 | +entry-position mismatches: 30 (all at index >= 2365) | ||
| 103 | +end-of-unit mismatches: 30 (same indices) | ||
| 104 | +all_zero (az) disagreements: 0 of 2395 | ||
| 105 | +``` | ||
| 106 | + | ||
| 107 | +The 30 are **end-of-buffer padding**, not a fork: our `bit` clamps at 7992 | ||
| 108 | +while the oracle's `tell` keeps counting sentinel reads toward 2^32-5906 | ||
| 109 | +(`ibc444c` r5's "last ~36 units" artifact, 30 here). | ||
| 110 | + | ||
| 111 | +Ladder excerpt around the first break: | ||
| 112 | + | ||
| 113 | +``` | ||
| 114 | +2355 ours p1 32x32 mi=(112,80) in=7980 post=7980 end=7980 az=1 | orc p1 (112,80) tx=3 in=7966 post=7966 end=7966 az=1 | ||
| 115 | +2359 ours p0 32x32 mi=(112,96) in=7986 post=7986 end=7986 az=1 | orc p0 (112,96) tx=3 in=7972 post=7972 end=7972 az=1 | ||
| 116 | +2365 ours p0 16x16 mi=(112,112) in=7992 post=7992 end=7992 az=1 | orc p0 (112,112) tx=2 in=7980 post=7980 end=7980 az=1 | ||
| 117 | +``` | ||
| 118 | + | ||
| 119 | +**There is no first divergent symbol in the coefficient ladder, because there | ||
| 120 | +is no divergence in it.** Every unit in the stream consumes the same number of | ||
| 121 | +bits on both sides, and every `all_zero` agrees. | ||
| 122 | + | ||
| 123 | +## 5. What the divergence actually was: a wrong-PLACE write | ||
| 124 | + | ||
| 125 | +Measured on the pre-rebase tree (`edffad9e` + this lane's fix), against the | ||
| 126 | +oracle's `EC_AV1_FINAL_DUMP`: | ||
| 127 | + | ||
| 128 | +``` | ||
| 129 | +RED-BEFORE Y 0/307200 U 72945/307200 first (160,80) V 64865/307200 first (160,80) | ||
| 130 | +``` | ||
| 131 | + | ||
| 132 | +Filters exonerated first: | ||
| 133 | + | ||
| 134 | +``` | ||
| 135 | +oracle PREFILT vs oracle FINAL Y 0 U 0 V 0 <- CDEF and LR inert | ||
| 136 | +ours PREFILT vs oracle PREFILT Y 0 U 72945 V 64865 <- present BEFORE deblock | ||
| 137 | +``` | ||
| 138 | + | ||
| 139 | +Two 8x8-cell difference components: **8 cells at x[160,192) y[80,96)** (sharp) | ||
| 140 | +and **1182 cells over x[320,640) y[160,480)** (run-away). Two components with | ||
| 141 | +those shapes is the signature of ONE wrong-place write, not two defects. The | ||
| 142 | +cell was **flat 55** where the oracle has a gradient — a `DC_PRED` chroma block | ||
| 143 | +committed at the wrong coordinates. | ||
| 144 | + | ||
| 145 | +**The prediction was not the problem.** `EC_PRED` vs the oracle's `EC_PREDOUT8` | ||
| 146 | +on that cell: | ||
| 147 | + | ||
| 148 | +``` | ||
| 149 | +ours OUR_PRED x=160 y=80 plane=1 bw=32 bh=16 mode=6 ad=2 sum=26258 | ||
| 150 | + row0=[54,53,53,52,50,48,46,45] | ||
| 151 | +oracle chroma sum over the same 32x16 rect = 26258, first row 54 53 53 52 50 48 46 45 | ||
| 152 | +``` | ||
| 153 | + | ||
| 154 | +Identical, sample for sample. So the defect had to be a *later, different* | ||
| 155 | +write — and `EC_MCPUSH` (the rung that did not exist before) named it: | ||
| 156 | + | ||
| 157 | +``` | ||
| 158 | +EC_MCPUSH plane=1 x=160 y=80 stride=32 w=32 h=16 res_len=512 at decode.rs:17045 | ||
| 159 | +EC_MCPUSH plane=2 x=160 y=80 stride=32 w=32 h=16 res_len=512 at decode.rs:17056 | ||
| 160 | +EC_HALV ibc_owned mi=(40,80) bw=64 bh=32 skip=true | ||
| 161 | +``` | ||
| 162 | + | ||
| 163 | +`decode_intrabc_owned_rect`, `if skip` arm, block `mi=(40,80)` 64x32 **skip**. | ||
| 164 | +`px=320, py=160`; the arm committed a 32x16 window at `(px/2, py/2) = (160,80)` | ||
| 165 | +and left its own 64x32 footprint at (320,160) unwritten. At 4:4:4 | ||
| 166 | +`av1_get_max_uv_txsize` is `ss_size_lookup[bsize]` (blockd.h) and the plane block | ||
| 167 | +is the block's OWN footprint, so the origin and the extent were both wrong. | ||
| 168 | + | ||
| 169 | +## 6. The rebase: main had already fixed it, more generally | ||
| 170 | + | ||
| 171 | +`git rebase main` conflicted in exactly that function. Main since `edffad9e`: | ||
| 172 | + | ||
| 173 | +- `5324a685` `lane-av1chromarect` — the ss-derived chroma extent and origins, | ||
| 174 | + **this function included, skip arm included** | ||
| 175 | +- `2c0fd2b9` `lane-av1chromadc` — the skipped-block chroma override windowed | ||
| 176 | + per unit | ||
| 177 | + | ||
| 178 | +`git show main:…/decode.rs` at `decode_intrabc_owned_rect`: | ||
| 179 | + | ||
| 180 | +```rust | ||
| 181 | +let (cw, ch) = (bw >> ss_x(fctx), bh >> ss_y(fctx)); | ||
| 182 | +let (cpx, cpy) = (px >> ss_x(fctx), py >> ss_y(fctx)); | ||
| 183 | +``` | ||
| 184 | + | ||
| 185 | +and the skip arm's `push_mc_rect(1, cpx, cpy, cside, cw, ch, …)` — which is my | ||
| 186 | +fix, generalized from the skip arm to the whole function. **So main's version | ||
| 187 | +subsumes mine and is the one kept**, for a substantive reason and not just to | ||
| 188 | +avoid a conflict: my version deliberately left the non-skip arm halving, because | ||
| 189 | +`lane-av1chromahalvings` r5 recorded that its ss extent makes the decode **refuse** | ||
| 190 | +(a 4:4:4 32x64 chroma plane block needs a `TxbSet` this crate lacked). Main | ||
| 191 | +solved that separately with a per-unit multi-unit walk | ||
| 192 | +(`read_intrabc_rect_chroma_split`), so the general form became reachable and is | ||
| 193 | +the correct one. My scoped version is now strictly worse: it would have left a | ||
| 194 | +known-wrong shape in the arm that reads coefficients. | ||
| 195 | + | ||
| 196 | +Resolution, honestly: **the fix is main's; the instrument is mine.** The branch | ||
| 197 | +was rebuilt from `79b2a73f` and carries only the rungs, `symr_mi()`, the gate and | ||
| 198 | +this report. A short comment at the two lines records the second-witness | ||
| 199 | +measurement, because main's comment cites only `r512.obu` and this is an | ||
| 200 | +independent confirmation on a different stream with a different failure shape. | ||
| 201 | + | ||
| 202 | +The pre-rebase commit `e0a7b744` is kept on `backup-av1ibcfork` for the record. | ||
| 203 | + | ||
| 204 | +## 7. State on current main: fully byte-exact | ||
| 205 | + | ||
| 206 | +With `chromarect` + `chromadc` in place, the witness's **residual tail is gone | ||
| 207 | +too** — the "(416,192) tail" this lane called a separate open defect was a | ||
| 208 | +consequence of the same wrong-place write, not an independent one: | ||
| 209 | + | ||
| 210 | +``` | ||
| 211 | +$ decode_probe 444_intrabc_rect4_witness.obu vs oracle EC_AV1_FINAL_DUMP | ||
| 212 | +MAIN+mine Y diff 0 of 307200 first (x,y) — | ||
| 213 | +MAIN+mine U diff 0 of 307200 first (x,y) — | ||
| 214 | +MAIN+mine V diff 0 of 307200 first (x,y) — | ||
| 215 | +``` | ||
| 216 | + | ||
| 217 | +That correction matters: the pre-rebase branch reported the tail as open, and it | ||
| 218 | +was not. | ||
| 219 | + | ||
| 220 | +## 8. The gate | ||
| 221 | + | ||
| 222 | +`a_444_intrabc_rect4_witness_is_byte_exact_after_the_skip_arm_footprint` | ||
| 223 | +(`stream.rs`). A **second** witness, not a repeat of | ||
| 224 | +`a_444_intrabc_owned_rect_strip_sizes_its_chroma_plane_block_and_decodes` | ||
| 225 | +(which pins `r512.obu`) — the two shapes fail differently: `r512.obu`'s 128-root | ||
| 226 | +strips fail as a sizing error *inside the coefficient walk*, while this | ||
| 227 | +witness's 64x32 skip block read **no coefficient at all**, so its only symptom | ||
| 228 | +was pixels. | ||
| 229 | + | ||
| 230 | +Four arms: 4:4:4 header asserted; the 4:2:0 twin byte-exact against the oracle | ||
| 231 | +(where `>> ss_x` IS `/ 2`, so it is the measurement and not a claim); | ||
| 232 | +`IBC_OWNED_RECT_CHROMA_FOOTPRINT_444_HITS >= 1` (gated on `ss_x == ss_y == 0`, | ||
| 233 | +so 4:2:0 can never bump it); **full byte-exactness on all three planes** — no | ||
| 234 | +prefix floor, which is only possible because both landed. | ||
| 235 | + | ||
| 236 | +``` | ||
| 237 | +a_444_intrabc_rect4_witness_is_byte_exact_after_the_skip_arm_footprint: | ||
| 238 | + 1 rect intra-BC block(s) committed a 4:4:4 chroma plane block; | ||
| 239 | + 4:2:0 twin byte-exact; 4:4:4 byte-exact on all three planes (307200 samples each) | ||
| 240 | +test result: ok. 1 passed; 0 failed | ||
| 241 | +``` | ||
| 242 | + | ||
| 243 | +### Mutation proof (release, the whole function back to the halving) | ||
| 244 | + | ||
| 245 | +``` | ||
| 246 | +MUT (bw >> ss_x, bh >> ss_y) / (px >> ss_x, py >> ss_y) -> (bw / 2, bh / 2) / (px / 2, py / 2) | ||
| 247 | + -> RED at stream.rs:49723 | ||
| 248 | + "plane U diverges from the oracle at sample 51360 of 307200 (x=160, y=80) | ||
| 249 | + -- this gate pins FULL byte-exactness on all three planes" | ||
| 250 | + test result: FAILED. 0 passed; 1 failed | ||
| 251 | + | ||
| 252 | +LIVE restored: ok | ||
| 253 | +``` | ||
| 254 | + | ||
| 255 | +The red lands on the **same (160,80)** this lane measured by hand before the | ||
| 256 | +gate existed — the gate and the investigation agree to the sample. | ||
| 257 | + | ||
| 258 | +## 9. Gates re-run (release, files touched before the build) | ||
| 259 | + | ||
| 260 | +``` | ||
| 261 | +a_444_intrabc_rect4_witness_is_byte_exact_after_the_skip_arm_footprint ok | ||
| 262 | +a_444_intrabc_owned_rect_strip_sizes_its_chroma_plane_block_and_decodes ok (chromarect) | ||
| 263 | +a_444_skipped_64x64_square_block_windows_its_chroma_override_per_unit ok (chromadc) | ||
| 264 | + -> test result: ok. 3 passed; 0 failed; 0 ignored; 769 filtered out | ||
| 265 | + | ||
| 266 | +444 lossless intrabc_rect gate_coverage refusal_inventory census | ||
| 267 | + -> test result: ok. 109 passed; 0 failed; 3 ignored; 0 measured; 660 filtered out | ||
| 268 | + | ||
| 269 | +mutation (halving restored, counter and gate kept) | ||
| 270 | + -> FAILED. 0 passed; 1 failed then restored -> ok | ||
| 271 | +cargo check -p ec-av1 --all-targets -> 0 errors, 0 warnings | ||
| 272 | +``` | ||
| 273 | + | ||
| 274 | +Main's checkout stayed clean throughout (`git status --porcelain` in | ||
| 275 | +`/home/user/Documents/Code/Rust/edith_codecs` printed nothing after every | ||
| 276 | +edit batch). | ||
| 277 | + | ||
| 278 | +## 10. Files (this branch vs `79b2a73f`) | ||
| 279 | + | ||
| 280 | +| file | what | | ||
| 281 | +|---|---| | ||
| 282 | +| `crates/ec-av1/src/msac.rs` | `SymbolDecoder::symr_mi()` | | ||
| 283 | +| `crates/ec-av1/src/decode.rs` | `EC_UNITIV` rungs + 4 helpers; `EC_MCWR`; `EC_MCPUSH` + `#[track_caller]` on `reconstruct_mc_rect` and `push_mc_rect`; the second-witness comment at the two ss lines | | ||
| 284 | +| `crates/ec-av1/src/stream.rs` | `a_444_intrabc_rect4_witness_is_byte_exact_after_the_skip_arm_footprint` | | ||
| 285 | +| `lanes/av1ibcfork.report.md` | this file | | ||
| 286 | + | ||
| 287 | +## 11. Not done, named | ||
| 288 | + | ||
| 289 | +1. **The `~1069 fewer reads` figure is now known to be an instrument artifact** | ||
| 290 | + (512 vs 513 measured, both sides filtered). It is still stated as fact in | ||
| 291 | + `lanes/ibc444c.report.md` r2 and in the gate doc at `stream.rs:48319` | ||
| 292 | + ("the chroma tail is a second entropy fork"). Correcting another lane's | ||
| 293 | + report text is a separate edit and was not done here; this report carries the | ||
| 294 | + real number and a future reader is told to re-measure. | ||
| 295 | +2. **No full local suite** — project rule: full suites run on the server fleet | ||
| 296 | + only. Everything quoted is a scoped, named run. | ||
| 297 | +3. **The oracle's `EC_ECDUMP_END` tail sentinel** (30 units, `tell >= 2^31`) is | ||
| 298 | + still an oracle-side artifact; our side clamps, so the last 30 ladder entries | ||
| 299 | + are not comparable. Treated as "no position", per `ibc444c` r5. | ||
| 300 | +4. **The two rungs are inert unless armed.** `EC_UNITIV` / `EC_MCWR` / | ||
| 301 | + `EC_MCPUSH` each hold one `LazyLock` atomic load per call site; nothing runs | ||
| 302 | + per sample on the hot path that was not already there. | ||