imgA: image/jpeg (absorbed jpeg-luau decoder + arithmetic coding, meta, EXIF orientation, encoder byte-identical to cjpeg) and codecs/Dct
- codecs/Dct: jpeg-luau's islow / reduced IDCTs + a forward islow DCT with jcdctmgr.c's quantiser; tests/codecs/dct.luau - image/jpeg: Decode (marker parser, absorbed + reader ranges, SOF9/SOF10 + DAC, EXIF / ICC / COM / JFIF density), Scan + Color (absorbed), Arith (jdarith.c port), Encode (baseline / optimised / progressive, 444/422/420, restarts, APP1/APP2/COM from meta), Tables (annex K) - tests: 115 cjpeg/jpegtran/Pillow files, 444 decodes bit-exact with djpeg at 1, 1/2, 1/4, 1/8 (104 arithmetic), 38 encodes byte-identical to cjpeg (so djpeg decodes them), orientation, meta, truncation, fuzz - licenses: libjpeg-turbo LICENSE + README.ijg, NOTICE rows - tools/bench.luau: jpeg block; tools/bench.sh runs every fixture generator (bench blocks read their outputs)
This commit is contained in:
1 parent
2eee0bc1a6
commit
692ef055de
19 files changed
+4613
-1
No files matched your search
@@ -56,3 +56,29 @@ do
|
||||
Png.encode(img)
|
||||
end)
|
||||
end
|
||||
|
||||
-- ------------------------------------------------------------------------------------------------ jpeg (ws-imgA)
|
||||
do
|
||||
local Jpeg = require("@formats/image/jpeg")
|
||||
local Types = require("@formats/Types")
|
||||
local JB = require("@tests/gen/jpeg_bench")
|
||||
for _, c in JB.files do
|
||||
local b = buffer.fromstring(c.data)
|
||||
local img = Jpeg.decode(Bytes.reader(b))
|
||||
assert(img and Crc32.of(img.pixels) == c.crc, "jpeg bench: " .. c.name .. " does not match djpeg")
|
||||
bench("jpeg decode " .. c.name, 3, c.width * c.height * 4, function()
|
||||
Jpeg.decode(Bytes.reader(b))
|
||||
end)
|
||||
end
|
||||
local b0 = buffer.fromstring(JB.files[1].data)
|
||||
bench("jpeg decode 1/8 (DC only)", 3, JB.width * JB.height * 4, function()
|
||||
Jpeg.decode(Bytes.reader(b0), { scale = 8 })
|
||||
end)
|
||||
local src = Types.Image.new(JB.width, JB.height, "rgb8")
|
||||
buffer.writestring(src.pixels, 0, JB.rgb)
|
||||
for _, o in { { label = "baseline 4:2:0 q85", quality = 85 }, { label = "progressive 4:2:0 q85", quality = 85, progressive = true }, { label = "baseline 4:4:4 q85 optimized", quality = 85, subsampling = "444", optimize = true } } do
|
||||
bench("jpeg encode " .. o.label, 2, JB.width * JB.height * 3, function()
|
||||
Jpeg.encode(src, o :: any)
|
||||
end)
|
||||
end
|
||||
end
|
||||
Reference in new issue
Block a user