Removed unnecessary dev dependencies

This commit is contained in:
Matteo Paonessa 2022-02-12 15:23:25 +01:00
parent 6c1a538162
commit 6099c3fe7c
2 changed files with 4 additions and 24 deletions

View File

@ -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]

View File

@ -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<P: AsRef<Path>>(path: P) -> Result<ImgVec<RGBAPLU>, 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
}