Browse Source

imageproc: Use DefaultHasher from stdlib instead of twox-hash

index-subcmd
Vojtech Kral Vincent Prouillet 6 years ago
parent
commit
3e4aa82ecc
23 changed files with 2 additions and 14 deletions
  1. +0
    -10
      Cargo.lock
  2. +0
    -1
      components/imageproc/Cargo.toml
  3. +2
    -3
      components/imageproc/src/lib.rs
  4. BIN
      docs/static/_resized_images/09c08ee3f954d0c100.jpg
  5. BIN
      docs/static/_resized_images/28c11b70e6d31a8400.jpg
  6. BIN
      docs/static/_resized_images/2e13805bc51b68e800.jpg
  7. BIN
      docs/static/_resized_images/2fa5b43d38d9f5a600.jpg
  8. BIN
      docs/static/_resized_images/42758a649ef513b600.jpg
  9. BIN
      docs/static/_resized_images/4df81a7c614e5cc000.jpg
  10. BIN
      docs/static/_resized_images/5a8ef01aac8b5c8700.jpg
  11. BIN
      docs/static/_resized_images/6320cb783d4be30e00.jpg
  12. BIN
      docs/static/_resized_images/6e0991f475d665df00.jpg
  13. BIN
      docs/static/_resized_images/72d0be8c5e35e50f00.jpg
  14. BIN
      docs/static/_resized_images/78e4b442f0b0cbf700.jpg
  15. BIN
      docs/static/_resized_images/792676f9505fb47700.jpg
  16. BIN
      docs/static/_resized_images/8b0ae741aed115a800.jpg
  17. BIN
      docs/static/_resized_images/b12c7fc72d2815e700.jpg
  18. BIN
      docs/static/_resized_images/b2435b04c4bd3cb400.jpg
  19. BIN
      docs/static/_resized_images/b9a9fe3b3dee28cc00.jpg
  20. BIN
      docs/static/_resized_images/ca684a0de40c030c00.jpg
  21. BIN
      docs/static/_resized_images/e13a85d2c34cbf6900.jpg
  22. BIN
      docs/static/_resized_images/f1f9e1ab29575d0f00.jpg
  23. BIN
      docs/static/_resized_images/f969dfdd99d2fe1500.jpg

+ 0
- 10
Cargo.lock View File

@@ -917,7 +917,6 @@ dependencies = [
"rayon 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", "rayon 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)",
"regex 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", "regex 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
"tera 0.11.8 (registry+https://github.com/rust-lang/crates.io-index)", "tera 0.11.8 (registry+https://github.com/rust-lang/crates.io-index)",
"twox-hash 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
"utils 0.1.0", "utils 0.1.0",
] ]


@@ -2447,14 +2446,6 @@ dependencies = [
"trust-dns-proto 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "trust-dns-proto 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
] ]


[[package]]
name = "twox-hash"
version = "1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"rand 0.3.22 (registry+https://github.com/rust-lang/crates.io-index)",
]

[[package]] [[package]]
name = "ucd-util" name = "ucd-util"
version = "0.1.1" version = "0.1.1"
@@ -2927,7 +2918,6 @@ dependencies = [
"checksum trust-dns-proto 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "32d7c204ee231f802aa821f9dc2195aa0d0269ef7e9f8c844208565c9e3981e4" "checksum trust-dns-proto 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "32d7c204ee231f802aa821f9dc2195aa0d0269ef7e9f8c844208565c9e3981e4"
"checksum trust-dns-resolver 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)" = "9b0a0c9d4f8dd56481209c5ae1a8965ed022461d352c81fb92466ec9d846929e" "checksum trust-dns-resolver 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)" = "9b0a0c9d4f8dd56481209c5ae1a8965ed022461d352c81fb92466ec9d846929e"
"checksum trust-dns-resolver 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "28b094ad60c4f51f36a493201d04d6605183c62bd5f0c73008a732f23950c156" "checksum trust-dns-resolver 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "28b094ad60c4f51f36a493201d04d6605183c62bd5f0c73008a732f23950c156"
"checksum twox-hash 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "475352206e7a290c5fccc27624a163e8d0d115f7bb60ca18a64fc9ce056d7435"
"checksum ucd-util 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "fd2be2d6639d0f8fe6cdda291ad456e23629558d466e2789d2c3e9892bda285d" "checksum ucd-util 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "fd2be2d6639d0f8fe6cdda291ad456e23629558d466e2789d2c3e9892bda285d"
"checksum unicase 1.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7f4765f83163b74f957c797ad9253caf97f103fb064d3999aea9568d09fc8a33" "checksum unicase 1.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7f4765f83163b74f957c797ad9253caf97f103fb064d3999aea9568d09fc8a33"
"checksum unicase 2.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "284b6d3db520d67fbe88fd778c21510d1b0ba4a551e5d0fbb023d33405f6de8a" "checksum unicase 2.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "284b6d3db520d67fbe88fd778c21510d1b0ba4a551e5d0fbb023d33405f6de8a"


+ 0
- 1
components/imageproc/Cargo.toml View File

@@ -9,7 +9,6 @@ regex = "1.0"
tera = "0.11.0" tera = "0.11.0"
image = "0.19.0" image = "0.19.0"
rayon = "0.9" rayon = "0.9"
twox-hash = "1.1"


errors = { path = "../errors" } errors = { path = "../errors" }
utils = { path = "../utils" } utils = { path = "../utils" }

+ 2
- 3
components/imageproc/src/lib.rs View File

@@ -3,7 +3,6 @@ extern crate lazy_static;
extern crate regex; extern crate regex;
extern crate image; extern crate image;
extern crate rayon; extern crate rayon;
extern crate twox_hash;


extern crate utils; extern crate utils;
extern crate errors; extern crate errors;
@@ -12,13 +11,13 @@ use std::path::{Path, PathBuf};
use std::hash::{Hash, Hasher}; use std::hash::{Hash, Hasher};
use std::collections::HashMap; use std::collections::HashMap;
use std::collections::hash_map::Entry as HEntry; use std::collections::hash_map::Entry as HEntry;
use std::collections::hash_map::DefaultHasher;
use std::fs::{self, File}; use std::fs::{self, File};


use regex::Regex; use regex::Regex;
use image::{GenericImage, FilterType}; use image::{GenericImage, FilterType};
use image::jpeg::JPEGEncoder; use image::jpeg::JPEGEncoder;
use rayon::prelude::*; use rayon::prelude::*;
use twox_hash::XxHash;


use utils::fs as ufs; use utils::fs as ufs;
use errors::{Result, ResultExt}; use errors::{Result, ResultExt};
@@ -133,7 +132,7 @@ pub struct ImageOp {


impl ImageOp { impl ImageOp {
pub fn new(source: String, op: ResizeOp, quality: u8) -> ImageOp { pub fn new(source: String, op: ResizeOp, quality: u8) -> ImageOp {
let mut hasher = XxHash::with_seed(0);
let mut hasher = DefaultHasher::new();
hasher.write(source.as_ref()); hasher.write(source.as_ref());
op.hash(&mut hasher); op.hash(&mut hasher);
hasher.write_u8(quality); hasher.write_u8(quality);


BIN
docs/static/_resized_images/09c08ee3f954d0c100.jpg View File

Before After
Width: 240  |  Height: 180  |  Size: 9.6KB

BIN
docs/static/_resized_images/28c11b70e6d31a8400.jpg View File

Before After
Width: 240  |  Height: 180  |  Size: 4.5KB

BIN
docs/static/_resized_images/2e13805bc51b68e800.jpg View File

Before After
Width: 240  |  Height: 180  |  Size: 15KB

BIN
docs/static/_resized_images/2fa5b43d38d9f5a600.jpg View File

Before After
Width: 240  |  Height: 180  |  Size: 13KB

BIN
docs/static/_resized_images/42758a649ef513b600.jpg View File

Before After
Width: 240  |  Height: 180  |  Size: 10KB

BIN
docs/static/_resized_images/4df81a7c614e5cc000.jpg View File

Before After
Width: 118  |  Height: 150  |  Size: 4.4KB

BIN
docs/static/_resized_images/5a8ef01aac8b5c8700.jpg View File

Before After
Width: 118  |  Height: 150  |  Size: 4.7KB

BIN
docs/static/_resized_images/6320cb783d4be30e00.jpg View File

Before After
Width: 118  |  Height: 150  |  Size: 4.4KB

BIN
docs/static/_resized_images/6e0991f475d665df00.jpg View File

Before After
Width: 150  |  Height: 150  |  Size: 5.4KB

BIN
docs/static/_resized_images/72d0be8c5e35e50f00.jpg View File

Before After
Width: 240  |  Height: 180  |  Size: 15KB

BIN
docs/static/_resized_images/78e4b442f0b0cbf700.jpg View File

Before After
Width: 150  |  Height: 150  |  Size: 5.5KB

BIN
docs/static/_resized_images/792676f9505fb47700.jpg View File

Before After
Width: 240  |  Height: 180  |  Size: 12KB

BIN
docs/static/_resized_images/8b0ae741aed115a800.jpg View File

Before After
Width: 150  |  Height: 150  |  Size: 5.5KB

BIN
docs/static/_resized_images/b12c7fc72d2815e700.jpg View File

Before After
Width: 100  |  Height: 126  |  Size: 3.4KB

BIN
docs/static/_resized_images/b2435b04c4bd3cb400.jpg View File

Before After
Width: 100  |  Height: 126  |  Size: 3.8KB

BIN
docs/static/_resized_images/b9a9fe3b3dee28cc00.jpg View File

Before After
Width: 118  |  Height: 150  |  Size: 4.7KB

BIN
docs/static/_resized_images/ca684a0de40c030c00.jpg View File

Before After
Width: 240  |  Height: 180  |  Size: 4.4KB

BIN
docs/static/_resized_images/e13a85d2c34cbf6900.jpg View File

Before After
Width: 150  |  Height: 150  |  Size: 5.5KB

BIN
docs/static/_resized_images/f1f9e1ab29575d0f00.jpg View File

Before After
Width: 240  |  Height: 180  |  Size: 18KB

BIN
docs/static/_resized_images/f969dfdd99d2fe1500.jpg View File

Before After
Width: 240  |  Height: 180  |  Size: 8.1KB

Loading…
Cancel
Save