[gegl] hue-chroma: simplify no chroma condition, and use fabsf



commit 52f883619a04a25ba24d90fbd6c8e2cb3235c2ea
Author: Øyvind Kolås <pippin gimp org>
Date:   Wed May 27 18:46:12 2020 +0200

    hue-chroma: simplify no chroma condition, and use fabsf

 operations/common/hue-chroma.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
---
diff --git a/operations/common/hue-chroma.c b/operations/common/hue-chroma.c
index f82b5b0f5..5080cfe1b 100644
--- a/operations/common/hue-chroma.c
+++ b/operations/common/hue-chroma.c
@@ -44,6 +44,7 @@ property_double (lightness, _("Lightness"), 0.0)
 #include "gegl-op.h"
 
 #define EPSILON     1e-6f
+#include <math.h>
 
 static void
 prepare (GeglOperation *operation)
@@ -79,19 +80,18 @@ process (GeglOperation       *op,
 
   while (n_pixels--)
     {
-      if ( ( abs(in_pixel[0]-in_pixel[1])>EPSILON)
-            && ( abs(in_pixel[1]-in_pixel[2])>EPSILON ) )
+      if ((fabsf(in_pixel[1])>EPSILON))
         {
           out_pixel[0] = in_pixel[0] + lightness;
           out_pixel[1] = in_pixel[1] + chroma;
           out_pixel[2] = in_pixel[2] + hue;
         }
       else 
-          {
+        {
           out_pixel[0] = in_pixel[0] + lightness;
           out_pixel[1] = in_pixel[1];
           out_pixel[2] = in_pixel[2];
-          }
+        }
 
       out_pixel[1] = CLAMP (out_pixel[1], 0, 300.0);
       out_pixel[3] = in_pixel[3];


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]