Make images smaller using best-in-class codecs, right in the browser.
JavaScript
It runs but not really
Surma0b4a673b1302
diff --git a/codecs/visdif/Cargo.lock b/codecs/visdif/Cargo.lockindex 3e097a56..b3d4397f 100644--- a/codecs/visdif/Cargo.lock+++ b/codecs/visdif/Cargo.lock@@ -281,6 +281,7 @@ dependencies = ["console_error_panic_hook","dssim-core","imgref",+ "rayon-core","rgb","wasm-bindgen","wasm-bindgen-test",diff --git a/codecs/visdif/Cargo.toml b/codecs/visdif/Cargo.tomlindex ea0424f0..1e4ec765 100644--- a/codecs/visdif/Cargo.toml+++ b/codecs/visdif/Cargo.toml@@ -18,6 +18,7 @@ wasm-bindgen = "0.2.38"dssim-core = "2.11.3"imgref = "1.7.0"rgb = "0.8.24"+rayon-core = "1.7.1"# The `console_error_panic_hook` crate provides better debugging of panics by# logging them with `console.error`. This is great for development, but requires# all the `std::fmt` and `std::panicking` infrastructure, so isn't great fordiff --git a/codecs/visdif/src/lib.rs b/codecs/visdif/src/lib.rsindex 57d64875..b35be307 100644--- a/codecs/visdif/src/lib.rs+++ b/codecs/visdif/src/lib.rs@@ -4,6 +4,7 @@ use wasm_bindgen::prelude::*;use dssim_core::{Dssim, ToRGBAPLU};use imgref;use rgb::FromSlice;+use rayon_core;mod utils;@@ -17,6 +18,7 @@ cfg_if! {}}+#[wasm_bindgen]#[no_mangle]pub fn ssim(data_a: Vec<u8>, data_b: Vec<u8>, width: usize, height: usize) -> f64 {diff --git a/codecs/visdif/src/utils.rs b/codecs/visdif/src/utils.rsindex 2ffc954d..24b802c6 100644--- a/codecs/visdif/src/utils.rs+++ b/codecs/visdif/src/utils.rs@@ -8,7 +8,7 @@ cfg_if! {// For more details see// https://github.com/rustwasm/console_error_panic_hook#readmeif #[cfg(feature = "console_error_panic_hook")] {- extern crate console_error_panic_hook;+ use console_error_panic_hook;pub use self::console_error_panic_hook::set_once as set_panic_hook;} else {#[inline]