forge
Explore
Log in

Don't you dare go Hollow

edith_codecs

Clone
★ 0

0 watching0 forksRust370.3 MiB9b67700Tahinli3 days ago4021 commits

gopad.sweep.txt84 lines, 5.1 KiBHistoryRawDownload
1lane-gopad -- a GOP-LENGTH-AWARE mini-GOP layout
2================================================
3
4Why. `Pyramid::default` is 8:-32:16, decided on the 48-frame gate
5(`encode::tests::bd_rate_film_long_gop`, lanes/pyr4.sweep.txt). The 12-frame
6gate `bd_rate_screen_native` preferred 16:-24:16 there, and lane-pyr4 wrote
7the price down: at gop 12 a FIXED mini-GOP of 8 splits 11 inter pictures into
88 + 3, and the 3-picture tail group is the expensive part. The shape was
9never the disagreement -- the tail was.
10
11The change (crates/ec-av1/src/encoder.rs). `Av1Encoder::encode_frames` no
12longer closes a group at `pyramid.mini_gop` flat; it asks `group_target()`
13how big the group being collected should be, given the pictures left before
14the next key frame (`config.gop - run_start % config.gop`, known to both
15entry points: `encode_sequence` sets gop = pictures.len(), the facade has it
16in its config). The rule shipped is ABSORB TAIL: while more than 1.5 x
17mini_gop is left, take mini_gop; otherwise take all of it.
18 remaining 11, mini_gop 8 -> 11 (was 8 + 3)
19 remaining 47, mini_gop 8 -> 8,8,8,8,8,7 (unchanged -> byte-identical)
20 remaining 3, mini_gop 8 -> 3 (the 4-picture pin clip, unchanged)
21`EC_AV1_GOP_LAYOUT=fixed` restores the old rule for an A/B.
22
23SHORT-GOP TABLE (`bd_rate_screen_native`, 12 frames, gop 12, EC_AV1_NATIVE_FILM=1
24EC_AV1_NATIVE_FILM4K=1, pyramid 8:-32:16 on every row; BD-rate %, lower better).
25Rows keyed by each log's own "pyramid requested/effective" print.
26
27| layout | film A vs libaom / rav1e | film B vs libaom / rav1e | bars 1080p | bars 2160p |
28|---|---|---|---|---|
29| fixed 8 + 3 (shipped, lanes/pyr4) | +51.2 / +21.4 | +91.0 / +53.5 | +4.8 / -11.5 | +20.5 / -3.4 |
30| balanced 6 + 5 (lanes/gopad/s12-balanced.log) | +48.4 / +18.5 | +82.0 / +46.0 | +3.6 / -12.5 | +14.2 / -8.7 |
31| absorb -> 11 ** SHIPS ** (lanes/gopad/s12-absorb.log) | +43.9 / +15.6 | +68.4 / +38.2 | +2.0 / -14.0 | +13.5 / -9.6 |
32| (reference) fixed with mini_gop 16, arf -24, lanes/pyr3 | +44.2 / +15.7 | +70.5 / +35.2 | -- | -- |
33
34Both films improve on both columns against the shipped fixed layout, by
357.3 / 5.8 (film A) and 22.6 / 15.3 (film B); the two bars rows improve too.
36Against the 16:-24:16 shape the 12-frame gate used to prefer, absorb at
378:-32:16 is better on three columns (+43.9 vs +44.2, +15.6 vs +15.7, +68.4 vs
38+70.5) and 3.0 short on one (film B vs rav1e +38.2 vs +35.2). The balanced
39split (equal groups <= mini_gop) is measurably WORSE than absorbing on every
40row: at gop 12 the longer single group wins, so 6 + 5 was dropped.
41
42CANDIDATE (c), per-group ARF offset scaled by log2(group_len)/log2(mini_gop):
43NOT BUILT. Its purpose was to give the longer (absorbed) group the -24 the
4412-frame gate liked, and the measurement above says the opposite -- the group
45of 11 at arf -32 already beats the recorded -24 arm on three of four columns,
46so the scaling would move away from the optimum. Skipped, with the numbers.
47
48LONG-GOP TABLE (`bd_rate_film_long_gop`, 48 frames, gop 48, 8:-32:16).
49
50| layout | film A vs libaom / rav1e | film B vs libaom / rav1e |
51|---|---|---|
52| fixed, as recorded on the pyr4 BRANCH | +55.7 / +13.5 | +165.1 / +56.6 |
53| fixed, control on THIS head (lanes/gopad/s48-fixed.log) | +55.2 / +12.8 | +151.3 / +47.4 |
54| absorb ** SHIPS ** (lanes/gopad/s48-absorb.log) | +55.2 / +12.8 | +151.3 / +47.4 |
55
56The control arm is the row that matters: main has moved since lane-pyr4
57measured (filter intra among others), so the pyr4 row is not this head's
58baseline -- film B is 13.8 / 9.2 better here for reasons that predate this
59lane. Against the control, absorb is IDENTICAL: every one of the eight ladder
60points matches byte for byte (film A 195531 / 356977 / 619801 / 1331401 B,
61film B 76541 / 171950 / 393470 / 1006532 B) at the same PSNR, so the 48-frame
62gate does not move by 0.0 on any of the four columns, not merely by <= 0.3.
63
6447 inter pictures take 8,8,8,8,8,7 under BOTH rules -- a group's boundaries
65are all `drain_pending` consumes, so the 48-frame stream is byte-identical
66and the confirmation arm reproduces the recorded numbers rather than
67approaching them. Pinned by `encoder::tests::the_mini_gop_layout_leaves_no
68_short_tail`, which walks both rules over mini_gop 2..=16 x remaining 1..=64.
69
70VERIFICATION
71 pins UNCHANGED (8446 / 28548): a 4-picture clip is a 3-picture run, one
72 group under both rules -- encode::tests::the_encoders_own_streams_are
73 _byte_identical_to_their_pins ok
74 encoder::tests::the_facade_codes_the_same_bytes_as_encode_sequence ok
75 encoder:: --include-ignored --test-threads 1: 29 passed / 0 failed
76 (includes bitrate_target_lands_within_10_percent_over_48_frames, whose
77 rate loop now sees a last group of up to 1.5 x mini_gop)
78 tile_bytes_do_not_depend_on_the_thread_count (--include-ignored) ok
79 EC_COMP_MISMATCH=1 over the whole lib suite: 546 passed / 0 failed /
80 43 ignored, 0 mismatch lines (lanes/gopad/suite.log)
81 cargo check --workspace --all-targets -j4: 0 errors, 0 ec-av1 warnings
82 (the 25 warning lines are pre-existing ec-opus / ec-vorbis)
83 Logs: lanes/gopad/{s12-balanced,s12-absorb,s48-absorb,s48-fixed,suite,
84 encoder-tests}.log