forge
Explore
Log in

Don't you dare go Hollow

lane-d792: narrow the straddle defect to the dequant step (prediction, levels, scan, tx type and the 16x8 kernel all pinned equal) and land the instruments

Browse files at this commit

4caf1919a70ac498fab73cde266cd23bec2680e2Ahmet Kaan GümüşParent: a0387ec
crates/ec-av1/src/decode.rsmodified+24 -0
@@ -6642,6 +6642,19 @@ fn read_coeffs_rect(
6642 };6642 };
6643 grid[pos] = if negative { -level } else { level };6643 grid[pos] = if negative { -level } else { level };
6644 }6644 }
6645+ // lane-d792: the rect unit's LEVEL grid in row-major (w) order, the
6646+ // twin of the oracle's `EC_DQCOEFF` rung -- a residual mismatch whose
6647+ // grids differ is a reader defect, one whose grids agree is a transform
6648+ // defect.
6649+ if crate::envflags::env_flag!("EC_DQCOEFF") {
6650+ let nz: Vec<String> = grid
6651+ .iter()
6652+ .enumerate()
6653+ .filter(|&(_, &v)| v != 0)
6654+ .map(|(i, &v)| format!("{}/{}:{v}", i / w, i % w))
6655+ .collect();
6656+ eprintln!("OUR_LEVELS w={w} h={h} eob={eob} tx={tx_type:?} nz={}", nz.join(","));
6657+ }
6645 Ok((Grid::Own(grid), tx_type))6658 Ok((Grid::Own(grid), tx_type))
6646 }6659 }
6647 6660
@@ -13648,6 +13661,17 @@ impl PlaneBuf<'_> {
13648 self.data.to_mut()[(y + row) * self.width + x + col] = sample;13661 self.data.to_mut()[(y + row) * self.width + x + col] = sample;
13649 }13662 }
13650 }13663 }
13664+ // lane-d792: the RECONSTRUCTION rung beside `EC_PRED`'s prediction one
13665+ // -- a block whose prediction matches the oracle's but whose written
13666+ // samples do not is either a residual defect or a later overwrite, and
13667+ // only this print separates the two.
13668+ if crate::envflags::env_flag!("EC_PRED") {
13669+ let row0: Vec<u16> =
13670+ (0..bw.min(8)).map(|c| self.data[y * self.width + x + c]).collect();
13671+ let col0: Vec<u16> =
13672+ (0..bh.min(8)).map(|r| self.data[(y + r) * self.width + x]).collect();
13673+ eprintln!("OUR_RECON x={x} y={y} bw={bw} bh={bh} row0={row0:?} col0={col0:?}");
13674+ }
13651 }13675 }
13652 13676
13653 /// Predicts under `mode` then adds `residual` (side*side, raster),13677 /// Predicts under `mode` then adds `residual` (side*side, raster),
crates/ec-av1/src/transform.rsmodified+35 -0
@@ -3105,3 +3105,38 @@ mod lossless_tx_tests {
3105 }3105 }
3106 }3106 }
3107 }3107 }
3108+
3109+#[cfg(test)]
3110+mod d792_tests {
3111+ /// lane-d792: ONE 16x8 DCT_DCT inverse against libaom's own numbers.
3112+ ///
3113+ /// The dequantized grid below is `EC_DQCOEFF`'s dump of the first
3114+ /// TX_16X8 unit of `$HOME/.cache/d792/small/f100.obu` (a rav1e
3115+ /// `speed=6 quantizer=100` encode of a 384x152 crop, whose bottom
3116+ /// straddle is where the reference-ladder decode failures live), in
3117+ /// libaom's own column-major `input[c * h + r]` order; the expected
3118+ /// residual is `aomdec`'s reconstruction of that block minus its
3119+ /// prediction (the two decoders' predictions are byte-identical there,
3120+ /// checked with the oracle's `EC_PREDOUT8` rung).
3121+ #[test]
3122+ fn a_16x8_inverse_matches_libaoms_own_dqcoeff_and_residual() {
3123+ const H: usize = 8;
3124+ const W: usize = 16;
3125+ // (libaom index, dequantized value).
3126+ const NZ: [(usize, i32); 17] = [
3127+ (0, 1554), (1, -1768), (2, 624), (3, -104), (9, 104), (10, -520), (11, 312),
3128+ (16, -104), (17, 104), (18, -104), (24, -104), (25, 104), (27, -104), (32, 208),
3129+ (33, -104), (35, -104), (40, 104),
3130+ ];
3131+ let mut grid = vec![0i32; W * H];
3132+ for (i, v) in NZ {
3133+ let (r, c) = (i % H, i / H);
3134+ grid[r * W + c] = v;
3135+ }
3136+ let out = super::inverse_transform_2d_typed_wh(&grid, W, H, 8, super::TxType::DctDct);
3137+ let col0: Vec<i32> = (0..H).map(|r| out[r * W]).collect();
3138+ let row0: Vec<i32> = out[..8].to_vec();
3139+ assert_eq!(col0, vec![-7, -2, 6, 17, 27, 34, 36, 37], "column 0");
3140+ assert_eq!(row0, vec![-7, -7, -6, -5, -2, 0, 1, -1], "row 0");
3141+ }
3142+}
lanes/d792.report.mdmodified+58 -0
@@ -69,3 +69,61 @@ fewer `sign`/`base` ones (aom 23085 base / 7966 sign / 3338 br; ours 23634 /
69 7715 / 3351). First divergence is an extra `br` at trace line ~22951 of69 7715 / 3351). First divergence is an extra `br` at trace line ~22951 of
70 44647. Next: resolve that line to its transform unit and read the rule that70 44647. Next: resolve that line to its transform unit and read the rule that
71 differs there.71 differs there.
72+
73+## Elimination chain (all measured on the 384x152 small repro, frame 0)
74+
75+The first differing sample is inside the luma block at `x=0 y=144`, a 16x8
76+intra block in the bottom straddle (PARTITION_HORZ is forced there by the
77+frame edge). For that block:
78+
79+1. **Prediction: identical.** `OUR_PRED sum=6959 row0=[82,74,65,56,50,47,46,45]
80+ col0=[82,85,85,85,85,85,85,85]` == the oracle's new `EC_PREDOUT8` line for
81+ `mi_row=36 mi_col=4`(sic: `mi_col=0`), to the sample.
82+2. **Coefficient bitstream: in sync.** `EC_TRACE_COEFF`'s `all_zero` range
83+ value agrees at ALL 750 transform units; `eob` agrees at all 514.
84+3. **Transform type: identical.** The oracle now prints the resolved
85+ `txtype`/`txsize`; the 514-long sequence matches ours entry for entry.
86+ All 19 TX_16X8 units are DCT_DCT.
87+4. **Transform unit shapes: identical.** Both decoders code 19 16x8, 27 8x4
88+ and 1 32x16 rectangular units (the oracle's new `EC_DQCOEFF` rung vs our
89+ new `OUR_LEVELS` rung).
90+5. **Level grids: identical.** The first three 16x8 units' non-zero
91+ (row/col, level) sets match the oracle's `EC_DQCOEFF` dump converted out
92+ of libaom's column-major `input[c * h + r]` layout -- which also
93+ re-verifies `SCAN_16X8` against `av1_default_scan_16x8`.
94+6. **The 16x8 inverse transform is correct.** New pin
95+ `transform::d792_tests::a_16x8_inverse_matches_libaoms_own_dqcoeff_and_residual`
96+ feeds our `inverse_transform_2d_typed_wh` libaom's own dequantized grid
97+ and asserts libaom's own residual (`aomdec` reconstruction minus the
98+ identical prediction): PASSES.
99+7. **The q index is frame-constant.** `aomdec`'s `current_base_qindex` is 127
100+ for all 1518 blocks of the 1920x792 key frame; no delta-q is in play.
101+
102+So the residual our decoder ADDS differs (ours `col0 = [-6,-3,4,13,21,26,28,
103+28]`, libaom's `[-7,-2,6,17,27,34,36,37]`, roughly a 0.77 factor) while the
104+levels, the shape, the type and the transform kernel all agree. The
105+remaining link is the DEQUANT step between them -- `dequant_and_inverse_typed_wh`
106+at the intra rect call sites (`decode.rs:9487/9543/9713/10826...`), where the
107+suspects are the `(w, h)` argument order (class `adjacent same-typed args`;
108+a transposed grid would weaken exactly the vertical response we see) and the
109+q index / DC-AC delta that site passes.
110+
111+## Instruments added this round
112+
113+* Oracle (`~/.cache/aom-oracle/src`, build2): `EC_PREDOUT8` on both 8-bit
114+ prediction paths, `txtype=`/`txsize=` on the `tag=tx_type` rung, and
115+ `EC_DQCOEFF` (the dequantized grid the inverse transform runs on).
116+* Ours: `OUR_RECON` (reconstructed row0/col0 beside `EC_PRED`'s prediction)
117+ and `OUR_LEVELS` (a rect unit's level grid, `EC_DQCOEFF=1`).
118+
119+## NOT done this round (budget)
120+
121+* `deferred: the root cause and its fix -- the dequant link above is the one
122+ unchecked step -- unblocked by dumping the dequantized grid at the rect
123+ intra call site and diffing it against the oracle's EC_DQCOEFF line`
124+* `deferred: the libaom crf-5 "Golomb tail" refusal -- it does NOT reproduce
125+ standalone at 046dbe0e (all four libaom points decode exact), so it needs
126+ the gate arm itself re-run to confirm it is stale`
127+* `deferred: the synthetic straddling fixtures (384x152 / 384x184 gates), the
128+ 1920x792 green arm, the suite and the workspace check -- they gate a fix
129+ that does not exist yet`