perf(image): VP8L literal symbols inline, cross-colour identity tiles skipped, T / TR / TL predictors and SWAR addPixels; JPEG IDCT 5x5 path, gray / 4:4:4 colour fast paths; QOI index as tables; TGA rows without per-pixel div/mod; BC7 / BC6H bit reads from a word table; bench_image: bcn / exr

This commit is contained in:
4DBug committed 2026-11-01 19:41:47 -06:00
1 parent 9855a7edd6
commit 903e239a0e
7 files changed
+293 -121

No files matched your search

+31
View File
@@ -180,3 +180,34 @@ if want("qoi", "tga", "bmp", "tiff") then
Tiff.decode(Bytes.reader(tl))
end)
end
if want("bcn", "exr") then
local Bcn = require("@rosetta/codecs/image/Bcn")
local BB = require("@tests/gen/bcn_bench")
local w, h = BB.w, BB.h
local px = buffer.fromstring(BB.rgba)
for _, kind in { "bc1", "bc3", "bc5" } do
local blocks = Bcn.encode(kind, px, w, h) :: buffer
bench("bcn decode " .. kind .. " 256x256", 5, w * h * 4, function()
Bcn.decode(kind, blocks, 0, w, h)
end)
bench("bcn encode " .. kind .. " 256x256", 2, w * h * 4, function()
Bcn.encode(kind, px, w, h)
end)
end
local b7, b6 = buffer.fromstring(BB.bc7), buffer.fromstring(BB.bc6h)
bench("bcn decode bc7 256x256", 5, w * h * 4, function()
Bcn.decode("bc7", b7, 0, w, h)
end)
bench("bcn decode bc6h 256x256", 5, w * h * 16, function()
Bcn.decode("bc6h", b6, 0, w, h)
end)
local Exr = require("@rosetta/image/exr")
local EB = require("@tests/gen/exr_bench")
local n = 512 * 256 * 16
for _, k in { "zip", "piz" } do
local data = buffer.fromstring(EB[k])
bench("exr decode " .. k .. " 512x256 half", 3, n, function()
Exr.decode(Bytes.reader(data), { native = true })
end)
end
end