The top ARF tpl window ships 11 pictures at preset 0
Browse files at this commit347128937d6f03aa2d234e4132c2fef92f2c28f0Parent: 2f91c3b- feat
- the top ARF tpl window ships 11 pictures at preset 0
2 changed files +111 -10
- crates/ec-av1/src/speed.rs +24 -10
- lanes/tplhalf.report.md +87 -0
crates/ec-av1/src/speed.rsmodified+24 -10
| @@ -180,7 +180,6 @@ | ||
| 180 | 180 | //! preset 3 BELOW preset 0 in every pass at load 16-25. The single-thread fps |
| 181 | 181 | //! column above comes from the BD arms themselves and is ordered correctly. |
| 182 | 182 | |
| 183 | - | |
| 184 | 183 | use std::sync::atomic::{AtomicU8, Ordering}; |
| 185 | 184 | |
| 186 | 185 | /// The highest preset. 10 is the fastest, as in rav1e. |
| @@ -537,11 +536,23 @@ pub(crate) const TPL_FUT_HALF: [usize; 11] = [2, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1]; | ||
| 537 | 536 | |
| 538 | 537 | /// lane-tplhalf: how many entries mode 2's window holds in TOTAL, `0` meaning |
| 539 | 538 | /// `encode::tpl_depth() - 1` (the budget every other tpl path uses). |
| 540 | -/// `EC_AV1_TPL_FUT_WIN=<n>` overrides it. It exists because the winning split | |
| 541 | -/// takes its whole future side from the budget's edge, so the budget had to | |
| 542 | -/// be tested apart from it (class `instrument at bound`) -- and apart from | |
| 543 | -/// `EC_AV1_TPL_D`, which deepens EVERY frame's lambda pass, not the ARF's. | |
| 544 | -pub(crate) const TPL_FUT_WIN: [usize; 11] = [0; 11]; | |
| 539 | +/// `EC_AV1_TPL_FUT_WIN=<n>` overrides it. The winning split takes its whole | |
| 540 | +/// future side from the budget's edge, so the budget was swept apart from | |
| 541 | +/// it (class `instrument at bound`) and apart from `EC_AV1_TPL_D`, which | |
| 542 | +/// deepens EVERY frame's lambda pass. 48-picture long-GOP, half=2: | |
| 543 | +/// | |
| 544 | +/// | window | film A | film B | | |
| 545 | +/// |---|---|---| | |
| 546 | +/// | 7 (`tpl_depth-1`, the split's own arm) | +20.9/-9.0 | +71.0/-1.8 | | |
| 547 | +/// | 9 | +21.0/-9.0 | +70.7/-2.0 | | |
| 548 | +/// | **11 (ships at presets 0..=2)** | **+20.9/-9.0** | **+70.4/-2.2** | | |
| 549 | +/// | |
| 550 | +/// 11 is film B -0.6/-0.4 against 7 with film A flat -- the keep rule -- and | |
| 551 | +/// saturates the one-group lookahead (2 past + 8 future available). Presets | |
| 552 | +/// 3..=6 keep 0 (`depth-1` = 3 at `TPL_DEPTH=4`), unswept. `TPL_D=10` at | |
| 553 | +/// half=2 was byte-identical to WIN=9: extra depth on non-ARF frames is | |
| 554 | +/// unused because a pyramid leaf's window is the group's own successors. | |
| 555 | +pub(crate) const TPL_FUT_WIN: [usize; 11] = [11, 11, 11, 0, 0, 0, 0, 0, 0, 0, 0]; | |
| 545 | 556 | |
| 546 | 557 | /// lane-arfpred: the qindex below which the ARF temporal filter is OFF -- |
| 547 | 558 | /// libaom scales `arnr` strength with the quantizer and stops filtering at |
| @@ -833,8 +844,7 @@ pub(crate) const RESTORATION: [bool; 11] = [ | ||
| 833 | 844 | /// (`presets_are_monotone_in_speed`) forbids them going below preset 3's 4 |
| 834 | 845 | /// in any case. |
| 835 | 846 | /// * **presets 7..10 stay at 1**, unmeasured: not swept by this lane. |
| 836 | -pub(crate) const TPL_DEPTH: [usize; 11] = | |
| 837 | - [crate::encode::TPL_DEPTH, 8, 8, 4, 4, 4, 4, 1, 1, 1, 1]; | |
| 847 | +pub(crate) const TPL_DEPTH: [usize; 11] = [crate::encode::TPL_DEPTH, 8, 8, 4, 4, 4, 4, 1, 1, 1, 1]; | |
| 838 | 848 | |
| 839 | 849 | /// `encode::tx_type_search`: whether an intra luma transform unit searches |
| 840 | 850 | /// its own `tx_type` instead of coding `DCT_DCT` (lane-txset). The five-type |
| @@ -1016,12 +1026,16 @@ static KNOBS: std::sync::RwLock<()> = std::sync::RwLock::new(()); | ||
| 1016 | 1026 | #[cfg(test)] |
| 1017 | 1027 | #[must_use] |
| 1018 | 1028 | pub(crate) fn knob_read() -> std::sync::RwLockReadGuard<'static, ()> { |
| 1019 | - KNOBS.read().unwrap_or_else(std::sync::PoisonError::into_inner) | |
| 1029 | + KNOBS | |
| 1030 | + .read() | |
| 1031 | + .unwrap_or_else(std::sync::PoisonError::into_inner) | |
| 1020 | 1032 | } |
| 1021 | 1033 | |
| 1022 | 1034 | /// Held by a test that SETS a process-global knob; see [`KNOBS`]. |
| 1023 | 1035 | #[cfg(test)] |
| 1024 | 1036 | #[must_use] |
| 1025 | 1037 | pub(crate) fn knob_write() -> std::sync::RwLockWriteGuard<'static, ()> { |
| 1026 | - KNOBS.write().unwrap_or_else(std::sync::PoisonError::into_inner) | |
| 1038 | + KNOBS | |
| 1039 | + .write() | |
| 1040 | + .unwrap_or_else(std::sync::PoisonError::into_inner) | |
| 1027 | 1041 | } |
lanes/tplhalf.report.mdadded+87 -0
| @@ -0,0 +1,87 @@ | ||
| 1 | +# lane-tplhalf: the top ARF's tpl split, then its budget | |
| 2 | + | |
| 3 | +Claude Code died mid-lane after the split commit (`0c8d5778`) and after | |
| 4 | +the WIN sweep logs landed; this report closes that lane. | |
| 5 | + | |
| 6 | +## 1. Premise | |
| 7 | + | |
| 8 | +`TPL_FUT=2` (lane-tplfut) concatenates past then future, nearest-first. | |
| 9 | +The split was `(tpl_depth()-1)/2` = 3 past + 4 future at depth 8, unswept. | |
| 10 | +The future half is taken from the budget's edge, so the budget itself had | |
| 11 | +to be swept apart from `EC_AV1_TPL_D` (which deepens every frame's lambda | |
| 12 | +pass, not the ARF window). Class: instrument-at-bound. | |
| 13 | + | |
| 14 | +## 2. Split sweep (`EC_AV1_TPL_FUT_HALF`) | |
| 15 | + | |
| 16 | +Deciding gate: `encode::tests::bd_rate_film_long_gop` (48 pictures), one | |
| 17 | +thread, native crops. BD vs libaom cpu-used 6 / rav1e speed 6, lower | |
| 18 | +better. Logs: `~/.cache/tplhalf/{control,h1,h2,h5}.log`. Load before each | |
| 19 | +arm 2.8-4.7, after 2.9-4.4. | |
| 20 | + | |
| 21 | +| past half | film A | film B | wall A | wall B | log | | |
| 22 | +|---|---|---|---|---|---| | |
| 23 | +| 1 (6 future) | +21.1 / -8.9 | +71.2 / -1.9 | 548.5s | 429.1s | h1.log | | |
| 24 | +| **2 (5 future, SHIPS)** | **+20.9 / -9.0** | **+71.0 / -1.8** | 551.3s | 442.3s | h2.log | | |
| 25 | +| 3 (4 future, old default) | +21.1 / -8.9 | +71.5 / -1.5 | 547.0s | 423.0s | control.log | | |
| 26 | +| 5 (2 future) | +21.1 / -8.9 | +71.5 / -1.6 | 561.8s | 438.6s | h5.log | | |
| 27 | + | |
| 28 | +Bracketed: 2 is down on all four columns against 3 (film A -0.2/-0.1, | |
| 29 | +film B -0.5/-0.3), and 1 and 5 are both worse than it on the deciding | |
| 30 | +film B libaom column. Wall of 2 is +0.8% / +4.6% vs 3, under the +15% | |
| 31 | +ceiling. `speed::TPL_FUT_HALF` = 2 at presets 0..=2; presets 3..=6 keep 1 | |
| 32 | +(`TPL_DEPTH=4`, unswept). | |
| 33 | + | |
| 34 | +## 3. Budget sweep (`EC_AV1_TPL_FUT_WIN`) at half=2 | |
| 35 | + | |
| 36 | +Same gate. `0` means `tpl_depth()-1` = 7. Logs: `h2.log`, `w9.log`, | |
| 37 | +`w11.log`, `h2d10.log`, `w11h3.log`. | |
| 38 | + | |
| 39 | +| window | film A | film B | wall A | wall B | log | | |
| 40 | +|---|---|---|---|---|---| | |
| 41 | +| 7 (`depth-1`) | +20.9 / -9.0 | +71.0 / -1.8 | 551.3s | 442.3s | h2.log | | |
| 42 | +| 9 | +21.0 / -9.0 | +70.7 / -2.0 | 545.3s | 430.2s | w9.log | | |
| 43 | +| **11 (SHIPS at presets 0..=2)** | **+20.9 / -9.0** | **+70.4 / -2.2** | 578.6s | 431.3s | w11.log | | |
| 44 | +| 11, half=3 (split re-check) | +20.9 / -9.0 | +70.9 / -1.9 | 554.8s | 437.7s | w11h3.log | | |
| 45 | +| `TPL_D=10` at half=2 | +21.0 / -9.0 | +70.7 / -2.0 | 543.7s | 435.8s | h2d10.log | | |
| 46 | + | |
| 47 | +11 vs 7: film B -0.6 / -0.4, film A 0.0 / 0.0 -- keep rule (one row | |
| 48 | +>=0.5 down, the other flat). Wall A +5.0%, wall B -2.5%. 11 saturates | |
| 49 | +the one-group lookahead (2 past + 8 future available). Half=3 at the | |
| 50 | +larger budget loses to half=2, so the split does not flip. | |
| 51 | + | |
| 52 | +`TPL_D=10` at half=2 is byte-identical to WIN=9 (same PSNR/bytes on both | |
| 53 | +films): extra depth on non-ARF frames is unused because a pyramid leaf's | |
| 54 | +window is the group's own successors. That is why WIN is its own knob. | |
| 55 | + | |
| 56 | +`speed::TPL_FUT_WIN` = 11 at presets 0..=2; presets 3..=6 keep 0 | |
| 57 | +(`depth-1` = 3 at `TPL_DEPTH=4`), unswept. | |
| 58 | + | |
| 59 | +## 4. 12-picture native guard | |
| 60 | + | |
| 61 | +STRUCTURALLY BLIND: `group_target` absorbs a 12-picture tail into one | |
| 62 | +group, so no next group is buffered and mode 2 falls back to the past | |
| 63 | +window. Not re-run; the standing table's 12-frame rows are the guard. | |
| 64 | + | |
| 65 | +## 5. Witness | |
| 66 | + | |
| 67 | +`encoder::tests::the_future_tpl_window_still_codes_every_picture_and_moves_the_stream` | |
| 68 | +already names that mode 2 at the old 3-past split is byte-identical on | |
| 69 | +the 128x128 fixture and that `EC_AV1_TPL_FUT_HALF=1` moves it. No new | |
| 70 | +witness: the long-GOP gate is the measurement. | |
| 71 | + | |
| 72 | +## 6. Other gates | |
| 73 | + | |
| 74 | +Recorded at merge time (this file's suite line). Pins are expected | |
| 75 | +unmoved: the 4-picture pin fixture has no next group, so the fallback | |
| 76 | +keeps the past window. | |
| 77 | + | |
| 78 | +## Deviations | |
| 79 | + | |
| 80 | +* Claude subscription died after the split commit and after the WIN | |
| 81 | + logs; this close is from those logs plus the WIN default they keep. | |
| 82 | +* Presets 3..=6 split and budget left unswept (named in the tables). | |
| 83 | +* 12-frame rows not re-measured (structurally blind, accepted). | |
| 84 | + | |
| 85 | +## Suite line | |
| 86 | + | |
| 87 | +Pending merge gates on this close. |