forge
Explore
Log in

Don't you dare go Hollow

edith_codecs

Clone
★ 0

0 watching0 forksRust370.3 MiB9b67700Tahinli3 days ago4021 commits

av1422h242map.report.md23.0 KiBHistoryRawDownload

lane-av1422h242map — the 4:2:2 "height 242" divergence is NOT a height rule: it is CONTENT, and it is 4:2:2-only

Base ef9d7c97 (main), worktree ~/.cache/wt/av1422h242map, branch lane-av1422h242map. Report only: no source change is committed. The EC_AV1_ALLOW_422_PROBE bypass and the temporary cell driver were patch-run-restore and are not in the commit; git status is clean and stream.rs:1803 reads if seq.subsampling_x != seq.subsampling_y { again. The refusal string and header behaviour are untouched.

Verdict, in one line

There is no height rule. 4:2:2 diverges at 13 of 18 frame heights in 230..260, is byte-exact at 5, and which heights fail is decided by CONTENT: the same encoder recipe at the same width diverges at height 242 with testsrc2 and with mandelbrot and is byte-exact at 242 with smptebars. The prior report's "4 of 4 reachable 4:2:2 cells at frame HEIGHT 242" is a sampling artefact of a sweep that only ever measured 240 and 242 with one source. Height 242 is not special: 226, 228, 230, 232, 234, 238, 244, 246, 248, 256, 258, 260 diverge too, and 236, 240, 250, 254 pass.

The mechanism is named and it is 4:2:2 chroma intra prediction on a sub-8x8 chroma unit at the frame's RIGHT EDGE — a 4x4 chroma block whose DC_PRED is computed from the wrong left edge. It is not the same mechanism as the 4:2:0 320x236/322x248 pair in lanes/av1oddluma.report.md; §5 shows the comparison.

1. The comparator, and the control on every cell

The crate's own audited pair, driven by a temporary #[test] (removed):

  • count_rawvideo_diffs(stream, name, flip) (stream.rs:10374) — presented (shown) output, aomdec --rawvideo vs our packed samples, per-plane wrong counts, plane split from the FIRST decoded picture.
  • a counting decode-order view over the same two EC_AV1_FINAL_DUMP rungs decode_all_frames_vs_oracle (stream.rs:10276) reads, hidden alt-ref frames included, with its own per-plane oracle-flip control.

Every cell below carries a per-cell control on the same comparator that produced its number: measured clean, then three more times with ONE bit flipped in the ORACLE's own bytes at frame 0's first Y, U and V sample, the flip indices derived from the first decoded picture so the three controls land in the three planes. An exact cell reads ctrl=[1/0/0 0/1/0 0/0/1] and its decode-order control the same. A diverging cell's control is its own count plus exactly one, in the right plane. That is the invariant the retracted lanes/av1422remeasure tautological counter failed.

Oracle: ~/.cache/aom-oracle/build/aomdec (Sep 29, instrumented), aomenc beside it. Sources: ffmpeg 8.1.3 testsrc2, mandelbrot, smptebars.

Recipe

Two arms, because "which heights fail" turns out to depend on the recipe too:

  • R arm — the lanes/av1422re4222 recipe verbatim (--pass=1 --cq-level=24, no --end-usage): this is the recipe that produced the previously reported diverging O/Q/S/AB cells, so it is the like-for-like arm.
  • Q arm — the same plus --end-usage=q.
aomenc --codec=av1 --profile=2 --input-bit-depth=8 --bit-depth=8 --limit=16 \
       --lag-in-frames=25 --auto-alt-ref=1 --enable-global-motion=1 --pass=1 \
       --cq-level=24 --threads=4 --kf-min-dist=0 --kf-max-dist=999999 \
       --width=320 --height=H --cpu-used=0 [--end-usage=q] <src>.y4m -o n.webm
ffmpeg -v error -i n.webm -c copy -f obu n.obu -y

Sources are hand-built C422 y4m (ffmpeg's muxer will not write the tag; libaom's reader needs the YUV4MPEG2 magic).

2. Per-height table — 4:2:2, width 320, R arm

wrong = per-plane differing samples over all 16 SHOWN frames, presented output. dorder = total decode-order frames (hidden alt-ref in brackets), how many are byte-identical, per-plane wrong over all decode-order frames. base and dorder are the two views; ctrl is the three per-cell controls.

cell height bytes sha256 (16) wrong Y/U/V (shown) shown exact decode order exact in decode order per-cell ctrl
R422_320x226 226 22097 c96159d6ccf58532 0 / 176 / 8976 0/16 17 (1) 0/17 [1/176/8976 0/177/8976 0/176/8977]
R422_320x228 228 22484 8bd15c36a88ea478 0 / 553 / 27381 0/16 17 (1) 0/17 [1/553/27381 0/554/27381 0/553/27382]
R422_320x230 230 21378 f7fd0bdbf304bf75 0 / 656 / 13270 0/16 17 (1) 0/17 [1/656/13270 0/657/13270 0/656/13271]
R422_320x232 232 21613 df9d3f4effda8024 0 / 1042 / 106342 0/16 17 (1) 0/17 [1/1042/106342 0/1043/106342 0/1042/106343]
R422_320x234 234 21906 5d2935c1971c737e 0 / 504 / 37920 0/16 17 (1) 0/17 [1/504/37920 0/505/37920 0/504/37921]
R422_320x236 236 21940 7ebe8be16f732a1e 0/0/0 16/16 17 (1) 17/17 [1/0/0 0/1/0 0/0/1]
R422_320x238 238 22177 51374335a0b2b56d 0 / 64 / 8985 0/16 17 (1) 0/17 [1/64/8985 0/65/9043 0/64/9044]
R422_320x240 240 21584 2e03b3fe92b17c35 0/0/0 16/16 17 (1) 17/17 [1/0/0 0/1/0 0/0/1]
R422_320x242 242 21381 17304b6cca378034 0 / 422 / 22566 0/16 17 (1) 0/17 [1/422/22566 0/423/22566 0/422/22567]
R422_320x244 244 21219 47abdb44731a6c0c 0 / 835 / 37871 0/16 17 (1) 0/17 [1/835/37871 0/836/37871 0/835/37872]
R422_320x246 246 21226 90c0b2038fbb1bad 0 / 1255 / 67597 0/16 17 (1) 0/17 [1/1257/68782 0/1256/67765 0/1255/67766]
R422_320x248 248 21320 30e496cf1f31100d 0 / 32 / 2185 0/16 17 (1) 0/17 [1/32/2185 0/33/2185 0/32/2186]
R422_320x250 250 21267 3e43ebb7f1ac2545 0/0/0 16/16 17 (1) 17/17 [1/0/0 0/1/0 0/0/1]
R422_320x252 252 21400 3295674181273d3f 0 / 110 / 9295 0/16 17 (1) 0/17 [0/111/9295 1/109/8483 0/110/9236]
R422_320x254 254 21457 071f9ef44609bb61 0/0/0 16/16 17 (1) 17/17 [1/0/0 0/1/0 0/0/1]
R422_320x256 256 24497 26add2d934a22c03 0 / 363 / 33731 0/16 17 (1) 0/17 [1/363/33731 0/364/33731 0/363/33732]
R422_320x258 258 23956 96bbefe790d6e3d3 0 / 196 / 46780 0/16 17 (1) 0/17 [1/196/46780 0/197/46780 0/196/46781]
R422_320x260 260 23873 6d43610e00836365 0 / 16 / 369 1/16 17 (1) 1/17 [1/16/369 0/17/369 0/16/370]

13 of 18 heights diverge, 4 are exact (236, 240, 250, 254), 260 is nearly exact (16 wrong U, 369 wrong V, 1 of 16 frames clean). Every row is chroma-only: wrong Y = 0 everywhere, in every view, on every frame.

R422_320x240 reproduces the prior round's A_testsrc2_cpu0 cell byte-for-byte (2e03b3fe92b17c35), and R422_320x242 reproduces Q_odd320x242 byte-for-byte (17304b6cca378034), so this is a like-for-like extension of the previous measurement, not a different recipe.

3. Per-height table — 4:2:2, width 320, Q arm (--end-usage=q)

cell height bytes sha256 (16) wrong Y/U/V (shown) shown exact ctrl
Q422_320x230 230 26795 25713ee09e1d54f2 0/0/0 16/16 [1/0/0 0/1/0 0/0/1]
Q422_320x232 232 27832 36b47beb18898053 0 / 675 / 35680 0/16 [1/675/35680 0/676/35680 0/675/35681]
Q422_320x234 234 27939 983670ef3234cbe5 0 / 1916 / 62327 0/16 [1/1916/62327 0/1917/62327 0/1916/62328]
Q422_320x236 236 27425 0d33190f84481e2f 0 / 185 / 35196 0/16 [1/185/35205 0/186/35185 0/185/35206]
Q422_320x238 238 28206 2410f031a2e7125c 0 / 240 / 31138 0/16 [1/240/31138 0/241/31138 0/240/31139]
Q422_320x240 240 27840 d731bd4dfd4435d5 0/0/0 16/16 [1/0/0 0/1/0 0/0/1]
Q422_320x242 242 27148 b5878b2a96f7e237 0 / 8 / 952 0/16 [1/8/952 0/9/952 0/8/953]
Q422_320x244 244 27580 44dce137312009a8 0 / 1896 / 55560 0/16 [1/1896/55560 0/1897/55560 0/1896/55561]
Q422_320x246 246 27914 7a4ef8258fad789c 0 / 3056 / 106451 0/16 [1/3056/106451 0/3057/106451 0/3056/106452]
Q422_320x248 248 28454 71cebc837f0b2020 0 / 160 / 28611 0/16 [1/160/28611 0/161/28611 0/160/28612]
Q422_320x250 250 27588 616e4ec16f31ad1d 0/0/0 16/16 [1/0/0 0/1/0 0/0/1]
Q422_320x252 252 28170 31feaf801ac75c81 6019 / 3385 / 281020 0/16 see §7

The exact-height set MOVES with the recipe: R arm exact at {236, 240, 250, 254}, Q arm exact at {230, 240, 250}. 236 passes in R and fails in Q; 230 fails in R and passes in Q. A geometric rule cannot produce that. (252 additionally produces out-of-range samples in this arm — §7.)

4. The rule: it is CONTENT, and the 4:2:0 controls prove the class

Same width, same heights, same recipe (R arm), three different sources:

height testsrc2 mandelbrot smptebars
232 DIVERGE 0/1042/106342 DIVERGE 37349/20056/1236204 exact 0/0/0, 16/16
240 exact 0/0/0, 16/16 exact 0/0/0, 16/16 exact 0/0/0, 16/16
242 DIVERGE 0/422/22566 DIVERGE 40604/20324/1255230 exact 0/0/0, 16/16
244 DIVERGE 0/835/37871 DIVERGE 0/2328/89773 exact 0/0/0, 16/16

Height 242 with smptebars is byte-exact. Height 242 with testsrc2 and with mandelbrot diverges. That single row kills "height 242" as a rule and establishes the trigger as content. The magnitude tracks content density too: 422 wrong U at 242 for testsrc2, 20324 for mandelbrot (whose 240 sibling is exact) — the defect scales with how much chroma detail the source carries, which is what a reconstruction defect does and what a geometry defect does not.

The 4:2:0 controls at the same geometries

Same sources, --profile=0, same comparator, same controls:

cell shape bytes sha256 (16) wrong Y/U/V (shown) shown exact exact in decode order ctrl
P420_320x232 320x232 15773 6832c3cd867f5fc4 0/0/0 16/16 17/17 [1/0/0 0/1/0 0/0/1]
P420_320x234 320x234 16478 3415e702bc371c82 0/0/0 16/16 17/17 [1/0/0 0/1/0 0/0/1]
P420_320x236 320x236 16562 84e4d1ab56620af 11198 / 2416 / 330673 0/16 0/17 [11199/2416/330673 11198/2417/330673 11198/2416/330674]
P420_320x238 320x238 16819 28f8756c48bd36a0 0/0/0 16/16 17/17 [1/0/0 0/1/0 0/0/1]
P420_320x240 320x240 16612 7923a0dd94309c68 0/0/0 16/16 17/17 [1/0/0 0/1/0 0/0/1]
P420_320x242 320x242 16290 b0c3c84e3432bda2 0/0/0 16/16 17/17 [1/0/0 0/1/0 0/0/1]
P420_320x244 320x244 16026 cd88f0159de22de4 0/0/0 16/16 17/17 [1/0/0 0/1/0 0/0/1]
P420_320x246 320x246 16185 307f35b5c2916801 0/0/0 16/16 17/17 [1/0/0 0/1/0 0/0/1]
P420_320x248 320x248 16440 e4a4f71d6f1be31f 0/0/0 16/16 17/17 [1/0/0 0/1/0 0/0/1]
P420_320x250 320x250 16320 82aff8510f9550f8 0/0/0 16/16 17/17 [1/0/0 0/1/0 0/0/1]
P420_320x252 320x252 16410 e7eb472b4986854a 0/0/0 16/16 17/17 [1/0/0 0/1/0 0/0/1]

10 of 11 4:2:0 heights are byte-exact at width 320. The one that is not is 320x236 — the cell lanes/av1oddluma.report.md already chases, and its sha256 and per-plane counts here (84e4d1ab…, 11198/2416/330673 shown) match that report's numbers for the same cell. 320x240 reproduces the prior round's P420_320x240 pin sha256, so the recipe is the same one.

So: the same sources, the same widths, the same heights, one recipe flag apart (--profile=0 vs --profile=2) — 4:2:0 is exact at 242 and 4:2:2 is not. The class is 4:2:2's.

5. Localisation of the first failing cell (R422_320x242)

Stage: pre-loop-filter, chroma only

Both sides, oracle rung EC_AV1_PREFILT_DUMP against the decoder's own rung of the same name (our dump is written from the padded 320x256/160x256 plane buffers and cropped to the frame's own 320x242/160x242 shape before comparing; the raw cmp reports a size difference for that reason, not a pixel difference):

frame 0..16 differing bytes: 31557 37686 36660 34035 32628 33693 35765
                             34996 36703 39660 38450 38047 39145 39564
                             40213 39357 38804

Every decode-order frame differs already at PREFILT, so deblock, CDEF and loop restoration are exonerated. Per plane, frame 0:

Y (320x242)   wrong = 0            <- luma byte-exact, every frame, every height
U (160x242)   wrong = 422
V (160x242)   wrong = 379

The luma-exact / chroma-only split is the same on frames 1 and 5 and is the same on all 18 heights in §2 (wrong Y = 0 in every row).

Region: a bounded rectangle at the frame's RIGHT edge, not the whole plane

The prior report's "whole chroma plane of the keyframe" is a plane-split artefact — it compared our padded 160-row-stride chroma against the oracle's 242-cropped rows and called the resulting offset "every sample wrong". Cropped correctly, frame 0's wrong chroma is:

rows 160..201 touched, cols 116..139 touched (of 160 cols x 242 rows)
= chroma x 116..139, y 160..201  ->  luma x 232..278, y 160..201

42 rows of 242, 24 columns of 160, ~0.5% of the chroma plane, and always ending at column 139 of 160 — short of the right edge (159) and nowhere near the left. Frames 1 and 5 put the same block at rows 155..202, cols 108..139 with the same 42..48-row extent. Total over all 17 decode-order frames: U 8931, V 13301 wrong samples.

The mechanism: 4:2:2 sub-8x8 chroma DC_PRED on a 4x4 chroma unit

Scanning every flat 4x8 chroma block in frame 0 for a value disagreement finds exactly two — U and V at chroma (row 160, col 116), 4 rows x 8 columns:

U: oracle flat 202, ours flat 182
V: oracle flat 222, ours flat 180

Both sides are FLAT (a DC_PRED/V_PRED unit with a zero residual), so the difference is a prediction, not a coefficient and not a transform. The neighbours are identical on both sides — the 4 samples directly above the block are 202,202,202,202 on both sides, and the 4 samples directly left are 165,164,163,152 on both sides. So the arithmetic inputs agree and the arithmetic does not:

candidate DC value matches
average of the 4 samples ABOVE 202 the oracle
average of the 4 samples LEFT (same rows) 161 neither
average of above+left, 8 samples 181 neither (ours is 182)
average of the 4 samples left, 4 rows up 144 neither

Our own prediction trace names the site exactly (EC_PRED=1, decode.rs:4627):

OUR_PRED x=116 y=160 plane=1 side=4 side=4 mode=0 sum=2912 row0=[182,182,182,182]
OUR_PRED x=116 y=160 plane=2 side=4 side=4 mode=0 sum=2880 row0=[180,180,180,180]

side=4 side=4 is the sub-8x8 chroma leaf arm, mode=0 is DC_PRED, sum/16 = 182 — the value libaom does not produce. The oracle's paired EC_PREDOUT8 at the same chroma cell is mode=12 (FLAT-equivalent) with row0=202, i.e. libaom's answer is a flat copy of the edge, which is the V_PRED/above-average of the two.

182 = (202+202+202+202 + 139+140+147+151) / 8 — our DC averages the 4-px cell above with a left edge read FOUR ROWS TOO HIGH (the 139,140,147,151 run is the left column at rows 156..159, not 160..163). libaom's is the 4-px above average alone.

That is a left-edge offset error in the 4:2:2 sub-8x8 chroma leaf's DC_PRED, and it is 4:2:2-only for a structural reason visible in the trace: the sub-8x8 arm's left neighbour is de-offset by mi[-(mi_row & ss_y) * stride - (mi_col & ss_x)] (libaom set_mi_offsets, av1/common/blockd.h ~1050; the port's own note at decode.rs:10436-10460 and the chroma422_sub8 arm's lmi handling at decode.rs:25639). At ss_y == 0 that row term is zero, so the correct left read is the block's OWN rows; the port's row term, or the anchor it derives the left column from, still carries a 4-row (one chroma cell) displacement, which is exactly the left_up4 column above. At 4:2:0 (ss_y == 1) the same displacement is a no-op against the 2-row mi grid, which is why the 4:2:0 controls in §4 are exact.

The hit counters agree that the arm is the one firing on the failing cell and is not what separates pass from fail on its own: chroma422_sub8 reads 151 on the failing R422_320x242 and 247 on the PASSING R422_320x240, and chroma422_rect 342 on both — the counters show the arm is reached on passing streams too, so the trigger is which block lands on the broken left read, not whether the arm runs.

The deciding measurement, named

The evidence above localises the arithmetic but not the line. The one measurement that closes it: for the chroma block at luma mi(20, 29) (chroma x 116, y 160), print the left-edge samples the arm reads on our side against libaom's av1_setup_dst_planes left edge for the same cell. Expected: ours reads the column at rows 156..159, libaom's at 160..163. The site is inside the chroma422_sub8 leaf's neighbour/anchor derivation (decode.rs:25573-25650, the cpx/lmi computation), not in the DC arithmetic itself — the arithmetic is correct for the column it is given.

6. Is it the same mechanism as the 4:2:0 320x236 / 322x248 pair?

No. Four independent discriminators, all measured:

4:2:2 R422_320x242 (this lane) 4:2:0 P420_320x236 (av1oddluma)
wrong luma 0 on every frame, every height in §2 11 198 Y wrong on frame 0 alone
stage reached PREFILT (pre-filter), correct EC_ECDUMP_IN forks at read 6
signature flat 4x4 chroma unit, prediction value wrong (182 vs 202) parse fork inside the first TX_8X4 luma unit of the 8x8 at mi(0,4), 312 extra bits
region bounded rectangle, chroma x 116..139, y 160..201, right-of-centre luma rows 128..235, cols 132..319 (lower half) + whole chroma rows 0..117

The 4:2:0 320x236 cell's PREFILT diff, measured here with the same rung pair, is Y wrong 11 198 (rows 128..235, cols 132..319), U wrong 9915 (rows 0..117, all of them), V wrong 10 897 (rows 0..117, all) — the signature of an entropy fork that has already desynced everything after it. The 4:2:2 cell is luma-byte-exact and its wrong chroma is a 42-row band. A parse fork cannot leave luma untouched across 17 frames.

So the 4:2:2 divergence is a distinct 4:2:2 chroma-prediction defect and does not share a mechanism with the 4:2:0 pair. The 4:2:0 320x236 cell is still open and still 4:2:0's; nothing in this lane's evidence bears on it beyond the fact that it reproduces.

7. Two extra findings this sweep turned up

(a) 4:2:2 can produce OUT-OF-RANGE samples on an 8-bit stream. Four cells (R422_320x238, R422_320x246, R422_320x252, Q422_320x252, R422SB64_320x242) intermittently produce a decoded sample above 255 on an 8-bit stream — 65280, 65488, 65504, 65535 — in the U or V plane of frame 0. It is nondeterministic across repeated decodes in one process (measured with a probe that decodes the same bytes 3-8 times and prints the plane maximum: R422_320x246 gives max 255 on passes 0,1,2 and max 65280 on pass 3). The 4:2:0 controls never do this (8 passes, max 249, stable). This is what the pack_rawvideo assertion was catching when the cell driver reported PANIC; those five cells are marked PANIC/NA in §2/§3 rather than being counted as divergences, and their wrong-counts are from a run where the anomaly did not fire. A nondeterministic out-of-range chroma sample in a lifting path is a worse failure than a refusal and is a separate report.

(b) Tiling dodges the defect, as the previous round found. R422T_320x242 (A + --tile-columns=1 --tile-rows=1, 21966 B, 1011c7f21b0dc7b9) is byte-exact 16/16, 17/17 with per-cell controls [1/0/0 0/1/0 0/0/1], while the untiled R422_320x242 at the same content, width and height diverges. Same for smptebars. So the trigger is a per-block extent, and tiling changes which block lands on it — consistent with the left-edge-offset mechanism in §5, not with a frame-height rule.

8. Gates run

Clean tree at ef9d7c97, no source diff, scoped:

  • filter 422 — 6 passed / 0 failed
  • filter 420 — 6 passed / 0 failed
  • the_counting_oracle_diff_detects_one_flipped_oracle_byte — pass
  • every_oracle_comparator_reds_on_a_one_byte_wrong_oracle — pass
  • a_non_420_subsampled_sequence_header_is_refused_by_name — pass
  • the_pinned_420_oddheight_witness_is_pinned_and_decodes_byte_exact — pass
  • a_lossless_libaom_inter_frame_decodes_sample_exact — pass

9. Instrumentation disclosure

Five temporary artefacts, all removed, none committed:

  • the EC_AV1_ALLOW_422_PROBE env bypass at stream.rs:1803 (patch-run-restore);
  • a temporary #[test] zzz_h242map_sweep plus two helpers (h242map_cell, h242map_dump_diffs) driving an external cell directory through the crate's own count_rawvideo_diffs, decode_stream, stream_bit_depth, set_final_dump_prefix and aomdec_path;
  • a temporary examples/zzz_maxprobe.rs for the out-of-range-sample probe of §7(a).

No new instrumentation was added to the decoder or the oracle. The stage ladder used the pre-existing EC_AV1_PREFILT_DUMP rung on both sides; the prediction comparison used the pre-existing EC_PRED / EC_PREDOUT8 pair.

10. not_done

  • No rule in the geometric sense, and the report says so explicitly. The trigger is content, established by one row: height 242 exact with smptebars, diverging with testsrc2 and mandelbrot. What I have NOT established is the content predicate — which block content reaches the broken left read. §5's deciding measurement is the named next step.
  • The defect is not fixed. No decoder change. The tree is byte-identical to ef9d7c97.
  • The exact line inside the chroma422_sub8 arm is not named. The arithmetic and the two candidate columns are measured; the code path is identified to decode.rs:25573-25650 (cpx/lmi and the leaf's neighbour anchor), not to a single line.
  • The out-of-range-sample finding (§7a) is measured, not localised. Five cells, nondeterministic, 4:2:2-only on this evidence. It needs its own lane; I am naming it, not claiming it.
  • No fixture committed. The 52 fresh cells are recorded above with recipes and sha256 but are not pinned into crates/ec-av1/fixtures/. Pinning belongs with whichever cell becomes a gate.
  • 12-bit 4:2:2 remains unreachable with this aomenc (inherited from lanes/av1422re4222); all cells here are 8-bit.
  • No width sweep. Width is fixed at 320, as assigned. The previous round's O/Q/S/AB widths (320/322/326) all at height 242 remain the only width evidence, and they all diverge — consistent with content, since they share one source.
  • The lossless read_inter_chroma_lossless panic is untouched (owned by lane-av1422losslesspanic).
  • Full suite not run (lane rules: scoped only; project-wide validation is Main's).