imgA-gif: faster median cut (cached box scores, keyed sort) and nearest-colour search (green-sorted, pruned); gif + quantize bench block

This commit is contained in:
4DBug committed 2026-10-31 08:37:09 -05:00
1 parent 603689bc14
commit a507a52bda
3 files changed
+115 -33

No files matched your search

+1 -1
View File
@@ -106,7 +106,7 @@ do
local a = Crc32.of(Quantize.map(px, W, H, pal, { dither = true }))
local pal2 = Quantize.palette(px, W, H, 64, { method = "mediancut" })
t:eq(Crc32.of(Quantize.map(px, W, H, pal2, { dither = true })), a, "mediancut + dither deterministic")
t:eq(a, 0xd2c76537, "mediancut 64 + dither: the pinned CRC (the same on both runtimes)")
t:eq(a, 0x50c4e466, "mediancut 64 + dither: the pinned CRC (the same on both runtimes)")
local o1 = Quantize.palette(px, W, H, 37, { method = "octree" })
local o2 = Quantize.palette(px, W, H, 37, { method = "octree" })
t:check(#o1 == #o2 and o1[#o1][1] == o2[#o2][1], "octree deterministic")