diff --git a/Cargo.toml b/Cargo.toml index 184792a..c2ef46d 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -33,10 +33,7 @@ img-parts = "0.2.3" bytes = "1.1.0" [dev-dependencies] -dssim = "2.11.2" -load_image = { version = "2.12.1", features = ["static"] } -imgref = "1.7.0" -lodepng = "3.0.0" +dssim = "3.1.2" kamadak-exif = "0.5.0" [lib] diff --git a/tests/jpeg.rs b/tests/jpeg.rs index d196bdf..c72f785 100644 --- a/tests/jpeg.rs +++ b/tests/jpeg.rs @@ -1,7 +1,4 @@ -use imgref::{Img, ImgVec}; -use std::path::Path; -use dssim::{RGBAPLU, ToRGBAPLU, Val}; -use load_image::ImageData; +use dssim::Val; use std::sync::Once; use std::fs; @@ -21,24 +18,10 @@ pub fn cleanup(file: &str) { } } -fn load>(path: P) -> Result, lodepng::Error> { - let img = load_image::load_image(path.as_ref(), false)?; - match img.bitmap { - ImageData::RGB8(ref bitmap) => Ok(Img::new(bitmap.to_rgbaplu(), img.width, img.height)), - ImageData::RGB16(ref bitmap) => Ok(Img::new(bitmap.to_rgbaplu(), img.width, img.height)), - ImageData::RGBA8(ref bitmap) => Ok(Img::new(bitmap.to_rgbaplu(), img.width, img.height)), - ImageData::RGBA16(ref bitmap) => Ok(Img::new(bitmap.to_rgbaplu(), img.width, img.height)), - ImageData::GRAY8(ref bitmap) => Ok(Img::new(bitmap.to_rgbaplu(), img.width, img.height)), - ImageData::GRAY16(ref bitmap) => Ok(Img::new(bitmap.to_rgbaplu(), img.width, img.height)), - ImageData::GRAYA8(ref bitmap) => Ok(Img::new(bitmap.to_rgbaplu(), img.width, img.height)), - ImageData::GRAYA16(ref bitmap) => Ok(Img::new(bitmap.to_rgbaplu(), img.width, img.height)), - } -} - fn diff(compressed: &str) -> Val { let attr = dssim::Dssim::new(); - let orig = attr.create_image(&load("tests/samples/uncompressed_드림캐쳐.jpg").unwrap()).unwrap(); - let comp = attr.create_image(&load(compressed).unwrap()).unwrap(); + let orig = dssim::load_image(&attr, "tests/samples/uncompressed_드림캐쳐.jpg").unwrap(); + let comp = dssim::load_image(&attr, compressed).unwrap(); let (diff, _) = attr.compare(&orig, comp); diff }