Merge branch 'lane-av1pyr2' (0e86c029): the native BD arm honours EC_AV1_PYRAMID; pyramid re-measured at native and stays opt-in
Browse files at this commit2 changed files +57 -1
- crates/ec-av1/src/encode.rs +21 -1
- crates/ec-av1/src/encoder.rs +36 -0
crates/ec-av1/src/encode.rsmodified+21 -1
| @@ -10922,6 +10922,13 @@ mod tests { | |||
| 10922 | /// EC_AV1_INTRABC=1 ... same command # intra block copy | 10922 | /// EC_AV1_INTRABC=1 ... same command # intra block copy |
| 10923 | /// EC_AV1_PAL_MAXCOLORS=256 ... same command # palette bound | 10923 | /// EC_AV1_PAL_MAXCOLORS=256 ... same command # palette bound |
| 10924 | /// EC_AV1_TILES=1:1 EC_AV1_TILE_THREADS=4 ... # 2x2 tiles | 10924 | /// EC_AV1_TILES=1:1 EC_AV1_TILE_THREADS=4 ... # 2x2 tiles |
| 10925 | + /// EC_AV1_PYRAMID=4:-16:8 ... same command # coding pyramid | ||
| 10926 | + /// | ||
| 10927 | + /// Under `EC_AV1_PYRAMID` this arm codes its ladder through the streaming | ||
| 10928 | + /// facade ([`our_ladder_pyramid`]), which exposes no per-packet | ||
| 10929 | + /// reconstruction: that path asserts ffmpeg's decode against our own | ||
| 10930 | + /// decoder on all three planes in display order, and prints the per-level | ||
| 10931 | + /// frame and byte census. | ||
| 10925 | /// | 10932 | /// |
| 10926 | /// All three gate clips are rows by default. `EC_AV1_NATIVE_FILM=1`, | 10933 | /// All three gate clips are rows by default. `EC_AV1_NATIVE_FILM=1`, |
| 10927 | /// `EC_AV1_NATIVE_FILM4K=1` and `EC_AV1_NATIVE_SCREEN=1` select a subset: | 10934 | /// `EC_AV1_NATIVE_FILM4K=1` and `EC_AV1_NATIVE_SCREEN=1` select a subset: |
| @@ -11033,7 +11040,20 @@ mod tests { | |||
| 11033 | let _ = crate::tile::take_palette_uv_hits(); | 11040 | let _ = crate::tile::take_palette_uv_hits(); |
| 11034 | let _ = crate::tile::take_intrabc_hits(); | 11041 | let _ = crate::tile::take_intrabc_hits(); |
| 11035 | let _ = take_intrabc_search(); | 11042 | let _ = take_intrabc_search(); |
| 11036 | - let (ours, ours_wall) = our_ladder(name, &source, cw, ch, fctx); | 11043 | + let (ours, ours_wall) = match pyramid_from_env() { |
| 11044 | + None => our_ladder(name, &source, cw, ch, fctx), | ||
| 11045 | + Some(pyramid) => { | ||
| 11046 | + let (ladder, wall, counts, bytes) = | ||
| 11047 | + our_ladder_pyramid(name, &source, cw, ch, pyramid); | ||
| 11048 | + eprintln!( | ||
| 11049 | + "{name}: pyramid {pyramid:?} -- frames key {} arf {} leaf {} \ | ||
| 11050 | + show_existing {}; bytes key {} arf {} leaf {} show_existing {}", | ||
| 11051 | + counts[0], counts[1], counts[2], counts[3], | ||
| 11052 | + bytes[0], bytes[1], bytes[2], bytes[3], | ||
| 11053 | + ); | ||
| 11054 | + (ladder, wall) | ||
| 11055 | + } | ||
| 11056 | + }; | ||
| 11037 | // gate-blind-to-feature: what the screen tools actually did at | 11057 | // gate-blind-to-feature: what the screen tools actually did at |
| 11038 | // native resolution, over this clip's four encodes. | 11058 | // native resolution, over this clip's four encodes. |
| 11039 | let screen_on = SCREEN_FRAMES[1].load(std::sync::atomic::Ordering::Relaxed); | 11059 | let screen_on = SCREEN_FRAMES[1].load(std::sync::atomic::Ordering::Relaxed); |
crates/ec-av1/src/encoder.rsmodified+36 -0
| @@ -412,6 +412,42 @@ impl Default for Pyramid { | |||
| 412 | /// (`encoder::tests::a_pyramid_stream_decodes_in_display_order_through_both_decoders` | 412 | /// (`encoder::tests::a_pyramid_stream_decodes_in_display_order_through_both_decoders` |
| 413 | /// checks every shown frame in display order against ffmpeg AND our own | 413 | /// checks every shown frame in display order against ffmpeg AND our own |
| 414 | /// decoder, with the hidden frame proven to win blocks), and the | 414 | /// decoder, with the hidden frame proven to win blocks), and the |
| 415 | + /// Re-measured a third time at NATIVE resolution (`encode::tests:: | ||
| 416 | + /// bd_rate_screen_native`, 1920x1024 crops, 12 frames, four quantizers, | ||
| 417 | + /// BD-rate vs libaom / vs rav1e), because every earlier verdict was taken | ||
| 418 | + /// on the 4x-downscaled gate (class `gate-recipe-confound`) and because | ||
| 419 | + /// leaf compound and the distance-scaled search have landed since: | ||
| 420 | + /// | ||
| 421 | + /// | arm | film 1080p | film 2160p | screen | | ||
| 422 | + /// |---|---|---|---| | ||
| 423 | + /// | flat (no pyramid) | +18.7 / +1.4 | +48.1 / +19.8 | +59.4 / -10.0 | | ||
| 424 | + /// | 4:-16:8 | +23.2 / +5.3 | +48.1 / +19.7 | +62.7 / -6.5 | | ||
| 425 | + /// | 2:-16:8 | +24.9 / +6.9 | +46.9 / +19.5 | +69.0 / -3.8 | | ||
| 426 | + /// | 8:-16:8 | +22.6 / +4.6 | +48.7 / +19.8 | +59.3 / -8.2 | | ||
| 427 | + /// | 4:-24:12 (before the leaf-compound merge) | +24.3 / +6.3 | +48.5 / +20.2 | +67.2 / -3.7 | | ||
| 428 | + /// | ||
| 429 | + /// The confound was real -- at native the gap is 5 BD points, not 30 -- | ||
| 430 | + /// but the sign is not: no arm beats flat on both films, every arm costs | ||
| 431 | + /// 4-6 points on 1080p, and the best 2160p arm (`2:-16:8`, -1.1 vs | ||
| 432 | + /// libaom) pays +10 on screen. So the pyramid still ships OFF. | ||
| 433 | + /// | ||
| 434 | + /// A native offset sweep on the 2160p clip alone (mini-GOP 4) says the | ||
| 435 | + /// offsets are not what is missing -- the whole 3x3 grid spans 2.9 BD | ||
| 436 | + /// points and none of it reaches flat's +48.1: | ||
| 437 | + /// | ||
| 438 | + /// | arf \ leaf | +4 | +8 | +12 | | ||
| 439 | + /// |---|---|---|---| | ||
| 440 | + /// | -8 | +48.9 / +20.4 | +49.2 / +20.1 | +50.2 / +20.5 | | ||
| 441 | + /// | -16 | +47.8 / +20.0 | +48.1 / +19.7 | +49.2 / +20.2 | | ||
| 442 | + /// | -24 | +47.3 / +20.0 | +47.6 / +19.7 | +48.5 / +20.2 | | ||
| 443 | + /// | ||
| 444 | + /// The gradient is monotone in both knobs (deeper ARF better, shallower | ||
| 445 | + /// leaf better), which is the shape of a group whose leaves cannot cash | ||
| 446 | + /// in the ARF's extra quality: what the leaves reach the hidden frame | ||
| 447 | + /// with is still one forward search per reference. Shrinking the mini-GOP | ||
| 448 | + /// helps for the same reason (2:-16:8 is the only arm that beats flat on | ||
| 449 | + /// any clip, and it beats it on the clip with the fastest motion). | ||
| 450 | + /// | ||
| 415 | /// quantizer offsets behave. Nothing selects the pyramid but an explicit | 451 | /// quantizer offsets behave. Nothing selects the pyramid but an explicit |
| 416 | /// [`Av1Encoder::with_pyramid`] call (or `EC_AV1_PYRAMID` on the gate and | 452 | /// [`Av1Encoder::with_pyramid`] call (or `EC_AV1_PYRAMID` on the gate and |
| 417 | /// on `ec-bench`); the default one-in-one-out path is byte-identical to | 453 | /// on `ec-bench`); the default one-in-one-out path is byte-identical to |