edith_codecs
Clone
0 watching0 forksRust370.3 MiB9b67700Tahinli3 days ago4021 commits
lane-ab16 r2 — the panic the gate's --enable-tx-size-search=0 was hiding, and where seed 43 really diverges
Branch lane-ab16 (off lane-rectx fad4d5a). r1 verdict was FAIL on four findings; this
round closes (1) and (3), and answers (2) and (4) with measurements rather than a fix.
(1) PANIC — fixed at the root: a TX unit is not a block of its own size
encode.rs Reach::of(4, ..) inside a PARTITION_VERT_A/_B indexed
HAS_TOP_RIGHT_VERT[Reach::table(4)] == [_; 3][3] and panicked
("index out of bounds: len 3 index 3"), because the vert tables have no 4x4 row at all —
libaom's has_tr_vert_tables[BLOCK_4X4] is literally NULL. It is NULL because that lookup
never happens there: for a 4x4 transform unit inside an 8x8 square, libaom's
has_top_right/has_bottom_left (reconintra.c) take the BLOCK's bsize with a non-zero
row_off/col_off, answer interior units from the block geometry alone
(col_off + tx_units < block_units), and reach the table only for a unit on the block's top
row / left column — where the table read is the BLOCK's row at the BLOCK's position.
crates/ec-av1/src/encode.rs(+Reach::of_tu, ~line 1215): that rule, transcribed.crates/ec-av1/src/decode.rs5212 / 5584: both TU loops (decode_block's multi-TU branch anddecode_leaf8's TX4 sub-grid) now callReach::of_tu(block, tx, ..)instead ofReach::of(tx, ..). Root, not per-symptom: these are the only two sites in the crate that ask a reach question for a sub-block transform unit (grep -n "Reach::of(").crates/ec-av1/src/encode.rsReach::in_vert_ab()+decode.rsvert_ab_tx4_hits(): counter for the exact call that used to panic, so the gate can hard-assert it is reached.
The fix is behaviour-preserving outside a vertical AB partition — pinned, not hoped:
of_tu_keeps_the_ordinary_answer_and_uses_the_block_row_under_vert_ab (encode.rs tests)
asserts of_tu(8, 4, ..) == of(4, ..) at every 4x4 position of a 2x2-superblock frame, that
the vert-table path answers at every one of them (the panic regression), and that the two
tables genuinely disagree where libaom says they must (top-right 4x4 unit of the 8x8 at
superblock row 1, column 0: has_tr_8x8 bit 16 = 1, has_tr_vert_8x8 bit 16 = 0).
EVIDENCE: gate stdout | --enable-tx-size-search=1 attempt (yuvtestsrc 64x64 cq55) decoded
through the AB partitions instead of aborting | refused after 4 vert-AB TX4 units: unsupported: AV1 tile (a HORZ/VERT intra strip with a split transform ...) — before this
round the same stream died with panicked at encode.rs:1279 index out of bounds: len 3 index 3 (decode_probe rc=101).
The gate, with tx-size search no longer pinned off
--enable-tx-size-search=0 is gone from the recipe builder; it is now per attempt:
- the six comparison attempts keep it OFF and stay pixel-exact (all four arms fired);
- four new attempts leave it at aomenc's default (ON). They reach the formerly-panicking
lookup and are allowed to stop at another lane's refusal — an
unsupportedmessage is tolerated, a panic or a pixel mismatch is not — and the gate hard-asserts that at least one TX4 unit inside a vertical AB partition was decoded.
Why the ON attempts cannot be compared pixel by pixel yet, measured not assumed: every 16x16
AB partition contains a 16x8/8x16 strip, and with a free transform size aomenc splits at
least one strip in 40/40 cells of a {yuvtestsrc, rgbtestsrc, mandelbrot, smptebars, testsrc2} x {8,14,22,30,40,50,55,60} sweep, so every one of them stops at lane-rectx's
still-standing "a HORZ/VERT intra strip with a split transform (per-unit rect prediction is
not ported)" refusal (or the 1:4 / sub-8x8 / palette ones). A pixel-exact tx-size-search arm
therefore needs that refusal lifted first — lane-rectx's, not this lane's.
EVIDENCE: gate stdout | cargo test -p ec-av1 --lib -- ab_partitions_below_16x16 of_tu_keeps --nocapture | pixel-exact on 6 streams, ab16 arms(HORZ_A,HORZ_B,VERT_A,VERT_B)=[2, 1, 2, 1],
yuvtestsrc cq=55 refused after 4 vert-AB TX4 units, test result: ok. 2 passed; 0 failed.
(3) Stale docstring — fixed
The gate's doc no longer claims a --tile-columns=1 attempt (there is none; r1's reproducer
for the base tile defect stands) and now states why tx-size search is left at aomenc's
default.
(2) Seed 43 of the merged SB gate: TWO real defects, both fixed -- it is GREEN now
The r2 first pass deferred this as "lane-rectx's problem". That deferral was wrong on the disposition and right on the location: the defects are on the 64x32-strip path, and they are two table transcriptions this lane could fix in one round.
The gate's own recipe spells --enable-ab-partitions=0 (stream.rs:9663), so aomenc wrote no AB
partition into seed 43 at all -- which means the refusal base fad4d5a stopped at ("a
HORZ_A/HORZ_B/VERT_A partition below 16x16") was decoded out of an ALREADY desynced stream. The
base pass was vacuous ([[refusal-hides-a-defect]]); lifting the refusal only removed the mask.
Bisection, element by element, our EC_TRACE_COEFF against the instrumented aomdec's
(EC_COEFF/EC_COEFF_STEP, msac RANGE compared, never tell()):
Defect A -- the two rect av1_nz_map_ctx_offset tables were transposed.
First divergence: the luma TU of the first 64x32 strip (mi 0,16), tx_size=12 (TX_64X32),
at scan index 7, libaom position 65 = (row 1, col 2), where the oracle reads ctx 6 and we read
16. libaom's array is indexed coeff_idx = (col << bhl) | row -- COLUMN-major, bhl = log2 of
the transform's HEIGHT (txb_common.h get_nz_map_ctx_from_stats) -- so a straight
transcription of it is [col][row], and base_ctx reads [row][col].
crates/ec-av1/src/cdf.rs NZ_MAP_CTX_OFFSET_32X64 / NZ_MAP_CTX_OFFSET_64X32: both
transposed into true [row][col]. Invisible on the square table (symmetric) and at
row, col < 2 (both halves agree there), which is every position lane-sbpart r8's gate ever
reached -- class [[reference-layout-not-spec]] / [[scan-weights-cross-axis]].
Defect B -- the 512-position CHROMA end-of-block CDF was the flat 1D row.
With A fixed the stream ran on to the same strip's chroma TU (tx_size=10, TX_32X16), where
the oracle reads eob=3 and we read eob=103 off EOB_PT_512_CHROMA.
av1_default_eob_multi512_cdfs is [q][plane][eob_multi_ctx][10] (token_cdfs.h:874); the
constant carried the SECOND inner index (eob_multi_ctx == 1, the 1D TX_CLASS_HORIZ/VERT
row, which is the flat 3277/6554/... distribution for BOTH planes) instead of the chroma
plane's 2D row -- and its doc comment had rationalised the flatness as "libaom's default is the
same at all four q-contexts". crates/ec-av1/src/cdf.rs: the real chroma rows, all four
q-contexts (EOB_PT_512_CHROMA{,_Q0,_Q1,_Q3}); crates/ec-av1/src/cdf_state.rs:1073: pick()
by q-context like every sibling table. Class [[cdf-row-held-constant]].
Both are pinned by unit tests that do not need a stream (decode.rs tests):
rect_nz_map_ctx_offset_tables_are_row_major re-derives every entry of all three tables from
libaom's own generating rule AND asserts the table path (base_ctx) equals the spelled-out
rule path (base_ctx_rect) at every (row, col) for both shapes -- those two disagreed
silently before; the_chroma_512_eob_cdf_is_not_the_flat_one_dimensional_row pins the
mis-indexing itself.
EVIDENCE: /ab16/{seed43.obu,ref.yuv,ours3.yuv,oc.raw,uc2.raw} | seed-43 stream
regenerated from the gate recipe (gradients seed 43, 192x128, cq45), decoded by
~/.cache/aom-oracle/build/aomdec --rawvideo and by decode_probe, coefficient traces
compared element by element | before: 20494/24576 luma bytes differ, first divergent element
TX_64X32 luma scan idx 7 (rng 57584 vs ours); after defect A: first divergence moves to the
chroma TX_32X16 eob (oracle 3, ours 103); after both: cmp ours3.yuv ref.yuv -> identical,
36864/36864 bytes.
(4) The chroma-only residue (mandelbrot 64x64 start_x=-0.6 cq30) -- re-measured, AB blocks ARE in it
Unchanged by this round: 670 differing bytes, all of them chroma, first at offset 4246 (U
plane starts at 4096), luma bit-exact. And the stream does contain all four AB arms: the
16x16 partition symbols are value=0 x2, 1 x2, 2, 3 x7, 4, 5, 6, 7 -- one HORZ_A, one HORZ_B,
one VERT_A, one VERT_B. Luma-exact with chroma-wrong means the entropy stream is fine through
the whole frame, so this is chroma PREDICTION/reconstruction, not a table or a desync
(a green entropy trace plus byte-exact luma exonerates the coefficient path -- the
h265-chroma/gmaffine class note in memory).
Disposition: deferred(a chroma-prediction lane -- 4-wide/8-wide intra MC at these sizes; this
lane's tables are now proven exact by the seed-43 bisection).
EVIDENCE: /ab16/{m30.obu,m_ref.yuv,m_ours.yuv} | aomenc gate recipe at cq30 on
mandelbrot=size=64x64:start_x=-0.6, decoded by aomdec and decode_probe, byte diff by plane;
EC_AV1_TRACE=1 ... | grep partition_w16 for the arm census | 670 diffs, 0 of them luma,
first at 4246; AB arm values 4/5/6/7 each present once.
Test totals
EC_AV1_REQUIRE_AOMENC=1 CARGO_TARGET_DIR=$HOME/.cache/cargo-target-ab16 cargo test -p ec-av1 --lib
(log $HOME/.cache/ab16-suite.log): 274 passed; 0 failed; 24 ignored, 619 s. That run
includes both gates this lane owns and every sibling the fixes touch --
a_real_aomenc_stream_with_a_superblock_level_horz_vert_partition_decodes_pixel_exact (seed 43
included, 40 seeds) is GREEN, a_real_aomenc_stream_with_ab_partitions_below_16x16_decodes_pixel_exact
is green with --enable-tx-size-search at aomenc's default on four of its ten attempts, and the
rectx / tiny / rectwire / sbpart gates that share the two corrected tables all pass.
EVIDENCE: $HOME/.cache/ab16-suite.log | cargo test -p ec-av1 --lib with the aomenc oracle
required | test result: ok. 274 passed; 0 failed; 24 ignored.
Residue
- deferred(a chroma-prediction lane): the mandelbrot cq30 chroma-only 670-byte residue above.
- deferred(base tile defect, r1 reproducer stands): no
--tile-columns=1arm in the AB gate. - deferred(lane-rectx): the tx-size-search AB attempts still stop at the "HORZ/VERT intra strip with a split transform" refusal, so they prove the reach lookup, not pixels.
- accepted: 10-bit proves HORZ_A + VERT_A only (r1).