[gegl] shadows-highlights-correction: Stick to single precision floating point



commit a2642bb90088756309c45e9ec45e485939d630cc
Author: Debarshi Ray <debarshir gnome org>
Date:   Tue Dec 19 08:40:42 2017 +0100

    shadows-highlights-correction: Stick to single precision floating point
    
    This is the OpenCL counterpart of commit 1abfd710baa02808.
    
    Note that copysignf and fabsf lead to run-time OpenCL compilation
    errors, so those are not used in the GPU code.

 .../workshop/shadows-highlights-correction.c       |   12 ++++++------
 1 files changed, 6 insertions(+), 6 deletions(-)
---
diff --git a/operations/workshop/shadows-highlights-correction.c 
b/operations/workshop/shadows-highlights-correction.c
index 9bcf96a..39e7f74 100644
--- a/operations/workshop/shadows-highlights-correction.c
+++ b/operations/workshop/shadows-highlights-correction.c
@@ -240,15 +240,15 @@ cl_process (GeglOperation       *op,
 
   cl_int cl_err = 0;
 
-  gfloat shadows    = 2.f * fminf (fmaxf (-1.0, (o->shadows / 100.f)), 1.f);
-  gfloat highlights = 2.f * fminf (fmaxf (-1.0, (o->highlights / 100.f)), 1.f);
-  gfloat whitepoint = fmaxf (1.f - o->whitepoint / 100.f, 0.01f);
-  gfloat compress   = fminf (fmaxf (0, (o->compress / 100.f)), 0.99f);
+  gfloat shadows    = 2.f * fminf (fmaxf (-1.0f, ((gfloat) o->shadows / 100.f)), 1.f);
+  gfloat highlights = 2.f * fminf (fmaxf (-1.0f, ((gfloat) o->highlights / 100.f)), 1.f);
+  gfloat whitepoint = fmaxf (1.f - (gfloat) o->whitepoint / 100.f, 0.01f);
+  gfloat compress   = fminf (fmaxf (0.0f, ((gfloat) o->compress / 100.f)), 0.99f);
 
-  gfloat shadows_ccorrect = (fminf (fmaxf (0.0f, (o->shadows_ccorrect / 100.f)), 1.f) - 0.5f)
+  gfloat shadows_ccorrect = (fminf (fmaxf (0.0f, ((gfloat) o->shadows_ccorrect / 100.f)), 1.f) - 0.5f)
                              * SIGN(shadows) + 0.5f;
 
-  gfloat highlights_ccorrect = (fminf (fmaxf (0.0f, (o->highlights_ccorrect / 100.f)), 1.f) - 0.5f)
+  gfloat highlights_ccorrect = (fminf (fmaxf (0.0f, ((gfloat) o->highlights_ccorrect / 100.f)), 1.f) - 0.5f)
                                 * SIGN(-highlights) + 0.5f;
 
   if (!cl_data)


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