From 719784120de878d1992917db048718c633a0fe51 Mon Sep 17 00:00:00 2001 From: Juliapixel <89038897+Juliapixel@users.noreply.github.com> Date: Sun, 24 Dec 2023 20:23:32 -0300 Subject: [PATCH] fix wrong implementation of unsharpen filter (#2079) --- src/imageops/sample.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/imageops/sample.rs b/src/imageops/sample.rs index 26dfe1ea6d..4ba2392739 100644 --- a/src/imageops/sample.rs +++ b/src/imageops/sample.rs @@ -991,9 +991,9 @@ where let ic: i32 = NumCast::from(c).unwrap(); let id: i32 = NumCast::from(d).unwrap(); - let diff = (ic - id).abs(); + let diff = ic - id; - if diff > threshold { + if diff.abs() > threshold { let e = clamp(ic + diff, 0, max); // FIXME what does this do for f32? clamp 0-1 integers?? NumCast::from(e).unwrap()