diff --git a/crates/ec-av1/src/encoder.rs b/crates/ec-av1/src/encoder.rs index fc965cd2..97e9242e 100644 --- a/crates/ec-av1/src/encoder.rs +++ b/crates/ec-av1/src/encoder.rs @@ -684,6 +684,26 @@ impl Default for Pyramid { /// columns better than `16:-24:16` ever was, film B vs rav1e 3.0 short), /// while 47 inter pictures still take 8 x 5 + 7 -- the long-GOP table /// above is coded byte for byte as it was measured. + /// THE THIRD LEVEL (lane-pyr5, `lanes/pyr5.sweep.txt`), swept on the + /// long-GOP gate against a control arm on this very head: + /// + /// | mini_gop:arf:leaf:mid | film A vs libaom / rav1e | film B vs libaom / rav1e | + /// |---|---|---| + /// | 8:-32:16 (control, 2-level) | +55.2 / +12.8 | +151.3 / +47.4 | + /// | 8:-32:16:-4 | +51.8 / +11.4 | +146.2 / +45.4 | + /// | **8:-32:16:-8** | **+52.1 / +11.7** | **+145.3 / +45.0** | + /// | 8:-32:16:-16 | +53.4 / +13.0 | +146.0 / +46.1 | + /// | 8:-32:20:-8 | +52.4 / +11.5 | +148.0 / +46.1 | + /// | 16:-32:16:-8 | +55.0 / +12.3 | +146.0 / +44.3 | + /// | 16:-32:16:-16 | +54.6 / +12.1 | +148.7 / +46.0 | + /// | 4:-32:16:-8 | +61.7 / +20.4 | +147.5 / +51.3 | + /// + /// `-4` and `-8` are within a point of each other and split the two + /// films; `-8` ships because film B is the wider gap. A mini-GOP of 4 + /// with a mid level -- rav1e's own shape at speed 6 -- is far worse here, + /// so the third level is worth more than a shorter group, and the census + /// (`lanes/census-longgop.md`) says why: at 8 pictures our leaves are + /// already cheap and the bytes sit in the ARFs. fn default() -> Self { Self { mini_gop: 8, @@ -726,8 +746,11 @@ const LEAF_SLOT: u8 = 0; /// chain (0) and of `GOLDEN_SLOT` (1), so all four levels are live at once. const MID_SLOT: u8 = 2; -/// [`Pyramid::default`]'s third level (`None` = the two-level pyramid). -const MID_DEFAULT: Option = None; +/// [`Pyramid::default`]'s third level (`None` = the two-level pyramid), the +/// long-GOP sweep's winner (`lanes/pyr5.sweep.txt`): every one of the four +/// long-GOP columns improves against the two-level shape, film B (the wider +/// gap) by 6.0 / 2.4 BD points. +const MID_DEFAULT: Option = Some(-8); /// The AV1 software encoder: [`EncoderConfig`] in, one [`Packet`] out per /// [`Av1Encoder::encode`] call — or, with a [`Pyramid`] configured, a diff --git a/lanes/census-longgop.md b/lanes/census-longgop.md index 4b32eb54..85e0ad2d 100644 --- a/lanes/census-longgop.md +++ b/lanes/census-longgop.md @@ -53,7 +53,7 @@ are of the censused stream. |---|---|---|---| | key | 1 @ 150: 20,079 (10.3%) | 1 @ 101: 34,700 (22.2%) | 1 @ **63**: 47,707 (**36.9%**) | | arf top | 6 @ 118: 94,076 (48.4%, mean 15,679) | 11 @ 122: 64,282 (41.1%, mean 5,843) | 1 @ 95: 14,513 (11.2%) | -| arf mid | -- | 12 @ 138: 28,365 (18.1%, mean 2,363) | 21 @ 129..168: 49,319 (38.1%, mean 2,349) | +| arf mid | -- | 12 @ 138: 28,365 (18.1%, mean 2,363) | 22 @ 129..168: 49,319 (38.1%, mean 2,242) | | leaf | 41 @ 166: 80,187 (41.3%, mean 1,955) | 24 @ 154: 28,955 (18.5%, mean 1,206) | 24 @ 163/168: 17,848 (13.8%, mean 743) | ## Where the gap is @@ -72,7 +72,7 @@ and the number of levels.** 2. **One hidden level against two.** rav1e's mini-GOP at speed 6 is FOUR pictures with two hidden levels (top ARF at the group's last picture at q120, an internal ARF at its midpoint at q137, two leaves at q153) -- 23 - hidden frames in 48 pictures against our 6. libaom is deeper still: 22 + hidden frames in 48 pictures against our 6. libaom is deeper still: 23 hidden frames over qindex 95..168. Our 8-picture group carries one hidden frame at q118 and then seven leaves that are 4 to 7 pictures away from their nearest good reference. diff --git a/lanes/pyr5.sweep.txt b/lanes/pyr5.sweep.txt new file mode 100644 index 00000000..8bbebbaf --- /dev/null +++ b/lanes/pyr5.sweep.txt @@ -0,0 +1,25 @@ +lane-pyr5: the third pyramid level, swept on encode::tests::bd_rate_film_long_gop +(48 pictures, gop 48, film rows only, -g 48). Every row keyed by the log's own +"pyramid requested/effective" print; logs in lanes/pyr5/.log. +Head 3aadd65b + the mid-level commit; the control arm is on THIS head, so the +comparison is not against lanes/pyr4.sweep.txt (main moved since). + +| arm | EC_AV1_PYRAMID | film A vs libaom / rav1e | film B vs libaom / rav1e | +|---|---|---|---| +| ctl (2-level, shipped) | 8:-32:16:off | +55.2 / +12.8 | +151.3 / +47.4 | +| mid4 | 8:-32:16:-4 | +51.8 / +11.4 | +146.2 / +45.4 | +| mid8 (KEPT) | 8:-32:16:-8 | +52.1 / +11.7 | +145.3 / +45.0 | +| mid16 | 8:-32:16:-16 | +53.4 / +13.0 | +146.0 / +46.1 | +| leaf20 | 8:-32:20:-8 | +52.4 / +11.5 | +148.0 / +46.1 | +| g16mid8 | 16:-32:16:-8 | +55.0 / +12.3 | +146.0 / +44.3 | +| g16mid | 16:-32:16:-16 | +54.6 / +12.1 | +148.7 / +46.0 | +| g4mid8 | 4:-32:16:-8 | +61.7 / +20.4 | +147.5 / +51.3 | + +Keep rule (both films down on both columns at 48 frames): mid4, mid8, mid16 and +leaf20 all pass; mid8 is the best on film B (the wider gap) and within 0.3 of +mid4 on film A. mini_gop 16 with a mid level is no better than the 2-level 8, +and mini_gop 4 -- rav1e's own group size -- is much worse: the third level, not +a shorter group, is what pays here. + +Encoder wall is unchanged within noise (231-280 s per 4-point ladder across +every arm, ctl 272 s / 255 s). diff --git a/lanes/pyr5/g16mid8.log b/lanes/pyr5/g16mid8.log index 0da69b0f..c27f25a3 100644 --- a/lanes/pyr5/g16mid8.log +++ b/lanes/pyr5/g16mid8.log @@ -4,3 +4,23 @@ running 1 test native crop, 48 frames, gop=48; tiles (0, 0), tile threads 1, intrabc false, palette maxcolors 128 | clip | ours PSNR/bytes per point | BD-rate vs libaom | BD-rate vs rav1e | wall ours:libaom:rav1e (noisy) | |---|---|---|---|---| +test encode::tests::bd_rate_film_long_gop has been running for over 60 seconds +film A (1080p source): sequence, pyramid requested Some(Pyramid { mini_gop: 16, arf_q_offset: -32, leaf_q_offset: 16, mid_q_offset: Some(-8) }) effective Some(Pyramid { mini_gop: 16, arf_q_offset: -32, leaf_q_offset: 16, mid_q_offset: Some(-8) }) +film A (1080p source): pricer armings default=20 real=905 +film A (1080p source): motion_mode 32x32 SIMPLE=188387 OBMC=0 WARP=8786 | 16x16 SIMPLE=91968 OBMC=0 WARP=9691 | 8x8 SIMPLE=20394 OBMC=0 WARP=3572 (0.0% OBMC / 6.8% WARP of 322798 eligible) +film A (1080p source): inter var-tx depths of 370055 blocks -- leaf single 0=68272 1=13752 (16.8% split) | leaf compound 0=130800 1=29202 (18.3% split) | 32x32 single 0=32654 1=25288 (43.6% split) | 32x32 compound 0=42129 1=27958 (39.9% split) +film A (1080p source): screen frames on=0 off=4 (0.0% on); palette blocks luma 0 chroma 0; intrabc blocks 0 (searched 0 / valid 0 / won 0) +film A (1080p source): filter intra on=true blocks 97766 (modes DC=23950 V=13294 H=18944 D157=27204 PAETH=14374) +| film A (1080p source) 1920x768 | 43.39 dB/182030 B, 45.35 dB/328827 B, 46.66 dB/578384 B, 47.77 dB/1150333 B | +55.0% | +12.3% | 264.6s:33.0s:52.7s | +film B (2160p HDR source): sequence, pyramid requested Some(Pyramid { mini_gop: 16, arf_q_offset: -32, leaf_q_offset: 16, mid_q_offset: Some(-8) }) effective Some(Pyramid { mini_gop: 16, arf_q_offset: -32, leaf_q_offset: 16, mid_q_offset: Some(-8) }) +film B (2160p HDR source): pricer armings default=17 real=785 +film B (2160p HDR source): motion_mode 32x32 SIMPLE=203793 OBMC=0 WARP=5781 | 16x16 SIMPLE=65840 OBMC=0 WARP=4892 | 8x8 SIMPLE=9254 OBMC=0 WARP=2842 (0.0% OBMC / 4.6% WARP of 292402 eligible) +film B (2160p HDR source): inter var-tx depths of 313056 blocks -- leaf single 0=61299 1=14132 (18.7% split) | leaf compound 0=95979 1=20274 (17.4% split) | 32x32 single 0=34131 1=32891 (49.1% split) | 32x32 compound 0=29642 1=24708 (45.5% split) +film B (2160p HDR source): screen frames on=0 off=4 (0.0% on); palette blocks luma 0 chroma 0; intrabc blocks 0 (searched 0 / valid 0 / won 0) +film B (2160p HDR source): filter intra on=true blocks 61505 (modes DC=15968 V=8057 H=8772 D157=22201 PAETH=6507) +| film B (2160p HDR source) 1920x1024 | 45.94 dB/68023 B, 47.48 dB/149250 B, 48.61 dB/350212 B, 49.63 dB/874824 B | +146.0% | +44.3% | 236.9s:68.3s:50.0s | +test encode::tests::bd_rate_film_long_gop ... ok + +test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 589 filtered out; finished in 719.73s + +RC=0 diff --git a/lanes/pyr5/g4mid8.log b/lanes/pyr5/g4mid8.log new file mode 100644 index 00000000..5a36c230 --- /dev/null +++ b/lanes/pyr5/g4mid8.log @@ -0,0 +1,26 @@ + +running 1 test + +native crop, 48 frames, gop=48; tiles (0, 0), tile threads 1, intrabc false, palette maxcolors 128 +| clip | ours PSNR/bytes per point | BD-rate vs libaom | BD-rate vs rav1e | wall ours:libaom:rav1e (noisy) | +|---|---|---|---|---| +test encode::tests::bd_rate_film_long_gop has been running for over 60 seconds +film A (1080p source): sequence, pyramid requested Some(Pyramid { mini_gop: 4, arf_q_offset: -32, leaf_q_offset: 16, mid_q_offset: Some(-8) }) effective Some(Pyramid { mini_gop: 4, arf_q_offset: -32, leaf_q_offset: 16, mid_q_offset: Some(-8) }) +film A (1080p source): pricer armings default=20 real=907 +film A (1080p source): motion_mode 32x32 SIMPLE=148806 OBMC=0 WARP=7759 | 16x16 SIMPLE=86205 OBMC=0 WARP=15470 | 8x8 SIMPLE=40140 OBMC=0 WARP=7116 (0.0% OBMC / 9.9% WARP of 305496 eligible) +film A (1080p source): inter var-tx depths of 395102 blocks -- leaf single 0=64042 1=14636 (18.6% split) | leaf compound 0=142574 1=41981 (22.7% split) | 32x32 single 0=28965 1=19709 (40.5% split) | 32x32 compound 0=49067 1=34128 (41.0% split) +film A (1080p source): screen frames on=0 off=4 (0.0% on); palette blocks luma 0 chroma 0; intrabc blocks 0 (searched 0 / valid 0 / won 0) +film A (1080p source): filter intra on=true blocks 172124 (modes DC=40605 V=26990 H=31893 D157=48676 PAETH=23960) +| film A (1080p source) 1920x768 | 44.23 dB/247983 B, 46.00 dB/460813 B, 47.20 dB/817026 B, 48.47 dB/2003982 B | +61.7% | +20.4% | 290.1s:32.5s:52.7s | +film B (2160p HDR source): sequence, pyramid requested Some(Pyramid { mini_gop: 4, arf_q_offset: -32, leaf_q_offset: 16, mid_q_offset: Some(-8) }) effective Some(Pyramid { mini_gop: 4, arf_q_offset: -32, leaf_q_offset: 16, mid_q_offset: Some(-8) }) +film B (2160p HDR source): pricer armings default=17 real=829 +film B (2160p HDR source): motion_mode 32x32 SIMPLE=203075 OBMC=0 WARP=6770 | 16x16 SIMPLE=77859 OBMC=0 WARP=6558 | 8x8 SIMPLE=25160 OBMC=0 WARP=6324 (0.0% OBMC / 6.0% WARP of 325746 eligible) +film B (2160p HDR source): inter var-tx depths of 361122 blocks -- leaf single 0=67314 1=18846 (21.9% split) | leaf compound 0=109627 1=31275 (22.2% split) | 32x32 single 0=34932 1=32330 (48.1% split) | 32x32 compound 0=34876 1=31922 (47.8% split) +film B (2160p HDR source): screen frames on=0 off=4 (0.0% on); palette blocks luma 0 chroma 0; intrabc blocks 0 (searched 0 / valid 0 / won 0) +film B (2160p HDR source): filter intra on=true blocks 114300 (modes DC=27469 V=17064 H=17400 D157=40869 PAETH=11498) +| film B (2160p HDR source) 1920x1024 | 46.73 dB/103046 B, 48.10 dB/249199 B, 49.14 dB/570401 B, 50.28 dB/1536115 B | +147.5% | +51.3% | 280.0s:67.9s:49.8s | +test encode::tests::bd_rate_film_long_gop ... ok + +test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 589 filtered out; finished in 787.98s + +RC=0 diff --git a/lanes/pyr5/leaf20.log b/lanes/pyr5/leaf20.log new file mode 100644 index 00000000..d2654081 --- /dev/null +++ b/lanes/pyr5/leaf20.log @@ -0,0 +1,26 @@ + +running 1 test + +native crop, 48 frames, gop=48; tiles (0, 0), tile threads 1, intrabc false, palette maxcolors 128 +| clip | ours PSNR/bytes per point | BD-rate vs libaom | BD-rate vs rav1e | wall ours:libaom:rav1e (noisy) | +|---|---|---|---|---| +test encode::tests::bd_rate_film_long_gop has been running for over 60 seconds +film A (1080p source): sequence, pyramid requested Some(Pyramid { mini_gop: 8, arf_q_offset: -32, leaf_q_offset: 20, mid_q_offset: Some(-8) }) effective Some(Pyramid { mini_gop: 8, arf_q_offset: -32, leaf_q_offset: 20, mid_q_offset: Some(-8) }) +film A (1080p source): pricer armings default=20 real=895 +film A (1080p source): motion_mode 32x32 SIMPLE=164174 OBMC=0 WARP=6272 | 16x16 SIMPLE=77527 OBMC=0 WARP=9371 | 8x8 SIMPLE=23144 OBMC=0 WARP=4034 (0.0% OBMC / 6.9% WARP of 284522 eligible) +film A (1080p source): inter var-tx depths of 335970 blocks -- leaf single 0=52287 1=9723 (15.7% split) | leaf compound 0=122388 1=31196 (20.3% split) | 32x32 single 0=26861 1=19708 (42.3% split) | 32x32 compound 0=44027 1=29780 (40.3% split) +film A (1080p source): screen frames on=0 off=4 (0.0% on); palette blocks luma 0 chroma 0; intrabc blocks 0 (searched 0 / valid 0 / won 0) +film A (1080p source): filter intra on=true blocks 120995 (modes DC=29242 V=17384 H=22920 D157=34266 PAETH=17183) +| film A (1080p source) 1920x768 | 43.73 dB/202302 B, 45.63 dB/364640 B, 46.90 dB/634119 B, 48.03 dB/1382933 B | +52.4% | +11.5% | 252.2s:32.4s:52.4s | +film B (2160p HDR source): sequence, pyramid requested Some(Pyramid { mini_gop: 8, arf_q_offset: -32, leaf_q_offset: 20, mid_q_offset: Some(-8) }) effective Some(Pyramid { mini_gop: 8, arf_q_offset: -32, leaf_q_offset: 20, mid_q_offset: Some(-8) }) +film B (2160p HDR source): pricer armings default=17 real=795 +film B (2160p HDR source): motion_mode 32x32 SIMPLE=196871 OBMC=0 WARP=4769 | 16x16 SIMPLE=59720 OBMC=0 WARP=4186 | 8x8 SIMPLE=14093 OBMC=0 WARP=1569 (0.0% OBMC / 3.7% WARP of 281208 eligible) +film B (2160p HDR source): inter var-tx depths of 290757 blocks -- leaf single 0=49201 1=11046 (18.3% split) | leaf compound 0=91253 1=24350 (21.1% split) | 32x32 single 0=28399 1=28507 (50.1% split) | 32x32 compound 0=30603 1=27398 (47.2% split) +film B (2160p HDR source): screen frames on=0 off=4 (0.0% on); palette blocks luma 0 chroma 0; intrabc blocks 0 (searched 0 / valid 0 / won 0) +film B (2160p HDR source): filter intra on=true blocks 76384 (modes DC=19406 V=10975 H=11071 D157=26852 PAETH=8080) +| film B (2160p HDR source) 1920x1024 | 46.34 dB/82651 B, 47.75 dB/184349 B, 48.80 dB/415557 B, 49.83 dB/1045824 B | +148.0% | +46.1% | 231.2s:68.0s:50.0s | +test encode::tests::bd_rate_film_long_gop ... ok + +test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 589 filtered out; finished in 700.26s + +RC=0 diff --git a/lanes/pyr5/mid4.log b/lanes/pyr5/mid4.log index 0da69b0f..beee9757 100644 --- a/lanes/pyr5/mid4.log +++ b/lanes/pyr5/mid4.log @@ -4,3 +4,23 @@ running 1 test native crop, 48 frames, gop=48; tiles (0, 0), tile threads 1, intrabc false, palette maxcolors 128 | clip | ours PSNR/bytes per point | BD-rate vs libaom | BD-rate vs rav1e | wall ours:libaom:rav1e (noisy) | |---|---|---|---|---| +test encode::tests::bd_rate_film_long_gop has been running for over 60 seconds +film A (1080p source): sequence, pyramid requested Some(Pyramid { mini_gop: 8, arf_q_offset: -32, leaf_q_offset: 16, mid_q_offset: Some(-4) }) effective Some(Pyramid { mini_gop: 8, arf_q_offset: -32, leaf_q_offset: 16, mid_q_offset: Some(-4) }) +film A (1080p source): pricer armings default=20 real=898 +film A (1080p source): motion_mode 32x32 SIMPLE=164270 OBMC=0 WARP=6489 | 16x16 SIMPLE=80073 OBMC=0 WARP=9495 | 8x8 SIMPLE=23749 OBMC=0 WARP=4142 (0.0% OBMC / 7.0% WARP of 288218 eligible) +film A (1080p source): inter var-tx depths of 360151 blocks -- leaf single 0=56319 1=10937 (16.3% split) | leaf compound 0=132345 1=34394 (20.6% split) | 32x32 single 0=27658 1=20926 (43.1% split) | 32x32 compound 0=44790 1=32782 (42.3% split) +film A (1080p source): screen frames on=0 off=4 (0.0% on); palette blocks luma 0 chroma 0; intrabc blocks 0 (searched 0 / valid 0 / won 0) +film A (1080p source): filter intra on=true blocks 120556 (modes DC=29264 V=17384 H=22906 D157=33940 PAETH=17062) +| film A (1080p source) 1920x768 | 43.80 dB/204732 B, 45.68 dB/372633 B, 46.94 dB/649485 B, 48.06 dB/1396732 B | +51.8% | +11.4% | 263.3s:33.0s:52.6s | +film B (2160p HDR source): sequence, pyramid requested Some(Pyramid { mini_gop: 8, arf_q_offset: -32, leaf_q_offset: 16, mid_q_offset: Some(-4) }) effective Some(Pyramid { mini_gop: 8, arf_q_offset: -32, leaf_q_offset: 16, mid_q_offset: Some(-4) }) +film B (2160p HDR source): pricer armings default=17 real=803 +film B (2160p HDR source): motion_mode 32x32 SIMPLE=201301 OBMC=0 WARP=4921 | 16x16 SIMPLE=62996 OBMC=0 WARP=4384 | 8x8 SIMPLE=14098 OBMC=0 WARP=1605 (0.0% OBMC / 3.8% WARP of 289305 eligible) +film B (2160p HDR source): inter var-tx depths of 313498 blocks -- leaf single 0=52809 1=12093 (18.6% split) | leaf compound 0=99502 1=26367 (20.9% split) | 32x32 single 0=30224 1=30842 (50.5% split) | 32x32 compound 0=31847 1=29814 (48.4% split) +film B (2160p HDR source): screen frames on=0 off=4 (0.0% on); palette blocks luma 0 chroma 0; intrabc blocks 0 (searched 0 / valid 0 / won 0) +film B (2160p HDR source): filter intra on=true blocks 76731 (modes DC=19740 V=10941 H=11220 D157=26925 PAETH=7905) +| film B (2160p HDR source) 1920x1024 | 46.33 dB/82075 B, 47.78 dB/185957 B, 48.84 dB/428057 B, 49.87 dB/1067582 B | +146.2% | +45.4% | 242.8s:68.3s:50.1s | +test encode::tests::bd_rate_film_long_gop ... ok + +test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 589 filtered out; finished in 724.46s + +RC=0 diff --git a/lanes/pyr5/short12.log b/lanes/pyr5/short12.log new file mode 100644 index 00000000..ed0d0057 --- /dev/null +++ b/lanes/pyr5/short12.log @@ -0,0 +1,12 @@ + +running 1 test + +native crop, 12 frames, gop=12; tiles (0, 0), tile threads 1, intrabc false, palette maxcolors 128 +| clip | ours PSNR/bytes per point | BD-rate vs libaom | BD-rate vs rav1e | wall ours:libaom:rav1e (noisy) | +|---|---|---|---|---| +bars 1080p: sequence, pyramid requested Some(Pyramid { mini_gop: 8, arf_q_offset: -32, leaf_q_offset: 16, mid_q_offset: Some(-8) }) effective Some(Pyramid { mini_gop: 8, arf_q_offset: -32, leaf_q_offset: 16, mid_q_offset: Some(-8) }) +bars 1080p: pricer armings default=17 real=172 +bars 1080p: motion_mode 32x32 SIMPLE=41210 OBMC=0 WARP=149 | 16x16 SIMPLE=3302 OBMC=0 WARP=238 | 8x8 SIMPLE=11133 OBMC=0 WARP=1199 (0.0% OBMC / 2.8% WARP of 57231 eligible) +bars 1080p: inter var-tx depths of 11239 blocks -- leaf single 0=1532 1=733 (32.4% split) | leaf compound 0=1244 1=617 (33.2% split) | 32x32 single 0=750 1=1744 (69.9% split) | 32x32 compound 0=2377 1=2242 (48.5% split) +bars 1080p: screen frames on=0 off=4 (0.0% on); palette blocks luma 0 chroma 0; intrabc blocks 0 (searched 0 / valid 0 / won 0) +bars 1080p: filter intra on=true blocks 25781 (modes DC=5725 V=2780 H=5357 D157=8191 PAETH=3728)