It runs but not really

This commit is contained in:
Surma
2020-08-25 13:03:10 +01:00
parent 8c56d16aea
commit 0b4a673b13
4 changed files with 5 additions and 1 deletions

View File

@@ -281,6 +281,7 @@ dependencies = [
"console_error_panic_hook", "console_error_panic_hook",
"dssim-core", "dssim-core",
"imgref", "imgref",
"rayon-core",
"rgb", "rgb",
"wasm-bindgen", "wasm-bindgen",
"wasm-bindgen-test", "wasm-bindgen-test",

View File

@@ -18,6 +18,7 @@ wasm-bindgen = "0.2.38"
dssim-core = "2.11.3" dssim-core = "2.11.3"
imgref = "1.7.0" imgref = "1.7.0"
rgb = "0.8.24" rgb = "0.8.24"
rayon-core = "1.7.1"
# The `console_error_panic_hook` crate provides better debugging of panics by # The `console_error_panic_hook` crate provides better debugging of panics by
# logging them with `console.error`. This is great for development, but requires # 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 # all the `std::fmt` and `std::panicking` infrastructure, so isn't great for

View File

@@ -4,6 +4,7 @@ use wasm_bindgen::prelude::*;
use dssim_core::{Dssim, ToRGBAPLU}; use dssim_core::{Dssim, ToRGBAPLU};
use imgref; use imgref;
use rgb::FromSlice; use rgb::FromSlice;
use rayon_core;
mod utils; mod utils;
@@ -17,6 +18,7 @@ cfg_if! {
} }
} }
#[wasm_bindgen] #[wasm_bindgen]
#[no_mangle] #[no_mangle]
pub fn ssim(data_a: Vec<u8>, data_b: Vec<u8>, width: usize, height: usize) -> f64 { pub fn ssim(data_a: Vec<u8>, data_b: Vec<u8>, width: usize, height: usize) -> f64 {

View File

@@ -8,7 +8,7 @@ cfg_if! {
// For more details see // For more details see
// https://github.com/rustwasm/console_error_panic_hook#readme // https://github.com/rustwasm/console_error_panic_hook#readme
if #[cfg(feature = "console_error_panic_hook")] { 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; pub use self::console_error_panic_hook::set_once as set_panic_hook;
} else { } else {
#[inline] #[inline]