ws-tex: codecs/image/Bcn (BC1-7 decode, BC1/3/4/5 encode) + codecs/image/Half
Decoders ported from Pillow BcnDecode.c (CC0) with D3D11 rules (BC6H +32 rounding, float output, reserved modes, signed RGTC). Tests against Pillow and Godot 4 (bcdec) over random blocks of every BC6H / BC7 mode; encoder PSNR above Pillow's encoder. Bench lines in tools/bench.luau. Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
1 parent
d3dbba500b
commit
b32d45ef99
10 files changed
+1761
No files matched your search
@@ -1078,3 +1078,27 @@ do
|
||||
jitTune(false)
|
||||
end
|
||||
end
|
||||
do
|
||||
-- textures (ws-tex): codecs/image/Bcn on a 256 x 256 image (tools/fixtures/bcn.py); MB/s of rgba8 output (decode)
|
||||
-- or input (encode); BC6H of rgbaf32 output
|
||||
local Bcn = require("@formats/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)
|
||||
end
|
||||
Reference in new issue
Block a user