forge
Explore
Log in

Don't you dare go Hollow

The instrument table, the kernels and the checks so far

Browse files at this commit

ef13e7f25f6a7f34a6defddf4789c2303896ccaaAhmet Kaan GümüşParent: a3b3ee4
  • docs
    • the instrument table, the kernels and the checks so far
Show full message
docs(txset): the instrument table, the kernels and the checks so far
lanes/txset.report.mdadded+86 -0
@@ -0,0 +1,86 @@
1+# lane-txset -- the transform-type search
2+
3+Branch `lane-txset` off main `3ebe0de9`. Scope: which `tx_type` an intra luma
4+transform unit is coded with, the forward kernels the missing types need, and
5+the writer symbol that names them.
6+
7+## 1. Instrument: what was coded, what was searched (read off the code)
8+
9+The writer coded ONE transform type, everywhere, always:
10+
11+ tile.rs:5216 enc.symbol(TX_TYPE_DCT_DCT_SET2, tx_type); // a constant
12+
13+and the search never varied a luma type either -- `search_block` and
14+`code_tx_depth` both go through `code_from_prediction`/`trial`, which pass
15+`TxType::DctDct` (`encode.rs:1993`, `:2278`). The only non-DCT types this
16+encoder has ever produced are CHROMA's, which code no symbol at all: the
17+decoder derives them from the chroma mode (`search_chroma` ->
18+`default_intra_tx_type`).
19+
20+STALE PREMISE IN THE CHARTER, corrected: this encoder writes
21+`reduced_tx_set: true` (`encode.rs:1660`, `:1760`) -- not 0. Under that bit
22+`get_tx_set` gives, per block class:
23+
24+| block class | tx size | set the WRITER uses | alphabet | types the search tried (before) | now |
25+|---|---|---|---|---|---|
26+| intra luma | 4x4, 8x8, 16x16 | `TX_SET_INTRA_2` (`intra_tx_type_{4,8,16}`) | 5 | DCT_DCT only | all 5 |
27+| intra luma | 32x32, 64x64 | none (`TxbSet::Luma{32,64}.tx_type == None`) | 1 | -- | -- |
28+| inter luma | 4x4..32x32 | `TX_SET_INTER_3` (`inter_tx_type_*`) | 2 (IDTX, DCT_DCT) | DCT_DCT only | DCT_DCT only |
29+| chroma | any | none, derived from uv_mode | -- | mode's default | unchanged |
30+
31+So the bytes reachable WITHOUT touching the frame header were the four
32+non-DCT members of `TX_SET_INTRA_2` on every intra luma unit at 16x16 and
33+below -- an alphabet the writer was already coding into, one symbol wide, and
34+never using. That is what this lane spends.
35+
36+Sets 13/17 (`DTT9_IDTX_1DDCT`, `ALL16`) that the charter names are NOT
37+reachable from here: they need `reduced_tx_set == 0` in the frame header,
38+which changes the alphabet of EVERY luma `tx_type` symbol in the stream
39+(`TxbSet::Luma*Set1`/`Set2` exist on the decode side with their CDFs; the
40+writer's set map at `tile.rs:4208` would have to take the bit). Deferred --
41+see below.
42+
43+## 2. Forward kernels
44+
45+`forward_transform_2d_typed` is basis-driven (`TxType::axes`), so
46+`V_DCT`/`H_DCT`/`V_ADST`/`H_ADST` and the plain ADST family already had
47+kernels; the FLIPADST family was refused by a `debug_assert`. A flipped axis
48+is the plain ADST kernel with the DECODER's output mirrored (`ud_flip` ->
49+row `h-1-i`, `lr_flip` -> column `w-1-j`), and a mirror is its own inverse,
50+so the analysis half is the same basis over the MIRRORED residual -- 12 lines,
51+no new kernel.
52+
53+Check: `transform::tests::a_typed_forward_round_trips_like_the_dct_one`, now
54+over all SIXTEEN types at 4x4/8x8/16x16 (was 3), each round trip's rmse under
55+2x `DCT_DCT`'s. PASS.
56+
57+## 3. The search + the writer
58+
59+* `encode::tx_type_candidates(set)` returns exactly the alphabet the writer
60+ can name for that set, so a searched type is always codable.
61+* `code_tx_depth` picks a type PER TRANSFORM UNIT (RD: sse + lambda * bits,
62+ the trial's bits carrying the `tx_type` symbol itself through
63+ `coeff_bits_typed`/`rdoq`), stored at `tu_row * n + tu_col` -- the writer's
64+ own index, so a unit the frame edge cuts away cannot slide the rest.
65+* `search_block` picks one for a whole-block transform, on the mode and angle
66+ already settled (libaom's ordering, the same shape the angle refinement has).
67+* `BlockCoeffs::luma_tx_types` carries them to `write_luma_tus` /
68+ `write_block_planes`; empty = `DCT_DCT` throughout, which is every inter,
69+ palette and filter-intra block.
70+* The symbol comes from the DECODER's own map (`decode::tx_type_symbol`,
71+ keyed by the CDF's alphabet width), so writer and reader cannot drift --
72+ and it already answers for the 7/12/16-symbol sets a `reduced_tx_set == 0`
73+ lane would turn on.
74+* Lever: `speed::TX_TYPE_SEARCH` (presets 0-6 on, 7-10 off), `EC_AV1_TXSET=0`
75+ forces it off and restores the pre-lane bytes.
76+
77+## 4. Checks
78+
79+| check | result |
80+|---|---|
81+| `transform::tests::a_typed_forward_round_trips_like_the_dct_one` (16 types) | PASS |
82+| `encoder::tests::an_edge_clip_codes_every_reduced_set_tx_type_both_decoders_read_exactly` | PASS -- hits `[IDTX 12, DCT_DCT 15445, ADST_ADST 70, ADST_DCT 161, DCT_ADST 467]`, ours == ffmpeg every sample |
83+| `cargo test -p ec-av1 --lib --release round_trip` (19 tests) | PASS |
84+| `predicted_coeff_bits_track_the_tile_the_writer_wrote`, `tile_bytes_do_not_depend_on_the_thread_count --include-ignored`, `the_facade_codes_the_same_bytes_as_encode_sequence` | PASS |
85+| `cargo check -p ec-av1 --all-targets` | 0 errors, 0 warnings |
86+