[gegl] shadows-highlights-correction: use inlinable fabsf
- From: Øyvind "pippin" Kolås <ok src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gegl] shadows-highlights-correction: use inlinable fabsf
- Date: Wed, 13 May 2020 01:13:53 +0000 (UTC)
commit b3ff45e4a3c1698323f3b5265508330f96dd971c
Author: Øyvind Kolås <pippin gimp org>
Date: Wed May 13 03:13:06 2020 +0200
shadows-highlights-correction: use inlinable fabsf
operations/common-gpl3+/shadows-highlights-correction.c | 11 +++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)
---
diff --git a/operations/common-gpl3+/shadows-highlights-correction.c
b/operations/common-gpl3+/shadows-highlights-correction.c
index 78531ed89..5531476ea 100644
--- a/operations/common-gpl3+/shadows-highlights-correction.c
+++ b/operations/common-gpl3+/shadows-highlights-correction.c
@@ -74,6 +74,13 @@ prepare (GeglOperation *operation)
gegl_operation_set_format (operation, "output", cie_laba);
}
+static inline gfloat int_fabsf (const gfloat x)
+{
+ union {gfloat f; guint32 i;} u = {x};
+ u.i &= 0x7fffffff;
+ return u.f;
+}
+
static gboolean
process (GeglOperation *operation,
void *in_buf,
@@ -163,10 +170,10 @@ process (GeglOperation *operation,
gfloat la_inverted_abs;
gfloat lb = (tb0 - 0.5f) * highlights_sign_negated * SIGN(la_inverted) + 0.5f;
- la_abs = fabsf (la);
+ la_abs = int_fabsf (la);
lref = copysignf(la_abs > low_approximation ? 1.0f / la_abs : 1.0f / low_approximation, la);
- la_inverted_abs = fabsf (la_inverted);
+ la_inverted_abs = int_fabsf (la_inverted);
href = copysignf(la_inverted_abs > low_approximation ? 1.0f / la_inverted_abs : 1.0f /
low_approximation,
la_inverted);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]