forge
Explore
Log in

Don't you dare go Hollow

lane-av1422warp: name the defect-3 read -- the DC sign context, dcctx 1 vs 0

Browse files at this commit

50a09277ba248a7d15984c5df021ca8ada0a6a99Ahmet Kaan GümüşParent: 5a6ca9d
Report only. No code change; the tree is byte-identical to b0f19759, the
EC_AV1_ALLOW_422_PROBE bypass is reverted, and the oracle's instrumented
aomdec is rebuilt to its committed shape (grep -c bitpos = 0).

Extended bitpos to EVERY EC_COEFF_STEP rung on both sides and paired
inside the single transform unit at index 1418, on the unit's own
coordinates. That enumerates the window in full -- 27 oracle reads against
28 of ours, the extra one a duplicate PRINT at the same bit, not a second
read.

Through the entire base/br/Golomb loop the two sides are IDENTICAL: same
tags, same order, same values, same bit positions under the constant -14.

The divergence is the first SIGN read. Both decode the same value (1) but
from a different CDF row:

    oracle  tag=sign     c=0 sign=1 dcctx=1  bit=56491
    ours    tag=sign_rect pos=0 sign=1 dcctx=0 bit=56506

The DC sign context is 1 on the oracle and 0 on ours. Same symbol value,
different row, so the range coder leaves in a different state and every
later bit in the window shifts -- that is the 6-bit excess measured last
round, and it is why the rng pairing turns over exactly at the sign pass
rather than anywhere in the base loop.

libaom takes that context from txb_ctx->dc_sign_ctx (decodetxb.c:366), a
3-symbol read from dc_sign_cdf_extra[plane_type] taken ONCE per transform
block. No EC_COEFF_STEP rung prints that symbol on either side, so this
lane could not pair it and does not claim whether our value is wrong or
merely reflects an already-drifted dc_sign_cdf_extra adaptation state. The
report says exactly that rather than guessing.

Second, independent finding recorded in the same window: our scan table
maps scan indices to different raster positions than the oracle's for this
unit (oracle c1->pos 8, c2->pos 1; ours c1->pos 1, c2->pos 8). Coefficient
VALUES match by scan index on both sides, so this does not by itself move a
bit, but it places coefficients in the wrong cells and would corrupt the
transform independently of the entropy question.

Refined unblock: add a rung for the dc_sign_cdf_extra symbol on BOTH
sides -- it is the one read in the unit that no EC_COEFF_STEP print covers
-- and pair it.
lanes/av1422warp.report.mdmodified+59 -8
@@ -244,16 +244,67 @@ one frame/block" rule) rather than to the whole step stream. The 6-bit magnitude
244 says the target is very close — the same unit's tail, or the mode reads between244 says the target is very close — the same unit's tail, or the mode reads between
245 two units.245 two units.
246 246
247+### The per-TU window bisect (run; the read is NAMED)
248+
249+Extending `bitpos` to EVERY `EC_COEFF_STEP` rung on both sides and pairing
250+inside the single transform unit at index 1418 (its own coordinates, per the
251+`ec-av1-oracle-trace-pairing` rule) enumerates the window completely. Both
252+instrumentations are reverted again (oracle `aomdec` rebuilt, `grep -c bitpos` =
253+0).
254+
255+**The window, 27 oracle reads against 28 of ours** (the extra one is a duplicate
256+PRINT of the same read, at the same bit, not a second read). Through the whole
257+base/br/Golomb loop the two sides are IDENTICAL — same tags, same order, same
258+values, same bit positions under the constant -14:
259+
260+```
261+ O 0 bit=56469 all_zero plane=2 ... all_zero=0 rng=42420
262+ O 1 bit=56469 tx_type plane=2 txtype=0 txsize=1
263+ O 2 bit=56475 eob eob=8
264+ O 3..26 base/br/after_bases/sign/post_golomb (c = 7,6,5,4,3,2,1,0)
265+ M 0 bit=56483 all_zero plane=0 ctx=2 entry=45064 all_zero=0 rng=42420
266+ M 1..21 eob/base/br/after_bases (c = 7,6,5,4,3,2,1,0)
267+```
268+
269+**The divergence is the first SIGN read.** Both decode the same value (1), but
270+from a different CDF row:
271+
272+```
273+oracle O 15 tag=sign c=0 sign=1 dcctx=1 rng=35769 bit=56491
274+ours M 22 tag=sign_rect pos=0 sign=1 dcctx=0 rng=52678 bit=56506
275+```
276+
277+`dcctx` — the DC sign context — is **1 on the oracle and 0 on ours**. Same symbol
278+value, different row, so the range coder leaves in a different state and every
279+later bit in the window shifts; that is the 6-bit excess, and it is why the
280+`rng` pairing that looked "identical through the base loop" turns over exactly at
281+the sign pass.
282+
283+libaom takes that context from `txb_ctx->dc_sign_ctx` (`decodetxb.c:366`), which
284+is a **3-symbol read from `dc_sign_cdf_extra[plane_type]` taken once per
285+transform block** — a CDF that no `EC_COEFF_STEP` rung prints on either side, so
286+this lane could not pair that symbol and cannot say whether our value is wrong or
287+merely reflects an already-drifted `dc_sign_cdf_extra` adaptation state.
288+
289+**Second, separate finding, worth its own look:** our scan table maps scan
290+indices to different raster positions than the oracle's for this unit — oracle
291+`c1 -> pos 8`, `c2 -> pos 1`; ours `c1 -> pos 1`, `c2 -> pos 8` (and
292+`c3 -> pos 2` vs ours `pos 16`, `c6 -> pos 24` vs ours `pos 3`). The coefficient
293+VALUES match by scan index on both sides, so this does not by itself move a bit,
294+but it places coefficients in the wrong cells and would corrupt the transform
295+independently of the entropy question.
296+
247 ### Unblock297 ### Unblock
248 298
249-The bit-position bisect below has been run and narrows this to a **6-bit**299+The per-TU window bisect below has been run and NAMES the read: the **DC sign
250-excess consumed between unit 1418's and unit 1419's `txb_skip` reads. Continue300+context** at the sign pass of unit 1418, `dcctx` 1 (oracle) against 0 (ours),
251-by restricting the per-coefficient step pairing to a SINGLE transform unit at a301+taken in libaom from `txb_ctx->dc_sign_ctx` — a 3-symbol read from
252-time — the whole-stream pairing does not work, because the two readers traverse302+`dc_sign_cdf_extra[plane_type]` per transform block. Next step: add a rung for
253-a unit's coefficients in different orders. The 4:2:2-only constructs in that303+that symbol on BOTH sides (it is the one read in the unit that no
254-window remain the candidates: the chroma-reference bookkeeping for the shared304+`EC_COEFF_STEP` print covers) and pair it, which should say outright whether our
255-mi(50,27) column, and whatever the 4:2:2 block tail reads after the shared305+value is wrong or merely drifted. The scan-table disagreement found in the same
256-chroma. Fixtures and dumps are in306+window (values match by scan index, positions do not) is a second, independent
307+lead to keep open. Fixtures and dumps are in
257 `~/.cache/av1422warp/` (`a1_f0.obu`, `f0.opred`, `f0.mpred`, `f0.ocoeff`,308 `~/.cache/av1422warp/` (`a1_f0.obu`, `f0.opred`, `f0.mpred`, `f0.ocoeff`,
258 `f0.mcoeff`, `f0.ostep`, `f0.step`, `f0.otx`); the probe bypass309 `f0.mcoeff`, `f0.ostep`, `f0.step`, `f0.otx`); the probe bypass
259 (`EC_AV1_ALLOW_422_PROBE`) is reverted and in no commit.310 (`EC_AV1_ALLOW_422_PROBE`) is reverted and in no commit.