Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
454 changes: 125 additions & 329 deletions Cargo.lock

Large diffs are not rendered by default.

19 changes: 8 additions & 11 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ name = "dssim"
readme = "README.md"
repository = "https://github.com/kornelski/dssim.git"
version = "3.4.1"
edition = "2021"
rust-version = "1.72"
edition = "2024"
rust-version = "1.85"

[[bin]]
doctest = false
Expand All @@ -25,20 +25,17 @@ imgref = "1.11.0"
getopts = "0.2.24"
rayon = { version = "1.10.0", optional = true }
rgb = "0.8.52"
lodepng = { version = "3.12", default-features = false, features = ["rust_backend"] }
load_image = { version = "3.3", features = ["lcms2-static"] }
png = "0.18"
zune-jpeg = "0.5"
moxcms = "0.8"
crossbeam-channel = "0.5.15"
ordered-channel = { version = "1.2.0" }
zenbitmaps = { git = "https://github.com/imazen/zenbitmaps.git", rev = "818992c", features = ["rgb"] }

[features]
default = ["threads", "dssim-core/default", "no-macos-vimage"]
default = ["threads", "dssim-core/default", "no-macos-vimage", "fma"]
threads = ["dep:rayon", "dssim-core/threads"]
avif = ["load_image/avif"]
# Support comparing WebP files directly
webp = ["load_image/webp"]
webp-static = ["load_image/webp-static"]
# Decode JPEGs using libjpeg-turbo derivative (closer to the reference decoder)
mozjpeg = ["load_image/mozjpeg"]
fma = ["dssim-core/fma"]
no-macos-vimage = ["dssim-core/no-macos-vimage"]

[package.metadata.release]
Expand Down
20 changes: 11 additions & 9 deletions benches/compare.rs
Original file line number Diff line number Diff line change
@@ -1,33 +1,35 @@
#![feature(test)]

extern crate test;
use dssim::{ToRGBAPLU, RGBAPLU};
use dssim::{RGBAPLU, ToRGBAPLU};
use imgref::{Img, ImgVec};
use test::Bencher;

fn load(path: &str) -> Result<ImgVec<RGBAPLU>, lodepng::Error> {
let image = lodepng::decode32_file(path)?;
Ok(Img::new(image.buffer.to_rgbaplu(), image.width, image.height))
Ok(Img::new(
image.buffer.to_rgbaplu(),
image.width,
image.height,
))
}

#[bench]
fn compare(bench: &mut Bencher) {
let attr = dssim::Dssim::new();
let other = &load("tests/test1-sm.png").unwrap();
let orig = attr.create_image(&load("tests/test2-sm.png").unwrap()).unwrap();
let orig = attr
.create_image(&load("tests/test2-sm.png").unwrap())
.unwrap();
let modif = attr.create_image(other).unwrap();

bench.iter(|| {
attr.compare(&orig, modif.clone())
});
bench.iter(|| attr.compare(&orig, modif.clone()));
}

#[bench]
fn create_image(bench: &mut Bencher) {
let attr = dssim::Dssim::new();
let img = &load("tests/test1-sm.png").unwrap();

bench.iter(|| {
attr.create_image(img)
});
bench.iter(|| attr.create_image(img));
}
5 changes: 4 additions & 1 deletion dssim-core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,16 @@ name = "dssim-core"
readme = "README.md"
repository = "https://github.com/kornelski/dssim.git"
version = "3.4.0"
edition = "2021"
edition = "2024"

[lib]
crate-type = ["lib", "staticlib"]

[dependencies]
imgref = "1.11.0"
itertools = "0.14"
archmage = { version = "0.8.6", optional = true }
magetypes = { version = "0.8.6", optional = true }
rayon = { version = "1.11.0", optional = true }
rgb = "0.8.52"

Expand All @@ -28,6 +30,7 @@ lodepng = "3.12.1"
[features]
default = ["threads"]
threads = ["dep:rayon"]
fma = ["dep:archmage", "dep:magetypes"]
no-macos-vimage = []
# internal for cargo-c only
capi = []
Expand Down
Loading