forge
Explore
Log in

Don't you dare go Hollow

Commits

Commits on c0807202163f951d8a304d5af75e7b7b002c81da

2026-08-30

fix(av1): filter-intra tx_type CDF row was the block's raw DC_PRED mode, not fimode_to_intradir(filter_intra_mode) -- desynced entropy stream at the first coefficient TU of every filter-intra block; 32x32/24x24/16x32 tiny-size gate goes 3/10,3/10,2/10 -> 10/10,10/10,10/10, 32x16 2/10 -> 8/10 (residual chroma-only defect open)Ahmet Kaan Gümüş · 3f037c3
fix(av1): filter-intra tx_type CDF row was the block's raw DC_PRED mode, not fimode_to_intradir(filter_intra_mode) -- desynced entropy stream at the first coefficient TU of every filter-intra block; 32x32/24x24/16x32 tiny-size gate goes 3/10,3/10,2/10 -> 10/10,10/10,10/10, 32x16 2/10 -> 8/10 (residual chroma-only defect open)

Also lands the EC_TRACE_COEFF per-symbol range ladder in read_coeffs (eob/base_eob/after_bases/sign/post_golomb tags) matching the oracle's decodetxb.c instrumentation added this round, and the all_zero/tx_type entry-range traces that isolated the divergence.
wip(tiny): per-symbol mode-info tracing, and the fixture-path probeAhmet Kaan Gümüş · c690c67
wip(tiny): per-symbol mode-info tracing, and the fixture-path probe

EC_TRACE_MODE_STEP-gated EC_ISTEP prints in the square read_intra_mode
and read_tx_size, plus an #[ignore]d probe_tiny_fixture_trace that
decodes a raw .obu from EC_TINY_FIXTURE_PATH so traces line up
byte-for-byte with a saved fixture instead of a regenerated one.

Purely additive; no logic changed. Committed by the orchestrator at the
agent's turn cap.
wip(tiny): size-boundary sweep + trace probes for the silent-wrong-pixel defectAhmet Kaan Gümüş · d931dba
wip(tiny): size-boundary sweep + trace probes for the silent-wrong-pixel defect

Two #[ignore]d diagnostics in stream.rs (probe_tiny_frame_size_boundary,
probe_tiny_32x32_trace) and a comment in intra.rs recording why the
no-neighbour corner fallback is NOT the bug.

Measured, 10 seeds per size: 16x16 is 10/10 pixel-exact (so the earlier
report that 16x16 fails two thirds of the time was a different recipe
and does not hold); 32x32 and 24x24 fail 3/10; 16x32 and 32x16 fail
2/10; 48x48 and 64x64 are 10/10. The clean sizes are the ones that take
the SB-level PARTITION_NONE path at side=64, where filter_intra_size_class
returns None so filter_intra never fires -- consistent with the cause.

Toggling --enable-filter-intra=0 on the exact failing seed-45 32x32
stream flips it from mismatched to exact. Prediction math is ruled out:
FILTER_INTRA_TAPS and predict_filter_intra's recursion were checked
byte-for-byte against libaom reconintra.c:805-899.

Committed by the orchestrator at the agent's turn cap. The agent
believed it had reverted intra.rs; it had not -- the residue was
comment-only and is kept.
Merge branch 'lane-hbd': 10-bit streams decode bit-exactAhmet Kaan Gümüş · 6b635d6
Merge branch 'lane-hbd': 10-bit streams decode bit-exact

Both of his AV1 films are yuv420p10le, so this is the wall his real
library actually hits. Four bit-depth assumptions were stacked behind
one another, each visible only once the one before it was fixed:

1. decode.rs passed a literal 8 as the bit_depth argument at all eight
   dequant call sites while quant.rs was already picking the right
   DC_QLOOKUP/AC_QLOOKUP row -- the whole frame came out ~4x low.
2. intra.rs's no-neighbour edge fallback (127/128/129) and dc()'s 128
   were 8-bit constants, so predictions went negative and clamped. This
   only appeared as a DIFFERENT failure shape after (1).
3. Deblock filter4/sclamp centring and the limit/blimit/hev_thr/flat
   thresholds needed << (bit_depth - 8). Correct per libaom
   loopfilter.c:517-628 but measured INERT on this fixture (identical
   diffs before and after) -- unexercised here, not dead.
4. cdef_filter_block read its primary-tap-set parity off pri_strength
   directly instead of pri_strength >> coeff_shift (libaom
   cdef_block.c:147). At 10-bit coeff_shift is 2, so pri_strength was
   always even and tap set {3,3} was silently never selected. That was
   the last 1/4096 pixel.

Gate a_real_aomenc_10bit_stream_decodes_pixel_exact: 0/4096 diffs.
The blanket "bit depth is not 8" refusal is gone, narrowed to the one
case that still reaches unported code -- superres.rs's upscale_row is
still &[u8].

Merge resolution: the dequant sites take main's per-plane quant deltas
AND the lane's bit_depth(); the superres margin keeps main's
inter-frame-capable take_last_frame_wide_margin plus the lane's
10-bit-with-superres refusal.

Suite 266 passed / 0 failed.
Merge branch 'lane-superres': inter-frame superres decodes pixel-exactAhmet Kaan Gümüş · b8f30b8
Merge branch 'lane-superres': inter-frame superres decodes pixel-exact

The inter-frame path stashed its LAST_FRAME_WIDE_MARGIN picture cropped
to the superblock-padded width/height instead of the mi-aligned
true_width/true_height the key-frame branch already used. Columns
[true_width, width) are never coded -- the last partial superblock stops
at true_width -- so the stashed chroma margin carried one column of
stale PlaneBuf content past the real decoded extent, and upscale_row's
right-edge replicate then consumed it one column early.

Luma was exact only because this fixture's luma true_width equals its
padded width (64 == 64); the chroma halves diverge by one, which is what
made the defect visible at all. Same shorten-vs-replicate class as the
truesize lane.

superres.rs's per-plane (w + ss_x) >> ss_x step derivation was NOT the
bug and matches libaom -- recorded so the next lane does not re-audit it.

Gate: a_real_aomenc_key_and_inter_superres_sequence_decodes_pixel_exact,
3 frames pixel-exact, superres_hits=3, predict_scaled_hits=36.
Suite 265 passed / 0 failed.
fix(av1): inter-frame superres margin used SB-padded width, not true_widthAhmet Kaan Gümüş · f06baba
fix(av1): inter-frame superres margin used SB-padded width, not true_width

decode_inter_frame_tile_with_cdfs's LAST_FRAME_WIDE_MARGIN write site
cropped the real-decoded margin to the superblock-padded width/height
instead of the mi-aligned true_width/true_height the key-frame branch
already used -- columns past true_width were never actually coded, so
the chroma upscale's right-edge replicate read one column of stale
buffer content one position early. Same shorten-vs-replicate class as
av1-truesize; fix matches the key-frame branch line for line.

Gate: a_real_aomenc_key_and_inter_superres_sequence_decodes_pixel_exact
now passes (3 frames pixel-exact, superres_hits=3). Full lib suite:
265 passed, 0 failed, 19 ignored. cargo check --workspace --all-targets
clean.
wip(hbd): scale CDEF strength/damping/direction-search by bit-depth coeff_shiftAhmet Kaan Gümüş · 50d59cc
wip(hbd): scale CDEF strength/damping/direction-search by bit-depth coeff_shift

libaom cdef_block.c: coeff_shift = bit_depth - 8 scales pri/sec strength
(<< coeff_shift) and damping (luma + coeff_shift, chroma one less), and
cdef_find_dir normalises each sample (>> coeff_shift) before the -128
centring (cdef_block.c:74).

Coded by lane-hbd r6, `cargo check -p ec-av1 --lib` clean, committed by
the orchestrator at the agent's turn cap. NOT yet run against the gate.
Merge branch 'main' into lane-superresAhmet Kaan Gümüş · 17c9a9c
Merge branch 'main' into lane-superres

Resolves the scaled-MC conflict in decode.rs in favour of the lane's
structure, and widens predict_scaled to u16 for main's high-bit-depth
sample type (fixture included).

Lane state after the merge: 264 passed, 1 failed -- the lane's own gate
a_real_aomenc_key_and_inter_superres_sequence_decodes_pixel_exact. That
is the lane's deliverable, not merge fallout, so this does not go to
main yet.
Merge branch 'lane-sbpart': per-plane quantizer deltas threaded end to endAhmet Kaan Gümüş · 768b0da
Merge branch 'lane-sbpart': per-plane quantizer deltas threaded end to end

delta_q_y_dc / u_dc / u_ac / v_dc / v_ac were parsed by ec-av1-syntax and
used only to decide lossless[segment_id]; the dequantizer ignored them.
This threads a QuantDeltas through stream -> decode -> transform so the
per-plane offsets reach dc_q/ac_q.

Blast radius measured, not assumed: every gate fixture aomenc writes has
all five deltas zero, so the suite is unchanged (264/0) -- which also
means this is not the rect64 luma mismatch's cause. lane-sbpart r11
disproved that hypothesis and named CURRENT_Q_IDX / segmentation qindex
as the next suspect.
fix(av1): thread per-plane quantizer deltas (delta_q_y_dc/u_dc/u_ac/v_dc/v_ac) into dequantAhmet Kaan Gümüş · 8560456
fix(av1): thread per-plane quantizer deltas (delta_q_y_dc/u_dc/u_ac/v_dc/v_ac) into dequant

Spec 5.9.12/7.12.2: these were parsed by ec-av1-syntax and used for nothing
but the lossless[] check. Threaded QuantDeltas through dequant_coeff_wh/
dequant_wh/dequant_and_inverse_typed(_wh) and all 8 decode.rs leaf call
sites, plane-correct (Y has no AC delta). decode_stream's 5 call sites now
pass header.quantization.delta_q_*; convenience wrappers pass ::default().
Plain 4-arg dequant/dequant_coeff/dequant_and_inverse (~20 external callers
in tile.rs/encode.rs/transform.rs) unchanged.

Blast radius measured, not assumed: EC_AV1_TRACE now prints the 5 deltas at
parse time. Measured zero on the r10 pinned repro (seed42.obu, base_q_idx
180) and on every stream the scoped decode::/quant::/transform:: suites
exercise (27/27 green) -- no gate was passing "for the wrong reason".

Charter's 81-vs-76 defect is NOT this: deltas are genuinely zero for
seed42, disproven by measurement per the charter's own fallback clause.
Pinned repro currently panics on an unrelated pre-existing gap (32x32
partition value=4, later superblock, same shape as the r9 part32-AB
dead-end) before it can even reach the pixel comparison. Report names the
next suspect (CURRENT_Q_IDX per-superblock delta-q state / segmentation
qindex) with a one-line instrumentation step, left for the next round.

Red: pinned_sbpart_stream_decodes_pixel_exact still fails (pre-existing,
unrelated gap, not a regression from this diff).
feat(av1): 10-bit gate + lift the blanket bit_depth refusalAhmet Kaan Gümüş · 4112c99
feat(av1): 10-bit gate + lift the blanket bit_depth refusal

ffmpeg_decode_sequence_10bit parses yuv420p10le u16 LE output,
leaving the 8-bit helper untouched. a_real_aomenc_10bit_stream_
decodes_pixel_exact drives a real aomenc --bit-depth=10 stream,
hard-asserts the parsed sequence header actually says bit_depth==10
before trusting any pixel comparison, then compares against ffmpeg's
own 10-bit decode.

The blanket "bit depth is not 8" refusal in stream.rs is gone in this
same commit -- Picture is u16 now and BIT_DEPTH is wired
(set_bit_depth). film_grain.rs/superres.rs keep their own narrow
refusals from the previous commit.

Currently RED: the gate runs for real (sequence header confirmed
10-bit, not a SKIP) but the decoded luma is off by roughly 4x from
ffmpeg's reference (ours ~82-117, ffmpeg ~331-471 for the same
gradient) -- a systematic scale defect somewhere in reconstruction
for depth != 8, not the "small rounding delta" the charter expected.
Landing red per charter; root cause is next round's first job.
feat(av1): narrow bit_depth != 8 refusals for film_grain and superresAhmet Kaan Gümüş · c0c9f9b
feat(av1): narrow bit_depth != 8 refusals for film_grain and superres

film_grain.rs's grain LUT/blend and superres.rs's upscale_row are both
hardcoded 8-bit. Both call sites now refuse by name on bit_depth != 8
instead of relying on stream.rs's blanket refusal, so lifting that
blanket (next step) does not silently miscode either path. Declared
in refusal_inventory.rs.
feat(av1): wire decode::set_bit_depth from stream.rs per frameAhmet Kaan Gümüş · 1da7ad6
feat(av1): wire decode::set_bit_depth from stream.rs per frame

BIT_DEPTH silently defaulted to 8 forever -- set_bit_depth existed
(decode.rs) but nothing called it. stream.rs now reads
seq.color_config.bit_depth per frame (defaulting to 8 with no
sequence header yet, matching every fixture) and sets it right next
to set_enable_edge_filter, for the same cross-sequence-on-one-thread
reason.
diag(av1): sbpart r10's EC_SBPART_DUMP64 trace; scratch probe strippedAhmet Kaan Gümüş · b615bdc
diag(av1): sbpart r10's EC_SBPART_DUMP64 trace; scratch probe stripped

r10 hit its cap without committing. Keeping the env-gated dump in
decode_block_rect64 (reusable); removed its throwaway transform test, which was
hand-verification scaffolding and had served its purpose. Its scratch fixtures
moved to fixtures/sbpart/ (gitignored) so the repro survives.

Its finding is in the r11 charter: the defect is NOT in decode_block_rect64.
Merge branch 'lane-hbd': Picture carries u16 samples; the encoder stays 8-bit at its own boundaryAhmet Kaan Gümüş · 8d71aab
Merge branch 'lane-hbd': Picture carries u16 samples; the encoder stays 8-bit at its own boundary

This was the blocker the previous round found: Picture.y/u/v are shared by the
encoder AND by decode_stream's return value and the DPB reference slots that
motion compensation reads back on frame 2+, so the bit_depth != 8 refusal could
not lift honestly until this type widened.

Boundaries chosen deliberately: the encoder narrows its caller's Picture to
local u8 at entry and widens its reconstruction back on the way out;
motion::search stays 8-bit (SAD math) with a locally narrowed reference;
film_grain and superres narrow at their own edges. Each of those is a place a
future 10-bit path will have to earn, and each is now visible instead of
implicit.

The lane checked -p ec-av1 only, so it did not see that tools/ec-bench builds a
Picture from 8-bit y4m; widened those three planes at the call site.

8-bit output bit-exact: 264 passed / 0 failed. Workspace --all-targets clean.

Still owed before the refusal can lift: decode::set_bit_depth is written but
never called, so the BIT_DEPTH thread-local is dead code defaulting to 8.
docs(av1): lane-sbpart r10 charter -- fix the truncated-corner reconstruction; landing red on the lane is allowedAhmet Kaan Gümüş · 2a9daf1
docs(av1): lane-sbpart r10 charter -- fix the truncated-corner reconstruction; landing red on the lane is allowed
Merge branch 'lane-hbd': the decoder's sample type is u16; 8-bit output unchangedAhmet Kaan Gümüş · e673d71
Merge branch 'lane-hbd': the decoder's sample type is u16; 8-bit output unchanged

PlaneBuf::data, the prediction scratch buffers, intra.rs, warp.rs,
restoration.rs, mc.rs and the OBMC/interintra blend chains all carry u16 now,
with clamp bounds derived from bit_depth instead of a literal 255. That is the
whole surface the bit_depth != 8 refusal was hiding behind: both AV1 films in
the user's library are yuv420p10le.

The encoder is 8-bit only and keeps u8 buffers -- its four call sites into the
now-shared prediction functions get a local, lossless round-trip box. That was
the round's one real design decision and it is the right one: nothing in the
encoder produces wider content to hold.

Two earlier attempts at this reverted rather than commit a non-compiling tree,
losing the work each time. This one landed because the charter allowed
`wip(hbd):` checkpoints while the compile-error count was falling -- 42 to 0 --
and because the widen started at PlaneBuf::data and let the compiler enumerate
the sites, with mc.rs last.

8-bit is bit-exact: 264 passed / 0 failed, every real-aomenc gate among them.

Still refused: bit_depth != 8. Lifting it needs a 10-bit gate, which needs a
second ffmpeg_decode_sequence helper emitting yuv420p10le with u16 LE parsing.
Merge branch 'main' into lane-hbdAhmet Kaan Gümüş · 04c2ffdBrowse files
Merge branch 'lane-sbpart': the rect64 luma corner decodes; nz_map offsets are indexed by the RAW tx_sizeAhmet Kaan Gümüş · 4d5caf0
Merge branch 'lane-sbpart': the rect64 luma corner decodes; nz_map offsets are indexed by the RAW tx_size

Root cause, after four rounds and a range ladder: libaom's
get_nz_map_ctx_from_stats indexes av1_nz_map_ctx_offset by the raw,
un-adjusted tx_size, and av1_nz_map_ctx_offset_32x64 / _64x32 are genuinely
different tables from the square one -- offset 11 vs 1 at (row=1, col=0). We
always used the square table for the superblock-strip corner read. The CDF-SET
resolution the previous round suspected (get_txsize_entropy_ctx) was already
correct: TX_32X64 and TX_64X32 both resolve to TX_64X64, exactly as we had it.

The bug was one level below the suspect, and the ladder is what found it: entry
range, eob and base_eob all matched the oracle, and the first divergence was a
single `base` symbol.

Gate: 15/40 pixel-exact, 25 named refusals, 0 mismatches, sb_rect_hits=36 (was
0/40 with a mismatch).

I declared the lane's two new refusal strings, which it added without listing --
the filter-intra one as a capability claim, since libaom's
av1_filter_intra_allowed_bsize capping at 32x32 is real evidence rather than
"never seen".

Suite 264 passed / 0 failed.
feat(av1): u16 widen compiles clean, 263/263 tests pass, 8-bit output bit-exactAhmet Kaan Gümüş · 35100f3
feat(av1): u16 widen compiles clean, 263/263 tests pass, 8-bit output bit-exact

Closes the 42-error checkpoint from r1's saved diff. decode.rs/warp.rs/mc.rs
call sites widened through OBMC and interintra blend chains; encode.rs and
motion.rs's own buffers stay u8 (encoder is 8-bit only this round) with a
local u16 round-trip box (intra_predict_u8 in encode.rs, inline conversion
in mc_trial and motion::search_traced_from_step) at their 4 call sites into
the now-widened intra::predict/mc::predict. bit_depth != 8 refusal
untouched, no 10-bit gate added.
fix(av1): superblock HORZ/VERT strip's luma corner nz-map ctx table -- pixel exactAhmet Kaan Gümüş · db23f4b
fix(av1): superblock HORZ/VERT strip's luma corner nz-map ctx table -- pixel exact

r7 range-laddered block2's coefficient read to a single symbol: base_ctx at
(row=1, col=0) diverges (ours 3, libaom level 1) with identical entry range,
eob and base_eob. Root cause per libaom source: get_txsize_entropy_ctx
resolves TX_32X64/TX_64X32's CDF *set* to square TX_64X64 (confirmed correct,
ruling out the charter's first suspect), but av1_nz_map_ctx_offset (the
position term feeding base_ctx) is separately indexed by the raw, un-adjusted
tx_size in decodetxb.c -- TX_32X64 and TX_64X32 each own a genuinely
different offset table from the square one (av1_nz_map_ctx_offset_32x64/
_64x32 in txb_common.c), confirmed against libaom source and used already by
lane-rectwire's base_ctx_rect for the smaller (<=32) rectangular sizes.
decode_block_rect64's luma corner read went through the generic (square-only)
base_ctx via read_coeffs, never picking up the rect table.

Added NZ_MAP_CTX_OFFSET_32X64/_64X32 (verified against the real libaom
tables), threaded an Option<(w, h)> rect_shape hint through read_coeffs/
base_ctx (None at every square call site, Some((bw, bh)) only from
decode_block_rect64), and select the matching offset table.

Gate: a_real_aomenc_stream_with_a_superblock_level_horz_vert_partition_decodes_pixel_exact
now 15/40 pixel-exact matches (0 mismatches, 25 named refusals, sb_rect_hits=36) --
was 0/40 pixel-exact before this round.
Merge branch 'lane-palette2': UV palette blocks decode pixel-exactAhmet Kaan Gümüş · 318c22b
Merge branch 'lane-palette2': UV palette blocks decode pixel-exact

Both chroma planes now reconstruct from their palette and index map
(read_palette_colors_uv written, PaletteUv reconstruction, record_palette_uv).
The gate hard-asserts palette_uv_hits moved before comparing pixels; 2 UV
palette blocks fire and match ffmpeg.

The previous round's uncommitted tree needed exactly one fix -- an 8x8-leaf
read_intra_mode call site still on the pre-UV signature -- so committing that
tree verbatim at the cap was worth doing.

The UV refusal string stays in the inventory: it is still live at two
out-of-scope call sites (rect strip, inter-frame leaf).

Suite 263 passed / 0 failed.
diag(av1): sbpart r7 -- per-symbol coeff range ladder localizes block2's true divergenceAhmet Kaan Gümüş · 36c2f06
diag(av1): sbpart r7 -- per-symbol coeff range ladder localizes block2's true divergence

Rung 3's entry/exit EC_TRACE_COEFF proved block2's luma coefficient read
(TxbSet::Luma64 corner, decode.rs:3214) is where the desync actually starts:
entry rng=63764 matches the oracle exactly (confirming r6's mode-info prefix
finding held all the way through skip/depth), but the luma read's own exit
range (46984 ours vs 46344 oracle) diverges -- overturning r6's suspicion
that around_rect's neighbour gather was the culprit; the gather only feeds
skip_ctx/dc_sign_ctx, and both of those read identically (all_zero=0 both
sides, dc_sign both agree).

Added a new oracle rung (11, scripts/instrument-aom-oracle.sh, same
EC_TRACE_COEFF flag) printing per-symbol rng inside read_coeffs_txb
(eob/base_eob/after_bases/sign/post_golomb), plus matching entry/exit
EC_COEFF/EC_COEFF_VAL markers at all 3 of decode_block_rect64's own
read_coeffs/read_coeffs_rect call sites and rng on read_eob's own TRACE
eob_pt/eob_extra lines. Range-laddered block2's luma block byte-for-byte
against the oracle: eob (6) and base_eob (level=1) both match. First value
divergence is the "base" symbol at scan position row=1,col=0 (pos=32) --
ours decodes value=3 (triggering an extra "br" read, final level 3), the
oracle's equivalent position decodes level=1 with no br read at all. This
is a NEW, sharper suspect than r6's around_rect/context-gather framing: the
coefficient magnitude symbol itself (base_ctx's context computation, or the
CDF row it indexes) for this specific scan position inside the 32x32 corner
scan.

Diagnostics only, no behavior change to the live gate (still red, same as
r6 left it) -- sb_rect_hits()>0 unproven this round, not attempted since the
fix itself wasn't reached within budget.

cargo check -p ec-av1 --tests: clean, only pre-existing missing-doc
warnings. Oracle rung env-gated, applied to the shared ~/.cache/aom-oracle
tree and rebuilt (ninja aomdec clean), also captured in
scripts/instrument-aom-oracle.sh so it reproduces from a fresh clone.