Re-sweep the coding pyramid on real film -- 16:-24:16
Browse files at this commit92428b38651d5c33bcb5d0890564e2370e6af8f3Parent: db67894- perf
- re-sweep the coding pyramid on real film -- 16:-24:16
3 changed files +84 -4
- crates/ec-av1/src/encode.rs +7 -1
- crates/ec-av1/src/encoder.rs +54 -3
- lanes/pyr3.sweep.txt +23 -0
crates/ec-av1/src/encode.rsmodified+7 -1
| @@ -13006,6 +13006,12 @@ mod tests { | ||
| 13006 | 13006 | // so every block taking either codes different syntax and different |
| 13007 | 13007 | // coefficients -- 8194 -> 7321 at q=150 and 28285 -> 27285 at q=60. |
| 13008 | 13008 | // `EC_AV1_CFL=0` / `EC_AV1_ANGLE=0` restore each half. |
| 13009 | + // Re-taken on lane-pyr3: the mini-GOP of the default pyramid is 16 | |
| 13010 | + // pictures at `q-24` / `q+16` now (the sweep in [`Pyramid::default`]), | |
| 13011 | + // so these four pictures code as one truncated group -- a hidden | |
| 13012 | + // ALTREF at `q-24` and three leaves at `q+16` -- instead of one | |
| 13013 | + // mini-GOP of 4 at `q-16` / `q+8`: 7373 -> 8076 at q=150 and | |
| 13014 | + // 27074 -> 27585 at q=60. `EC_AV1_PYRAMID=4:-16:8` restores these. | |
| 13009 | 13015 | // Re-taken on lane-fintra: the sequence header sets |
| 13010 | 13016 | // `enable_filter_intra`, so every DC_PRED intra block of at most |
| 13011 | 13017 | // 32x32 without a luma palette carries a `use_filter_intra` flag and |
| @@ -13013,7 +13019,7 @@ mod tests { | ||
| 13013 | 13019 | // prediction and different coefficients -- 7321 -> 7373 at q=150 and |
| 13014 | 13020 | // 27285 -> 27074 at q=60. `EC_AV1_FILTER_INTRA=0` restores these. |
| 13015 | 13021 | let pins: [(u8, usize, u64); 2] = |
| 13016 | - [(150, 7373, 0xd0af_b890_28bc_cfbf), (60, 27074, 0x8324_0e9f_5971_e4e7)]; | |
| 13022 | + [(150, 8076, 0x8171_4818_e223_ab21), (60, 27585, 0xdbe7_eecd_6d64_c4f5)]; | |
| 13017 | 13023 | for (q, bytes, hash) in pins { |
| 13018 | 13024 | let encoded = encode_sequence(&source, q, 0.5).unwrap(); |
| 13019 | 13025 | assert_eq!( |
crates/ec-av1/src/encoder.rsmodified+54 -3
| @@ -542,11 +542,62 @@ impl Default for Pyramid { | ||
| 542 | 542 | /// entry point still codes flat, since a picture no longer maps to a |
| 543 | 543 | /// packet under a pyramid — [`Av1Encoder::with_pyramid`] plus |
| 544 | 544 | /// [`Av1Encoder::encode_frames`] is the streaming surface that reorders. |
| 545 | + /// RE-SWEPT on lane-pyr3, on main 503d7aa9 -- `4:-16:8` was chosen when | |
| 546 | + /// the gate's "film" rows were still colour bars, and CfL, the luma | |
| 547 | + /// angle deltas, filter intra, the propagating tpl map and the rate-loop | |
| 548 | + /// step have all landed since (class `unswept decision constants`). The | |
| 549 | + /// axes were swept in the order mini-GOP first at the shipped offsets, | |
| 550 | + /// then both offset axes at the best mini-GOP, then the joint corners | |
| 551 | + /// (`encode::tests::bd_rate_screen_native`, BD-rate vs libaom / vs | |
| 552 | + /// rav1e; the bars rows move by at most 4 points across the WHOLE sweep | |
| 553 | + /// and decide nothing, the screen row is byte-identical in every arm | |
| 554 | + /// because the content gate codes it flat): | |
| 555 | + /// | |
| 556 | + /// | arm | film A | film B | | |
| 557 | + /// |---|---|---| | |
| 558 | + /// | flat (no pyramid) | +61.4 / +31.3 | +85.3 / +49.7 | | |
| 559 | + /// | 2:-16:8 | +59.2 / +28.1 | +82.3 / +49.1 | | |
| 560 | + /// | 4:-16:8 (was shipped) | +52.8 / +23.3 | +81.0 / +46.1 | | |
| 561 | + /// | 8:-16:8 | +54.3 / +24.4 | +81.8 / +45.8 | | |
| 562 | + /// | 16:-16:8 | +50.8 / +21.4 | +73.8 / +38.7 | | |
| 563 | + /// | 8:-8:8 | +58.0 / +27.5 | +83.3 / +46.5 | | |
| 564 | + /// | 8:-24:8 | +52.7 / +23.4 | +83.7 / +48.4 | | |
| 565 | + /// | 8:-32:8 | +52.3 / +23.1 | +86.8 / +51.9 | | |
| 566 | + /// | 8:-16:0 | +60.7 / +30.7 | +85.3 / +51.2 | | |
| 567 | + /// | 8:-16:4 | +57.6 / +27.4 | +84.1 / +48.6 | | |
| 568 | + /// | 8:-16:12 | +51.8 / +22.2 | +80.4 / +43.9 | | |
| 569 | + /// | 8:-16:16 | +50.1 / +20.5 | +80.6 / +43.4 | | |
| 570 | + /// | 16:-24:8 | +47.8 / +19.0 | +71.5 / +37.4 | | |
| 571 | + /// | 16:-16:12 | +48.0 / +18.9 | +71.1 / +35.7 | | |
| 572 | + /// | 16:-16:16 | +45.9 / +17.0 | +69.3 / +34.0 | | |
| 573 | + /// | 16:-24:12 | +45.6 / +17.0 | +70.2 / +35.6 | | |
| 574 | + /// | **16:-24:16** | **+44.2 / +15.7** | **+70.5 / +35.2** | | |
| 575 | + /// | 16:-32:16 | +43.6 / +15.2 | +71.2 / +36.2 | | |
| 576 | + /// | 16:-24:20 (past the swept range) | +42.9 / +14.5 | +70.8 / +34.9 | | |
| 577 | + /// | 16:-24:24 (past the swept range) | +42.6 / +14.1 | +71.3 / +35.7 | | |
| 578 | + /// | |
| 579 | + /// `16:-24:16` ships: it takes 8.6 / 7.6 points off film A and 10.5 / | |
| 580 | + /// 10.9 off film B against the old defaults, and every axis through it | |
| 581 | + /// is at or next to its own minimum. The two arms past the swept leaf | |
| 582 | + /// range were run because leaf `+16` was the range's edge and still | |
| 583 | + /// improving (class `instrument at bound`): film A keeps falling to | |
| 584 | + /// `+24` but film B turns back up at `+20`, so `+16` is where BOTH films | |
| 585 | + /// are minimal and the bound is not the answer. Deeper ARF is the same | |
| 586 | + /// shape -- `-32` buys 0.6 on film A and gives 0.7 back on film B. | |
| 587 | + /// | |
| 588 | + /// TWO THINGS THIS SWEEP DOES NOT SAY. The mini-GOP axis is measured | |
| 589 | + /// against a gate that codes 12 frames with `gop = 12`, and a group is | |
| 590 | + /// cut at every key frame (`encode_frames`), so `16` here is really | |
| 591 | + /// "one hidden ARF per GOP" and any mini-GOP over 12 codes the same | |
| 592 | + /// stream; on a stream with a longer GOP `16` is a genuine 16-picture | |
| 593 | + /// group, which this gate cannot measure. And the offsets were swept at | |
| 594 | + /// mini-GOP 8 before 16 won the first axis; the two joint corners at 16 | |
| 595 | + /// confirm the same gradient, but the full grid at 16 is not measured. | |
| 545 | 596 | fn default() -> Self { |
| 546 | 597 | Self { |
| 547 | - mini_gop: 4, | |
| 548 | - arf_q_offset: -16, | |
| 549 | - leaf_q_offset: 8, | |
| 598 | + mini_gop: 16, | |
| 599 | + arf_q_offset: -24, | |
| 600 | + leaf_q_offset: 16, | |
| 550 | 601 | } |
| 551 | 602 | } |
| 552 | 603 | } |
lanes/pyr3.sweep.txtadded+23 -0
| @@ -0,0 +1,23 @@ | ||
| 1 | +lane-pyr3 pyramid shape sweep on main 503d7aa9 (bd_rate_screen_native, BD-rate vs libaom / vs rav1e) | |
| 2 | +arm film A film B screen | |
| 3 | +flat +61.4%|+31.3% +85.3%|+49.7% +49.2%|-16.0% | |
| 4 | +2:-16:8 +59.2%|+28.1% +82.3%|+49.1% | |
| 5 | +4:-16:8 +52.8%|+23.3% +81.0%|+46.1% +49.2%|-16.0% | |
| 6 | +8:-16:8 +54.3%|+24.4% +81.8%|+45.8% | |
| 7 | +16:-16:8 +50.8%|+21.4% +73.8%|+38.7% | |
| 8 | +8:-8:8 +58.0%|+27.5% +83.3%|+46.5% | |
| 9 | +8:-24:8 +52.7%|+23.4% +83.7%|+48.4% | |
| 10 | +8:-32:8 +52.3%|+23.1% +86.8%|+51.9% | |
| 11 | +8:-16:0 +60.7%|+30.7% +85.3%|+51.2% | |
| 12 | +8:-16:4 +57.6%|+27.4% +84.1%|+48.6% | |
| 13 | +8:-16:12 +51.8%|+22.2% +80.4%|+43.9% | |
| 14 | +8:-16:16 +50.1%|+20.5% +80.6%|+43.4% | |
| 15 | +16:-24:8 +47.8%|+19.0% +71.5%|+37.4% | |
| 16 | +16:-16:12 +48.0%|+18.9% +71.1%|+35.7% | |
| 17 | +16:-16:16 +45.9%|+17.0% +69.3%|+34.0% | |
| 18 | +16:-24:12 +45.6%|+17.0% +70.2%|+35.6% | |
| 19 | +16:-24:16 +44.2%|+15.7% +70.5%|+35.2% | |
| 20 | +16:-32:16 +43.6%|+15.2% +71.2%|+36.2% | |
| 21 | +16:-24:20 +42.9%|+14.5% +70.8%|+34.9% | |
| 22 | +16:-24:24 +42.6%|+14.1% +71.3%|+35.7% | |
| 23 | +16:-24:16 +44.2%|+15.7% +70.5%|+35.2% +49.2%|-16.0% |