diff --git a/src/pixie.nim b/src/pixie.nim index 2f96229..dd6a0c2 100644 --- a/src/pixie.nim +++ b/src/pixie.nim @@ -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) diff --git a/tests/benchmark_blends.nim b/tests/benchmark_blends.nim index 8febace..98a0b07 100644 --- a/tests/benchmark_blends.nim +++ b/tests/benchmark_blends.nim @@ -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)) diff --git a/tests/benchmark_images.nim b/tests/benchmark_images.nim index 32b28fe..9f5c118 100644 --- a/tests/benchmark_images.nim +++ b/tests/benchmark_images.nim @@ -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: diff --git a/tests/validate_png.nim b/tests/validate_png.nim index 79155e1..b7648ad 100644 --- a/tests/validate_png.nim +++ b/tests/validate_png.nim @@ -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