edith_codecs
Clone
https://git.tahinli.com/Tahinli/edith_codecs.git
0 watching·0 forks·Rust·370.3 MiB·9b67700·Tahinli·3 days ago·4021 commits
| 1 | # lane-split — the split decision's own calibration: swept, and the control wins |
| 2 | |
| 3 | lane-txd left one live hypothesis behind its refuted arm (class |
| 4 | `rd-rate-term-calibration`): the correct `tx_depth` price is a one-sided push |
| 5 | AWAY from splitting, so maybe what is mis-calibrated is the weight the split |
| 6 | trial's rate is judged under, not the price. This lane restored the correct |
| 7 | pricing (`60c3cdf6` + its pins), built the knob and the census, and swept. |
| 8 | The sweep is single-peaked and its peak IS the control weight, and every |
| 9 | point on it is worse than the row-0-priced control. The pricing fix goes back |
| 10 | out again; the census and the swept knob stay. |
| 11 | |
| 12 | ## The knob |
| 13 | |
| 14 | `EC_AV1_SPLIT_LAMBDA` (`encode::split_lambda_mult`, constant `SPLIT_LAMBDA = |
| 15 | 1.0`) multiplies the RATE term of the transform-SPLIT trial only — the intra |
| 16 | `tx_depth` depth>0 candidates in `code_square` and the inter var-tx depth-1 |
| 17 | trial in `commit_inter_luma`. Below 1 the split is charged less for its bits |
| 18 | and fires more; above 1, less. The flat arm is untouched, so this is exactly |
| 19 | the depth-0-versus-split margin and nothing else. |
| 20 | |
| 21 | ## Sweep — film B gate row, WITH the correct `tx_depth` pricing on |
| 22 | |
| 23 | Deciding gate, 12-frame native, BD-rate vs libaom cpu-used 6 / rav1e speed 6. |
| 24 | |
| 25 | | `EC_AV1_SPLIT_LAMBDA` | film B | bars 2160p | |
| 26 | |---|---|---| |
| 27 | | 0.6 | +28.4 / +0.5 | +10.5 / −11.8 | |
| 28 | | 0.8 | +26.1 / −0.9 | +10.0 / −12.2 | |
| 29 | | **1.0 (control weight)** | **+25.2 / −1.6** | **+8.7 / −13.4** | |
| 30 | | 1.25 | +25.9 / −1.1 | +8.9 / −13.2 | |
| 31 | | 1.5 | +26.2 / −0.9 | +9.3 / −13.0 | |
| 32 | | 2.0 | +26.3 / −0.8 | +11.7 / −11.4 | |
| 33 | | — control, row-0 pricing (`2caf213b`) | **+24.9 / −1.9** | +8.7 / −13.4 | |
| 34 | |
| 35 | The λ=1.0 row reproduces lane-txd's arm to the decimal, so the sweep is |
| 36 | against a reproduced control. The curve has ONE optimum, it sits at the |
| 37 | weight the encoder already uses, and it is still 0.3 worse on both columns |
| 38 | than the row-0-priced control. No re-weighting of the split's rate recovers |
| 39 | what correct pricing costs — so the split trial's λ was not the mis-calibrated |
| 40 | term either, and the class `rd-rate-term-calibration` reading of lane-txd's |
| 41 | result is refuted on its own terms. |
| 42 | |
| 43 | ## Census 1 — the split DECISION (`EC_AV1_SPLIT_CENSUS=1`) |
| 44 | |
| 45 | Film B gate crop, 12 frames, q150, the shipped (row-0-priced) encoder. Rows |
| 46 | are TRIALS OFFERED by the RD search, which includes partition candidates that |
| 47 | later lose — not coded blocks; the coded-block view is census 2 below. |
| 48 | |
| 49 | ``` |
| 50 | site frame side offered split share% win_rate win_dist lose_rate lose_dist |
| 51 | intra key 16 7504 1671 22.3 19.07 335 25.97 444 |
| 52 | intra key 32 1876 166 8.8 62.25 1381 78.58 1553 |
| 53 | intra inter 8 12424 4620 37.2 9.26 362 10.26 533 |
| 54 | intra inter 16 4704 942 20.0 23.29 1714 28.73 2109 |
| 55 | inter inter 16 1711 167 9.8 14.96 1480 21.14 1741 |
| 56 | inter inter 32 936 250 26.7 37.86 5869 38.32 6302 |
| 57 | inter inter 64 5280 483 9.1 15.77 8333 16.02 8461 |
| 58 | ``` |
| 59 | |
| 60 | `win_rate`/`lose_rate` are bits (including the `tx_depth` / `txfm_split` |
| 61 | symbols), `win_dist`/`lose_dist` squared error. Read: the winner is cheaper on |
| 62 | BOTH terms in every row — the loser is never a rate-versus-distortion trade |
| 63 | the weight could tip, which is the same thing the sweep says from the outside. |
| 64 | |
| 65 | With the correct pricing ON the shares fall exactly where lane-txd's price |
| 66 | table predicts (intra key 16: 22.3% → 21.0%, intra inter 8: 37.2% → 32.9%, |
| 67 | inter var-tx 32: 26.7% → 27.9%) — a 4-point drop on the inter frame's intra |
| 68 | blocks, which are the 66% ctx-2 population. |
| 69 | |
| 70 | ## Census 2 — ours vs libaom, coded blocks, same crop and rate |
| 71 | |
| 72 | Both streams read by OUR decoder (`EC_AV1_BITCENSUS=1 syntax_census`), film B |
| 73 | gate crop 1920x1024 @ 00:40:00, 12 frames, `-g 12`. Ours q150 = 27343 payload |
| 74 | bytes; libaom `-cpu-used 6 -crf 30` = 28590. Split share = the share of coded |
| 75 | blocks whose PUBLISHED luma transform is smaller than the block, read as the |
| 76 | mass the tx-size histogram moves down against the block-size histogram. |
| 77 | |
| 78 | | | key frame | whole stream | |
| 79 | |---|---|---| |
| 80 | | ours | 4.8% | 1.0% | |
| 81 | | libaom crf 30 | 7.6% | 2.1% | |
| 82 | |
| 83 | libaom splits about twice as often as we do at the same rate — so we are on |
| 84 | the LOW side of libaom's split rate, and the sweep says every step toward |
| 85 | libaom's rate (λ 0.8, 0.6) costs 1.2 and 3.5 BD points on film B. The split |
| 86 | rate is not where film B's +25% lives; a lane that goes after it by moving |
| 87 | this margin is measuring the wrong knob. |
| 88 | |
| 89 | ## Gate — the shipped tree |
| 90 | |
| 91 | Encoder output is BYTE-IDENTICAL to `2caf213b` (both stream pins green and |
| 92 | UNMOVED at 8325 / 33014, at the default preset and at `EC_AV1_SPEED=6`), so |
| 93 | the rows are the control's, re-measured here: |
| 94 | |
| 95 | | row | shipped | |
| 96 | |---|---| |
| 97 | | film A | +21.0 / −4.8 | |
| 98 | | film B | +24.9 / −1.9 | |
| 99 | | screen | +14.5 / −33.2 | |
| 100 | | bars 1080p | −2.0 / −17.6 | |
| 101 | | bars 2160p | +8.7 / −13.4 | |
| 102 | |
| 103 | `bd_rate_film_long_gop` was not run: nothing ships that moves a byte. |
| 104 | |
| 105 | ## Suite |
| 106 | |
| 107 | * `--skip stream::` 338 passed / 0 failed / 32 ignored; `stream:: --skip |
| 108 | 10bit` 200 / 0 / 15; `10bit` 42 / 0 / 1. All RC=0. |
| 109 | * `--ignored encoder::tests::every_speed_preset_decodes_sample_exact_through_both_decoders` |
| 110 | passed. |
| 111 | * `encode::tests::the_split_census_buckets_are_distinct_and_in_bounds` — the |
| 112 | census index enumerated over its whole domain (class |
| 113 | `enumerate-table-domain`). |
| 114 | * `timeout 900 cargo check --workspace --all-targets -j4`: 0 errors, 0 ec-av1 |
| 115 | warnings. |
| 116 | |
| 117 | ## Disposition |
| 118 | |
| 119 | `deferred: the tx_depth context pricing — built twice (lane-ctx2, lane-txd), |
| 120 | now swept against its own split weight and still losing at every point. What |
| 121 | would unblock it is NOT another calibration knob on this margin: the census |
| 122 | says the losing arm is worse on rate AND distortion together, so the depth |
| 123 | trial is choosing between two arms the search already separates cleanly. |
| 124 | Whatever film B's +25% is, it is not the transform-split margin.` |
| 125 | |
| 126 | `deferred: a bug found while building the census — encoder.rs used |
| 127 | bool::then_some to build a Drop guard, which CONSTRUCTS and then DROPS the |
| 128 | guard when the flag is off. Fixed here (then_some -> then); swept the class: the crate's |
| 129 | other 9 `then_some` calls all pass a reference or a `Copy` scalar, none of |
| 130 | which has a `Drop` impl.` |