From 4a980bf4c0f80ed117abcef4708f825e6f951ea5 Mon Sep 17 00:00:00 2001 From: Assil Ksiksi Date: Sat, 7 Sep 2024 22:11:50 -0400 Subject: [PATCH 1/2] feat: use rusty-chromaprint instead of native --- README.md | 20 +-- flake.nix | 4 +- needle/Cargo.lock | 216 +++++++++++++-------------------- needle/Cargo.toml | 8 +- needle/src/audio/analyzer.rs | 25 ++-- needle/src/audio/comparator.rs | 4 +- needle/src/lib.rs | 3 - 7 files changed, 110 insertions(+), 170 deletions(-) diff --git a/README.md b/README.md index ade6340..b43baf2 100644 --- a/README.md +++ b/README.md @@ -185,7 +185,7 @@ sudo apt-get install \ cargo install --path . ``` -This will **dynamically** link against FFmpeg and statically link `chromaprint`. +This will **dynamically** link against FFmpeg. #### Dynamic @@ -223,7 +223,7 @@ brew install cmake pkg-config ffmpeg cargo install --path . ``` -This will **dynamically** link against FFmpeg. `chromaprint` will be statically linked. +This will **dynamically** link against FFmpeg. ### Windows @@ -242,7 +242,7 @@ cargo vcpkg build 3. Build: ```bash -# Statically link against both FFmpeg and chromaprint +# Statically link against FFmpeg. cargo build --release --features static ``` @@ -250,7 +250,7 @@ cargo build --release --features static 1. Set the following environment variables: - a. To dynamically link **both** FFmpeg and `chromaprint`: + a. To dynamically link FFmpeg: ```powershell # Powershell @@ -264,18 +264,6 @@ cargo build --release --features static export VCPKGRS_TRIPLET='x64-windows' ``` - b. Just `chromaprint`: - - ```powershell - # Powershell - $env:CHROMAPRINT_SYS_DYNAMIC='1' - ``` - - ```bash - # Git bash - export CHROMAPRINT_SYS_DYNAMIC=1 - ``` - 2. Build deps: ``` diff --git a/flake.nix b/flake.nix index 30d7872..8df4b78 100644 --- a/flake.nix +++ b/flake.nix @@ -20,7 +20,7 @@ inherit pname; inherit version; src = ./needle; - cargoSha256 = "sha256-aUKzSbyniuk2+UZmrUZjMv+yhcjn+eilnZtCMxzJLZo="; + cargoSha256 = "sha256-CUcjt7BLvTSaiiYCuzVilEf0y1zN08Bo8YtvKFVTSiM="; # nativeBuildInputs: used only in build phase nativeBuildInputs = [ pkgs.cmake @@ -30,7 +30,6 @@ # buildInputs: used only at runtime (i.e., linked against) # https://nixos.org/manual/nixpkgs/stable/#ssec-stdenv-dependencies-overview buildInputs = [ - pkgs.chromaprint pkgs.ffmpeg-full ] ++ pkgs.lib.optionals pkgs.stdenv.isLinux [ pkgs.fftw @@ -58,7 +57,6 @@ in { default = pkgs.mkShell { buildInputs = [ - pkgs.chromaprint pkgs.ffmpeg-full pkgs.libiconv # required by rust-ffmpeg build script pkgs.pkg-config diff --git a/needle/Cargo.lock b/needle/Cargo.lock index 273a298..36ace98 100644 --- a/needle/Cargo.lock +++ b/needle/Cargo.lock @@ -61,29 +61,6 @@ dependencies = [ "serde", ] -[[package]] -name = "bindgen" -version = "0.60.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "062dddbc1ba4aca46de6338e2bf87771414c335f7b2f2036e8f3e9befebf88e6" -dependencies = [ - "bitflags 1.3.2", - "cexpr", - "clang-sys", - "clap", - "env_logger", - "lazy_static", - "lazycell", - "log", - "peeking_take_while", - "proc-macro2", - "quote", - "regex", - "rustc-hash", - "shlex", - "which", -] - [[package]] name = "bindgen" version = "0.69.4" @@ -143,31 +120,6 @@ version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" -[[package]] -name = "chromaprint-rust" -version = "0.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ac1d9bca6efb59acb6a08aa386e252dda3c6541ef18d277841b48d9133cbc934" -dependencies = [ - "chromaprint-sys-next", - "num-traits", - "thiserror", -] - -[[package]] -name = "chromaprint-sys-next" -version = "1.5.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "74158b525ca4b9517023d890458b18f3ad9924c341190aba0c07d9a8f819ce2a" -dependencies = [ - "bindgen 0.60.1", - "cfg-if", - "cmake", - "libc", - "pkg-config", - "vcpkg", -] - [[package]] name = "chrono" version = "0.4.38" @@ -230,15 +182,6 @@ dependencies = [ "os_str_bytes", ] -[[package]] -name = "cmake" -version = "0.1.50" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a31c789563b815f77f4250caee12365734369f942439b7defd71e18a48197130" -dependencies = [ - "cc", -] - [[package]] name = "console" version = "0.15.8" @@ -294,29 +237,6 @@ version = "0.3.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a357d28ed41a50f9c765dbfe56cbc04a64e53e5fc58ba79fbc34c10ef3df831f" -[[package]] -name = "env_logger" -version = "0.9.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a12e6657c4c97ebab115a42dcee77225f7f482cdd841cf7088c657a42e9e00e7" -dependencies = [ - "atty", - "humantime", - "log", - "regex", - "termcolor", -] - -[[package]] -name = "errno" -version = "0.3.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "534c5cf6194dfab3db3242765c03bbe257cf92f22b38f6bc0c58d59108a820ba" -dependencies = [ - "libc", - "windows-sys", -] - [[package]] name = "ffmpeg-next" version = "7.0.2" @@ -334,7 +254,7 @@ version = "7.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "972a460dd8e901b737ce0482bf71a837e1751e3dd7c8f8b0a4ead808e7f174a5" dependencies = [ - "bindgen 0.69.4", + "bindgen", "cc", "libc", "num_cpus", @@ -375,21 +295,6 @@ version = "0.3.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d231dfb89cfffdbc30e7fc41579ed6066ad03abda9e567ccafae602b97ec5024" -[[package]] -name = "home" -version = "0.5.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e3d1354bf6b7235cb4a0576c2619fd4ed18183f689b12b006a0ee7329eeff9a5" -dependencies = [ - "windows-sys", -] - -[[package]] -name = "humantime" -version = "2.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9a3a5bfb195931eeb336b2a7b4d761daec841b97f947d34394601737a7bba5e4" - [[package]] name = "iana-time-zone" version = "0.1.60" @@ -499,12 +404,6 @@ version = "0.5.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0717cef1bc8b636c6e1c1bbdefc09e6322da8a9321966e8928ef80d20f7f770f" -[[package]] -name = "linux-raw-sys" -version = "0.4.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "78b3ae25bc7c8c38cec158d1f2757ee79e9b3740fbc7ccf0e59e4b08d793fa89" - [[package]] name = "log" version = "0.4.22" @@ -543,13 +442,14 @@ name = "needle-rs" version = "0.1.5" dependencies = [ "bincode", - "chromaprint-rust", "clap", "ffmpeg-next", "infer", "insta", "md5", + "num-traits", "rayon", + "rusty-chromaprint", "serde", "serde_json", "thiserror", @@ -568,6 +468,24 @@ dependencies = [ "minimal-lexical", ] +[[package]] +name = "num-complex" +version = "0.4.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "73f88a1307638156682bada9d7604135552957b7818057dcef22705b4d509495" +dependencies = [ + "num-traits", +] + +[[package]] +name = "num-integer" +version = "0.1.46" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7969661fd2958a5cb096e56c8e1ad0444ac2bbcd0061bd28660485a44879858f" +dependencies = [ + "num-traits", +] + [[package]] name = "num-traits" version = "0.2.19" @@ -599,12 +517,6 @@ version = "6.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e2355d85b9a3786f481747ced0e0ff2ba35213a1f9bd406ed906554d7af805a1" -[[package]] -name = "peeking_take_while" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "19b17cddbe7ec3f8bc800887bab5e717348c95ea2ca0b1bf0837fb964dc67099" - [[package]] name = "pin-project-lite" version = "0.2.14" @@ -617,6 +529,15 @@ version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d231b230927b5e4ad203db57bbcbee2802f6bce620b1e4a9024a07d94e2907ec" +[[package]] +name = "primal-check" +version = "0.3.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc0d895b311e3af9902528fbb8f928688abbd95872819320517cc24ca6b2bd08" +dependencies = [ + "num-integer", +] + [[package]] name = "proc-macro-error" version = "1.0.4" @@ -679,6 +600,15 @@ dependencies = [ "crossbeam-utils", ] +[[package]] +name = "realfft" +version = "3.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "953d9f7e5cdd80963547b456251296efc2626ed4e3cbf36c869d9564e0220571" +dependencies = [ + "rustfft", +] + [[package]] name = "regex" version = "1.10.5" @@ -723,6 +653,18 @@ version = "0.8.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7a66a03ae7c801facd77a29370b4faec201768915ac14a721ba36f20bc9c209b" +[[package]] +name = "rubato" +version = "0.14.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e6dd52e80cfc21894deadf554a5673002938ae4625f7a283e536f9cf7c17b0d5" +dependencies = [ + "num-complex", + "num-integer", + "num-traits", + "realfft", +] + [[package]] name = "rustc-hash" version = "1.1.0" @@ -730,16 +672,28 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2" [[package]] -name = "rustix" -version = "0.38.34" +name = "rustfft" +version = "6.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "70dc5ec042f7a43c4a73241207cecc9873a06d45debb38b329f8541d85c2730f" +checksum = "43806561bc506d0c5d160643ad742e3161049ac01027b5e6d7524091fd401d86" dependencies = [ - "bitflags 2.6.0", - "errno", - "libc", - "linux-raw-sys", - "windows-sys", + "num-complex", + "num-integer", + "num-traits", + "primal-check", + "strength_reduce", + "transpose", + "version_check", +] + +[[package]] +name = "rusty-chromaprint" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1755646867c36ecb391776deaa0b557a76d3badf20c142de7282630c34b20440" +dependencies = [ + "rubato", + "rustfft", ] [[package]] @@ -806,6 +760,12 @@ version = "1.13.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67" +[[package]] +name = "strength_reduce" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fe895eb47f22e2ddd4dabc02bce419d2e643c8e3b585c78158b349195bc24d82" + [[package]] name = "strsim" version = "0.10.0" @@ -954,6 +914,16 @@ dependencies = [ "tracing-serde", ] +[[package]] +name = "transpose" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1ad61aed86bc3faea4300c7aee358b4c6d0c8d6ccc36524c96e4c92ccf26e77e" +dependencies = [ + "num-integer", + "strength_reduce", +] + [[package]] name = "unicode-ident" version = "1.0.12" @@ -1032,18 +1002,6 @@ version = "0.2.92" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "af190c94f2773fdb3729c55b007a722abb5384da03bc0986df4c289bf5567e96" -[[package]] -name = "which" -version = "4.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "87ba24419a2078cd2b0f2ede2691b6c66d8e47836da3b6db8265ebad47afbfc7" -dependencies = [ - "either", - "home", - "once_cell", - "rustix", -] - [[package]] name = "winapi" version = "0.3.9" diff --git a/needle/Cargo.toml b/needle/Cargo.toml index acf8a33..a850ee0 100644 --- a/needle/Cargo.toml +++ b/needle/Cargo.toml @@ -33,7 +33,6 @@ thiserror = "1" tracing = "0.1.34" tracing-subscriber = "0.2" ffmpeg-next = { version = "7.0.2", default-features = false, features = ["codec", "format", "software-resampling"] } -chromaprint-rust = "0.1" clap = { version = "3", features = ["derive"] } bincode = "1.3" serde = { version = "1", features = ["derive"] } @@ -41,16 +40,17 @@ serde_json = "1" rayon = { version = "1", optional = true } infer = { version = "0.8", default-features = false } md5 = "0.7" +rusty-chromaprint = "0.2.0" +num-traits = "0.2.19" [dev-dependencies] insta = "1" [features] -default = ["rayon", "static-chromaprint"] -static-chromaprint = ["chromaprint-rust/static"] +default = ["rayon"] static-ffmpeg = ["ffmpeg-next/static"] static-ffmpeg-build = ["ffmpeg-next/build"] -static = ["static-chromaprint", "static-ffmpeg"] +static = ["static-ffmpeg"] [target.'cfg(windows)'.build-dependencies] vcpkg = "0.2" diff --git a/needle/src/audio/analyzer.rs b/needle/src/audio/analyzer.rs index 4ffce02..863282d 100644 --- a/needle/src/audio/analyzer.rs +++ b/needle/src/audio/analyzer.rs @@ -1,9 +1,7 @@ -extern crate chromaprint_rust; extern crate ffmpeg_next; #[cfg(feature = "rayon")] extern crate rayon; - -use chromaprint_rust as chromaprint; +extern crate rusty_chromaprint; use std::path::Path; use std::time::Duration; @@ -11,6 +9,8 @@ use std::time::Duration; #[cfg(feature = "rayon")] use rayon::prelude::*; +use rusty_chromaprint::{Configuration, Fingerprinter}; + use super::FrameHashes; use crate::{Error, Result}; @@ -173,10 +173,11 @@ impl> Analyzer

{ let mut frame_resampled = ffmpeg_next::frame::Audio::empty(); // Setup the audio fingerprinter - let mut chromaprint_ctx = chromaprint::Context::default(); + let config = &Configuration::preset_test2(); + let target_sample_rate = config.sample_rate(); + let mut chromaprint_ctx = Fingerprinter::new(config); // Setup the audio resampler - let target_sample_rate = chromaprint_ctx.sample_rate(); let mut resampler = decoder .decoder .resampler( @@ -215,7 +216,8 @@ impl> Analyzer

{ } }); - chromaprint_ctx.start(target_sample_rate, 2)?; + // TODO(aksiksi): Export ResetError from rusty-chromaprint. + chromaprint_ctx.start(target_sample_rate, 2).expect("failed to start fingerprinter"); for p in audio_packets { if p.pts().unwrap() <= 0 { @@ -272,7 +274,7 @@ impl> Analyzer

{ // Feed the i16 samples to Chromaprint. Since we are using the default sampling rate, // Chromaprint will _not_ do any resampling internally. - chromaprint_ctx.feed(samples)?; + chromaprint_ctx.consume(samples); if delay.is_none() { break; @@ -283,10 +285,10 @@ impl> Analyzer

{ } } - chromaprint_ctx.finish()?; + chromaprint_ctx.finish(); - let chromaprint_hash_delay = chromaprint_ctx.get_delay()?; - let item_duration = chromaprint_ctx.get_item_duration()?; + let chromaprint_hash_delay = Duration::ZERO; + let item_duration = Duration::from_secs_f32(config.item_duration_in_seconds()); // We can use the given hash duration and Chromaprint's item duration to // figure out how many hashes we can skip. @@ -297,8 +299,7 @@ impl> Analyzer

{ }; for (i, hash) in chromaprint_ctx - .get_fingerprint_raw()? - .get() + .fingerprint() .iter() .enumerate() .step_by(step_by) diff --git a/needle/src/audio/comparator.rs b/needle/src/audio/comparator.rs index e89889a..f7446fa 100644 --- a/needle/src/audio/comparator.rs +++ b/needle/src/audio/comparator.rs @@ -1,4 +1,3 @@ -extern crate chromaprint_rust; #[cfg(feature = "rayon")] extern crate rayon; @@ -7,7 +6,6 @@ use std::fmt::Display; use std::path::Path; use std::time::Duration; -use chromaprint_rust as chromaprint; #[cfg(feature = "rayon")] use rayon::prelude::*; @@ -149,7 +147,7 @@ impl> Comparator

{ #[inline] fn compute_hash_for_match(hashes: &[(u32, Duration)], (start, end): (usize, usize)) -> u32 { let hashes: Vec = hashes.iter().map(|t| t.0).collect(); - chromaprint::simhash::simhash32(&hashes[start..end + 1]) + crate::simhash::simhash32(&hashes[start..end + 1]) } /// Runs a LCS (longest common substring) search between the two sets of hashes. This runs in diff --git a/needle/src/lib.rs b/needle/src/lib.rs index a89c1af..dbb623a 100644 --- a/needle/src/lib.rs +++ b/needle/src/lib.rs @@ -143,9 +143,6 @@ pub enum Error { /// Wraps [std::io::Error]. #[error("IO error: {0}")] IOError(#[from] std::io::Error), - /// Wraps [chromaprint_rust::Error]. - #[error("Chromaprint error: {0}")] - ChromaprintError(#[from] chromaprint_rust::Error), } /// Common result type. From a8a0e05861acfb292a4ff674c103c8c770831081 Mon Sep 17 00:00:00 2001 From: Assil Ksiksi Date: Sat, 7 Sep 2024 22:11:30 -0400 Subject: [PATCH 2/2] chore: move simhash into needle --- needle/src/lib.rs | 1 + needle/src/simhash.rs | 1041 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 1042 insertions(+) create mode 100644 needle/src/simhash.rs diff --git a/needle/src/lib.rs b/needle/src/lib.rs index dbb623a..a358a30 100644 --- a/needle/src/lib.rs +++ b/needle/src/lib.rs @@ -112,6 +112,7 @@ use std::path::PathBuf; pub mod audio; /// Common utility functions. pub mod util; +mod simhash; /// Common error type. #[derive(thiserror::Error, Debug)] diff --git a/needle/src/simhash.rs b/needle/src/simhash.rs new file mode 100644 index 0000000..5371b3c --- /dev/null +++ b/needle/src/simhash.rs @@ -0,0 +1,1041 @@ +use core::ops::{AddAssign, BitAnd, BitOrAssign, Shl, SubAssign}; + +use num_traits::{ops::wrapping::WrappingSub, FromPrimitive, Num}; + +/// 32-bit version of SimHash. +#[inline] +pub fn simhash32(data: &[u32]) -> u32 { + simhash::(data) +} + +/// Computes the SimHash of a set of data. This function is generic over all numeric types. +/// +/// Note that: +/// +/// 1) size_of(T) must equal to N bits +/// 2) the hash size must match the input bit width +/// +/// Reimplementation of: https://github.com/acoustid/chromaprint/blob/516e3b31c7fa6e822035ea3b3e31f9c7f51ef4b6/src/simhash.cpp#L8 +#[inline] +pub fn simhash(data: &[T]) -> T +where + T: Num + + FromPrimitive + + WrappingSub + + AddAssign + + SubAssign + + BitAnd + + BitOrAssign + + Shl + + Copy, +{ + assert_eq!( + std::mem::size_of::() * 8, + N, + "size of T must be equal to {} bits", + N + ); + + let mut buf = [0i64; N]; + + for i in 0..data.len() { + for j in 0..N { + let s = T::one() << T::from_usize(j).unwrap(); + if (data[i] & s) != T::zero() { + buf[j] += 1; + } else { + buf[j] -= 1; + } + } + } + + let mut hash = T::zero(); + for i in 0..N { + if buf[i] > 0 { + hash |= T::one() << T::from_usize(i).unwrap(); + } + } + + hash +} + +#[cfg(test)] +mod test { + use super::*; + + #[test] + fn test_single() { + const DATA: &[u32] = &[3740390231]; + assert_eq!(simhash32(DATA), 3740390231); + } + + #[test] + fn test_small() { + const DATA: &[u32] = &[ + 3740390231, 3739276119, 3730871573, 3743460629, 3743525173, 3744594229, 3727948087, + 1584920886, 1593302326, 1593295926, 1584907318, + ]; + assert_eq!(simhash32(DATA), 3732003127); + } + + #[test] + fn test_normal() { + const DATA: &[i32] = &[ + 1518991452, + -1511651436, + -1511579771, + -1528353403, + -1528469033, + -1528501962, + -1511724778, + -1511543546, + -1477991162, + -1478183674, + -1502310138, + -1506504441, + -1506482827, + -1489541659, + -1489619548, + -1485437532, + -1510078540, + -1511127164, + -1528353403, + -1527829033, + -1528469130, + -1511720650, + -1511741178, + -1478185722, + -1477139194, + -1502300922, + -1506504441, + -1506499307, + -1489640091, + -1489607196, + -1485437020, + -1518991452, + -1511061628, + -1527826556, + -1527828587, + -1526896137, + -1527907978, + -1511720682, + -1511741178, + -1478185722, + -1478187770, + -1502310138, + -1506504441, + -1506482891, + -1489541659, + -1489619548, + -1485437020, + -1510078540, + -1511061627, + -1528352891, + -1531105897, + -1531090442, + -1532692202, + -1511741178, + -1511740154, + -1478187770, + -1485523706, + -1506504441, + -1506482921, + -1489640091, + -1489607195, + -1485437020, + -1518991451, + -1511061627, + -1527824507, + -1527829113, + -1526896137, + -1527383690, + -1511737082, + -1511740154, + -1478187770, + -1493912314, + -1506504441, + -1506495225, + -1506417307, + -1489607195, + -1489619036, + -1518991451, + -1511127147, + -1527834747, + -1527828603, + -1532155433, + -1532106378, + -1515914986, + -1515935482, + -1478185722, + -1478187770, + -1502301946, + -1506508537, + -1506482891, + -1489541659, + -1489623644, + -1518991452, + -1518991451, + -1528363131, + -1528352891, + -1527435881, + -1527486089, + -1511659210, + -1511675642, + -1478185722, + -1477139194, + -1502301946, + -1506504441, + -1506483939, + -1489639955, + -1489605148, + -1518985308, + -1518989404, + -1510535532, + -1527302523, + -1527437691, + -1527419177, + -1510609130, + -1510675178, + -1510691818, + -1481262058, + -1477143546, + -1502309370, + -1508577209, + -434870827, + -434756188, + -415879260, + -445247580, + -437907532, + -454621308, + -459200571, + -459247673, + -459215018, + -454956282, + -168580858, + -135021306, + -135166714, + -428829674, + -432999337, + -164600619, + -147771996, + -183358044, + -177070172, + -168687968, + -168622448, + -169789756, + -174053819, + -241111289, + -207574778, + -207378170, + -136135418, + -136149758, + -144670458, + -147803385, + -181341379, + -466589844, + -466472980, + -462280212, + -453899804, + -441249884, + -441448828, + -405790003, + -405773617, + -212797746, + -210506258, + -504190746, + -508315418, + -508457770, + -235866938, + 1932534159, + 1930441613, + 1930568684, + 1915889644, + 1936856420, + 1944259940, + 1906313541, + 1906339141, + 1906371911, + 1889648454, + 1894956870, + 1911729990, + 1936891142, + 1936885046, + 1935705190, + 1935696999, + 1935680743, + 1902128629, + 1886531045, + 1886533092, + 1894909920, + 1894777456, + 1894838788, + 1910546948, + 1910552069, + 1927327253, + -220026347, + -220026091, + -220029161, + -160267513, + -143604977, + -181374401, + -198158807, + -197973207, + -194893779, + -185460627, + -185579027, + -168802355, + -179281267, + 2001760911, + 1980842638, + 1930589094, + 1934812326, + 1911745702, + -172897118, + 1974498438, + 1978687623, + 1399857613, + 1378957149, + 1383218988, + 1382169892, + 1407388961, + 1373635889, + 1352671493, + 1352725255, + 1356976982, + 1424160326, + 1416802119, + 1429389059, + 1395821841, + 1377864993, + 1382081892, + 1390470500, + 1408268276, + 1374830549, + 1355952117, + 1347567523, + 1364264418, + 1364197858, + 1364222290, + 1408299330, + 1390540098, + 1390586946, + 1407364163, + 1398967619, + 1398966083, + 1366327891, + 1362141814, + 1345385062, + 1882324582, + 1886579046, + 1893886055, + -253671323, + 1911604565, + 1903223300, + 1932648964, + 1932612101, + 1932752501, + 1903356389, + 1911744743, + 1907574951, + 1940999303, + 1945118087, + 1397760903, + 1381040783, + 1381118975, + 1383212135, + 1399002147, + 1373637667, + 1373662227, + 1356915719, + 1352711495, + 1358085959, + 1374863175, + 1397931331, + 1379044675, + 1379110177, + 1382085985, + 1407247719, + 1373660535, + 1358067031, + 1358069223, + 1347556833, + 1347438433, + 1364214641, + 1366352385, + 1399894529, + 1391504977, + 1391700545, + 1391635395, + 1391640515, + 1383237443, + 1467056711, + 1362162199, + -265230801, + -265261521, + -261986001, + -186484691, + -186529755, + -185545355, + -168758715, + -212802875, + -233745785, + -216894826, + -212703834, + -237868894, + -242071390, + -256685950, + 1353786498, + 1374692806, + 1399859142, + 1383282022, + -697160666, + -966649822, + -941619166, + -941615086, + -975116030, + -710824190, + -1800225022, + -1648969982, + -1651067646, + -1650555343, + -1615296992, + -1619484128, + -1641487776, + -567803168, + -567737696, + -30797152, + -163958620, + 1999438061, + 1973814334, + 1889668106, + 815933450, + 279062538, + 279063562, + 14740507, + 299955499, + 291799915, + 828670569, + 828691033, + 807727737, + 874897979, + 879190827, + 342258986, + 484924714, + 484825466, + 484948298, + 1567079370, + 1601018826, + 2145951706, + -5664262, + -5663814, + -22310216, + -559238472, + -559177048, + -567745876, + -566746460, + -566684960, + -567659676, + 1982738468, + 2003238959, + 1973816334, + 815933450, + 279062538, + 279066634, + 11537482, + 15785339, + 7656939, + 291816427, + 291799979, + 828699579, + 820376507, + 350614457, + 342356923, + 73848250, + 207871466, + 207731578, + 1298381594, + 1566817034, + 1609018122, + -558911734, + -22044406, + -559238630, + -559250888, + -559185304, + -555179288, + -566697236, + -566742300, + -567602464, + -567660060, + -30469916, + 2003240173, + 1973816394, + 884096010, + 347219978, + 351419402, + 342899738, + 351282218, + 351285354, + 882901098, + 887357658, + 887361754, + 878989787, + 879063387, + 342356283, + 342349178, + 350723578, + 367507866, + 350726538, + 1978121098, + 1978505866, + 1978506906, + -139619686, + -156265767, + -156331400, + -156323272, + -697376216, + -701685140, + -700702108, + -700636320, + -164298524, + 2004091111, + 1906508926, + 1889668110, + 279066634, + 279062538, + 279063562, + 14738491, + 283157803, + 291537259, + 828408683, + 828670715, + 828748409, + 811704953, + 811837049, + 811771385, + 811834792, + 887197096, + 887201688, + 896646792, + 829660808, + 825472648, + 825484952, + 829612472, + 829616552, + 837996968, + 838001576, + 835723949, + 324018879, + 307241727, + 309469543, + 309470247, + 316677155, + 333449251, + 333473795, + 295762945, + 10747713, + 15924929, + 24280769, + 17989440, + 53628240, + 52446560, + 65037665, + 60845411, + 329317846, + 27459014, + 15924418, + 1232098, + 1082723, + 17860387, + 288403969, + 1399895553, + 1390521873, + 1390586641, + 1390587185, + 1382200625, + 1383236113, + 1393672709, + 1360065031, + 1880159807, + 1882319406, + 1886578734, + 1962072111, + 1957742695, + 1955646935, + 1976623821, + 1997566671, + 1913717391, + 1930568366, + 1930570918, + 1909598374, + 1907493026, + 1907559554, + 1907434630, + 298852742, + 324022983, + 307392885, + 309486629, + 333708321, + 299944993, + 299957265, + 278983937, + 279051847, + 15924935, + 24276679, + 51544003, + 53611859, + 321998049, + 325084385, + 329278693, + 329315829, + 280096197, + 11726293, + 5436915, + 1234787, + 17875747, + 288403987, + 1399886339, + 1390456595, + 1390586131, + 1390585873, + 1382193233, + 1383237440, + 1378910720, + 1362141717, + 1882255933, + 1882258989, + 1886578991, + 1894967335, + 1890699367, + 1957743719, + 1959818055, + 1901093583, + 1930494670, + 1930561246, + 1934764198, + 1945249958, + 1941129382, + 1907427463, + 1911563655, + 1934631559, + 303043214, + 303178479, + 309469223, + 325202979, + 299895843, + 283130899, + 278948867, + 279051525, + 10681925, + 32669377, + 38960961, + 101866817, + 36851057, + 39900257, + 312517857, + 396404198, + 1957799366, + 1957868998, + 1414700390, + 1410436390, + 1410369830, + -718230778, + -147801338, + -164562170, + -165482730, + -151591642, + -155258841, + -557924320, + -558349968, + -558341184, + -566726080, + -700956144, + 1463423520, + 1463690016, + 1429610532, + 1442267191, + 347210766, + 351411470, + 338824970, + 338890251, + 338959737, + 880026729, + 900998377, + 632565993, + 632565977, + 614731849, + 878985545, + 879149881, + 887535419, + 1017556778, + 497336186, + 497335130, + 1608825802, + 1601018762, + 1596825482, + 1584103834, + -559246918, + -559246934, + -693456472, + -559176792, + -555162968, + -567745876, + -683904340, + -717327652, + 1966482040, + 1966224680, + 1978747945, + 1978682394, + 1978923018, + 1965287434, + 1965091850, + 891415627, + 895730937, + 636731817, + 565461481, + 552874969, + 540029449, + 540029465, + 606216747, + 1692542763, + 1956785450, + 1973442874, + 1974786314, + 2012518666, + -30110902, + -30634022, + -26242566, + -22376022, + -5598293, + -22367576, + -22306136, + -25632084, + -1103568156, + -1103498528, + -163679520, + -164728736, + -161201952, + -140459785, + -173882170, + 1977772230, + 1948412302, + 1949514127, + 1966091695, + 1970283695, + 1978663147, + 1974468859, + 1973428299, + 888152075, + 888152331, + 888301370, + 1957854762, + 1957874218, + 1420872218, + 1441839626, + -680224246, + -165376246, + -30570726, + -26561734, + -22367894, + -1096121368, + -1096117528, + -1095195992, + -1082596692, + -1086823700, + -1086651668, + -12700948, + -147446548, + -176944024, + -441447365, + 1706167306, + 1978805258, + 1901210698, + 1896885466, + 823141546, + 837812394, + 833880234, + 832843930, + 820256906, + 811872714, + 812057370, + 811992874, + 283520298, + 346433834, + 1420060954, + 1420077322, + 1424263434, + 1441566282, + -38959398, + -5668262, + -22375877, + -22375880, + -22367704, + -26631576, + -30907676, + -30928160, + -30866784, + -163901020, + 1983709421, + 2011497582, + 1906707466, + 816199690, + 816195594, + 279063562, + 278930442, + 14738475, + 283148649, + 291537897, + 895779561, + 879030905, + 879096379, + 879190555, + 342254874, + 476476458, + 484924458, + 216520730, + 1575467082, + 1567078730, + 1609408474, + -5728294, + -5663846, + -22310215, + -22310216, + -559238488, + -554065240, + -566730068, + -566746464, + -566619424, + -567660508, + 1982795813, + 2011628590, + 1973554190, + 279062538, + 279062538, + 77732874, + 82838539, + 82867563, + 74498409, + 358924649, + 367301097, + 887403513, + 887469019, + 887600091, + 342276058, + 476485594, + 476552698, + 493336922, + 1567078746, + 1596438986, + 2120596954, + -17979942, + -22301702, + -22375687, + -22375688, + -22367576, + -1092050200, + -1087839512, + -1087835416, + -1121316184, + -1523698264, + -450618135, + -436991894, + -441382822, + 1708268618, + 1699884234, + 1695687882, + 1997743322, + 930152618, + 670105770, + 665850043, + 636498059, + 628109515, + 611324171, + 877818427, + 886205994, + 884108074, + 1957755706, + 1973725450, + 2011478282, + 1998883146, + -13856806, + -26508390, + -22375430, + -22375815, + -22371736, + -559308184, + -555163028, + -567778716, + -29814176, + -29748640, + -29478812, + -143392667, + 1978729534, + 1957825550, + 1962032142, + 875703370, + 875768907, + 875834857, + 905192681, + 900989161, + 632553977, + 632558027, + 610534155, + 610583066, + 610723626, + 1021766954, + 1017572650, + 2108995866, + 2142538058, + 2138344394, + 2117439114, + -29509990, + -25513030, + -21326918, + -4549720, + -4545880, + -21454168, + -25632092, + -29859088, + -163966240, + -163958172, + -147972060, + -144441305, + 1973683262, + 1906707470, + 1889937418, + 812001290, + 807877706, + 271859067, + 905188587, + 833880299, + 832844011, + 564408537, + 820269129, + 811979097, + 887534459, + 883340923, + 884457082, + 888446970, + 888446938, + 891591050, + 1998953882, + 1982315930, + 1982247322, + 1986433467, + 1990628265, + 1991701160, + 1995858664, + 1999905388, + 1999905324, + -182050260, + 1965175596, + 1977812268, + 1973421096, + 1974469641, + 1978807563, + 1968316170, + 890246922, + 890250602, + 894448874, + 636486890, + 615776442, + 614731914, + 618934474, + 878989771, + 879153945, + 879142697, + 887533355, + 900054842, + 1470413658, + 1608825418, + 1583651530, + 2116914826, + -26507366, + -18181702, + -559246870, + -559238807, + -559242392, + -559357332, + -563551708, + -567746016, + -566312416, + -700517536, + -684269344, + 2012664032, + 1979106499, + 1979108486, + 1965476231, + 1965542277, + 1965391269, + 1965319597, + 1978671277, + 1703948521, + 1703948569, + 609231113, + 609231627, + 609362730, + 619851562, + 1957828906, + 1957693754, + 1958005002, + 1974769930, + 2004126538, + 2116849562, + -165050438, + -152399430, + -156593221, + -156585304, + -693460312, + -689380696, + -700947796, + -700964124, + -163704092, + -163700700, + -161214427, + 2007237679, + 1973816334, + 1894131722, + 812001290, + 270994698, + 270800235, + 812922091, + 821298347, + 816058539, + 564425883, + 551867787, + 618956683, + 619093691, + 1977788075, + 2012391082, + 2012260090, + 1987097434, + -165637350, + -433871046, + -433936598, + -433674950, + -1486444753, + -1514749396, + -1246313940, + -1245949380, + -176397804, + -180592108, + -148037088, + -147967455, + -433848286, + -404486942, + -408664842, + -442055546, + 1979120774, + 1966501262, + 1949727119, + 1949400493, + 1970300077, + ]; + + // SAFETY: The array above is copied from the C++ version and just needs + // its contents casted to u32. + let (_, converted, _) = unsafe { DATA.align_to::() }; + let hash = simhash32(converted); + assert_eq!(1961926954, hash); + } +} +