1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
//! Always-compiled scalar reference implementation.
//!
//! Iterates the SoA arrays in lockstep, computing
//! `(query - entry).abs²` summed across the three channels and
//! tracking the running min. Used by the dispatcher when no SIMD
//! backend is reachable on the current target, and by every parity
//! test as the bit-identical baseline.
use ;
/// Squared Delta E 76 (squared Euclidean distance in LAB) between two
/// LAB triples. Matches [`nearest_idx`]'s inline metric associativity
/// (`(dl*dl + da*da) + db*db`), so independently-evaluated distances
/// are bit-equal to those computed inside the scan loop. Standalone
/// form is the reference shape used by metric-level property tests
/// (`prop_de76_self_distance_zero`, `prop_de76_symmetric`,
/// `prop_de76_nonneg` in `colorthief-dataset/tests/properties.rs`).
/// Reference implementation. On targets where the dispatcher selects
/// a SIMD backend in production builds (e.g. aarch64 NEON), this
/// function is only called from parity tests and the bench harness;
/// the `#[allow(dead_code)]` keeps clippy quiet about that — keeping
/// the scalar reference alive is the whole point.