Disable nimPng and stb image.

This commit is contained in:
treeform 2022-07-10 11:12:45 -07:00
parent 3abdfb8495
commit 8bc78c939b
2 changed files with 45 additions and 42 deletions

View file

@ -1,4 +1,4 @@
import benchy, pixie/fileformats/jpeg, jpegsuite, os, stb_image/read as stbi import benchy, pixie/fileformats/jpeg, jpegsuite, os
for file in jpegSuiteFiles: for file in jpegSuiteFiles:
let data = readFile(file) let data = readFile(file)
@ -6,17 +6,18 @@ for file in jpegSuiteFiles:
timeIt "pixie " & file.splitPath.tail & " decode": timeIt "pixie " & file.splitPath.tail & " decode":
discard decodeJpeg(data) discard decodeJpeg(data)
block: # import stb_image/read as stbi
for file in jpegSuiteFiles: # block:
let data = readFile(file) # for file in jpegSuiteFiles:
var name = file.splitPath.tail # let data = readFile(file)
# var name = file.splitPath.tail
timeIt "stb " & file.splitPath.tail & " decode": # timeIt "stb " & file.splitPath.tail & " decode":
var width, height, channels: int # var width, height, channels: int
discard loadFromMemory( # discard loadFromMemory(
cast[seq[byte]](data), # cast[seq[byte]](data),
width, # width,
height, # height,
channels, # channels,
stbi.RGBA # stbi.RGBA
) # )

View file

@ -1,5 +1,4 @@
import benchy, nimPNG, pixie/fileformats/png, stb_image/read as stbi, import benchy, pixie/fileformats/png
stb_image/write as stbr
let let
filePath = "tests/fileformats/png/lenna.png" filePath = "tests/fileformats/png/lenna.png"
@ -22,37 +21,40 @@ block:
timeIt "pixie encode + alpha": timeIt "pixie encode + alpha":
discard encodePng(decodedImage) discard encodePng(decodedImage)
block: # import nimPNG
timeIt "nimPNG decode": # block:
discard decodePNG32(data) # timeIt "nimPNG decode":
# discard decodePNG32(data)
let decoded = decodePNG32(data) # let decoded = decodePNG32(data)
timeIt "nimPNG encode": # timeIt "nimPNG encode":
discard encodePNG32(decoded.data, decoded.width, decoded.height) # discard encodePNG32(decoded.data, decoded.width, decoded.height)
block: # import stb_image/read as stbi, stb_image/write as stbr
timeIt "stb_image decode": # block:
var width, height, channels: int # timeIt "stb_image decode":
discard loadFromMemory( # var width, height, channels: int
cast[seq[byte]](data), # discard loadFromMemory(
width, # cast[seq[byte]](data),
height, # width,
channels, # height,
stbi.RGBA # channels,
) # stbi.RGBA
# )
var width, height, channels: int # var width, height, channels: int
let decoded = loadFromMemory( # let decoded = loadFromMemory(
cast[seq[byte]](data), # cast[seq[byte]](data),
width, # width,
height, # height,
channels, # channels,
stbi.RGBA # stbi.RGBA
) # )
timeIt "stb_image encode": # timeIt "stb_image encode":
discard writePNG(width, height, channels, decoded).len # discard writePNG(width, height, channels, decoded).len
# import cairo
# block: # block:
# timeIt "cairo decode": # timeIt "cairo decode":
# discard imageSurfaceCreateFromPng(filePath.cstring) # discard imageSurfaceCreateFromPng(filePath.cstring)