tests/codecs (m-z): comments: specs only
This commit is contained in:
1 parent
98b4ce533e
commit
a6732d45f2
23 files changed
+46
-177
No files matched your search
@@ -1,6 +1,4 @@
|
||||
-- codecs/image/Quantize tests: palette size bounds for every method and colour budget, the exact (lossless) palette at
|
||||
-- <= maxColors colours, transparency handling, PSNR of quantized images above thresholds, determinism of both
|
||||
-- methods and of Floyd-Steinberg dithering (the same CRC on both runtimes), bad arguments, and a no-throw pass.
|
||||
-- codecs/image/Quantize tests: palette bounds, exact palettes, transparency, PSNR thresholds, determinism.
|
||||
local T = require("@tests/T")
|
||||
local Quantize = require("@rosetta/codecs/image/Quantize")
|
||||
local Crc32 = require("@rosetta/core/Crc32")
|
||||
@@ -43,7 +41,6 @@ end
|
||||
|
||||
local W, H = 128, 96
|
||||
local px = photo(W, H)
|
||||
-- palette bounds and quality
|
||||
local MIN_PSNR = { [256] = 30, [64] = 24, [16] = 17, [2] = 10 }
|
||||
for _, method in { "mediancut", "octree" } do
|
||||
for _, k in { 2, 16, 64, 256 } do
|
||||
@@ -66,7 +63,6 @@ for _, method in { "mediancut", "octree" } do
|
||||
end
|
||||
end
|
||||
|
||||
-- exact palettes: lossless
|
||||
do
|
||||
local n = 50 * 40
|
||||
local b = buffer.create(n * 4)
|
||||
@@ -84,7 +80,6 @@ do
|
||||
t:check(e3 and #p3 == 200 and buffer.tostring(render(i3, p3, n)) == buffer.tostring(b), "quantize() exact")
|
||||
end
|
||||
|
||||
-- transparency
|
||||
do
|
||||
local b = buffer.create(16 * 4)
|
||||
for i = 0, 15 do
|
||||
@@ -112,7 +107,6 @@ do
|
||||
t:check(#o1 == #o2 and o1[#o1][1] == o2[#o2][1], "octree deterministic")
|
||||
end
|
||||
|
||||
-- bad arguments never throw
|
||||
do
|
||||
t:eq(#Quantize.palette(nil :: any, 1, 1, 4), 0, "nil pixels")
|
||||
t:eq(#Quantize.palette(buffer.create(3), 1, 1, 4), 0, "short buffer")
|
||||
|
||||
Reference in new issue
Block a user