imgA: JPEG-in-TIFF pixel check through F.load (image/jpeg via the decodeImage hook) against tifffile
This commit is contained in:
1 parent
fb3dc75282
commit
9b2bc84b39
2 files changed
+22
-2
No files matched your search
@@ -89,6 +89,19 @@ do
|
||||
end,
|
||||
})
|
||||
t:check(img and calls > 0, "jpeg through the hook")
|
||||
-- the real thing through the api (image/jpeg decodes the stitched streams): within 2 levels of libjpeg-turbo
|
||||
local F = require("@formats")
|
||||
local ref = Fx.jpegRef
|
||||
local full, ferr = F.load(Fx.jpeg, { format = "tiff" })
|
||||
t:check(full and full.width == ref.width and full.height == ref.height, "jpeg-in-tiff through F.load: " .. tostring(ferr))
|
||||
local worst = 0
|
||||
for i = 0, ref.width * ref.height - 1 do
|
||||
for k = 0, 2 do
|
||||
worst = math.max(worst, math.abs(buffer.readu8(full.pixels, i * 4 + k) - string.byte(ref.rgb, i * 3 + k + 1)))
|
||||
end
|
||||
end
|
||||
t:check(worst <= 2, "jpeg-in-tiff pixels: max error " .. worst .. " against tifffile")
|
||||
t:note("JPEG-in-TIFF through F.load: max error %d against tifffile / libjpeg-turbo", worst)
|
||||
end
|
||||
|
||||
-- encoder round trips
|
||||
|
||||
Reference in new issue
Block a user