edith_codecs
Clone
0 watching0 forksRust370.3 MiB9b67700Tahinli3 days ago4021 commits
lane-b128 — a real 128x128 root under EC_AV1_SB128
Three results:
- Task 0 (the drl pricer) is a STALE premise, and now has its enumeration
test. The charter's
encode.rs:8722mis-pricing was already closed by the lane-sb128b merge on the WRITER side; the pricer's own offer set is provably clamp-free against its own stack. - The 128x128
PARTITION_NONEroot is implemented, witnessed and MEASURED — and it turns lane-sb128b's refutation around: film B +24.2%/−2.5% vs libaom cpu-6 / rav1e s6 with 128 superblocks ON, against the SPLIT-only arm's +37.5%/+7.3%. - HORZ/VERT (128x64, 64x128) are deferred — see the disposition below.
1. Task 0 — the drl offer set, enumerated
crate::tile::signalled_drl_idx(entries, start, target) is the writer's
clamp rule as one pure function (write_drl_idx's own walk now carries a
debug_assert_eq! against it, so the two cannot drift). The pricer's offer
set is enumerated against it over every stack size 0..=4, for both the
NEWMV (best_new_mv_syntax) and the NEARMV (entries.get(idx)) arms:
cargo test -p ec-av1 --lib -- every_drl_index_the_new_mv_pricer
test encode::tests::every_drl_index_the_new_mv_pricer_offers_is_one_the_writer_can_signal ... ok
GREEN as written: best_new_mv_syntax breaks at entries.len() <= idx,
which is exactly write_drl_idx's entries.len() > idx + 1 condition, so
no offered index is ever clamped against the same stack. Byte effect:
none — the pins are byte-identical (below). The residual error the report
open item names is entirely the SEARCH-time vs WRITE-time stack divergence
(lane-sb128b's second open item), which no change on this line can reach.
2. The 128 root
What moved
tile.rs—Quadrant::Whole128(BlockCoeffs);write_sb128_roottakes the partition value;write_inter_block_128writes the block (skip,is_inter, the reference/mode chain at a 32x32-mi window, motion mode, tx syntax, mi grid + neighbour bands over all 32 mi cells); the inter tile loop skips the root's remaining three 64x64 cells, mirroring the decoder's ownsb128_none;partition_bitsgained the 128 row;signalled_drl_idx;take_sb128_none_hits.encode.rs—search_root_128(the candidate, its legality and its lambda),search_skip_64parameterised byside, the tile search loop restructured into ROOTS x cells, the 128-vs-four decision,take_b128_none_hits, theEC_AV1_B128_CENSUS=1per-frame line.
Deliberate limits (deviations from the charter, each with its reason)
- SKIP only. A 128x128 block's residual is four TX_64X64 luma units
interleaved with a TX_32X32 chroma pair per 64x64 mu chunk (the chroma
units on the offset-10
txb_skiprows), plus onetxfm_partitionsymbol per chunk. Neither the writer norPlane::code_from_predictionhas that path;write_inter_block_128REFUSES a non-skip block rather than coding one wrong.search_root_128therefore offersresidual: false. - Single reference only. The compound arm at 128 would go through
write_compound_blockat a window size it has never been exercised at. - Inter frames only. A key frame's 128 root still writes SPLIT.
- HORZ / VERT deferred. Two 128x64 / 64x128 blocks need rect neighbour recording and rect prediction/SSE on the WRITER and SEARCH sides (the decoder already reads both, lane-sb128c r7); the square NONE arm reuses every existing square helper unchanged.
Witness (red before / green after)
encode::tests::a_128_superblock_clip_whose_root_search_codes_128x128_blocks_decodes_exact
(--ignored, it moves the process-global superblock size):
cargo test -p ec-av1 --release --lib -- --ignored \
a_128_superblock_clip_whose_root_search --nocapture
128x128 PARTITION_NONE blocks: search won 406, writer coded 406
test ... ok
8 frames, 1280x768, a slow pan over smptebars at force_sb128(true):
406 128x128 blocks coded, every frame sample-exact against the encoder's
own reconstruction through decode_stream AND through ffmpeg. RED before
this lane by construction: write_sb128_root wrote PARTITION_SPLIT at
every root, so the count was 0 and no such block existed to decode.
Census (EC_AV1_B128_CENSUS=1, plus a per-row count in the gate)
Per row, over the four-quantizer ladder (search took / writer coded -- the writer is higher because the filter search re-codes each tile):
| row | 128 roots taken | writer-coded |
|---|---|---|
| bars 1080p | 3448 | 6013 |
| bars 2160p | 4144 | 5827 |
| film A | 505 | 1241 |
| film B | 1928 | 3189 |
| screen capture | 4736 | 4774 |
Per frame on film B the census reads e.g. 100 whole 128x128 roots, 336 coded blocks (83.3% of the frame's area at 128) -- the lever cen3's L1
asked for (38754 coded blocks vs libaom's 16178) is really being pulled.
All of them are on INTER frames: a key frame's 128 root still writes SPLIT.
3. The gate
bd_rate_screen_native, 12 frames, four quantizers, BD-rate vs libaom
cpu-used 6 / rav1e speed 6 (lower is better). Both arms from THIS tree,
both controls reproduced (not taken from the charter):
| row | 64 superblocks (control) | 128 + the 128 root |
|---|---|---|
| bars 1080p | −2.6 / −18.3 | −3.3 / −18.9 |
| bars 2160p | +8.8 / −13.2 | +7.9 / −14.0 |
| film A (1080p) | +20.6 / −5.1 | +20.4 / −5.2 |
| film B (2160p) | +24.8 / −2.1 | +24.2 / −2.5 |
| screen capture | +14.6 / −33.2 | +14.4 / −33.2 |
Long GOP (bd_rate_film_long_gop, 48 frames):
| row | 64 superblocks | 128 + the 128 root |
|---|---|---|
| film A | +24.7 / −7.5 | +24.4 / −7.7 |
| film B | +86.8 / +7.4 | +85.6 / +6.6 |
The 2x2 the charter asked for (film B, 12 frames):
| arm | vs libaom | vs rav1e |
|---|---|---|
| SB64, LR on (control) | +24.8% | −2.1% |
| SB128 + 128 root, LR on | +24.2% | −2.5% |
SB128 + 128 root, LR off (EC_AV1_LR=0) |
+24.6% | −2.3% |
(The SB64 LR-off control was not re-run: the SB64 path is byte-identical to the control tree -- the pins prove it -- and lane-sb128b measured it at +25.4/−1.6. The forced ≥128 LR unit is no longer a loss: LR ON is the better arm on both columns now, the reverse of lane-sb128b's reading.)
Every row of both gates is down or flat on both columns. The keep rule HOLDS -- and the default still does not flip. See below.
4. Why the default stays OFF (the blocker, not this lane's)
With EC_AV1_SB128=1, eleven of this crate's own round-trip tests fail,
and they fail with the 128x128 BLOCK switched off (EC_AV1_B128=0) too --
i.e. they are lane-sb128's SPLIT-only plumbing, at sizes its own 256x128
witness never covered:
stream::tests::decode_stream_round_trips_a_gop
stream::tests::decode_stream_round_trips_an_odd_size_gop
stream::tests::decode_stream_agrees_with_ffmpeg_on_a_gop
stream::tests::decode_stream_matches_the_tile_path_on_a_key_frame
stream::tests::streaming_decode_matches_the_collecting_one
stream::tests::a_doubly_cut_superblock_root_round_trips_in_every_plane
stream::tests::a_sweep_of_doubly_straddling_sizes_round_trips_through_ffmpeg
encoder::tests::every_tile_layout_decodes_sample_exact_through_both_decoders
encoder::tests::tile_bytes_do_not_depend_on_the_thread_count
encoder::tests::a_moving_detail_clip_codes_two_delta_q_levels_both_decoders_read_exactly
encode::tests::a_repeated_pattern_key_frame_codes_intrabc_blocks_ffmpeg_decodes_exactly
decode_stream_round_trips_a_gop fails with exactly the refusal lane-sb128b
root-caused ("a reference frame selected with no picture at this frame's own
ref_frame_idx slot"), so at least one writer/reader desync is still live in
the 128 path at odd sizes / multiple tiles. Two more
(encode::tests::reach_matches_libaom_has_top_right_and_has_bottom_left,
every_rect_shape_reaches_what_libaom_says_over_the_whole_superblock) are
TEST staleness: they assert libaom's 64-superblock reach tables against a
process whose superblock size is 128.
A 0.6-point BD win does not buy shipping that, so SB128_DEFAULT stays
false and the whole feature stays behind EC_AV1_SB128=1. The next lane
is named by this list.
5. A defect fixed on the way (class: stale header in the test harness)
Ten decode round-trip tests encode with THIS process's encoder and then
decode the tile directly with a plain FrameCtx, whose superblock size is
the DECODER default (64) -- not the size the writer used. With 128
superblocks on, the reader skipped the root's partition symbol and the tile
desynced at symbol 0 (found by EC_AV1_SYMTRACE: the reader's first symbol
was the writer's second). FrameCtx::for_encoder exists for exactly this
and is now used in all ten; the module was swept, and two of the ten were
not failing yet. Same shape as the filter_intra_on() argument beside them.
Disposition
deferred: HORZ / VERT at the 128 root (two 128x64 / 64x128 blocks) -- the writer has no rect neighbour recording and the search no rect prediction/SSE at this size; the square NONE arm needed neither. Unblocked by a rectrecord_inter/recordpair plus a rect trial insearch_root_128. The decoder already reads both (lane-sb128c r7).deferred: the 128 block's residual and its compound arm -- four TX_64X64 luma units interleaved with a TX_32X32 chroma pair per mu chunk, on the offset-10txb_skiprows, plus onetxfm_partitionsymbol per chunk. Unblocked by that writer path;write_inter_block_128refuses a non-skip block until then, so nothing can silently code one wrong.deferred: the intra 128 root on key frames -- the key-frame writer codes SPLIT at every 128 root, as before.open: the eleven pre-existing 128-superblock desyncs above (the default's blocker).open: search-time vs write-time mv stacks still differ (lane-sb128b's own second open item); the writer's clamp makes it safe, not right.
Suite / checks (default OFF, the shipped state)
s1 --skip stream:: 340 passed; 0 failed; 34 ignored (RC=0)
s2 stream:: --skip 10bit 200 passed; 0 failed; 15 ignored (RC=0)
s3 10bit 42 passed; 0 failed; 1 ignored (RC=0)
--ignored every_speed_preset_decodes_sample_exact_through_both_decoders ok
--ignored a_128_superblock_clip_whose_root_search... ok (406 blocks)
the_encoders_own_streams_are_byte_identical_to_their_pins ok, and ok at EC_AV1_SPEED=6
cargo check --workspace --all-targets 0 errors, 0 ec-av1 warnings