tests stuff

This commit is contained in:
Ryan Oldenburg 2021-01-25 11:49:29 -06:00
parent 29099a08eb
commit 65afc67792
4 changed files with 20 additions and 7 deletions

View file

@ -44,8 +44,7 @@ proc writeFile*(image: Image, filePath: string) =
let fileFormat = case splitFile(filePath).ext:
of ".png": ffPng
of ".bmp": ffBmp
of ".jpg": ffJpg
of ".jpeg": ffJpg
of ".jpg",".jpeg": ffJpg
else:
raise newException(PixieError, "Unsupported image file extension")
image.writeFile(filePath, fileformat)

View file

@ -319,3 +319,17 @@ timeIt "blendExcludeMaskFloats":
).rgba
reset()
timeIt "blendNormalPremultiplied":
for i in 0 ..< backdrop.data.len:
backdrop.data[i] = blendNormalPremultiplied(backdrop.data[i], source.data[i])
when defined(amd64) and not defined(pixieNoSimd):
import nimsimd/sse2
timeIt "blendNormalPremultiplied [simd]":
for i in countup(0, backdrop.data.len - 4, 4):
let
b = mm_loadu_si128(backdrop.data[i].addr)
s = mm_loadu_si128(source.data[i].addr)
mm_storeu_si128(backdrop.data[i].addr, blendNormalPremultiplied(b, s))

View file

@ -27,11 +27,11 @@ timeIt "sharpOpacity":
a.fill(rgba(63, 127, 191, 191))
timeIt "toAlphy":
a.toAlphy()
timeIt "toPremultipliedAlpha":
a.toPremultipliedAlpha()
timeIt "fromAlphy":
a.fromAlphy()
timeIt "toStraightAlpha":
a.toStraightAlpha()
timeIt "lerp integers":
for i in 0 ..< 100000:

View file

@ -2,7 +2,7 @@ import chroma, pixie/fileformats/png, stb_image/read as stbi, strformat, pngsuit
for file in pngSuiteFiles:
let
data = readFile(&"tests/images/pngsuite/{file}.png")
data = readFile(&"tests/images/png/pngsuite/{file}.png")
pixieLoaded = decodePng(cast[seq[uint8]](data))
var