forge
Explore
Log in

Don't you dare go Hollow

The palette colour bound ships at 128, not 32

Browse files at this commit

7aa07927329c813f733607dbe3c4c228a5d06008Ahmet Kaan GümüşParent: 530272b
  • perf
    • the palette colour bound ships at 128, not 32
Show full message
perf(av1): the palette colour bound ships at 128, not 32

The bound this lane inherited from the first palette lane was never swept.
On the gate's screen capture it was throwing away half the palette blocks:
32 -> 515 blocks, +66.4%/+10.3% vs libaom/rav1e; 64 -> 1264, +57.1%/+3.2%;
128 -> 1102, +56.9%/+2.3%; 256 byte-identical to 128. The film clips do not
set the header bit, so they are unchanged, and the screen clip's encode wall
is unchanged too (6.1s).
crates/ec-av1/src/encode.rsmodified+10 -1
@@ -2338,6 +2338,15 @@ fn commit_inter_luma(
23382338 /// The largest distinct-colour count a block may hold and still be offered a
23392339 /// palette candidate at all: past it the k-means quantisation costs more
23402340 /// error than the map saves rate, and every trial is wasted wall.
2341+///
2342+/// Swept on the gate's own screen capture (lane-av1pal2, the
2343+/// `unswept-decision-constants` class): 32 (the value this lane inherited)
2344+/// finds 515 palette blocks and scores +66.4%/+10.3% vs libaom/rav1e, 64
2345+/// finds 1264 and scores +57.1%/+3.2%, 128 finds 1102 and scores
2346+/// +56.9%/+2.3%, and 256 is byte-identical to 128 -- above 128 the bound
2347+/// binds on nothing this content holds. 128 ships: best BD against both
2348+/// references and no wall cost at all (6.1s, the same as at 32, because the
2349+/// blocks it newly admits are ones the RD then keeps).
23412350 /// `EC_AV1_PAL_MAXCOLORS`.
23422351 fn palette_max_colors() -> usize {
23432352 static N: std::sync::OnceLock<usize> = std::sync::OnceLock::new();
@@ -2345,7 +2354,7 @@ fn palette_max_colors() -> usize {
23452354 std::env::var("EC_AV1_PAL_MAXCOLORS")
23462355 .ok()
23472356 .and_then(|v| v.parse().ok())
2348- .unwrap_or(32)
2357+ .unwrap_or(128)
23492358 })
23502359 }
23512360