From 0b4a673b13028ec1ea4f99a753a080af932272b4 Mon Sep 17 00:00:00 2001 From: Surma Date: Tue, 25 Aug 2020 13:03:10 +0100 Subject: [PATCH] It runs but not really --- codecs/visdif/Cargo.lock | 1 + codecs/visdif/Cargo.toml | 1 + codecs/visdif/src/lib.rs | 2 ++ codecs/visdif/src/utils.rs | 2 +- 4 files changed, 5 insertions(+), 1 deletion(-) diff --git a/codecs/visdif/Cargo.lock b/codecs/visdif/Cargo.lock index 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.toml index 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 for diff --git a/codecs/visdif/src/lib.rs b/codecs/visdif/src/lib.rs index 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, data_b: Vec, width: usize, height: usize) -> f64 { diff --git a/codecs/visdif/src/utils.rs b/codecs/visdif/src/utils.rs index 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#readme if #[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]