forge
Explore
Log in

Don't you dare go Hollow

Commits

Commits on 52c91bc63a2e0793876d439518cb9fc82c3fea6d

2026-09-02

fix(av1): a 128-root block re-stamped its chroma entropy context from the whole-block grid and recorded a 64x128 var-tx block as 128x128 -- the mu-chunk DC sign of every unit but the top-left was lost (dc_sign_ctx 1 vs libaom 2 at the first chroma unit of the 64x128 edge block) and the next superblock's 128-root partition ctx read 16 vs 19; 192x256 sb128 8-bit inter stream goes 4-of-6 frames differing (36073 bytes) -> 6/6 bit-exact, new gate arm 46Ahmet Kaan Gümüş · 52c91bc
fix(av1): a 128-root block re-stamped its chroma entropy context from the whole-block grid and recorded a 64x128 var-tx block as 128x128 -- the mu-chunk DC sign of every unit but the top-left was lost (dc_sign_ctx 1 vs libaom 2 at the first chroma unit of the 64x128 edge block) and the next superblock's 128-root partition ctx read 16 vs 19; 192x256 sb128 8-bit inter stream goes 4-of-6 frames differing (36073 bytes) -> 6/6 bit-exact, new gate arm 46
feat(av1): intra 128x64/64x128 at the 128 superblock root -- rect intra block with per-TU prediction, mu-chunk chroma, and a frame-edge write clipAhmet Kaan Gümüş · 603f865
feat(av1): intra 128x64/64x128 at the 128 superblock root -- rect intra block with per-TU prediction, mu-chunk chroma, and a frame-edge write clip

The key-frame path refused the 128 root's HORZ/VERT arm by name (r7). It now
decodes one BLOCK_128X64 (or 64x128) per half through decode_block_128rect:
two-or-more SQUARE luma transform units (max_txsize_rect_lookup caps at
TX_64X64), one 32x32 chroma unit per 64x64 mu chunk per plane on the
offset-10 txb_skip rows, per-TU prediction in raster order, one cdef_idx per
half fanned over the CDEF units it covers.

PlaneBuf::reconstruct/reconstruct_rect now clip at the padded frame edge: our
buffer is 32-aligned while libaom's is superblock aligned, and a 64x64 unit of
a bottom-edge 128x64 block indexed one row past a 1080p buffer -- two panics
on real 10-bit 1920x792 extracts.

Gate: a_real_aomenc_sb128_intra_rect_block_decodes_pixel_exact, 5 real aomenc
streams (8+10 bit, HORZ and VERT, cq 8..55), every decode-order frame
pixel-exact vs aomdec, 96 intra 128-rect blocks.
feat(av1): decode the 128 root's gathered frame-edge HORZ/VERT arm on the inter pathAhmet Kaan Gümüş · 83a30ca
feat(av1): decode the 128 root's gathered frame-edge HORZ/VERT arm on the inter path

mi_rows/mi_cols that do not fill the last 128 superblock make has_rows128 /
has_cols128 false, and the gathered bit then codes PARTITION_HORZ (a 128x64
block whose bottom half is outside the frame) or PARTITION_VERT (64x128) --
the only 128-partition shape a 1080p stream reaches (mi_rows 270). The inter
tile path now decodes both through inter_piece! with two TX_64X64 luma units
per mu chunk, TX_32X32 chroma, per-block cdef_idx fan-out and sb-size-aware
whole-block delta-q; Neighbours::new pads its side arrays to a superblock
multiple (libaom av1_alloc_context_buffers) since such a block records state
past the last mi row. The intra path is square-block only and now refuses the
arm BY NAME instead of silently decoding it as four 64x64 quadrants.

Gate a_real_aomenc_sb128_gathered_edge_horz_partition_decodes_pixel_exact:
4 real aomenc --sb-size=128 --cpu-used=0 streams (384x320 and 192x256, 8+10
bit, cq 32/45/55), every decode-order frame incl. the hidden alt-ref compared
against the instrumented aomdec, hard-asserting the edge counter and the inter
128x64/64x128 block counter.
wip(sb128c): r7 partial from the interrupted roundAhmet Kaan Gümüş · 386c0a8
wip(sb128c): r7 partial from the interrupted round

Inter-path 128x64 / 64x128 at the 128 root: gathered-edge counters, the
two-square-TX_64X64 var-tx read for bw.max(bh) > 64, the mu-chunk chroma
branch ordered before the rect_tu one, sb-size-aware whole_sb delta-q
test, overhang clamp in PlaneBuf, and the HORZ/VERT inter_piece! arm with
per-block cdef_idx fan-out. AB shapes stay refused by name.
fix(av1): gate the top-right mv probe on the bs>64 half of has_top_right only, and cap inter var-tx leaves per root sizeAhmet Kaan Gümüş · 76749a1
fix(av1): gate the top-right mv probe on the bs>64 half of has_top_right only, and cap inter var-tx leaves per root size

The r5 wiring applied libaom's whole has_top_right, position mask included,
without its three shape refinements (is_last_vertical_rect,
is_first_horizontal_rect, the PARTITION_VERT_A bottom-left square). That is
right for a 128 block (bs > 64 -> no candidate, the defect r5 fixed) and wrong
below it: the 64-level AB, free-partition and 1:4 stream gates lost frame 16
luma. Gate on the size half only; ceiling and upgrade path named at the helper.
Also: the merged var-tx leaf ceiling is per root (32 below the 128 root, 64 at
it, where the mu-chunk reader codes a TX_64X64's 32x32 coded corner), and the
skipped-inter internal-edge suppression is narrowed to the 128 root, the only
size whose leaves are not the block.
fix(av1): gate the mv-stack top-right probe on has_top_right; 128-root motion_mode/obmc CDF rows; TX_64X64 coded corner on the intra-in-inter pathAhmet Kaan Gümüş · b6c54c5
fix(av1): gate the mv-stack top-right probe on has_top_right; 128-root motion_mode/obmc CDF rows; TX_64X64 coded corner on the intra-in-inter path

Three root causes behind the 128x128 inter gate's frame-5 reconstruction residue,
all on a 256x256 8/10-bit stream with use_128x128_superblock:

1. mvstack.rs find_mv_stack{,_compound} called scan_top_right unconditionally.
   libaom setup_ref_mv_list (mvref_common.c:497/546) gates it on has_top_right,
   which is 0 for bs > 16 -- a 128x128 block's above-right cell is populated
   (previous SB row) but unavailable, so we invented a candidate and desynced
   the drl symbols.
2. decode.rs mapped a square block's motion_mode/obmc CDF row with
   trailing_zeros - 3, sending 128 to our packed BLOCK_16X32 row. Added libaom
   default_motion_mode_cdf / default_obmc_cdf rows 13/14/15 (64X128, 128X64,
   128X128) and explicit match arms ahead of the square one.
3. A TX_64X64 luma unit on the intra-in-inter-frame path used the full 64x64
   scan and tx_side; only the top-left 32x32 is coded (spec 5.11.40), which
   panicked the inverse transform on the 10-bit arm.

All 9 decode-order frames of the 8-bit and 10-bit gate arms are now pixel-exact
(EC_AV1_PREFILT_DUMP, was 19550/14164/26667/26716 wrong bytes on f5..f8); the
mode-value ladder matches aomdec exactly. The tx-size-search arm is still red on
4 post-deblock chroma pixels -- a phantom chroma TU edge published by the
per-vartx-leaf lf-grid write, analysed in lanes/sb128c-r5.handoff.md.
Merge branch 'lane-r14' (b86eb38): general sub_tx_size_map and (row,col,tw,th) var-tx leaves, plus rectangular inter leaf codingAhmet Kaan Gümüş · fcf808d
Merge branch 'lane-r14' (b86eb38): general sub_tx_size_map and (row,col,tw,th) var-tx leaves, plus rectangular inter leaf coding

Var-tx split now recurses with a general sub_tx_size_map and codes leaves by
(row, col, tx_w, tx_h) instead of a square-only shape, so a split transform on
a 1:4 inter strip with a 64-px axis decodes instead of refusing. Refusal
dropped from refusal_inventory.rs; gate_coverage drops enable-tx64 from the
never-exercised set.

Gate: real_aomenc_1to4_streams_decode_pixel_exact_and_rect_vartx_leaves_fire_before_a_named_refusal
Suite: 382 passed / 0 failed / 33 ignored.
fix(av1): restore the TX_32X32 uv cap; suppress skip-inter 128 edges explicitlyAhmet Kaan Gümüş · a948429
fix(av1): restore the TX_32X32 uv cap; suppress skip-inter 128 edges explicitly

An INTRA 128x128 block's internal chroma transform edges ARE filtered by libaom
(`curr_skipped` carries an `is_inter_block` term), so dropping
`fill_lf_grid_rect`'s uv `.min(32)` cap outright -- my first attempt at the
skip-inter suppression -- turned the sibling key-frame gate
a_real_aomenc_key_frame_with_a_128x128_none_partition_decodes_pixel_exact RED.

The cap is back. The suppression is now explicit and inter-only: a new
`Neighbours::suppress_internal_lf_edges` writes the block's UNCAPPED chroma
extent into the uv grids, called only from the `skip && is_inter` branch of
`decode_inter_block`, alongside the existing gate on the per-leaf luma
publication. Both 128-NONE gates on one run: key frame ok; the inter gate moves
from decode-order frame 4 (deblock) to frame 5 (an independent reconstruction
defect in the bottom superblock row, documented in the r4 handoff).
fix(av1): an OBMC neighbour with no recorded switchable filter aborted the process instead of refusingAhmet Kaan Gümüş · a1a5ef8
fix(av1): an OBMC neighbour with no recorded switchable filter aborted the process instead of refusing

`neighbour_filter` handed the `[3, 3]` "no filter recorded" sentinel straight to
`from_switchable_symbol`, which panics on anything above 2 -- a crash on stream
data, reproducible on a real 192x68 cq40 8-bit aomenc stream where an inter leaf
below 8x8 desyncs upstream. It now returns `Result` and refuses by name; the
desync itself belongs to lane-intersub8.

Also: an `EC_AV1_DEBLOCK_TRACE_V` rung (per-edge len/level plus the vertical
pass's real bounds), and `a_frame_edge_straddling_band_decodes_pixel_exact`,
an ignored pinned test carrying the four 192x68 / 68x192 straddle arms. The
+-1 straddling-band defect is bisected to CDEF this round: reconstruction and
post-deblock both match the instrumented reference on the failing frame.
Merge branch 'lane-kf1200' (bee8ec0): the 16x4/4x16 chroma pair's edge-filter type comes from the pair's base mi, and a chroma-carrying gate source to prove itAhmet Kaan Gümüş · a8d25d4
Merge branch 'lane-kf1200' (bee8ec0): the 16x4/4x16 chroma pair's edge-filter type comes from the pair's base mi, and a chroma-carrying gate source to prove it

Root cause found on a 3840x1608 10-bit key frame that decoded with no refusal
and 12 wrong U samples (Y and V exact, and already wrong before the loop
filter, so reconstruction rather than deblock/CDEF/LR/grain):

libaom builds chroma_above_mbmi / chroma_left_mbmi from
mi[-((mi_row & ss_y) * stride + (mi_col & ss_x))] (set_mi_offsets,
av1/common/blockd.h), i.e. from the PAIR's top-left luma mi, never the odd
row/column of the closing strip. Reading the strip's own mi named a
non-chroma-reference 4-row block whose uv_mode is UV_DC_PRED and so lost a
SMOOTH neighbour: filt_type 0 instead of 1 turned av1_use_intra_edge_upsample
on (blk_wh 12 <= 16) for a directional chroma strip and moved 4 samples by 1.

Gate: a_real_aomenc_stream_with_a_16_level_1to4_partition_decodes_pixel_exact
now alternates a CHROMA-CARRYING source (smooth cb/cr gradients) into the odd
attempts -- the old gray source left both chroma planes constant, so every
uv_mode was DC and the shape was unreachable -- and hard-asserts a new
RECT4_16_UV_PAIR_FILT_HITS counter (pairs where the pair-base answer differs
from the strip-mi answer). Measured on this merge: 13 flips at 8-bit, 8 at
10-bit; the lane reports the gate FAILS with the fix reverted.

Also merged: a second tracked fixture crates/ec-av1/fixtures/reelb_ss300_key_frame.obu
(3840x2160 10-bit key frame, one temporal unit) with gate
the_reelb_ss300_key_frame_skipped_cfl_decodes_pixel_exact.

MERGE NOTE -- the two sub-8x8 skip arms (decode_leaf_split4, decode_leaf_rect8)
are the SAME arms lane-reelckf fixed on main, not additional ones: both lanes
wrote the identical "a skipped chroma block still gets its CfL alpha" fix
independently. The resolution keeps ONE fix and bumps BOTH lanes' counters
(CHROMA_SKIP_CFL_HITS and SKIP_CFL_HITS) so neither lane's gate becomes
vacuous. Likewise the pair-mi read exists once, with lane-kf1200's counter.

Lane suite: 378 passed, 0 failed, 33 ignored.
docs(sb128c): r4 handoffAhmet Kaan Gümüş · 1b74214Browse files
fix(av1): a SKIP inter 128x128 block's internal TX_64X64 edges were deblockedAhmet Kaan Gümüş · a176458
fix(av1): a SKIP inter 128x128 block's internal TX_64X64 edges were deblocked

libaom `set_one_param_for_line_luma`/`_chroma` suppress every edge that is a
transform-unit edge but not a prediction-unit edge when
`curr_skipped = mbmi->skip_txfm && is_inter_block(mbmi)`. `get_transform_size`
still reports TX_64X64 (luma) / TX_32X32 (chroma) for a skipped 128x128 inter
block, so the tu_edge at the block's own x=64 / y=64 exists -- it is simply
never filtered. This decoder published those units into the lf grid
unconditionally and filtered them.

Two changes in `crates/ec-av1/src/decode.rs`:
- the per-leaf `fill_lf_grid_rect` loop is now gated on `!(skip && is_inter)`,
  leaving the block-level 128 publication (no internal luma edge) in place --
  the 128 root is the only block that reaches that loop skipped, because
  `read_block_tx_size` hands back four TX_64X64 leaves for `side > 64`
  regardless of `skip`.
- `fill_lf_grid_rect`'s uv extent drops its `.min(32)` cap: inert for every
  block up to 64 wide (64/2 == 32) and wrong for a 128-sided one, where it
  published an internal chroma edge every 32 chroma px. A non-skip 128 block
  still gets uv 32 through its own per-leaf calls (`w_mi * MI == 64`).

Also indexes `dump_stage`'s output per decode-order picture (`EC_AV1_POSTDEBLOCK_DUMP`
overwrote `.f0` every frame, so only the last picture was comparable against
aomdec's own indexed rung -- that rung is what isolated this defect).

Measured on the 8-bit 256x256 sb128 inter gate stream: decode-order frames 0-4
were pre-filter exact and frame 4 diverged post-deblock (98 luma px in a 9-px
band at x=64, 274 chroma); all five stages are now exact. aomdec's post-deblock
dump changes ZERO pixels in columns 50..78 of that frame -- it filters nothing
there.
fix(av1): a skipped sub-8x8 chroma block dropped its CfL alpha entirelyAhmet Kaan Gümüş · f4f89df
fix(av1): a skipped sub-8x8 chroma block dropped its CfL alpha entirely

Both sub-8x8 leaf paths (decode.rs:10554 4-leaf, :10916 2-leaf) passed
`None` for the CfL argument in their `skip_txfm` arm, so a chroma block
with `uv_mode == UV_CFL_PRED` and no residual reconstructed as flat DC.
libaom's `av1_predict_intra_block_facade` (av1/common/reconintra.c:1719)
calls `cfl_predict_block` whenever `mbmi->uv_mode == UV_CFL_PRED`;
`skip_txfm` only drops the residual, never the alpha.

Sweep of the class: every `reconstruct`/`reconstruct_rect` chroma call
site was checked for a literal `None` in the cfl slot -- the rect skip
arms (6015/6519/8078) already pass it, and the one remaining `None`
(20284) sits behind a refusal that forces `uv_mode == DC_PRED`.

Gate: a new pinned 1-frame 3840x1608 10-bit AV1 key frame fixture plus a
test that hard-asserts `skip_cfl_hits > 0` (the shape fires exactly once
in that frame; lane-reelckf r1 already burned 20 aomenc recipes hunting a
skipped sub-8x8 CfL block and never produced one, so a synthetic gate is
out of reach). Before the fix 463 bytes of that frame's chroma were
wrong; after it the frame is pixel-exact against ffmpeg.
merge: main (85887c7) into lane-sb128cAhmet Kaan Gümüş · 350a0db
merge: main (85887c7) into lane-sb128c

No conflicts (auto-merge in decode.rs, stream.rs, gate_coverage.rs, mvstack.rs).
cdf.rs untouched by both sides. `cargo check -p ec-av1` clean on the merged tree.
Merge branch 'lane-reelckf' (55532c7): skipped CfL blocks still predict, and a 1:4 chroma pair reads its edge-filter type at the chroma-reference miAhmet Kaan Gümüş · cfef385
Merge branch 'lane-reelckf' (55532c7): skipped CfL blocks still predict, and a 1:4 chroma pair reads its edge-filter type at the chroma-reference mi

Two chroma defects found on real 1920x792 10-bit AV1 key frames, whose luma
was already bit-exact at every seek point:

1. A SKIPPED intra block whose uv_mode is UV_CFL_PRED must still PREDICT with
   the chroma-from-luma term. libaom predict_and_reconstruct_intra_block calls
   av1_predict_intra_block_facade unconditionally and guards only the residual
   on mbmi->skip_txfm. Three skip arms dropped the CfL term entirely
   (decode_rect4_16's 16x16-level 1:4 chroma pair, decode_leaf_split4 and
   decode_leaf_rect8's 4x4 groups); one key frame had 499 wrong chroma samples
   from this alone.

2. The chroma intra-edge FILTER TYPE of a 1:4 pair comes from the CHROMA
   REFERENCE position (libaom get_intra_edge_filter_type -> chroma_above_mbmi /
   chroma_left_mbmi), not from the closing strip: at the closing strip the cell
   above is the pair's own first strip, so the mi-exact UV map missed and the
   coarse fallback answered, flipping av1_use_intra_edge_upsample and moving
   directional chroma by +-1..3.

Gates:
* a_real_aomenc_sb128_stream_whose_skipped_cfl_and_1to4_chroma_pairs_decode_pixel_exact
  -- real aomenc --sb-size=128 --cpu-used=0 --enable-cfl-intra=1
  --enable-1to4-partitions=1, both bit depths, hard-asserts the directional
  1:4 chroma pair counter per compared attempt.
* a_real_film_key_frame_with_a_skipped_cfl_block_decodes_pixel_exact -- new
  tracked fixture crates/ec-av1/fixtures/reelc_kf2700.obu, a 1920x792 10-bit
  key frame truncated to one temporal unit; the only stream we have with a
  skipped UV_CFL_PRED block (48 aomenc recipes never produced one). The
  skipped-CfL counter is hard-asserted BEFORE the ffmpeg compare so an absent
  ffmpeg cannot make the gate vacuous.

gate_coverage: covers_both_depths also recognises `for depth in [8usize, 10]`,
which had classified such a gate as 10-bit only and hid --enable-cfl-intra=1
from the 8-bit never-exercised list; enable-cfl-intra leaves BOTH lists.
decode_probe prints the two new counters.

Lane suite: 379 passed, 0 failed, 33 ignored.
docs(lanes): worktree setup rules left uncommitted in main's tree by another laneAhmet Kaan Gümüş · 95b6784
docs(lanes): worktree setup rules left uncommitted in main's tree by another lane

Byte-identical to the same addition on lane-reelckf 55532c7; committed
separately so the merge does not overwrite an uncommitted working-tree edit.
fix(av1): an INTRA-coded 128x128 block inside an inter frame decodes; three 128-root defectsAhmet Kaan Gümüş · 3084278
fix(av1): an INTRA-coded 128x128 block inside an inter frame decodes; three 128-root defects

lane-sb128c r3.

- CLASS SWEEP (uv_mode alphabet): `is_cfl_allowed` is now decided inside the
  two readers every caller routes through -- `read_intra_mode_rect` (from
  `bw`/`bh`) and `read_intra_mode` (from `side`) -- instead of at each call
  site. Four call sites passed a hardcoded `true`; only the 128/64 ones were
  wrong, but the decision no longer lives where a new caller can get it wrong
  (class wrong-alphabet-same-value).
- The intra tail of `decode_inter_block` now codes its chroma per 64x64 mu
  chunk (TX_32X32 units, offset-10 `txb_skip` rows, per-unit
  `record_mi_chroma`), exactly as the inter half does; the refusal
  "an INTRA-coded 128x128 block inside an inter frame" is gone.
- `read_block_tx_size`'s TX_MODE_LARGEST early return produced four TX_64X64
  luma leaves for INTER 128 blocks only; an intra 128 block resolves the same
  way and got a single 128-wide unit that codes nothing.
- `get_tx_size_context` compares against `tx_size_wide[max_txsize_rect_lookup]`
  (64 at BLOCK_128X128), never the block's own 128 side.
- The inter tile's 128 PARTITION_NONE root passed its `at` in SUB16 units to a
  callee that takes MI, so every 128 root except the first decoded at a quarter
  of its position; and the `inter_piece!` macro hardcoded `reject_residual =
  true`, which refused the square 128 root at its first non-skip block.

Gate `a_real_aomenc_inter_128x128_none_root_decodes_pixel_exact` is un-ignored
and RED: all three arms now decode all 9 frames with no refusal (recipe moved
to --min-partition-size=64; at 32 two arms stop on other lanes' AB refusals),
but display frame 2 differs in 98 luma px in a band at x=58..66 spanning the
frame height, plus scattered chroma -- a reconstruction/loop-filter residue at
the 128 root's internal 64-px edge, not an entropy desync (9 frames stay in
sync). See lanes/sb128c-r3.report.md.
fix(av1): a same-size reference at a height that is not a multiple of 8 was refused, and loop restoration ran over the mi-rounded plane instead of the cropped oneAhmet Kaan Gümüş · 570d099
fix(av1): a same-size reference at a height that is not a multiple of 8 was refused, and loop restoration ran over the mi-rounded plane instead of the cropped one

Two true-size-vs-mi-rounded defects (class av1-truesize-lane), both found by
the (192,68)/(68,192) straddling arms lane-golomb r7 measured but could not add.

1. decode.rs `decode_inter_frame_tile_with_cdfs` compared the reference
   picture's height against `true_height = mi_rows * 4` (the mi-rounded
   size). A decoded `Picture` is cropped to the header's `fh`, so for any
   height that is not a multiple of 8 (68 -> mi_rows 18 -> 72) this compared
   68 against 72 and refused EVERY same-size reference by name ("a reference
   picture whose height does not match this frame's own true size"). libaom
   compares references on the CROPPED dimensions --
   `av1_setup_scale_factors_for_frame(&sf, ref->y_crop_width,
   ref->y_crop_height, cm->width, cm->height)` -- and calls a reference
   scaled only when those differ. Height must still match: AV1 superres never
   scales height. MEASURED: with `arms.push((192, 68, 5, false))` all eight cq
   attempts refused before this commit; after it none do (they now stop at
   another lane's inter SB-level AB partition, or reach a compare).

2. `apply_loop_restoration` passed each plane's `true_width`/`true_height`.
   LR is the one post-decode filter that does NOT walk the mi grid: libaom
   sizes every plane with `av1_get_upsampled_plane_size`
   (av1/common/restoration.c:47), asserts it equals the buffer's crop width
   (restoration.c:1106) and extends the border from that cropped edge
   (restoration.c:1109) before filtering. Deblock and CDEF do walk the mi
   grid, which is why this went unnoticed until a non-multiple-of-8 size.
   NOT exercised by any gate here: every straddle gate recipe runs
   `--enable-restoration=0`. Source-cited only.

edge32 gate stays green on the merged tree: 38 pixel-exact attempts, 64-level
edge bits [horz_or_vert=7 split=197] right-VERT=7, 2 named refusals, all eight
cq levels at both depths.
docs(r14): r4 report -- main merge (no conflicts, cdf.rs identical), firing assert restored as a hard 8-bit assert, film-depth regression attributed to main; suite 372/0/32Ahmet Kaan Gümüş · 5677085
docs(r14): r4 report -- main merge (no conflicts, cdf.rs identical), firing assert restored as a hard 8-bit assert, film-depth regression attributed to main; suite 372/0/32
Merge main 85887c7 (lane-mvtwin, lane-sb128b) into lane-kf1200Ahmet Kaan Gümüş · 28188f3
Merge main 85887c7 (lane-mvtwin, lane-sb128b) into lane-kf1200

Clean auto-merge; cdf.rs byte-identical to main's. The r1 pair-mi
chroma edge-filter fix at decode.rs:7736 and its counter survive.
docs(sb128c): r2 handoffAhmet Kaan Gümüş · 2617a22Browse files
fix(av1): an intra block in an INTER frame reads the no-CFL uv_mode alphabet above 32x32Ahmet Kaan Gümüş · e4259c9
fix(av1): an intra block in an INTER frame reads the no-CFL uv_mode alphabet above 32x32

libaom `read_intra_block_mode_info` calls
`read_intra_mode_uv(ec_ctx, r, is_cfl_allowed(xd), bsize)`, and
`is_cfl_allowed` (blockd.h) is
`block_size_wide[bsize] <= 32 && block_size_high[bsize] <= 32`.
`decode_inter_block`'s intra tail read the 14-symbol `uv_mode_cfl` CDF
unconditionally, so every intra block 64 px or wider inside an inter frame
decoded the same VALUE off a different interval and desynced the tile at
that symbol (class wrong-alphabet-same-value). Every other `uv_mode` reader
in this file already makes the split; this was the last one.

Found by an aomdec-vs-ours msac RANGE ladder on a 256x256 --sb-size=128
8-frame aomenc stream: the 64x64 intra block at mi (0,32) of an inter frame
entered at rng=61470 in both decoders and left at 35887 (ours) vs 54271
(aomdec), 4 bits over-read; after the fix the whole ladder tracks.

Also: the partition_w64 trace line carries its pre-read range and the
EC_MODE line carries is_inter/skip/side, both behind the existing env vars.
test(av1): pin a 1920x792 10-bit AV1 key frame as a fixture -- the only stream we have with a skipped CfL blockAhmet Kaan Gümüş · 293bc74
test(av1): pin a 1920x792 10-bit AV1 key frame as a fixture -- the only stream we have with a skipped CfL block

30 aomenc recipes (r1's 20 plus 18 more in r2, sweeping chroma-correlated geq
sources at cq 40..63, cpu-used 0..2, min/max-partition 4..64, 8 and 10 bit)
never made the encoder pick a CfL block with skip=1: the two conditions pull
against each other, since skip needs a zero luma residual and CfL needs luma AC
worth scaling. The instrumented oracle (EC_TRACE_MODE=1 aomdec) counts 5
'uv_mode=13 skip=1' blocks in this real 1920x792 10-bit key frame, so it is
pinned as crates/ec-av1/fixtures/reelc_kf2700.obu (36 kB, first temporal unit
only) and gated: decode + skip_cfl>0 assert run unconditionally, the three-plane
compare against ffmpeg's yuv420p10le decode runs when ffmpeg is present.

This closes r1's open item -- the skipped-intra-still-predicts-CfL fix (29cd53f)
now fails a test if reverted.
Merge branch 'main' (85887c7) into lane-golombAhmet Kaan Gümüş · 733770a
Merge branch 'main' (85887c7) into lane-golomb

Clean auto-merge; mvstack.rs, cdf.rs, cdf_state.rs, refusal_inventory.rs
verified byte-identical to main.
fix(av1): an inter block's chroma tx_type is the colocated luma type NARROWED to the chroma size's ext-tx set, not DCT_DCT at every side >= 32Ahmet Kaan Gümüş · 555df44
fix(av1): an inter block's chroma tx_type is the colocated luma type NARROWED to the chroma size's ext-tx set, not DCT_DCT at every side >= 32

av1_get_tx_type (libaom av1/common/blockd.h:1278-1309) resolves an inter
block's chroma transform type in three steps: DCT_DCT only when
txsize_sqr_up_map[tx_size] is STRICTLY greater than TX_32X32; otherwise the
colocated luma unit's coded type from xd->tx_type_map; then narrowed by
av1_ext_tx_used[av1_get_ext_tx_set_type(uv_tx, is_inter, reduced)]
(blockd.h:1036 / 1097).

This decoder had the first step as "chroma side >= 32 -> DCT_DCT" and no
third step at all. At exactly TX_32X32 an inter block reads
EXT_TX_SET_DCT_IDTX, which contains IDTX -- so a 64x64 inter superblock
whose first var-tx luma leaf coded IDTX must inverse-transform its 32x32
chroma units with IDTX, and we used DCT_DCT. IDTX and DCT_DCT are both
TX_CLASS_2D, so the scan, the coefficient contexts and every msac range
stayed identical: the stream never desynced, luma stayed bit-exact, and one
64x64 superblock of chroma came out as high-frequency noise. The missing
third step was also wrong the other way for a 16x16 chroma unit under 8x8
luma leaves (EXT_TX_SET_DTT9_IDTX_1DDCT excludes the four 1D ADST types).

New reduce_inherited_chroma_tx_type covers all four inter sets and both
inter-chroma callers (read_inter_plane, read_inter_plane_rect) -- the only
two sites in the crate that derive a chroma tx_type for an inter block.

Gate a_real_aomenc_stream_with_a_32x32_frame_edge_rect_partition goes
"192x80 cq35 frames=5 10bit=false frame 3 plane U: 978 pixels differ" ->
ok, 38 pixel-exact attempts over 5 arms x 8 cq levels, 8-bit and 10-bit.
Plus a unit test enumerating the set-membership table against libaom's.
Merge main 85887c7 (lane-mvtwin 2e2a225) into lane-reelckfAhmet Kaan Gümüş · 2bbef8b
Merge main 85887c7 (lane-mvtwin 2e2a225) into lane-reelckf

Auto-merge, no conflicts: mvstack.rs + stream.rs gates only, cdf.rs untouched,
no deletions.
chore(av1): keep a foreign EC_AV1_TRACE rng field on the partition_w64 trace; r1 suite was 370/1 and the red was this worktree's missing fixtures symlinkAhmet Kaan Gümüş · e4febc9
chore(av1): keep a foreign EC_AV1_TRACE rng field on the partition_w64 trace; r1 suite was 370/1 and the red was this worktree's missing fixtures symlink

The partition_w64 trace's rng= field appeared in this worktree at 08:15 after
this lane's last commit and is not this lane's edit; it is inert unless
EC_AV1_TRACE is set and helps r2's range ladder, so it is kept and disclosed
here rather than reverted.

a_real_aomenc_stream_with_film_grain_decodes_pixel_exact failed on
Os NotFound reading fixtures/golden6-mismatch.obu -- the worktree was created
without the shared fixtures symlink. Symlink created, test re-run ok.
Merge branch 'lane-mvtwin' (2e2a225): three MV-stack defects found by a phase-by-phase diff of the two twins against libaomAhmet Kaan Gümüş · 9ae16b3
Merge branch 'lane-mvtwin' (2e2a225): three MV-stack defects found by a phase-by-phase diff of the two twins against libaom

A 20-phase table of find_mv_stack_with_sign_bias / find_mv_stack_compound vs
mvref_common.c setup_ref_mv_list; 17 phases exact, three defects:

1. compound combine (mvref_common.c:718-719): slots past both ref lists take
   that side's global MV, not (0, 0).
2. insertion cap (:100/128/388/425): the 9th distinct candidate is DROPPED AT
   INSERTION -- we pushed unbounded and sorted+truncated, keeping a different
   set. The dedup weight bump still applies on a full stack.
3. reach/availability is TILE-relative (:512-533), not frame-relative; new
   MiGrid::tile_origin.

has_top_right deliberately unchanged: porting libaom's mask without the three
shape refinements (which need the partition type) would regress the 64x128
VERT-rect case; the corner-cut at mvstack.rs:588 keeps its upgrade path.

New gate a_real_aomenc_compound_mv_stack_* (3 arms, comp_gm_fill_hits=7,
stack_full_drops=2, tile_reach_clips=1, pixel-exact) plus one #[ignore]d
multi-tile reproducer.

Gates by name 48 passed / 0 failed; full lib suite 377 passed / 0 failed / 33 ignored.