RSS/Atom feed Twitter
Site is read-only, email is disabled

[PATCH 1/1] red-eye-removal: Use f suffix for float constants

This discussion is connected to the gegl-developer-list.gnome.org mailing list which is provided by the GIMP developers and not related to gimpusers.com.

This is a read-only list on gimpusers.com so this discussion thread is read-only, too.

1 of 1 message available
Toggle history

Please log in to manage your subscriptions.

[PATCH 1/1] red-eye-removal: Use f suffix for float constants Jan Vesely 20 Apr 21:31
Jan Vesely
2014-04-20 21:31:31 UTC (about 10 years ago)

[PATCH 1/1] red-eye-removal: Use f suffix for float constants

Signed-off-by: Jan Vesely
---
opencl/red-eye-removal.cl | 8 ++++---- opencl/red-eye-removal.cl.h | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/opencl/red-eye-removal.cl b/opencl/red-eye-removal.cl index 3de51d5..537666b 100644
--- a/opencl/red-eye-removal.cl
+++ b/opencl/red-eye-removal.cl
@@ -16,9 +16,9 @@
* Copyright 2013 Carlos Zubieta
*/

-#define RED_FACTOR 0.5133333
+#define RED_FACTOR 0.5133333f
#define GREEN_FACTOR 1
-#define BLUE_FACTOR 0.1933333
+#define BLUE_FACTOR 0.1933333f

__kernel void cl_red_eye_removal(__global const float4 *in, __global float4 *out, @@ -29,13 +29,13 @@ __kernel void cl_red_eye_removal(__global const float4 *in, float adjusted_red = in_v.x * RED_FACTOR; float adjusted_green = in_v.y * GREEN_FACTOR; float adjusted_blue = in_v.z * BLUE_FACTOR; - float adjusted_threshold = (threshold - 0.4) * 2; + float adjusted_threshold = (threshold - 0.4f) * 2; float tmp;

if (adjusted_red >= adjusted_green - adjusted_threshold && adjusted_red >= adjusted_blue - adjusted_threshold) {
- tmp = (adjusted_green + adjusted_blue) / (2.0 * RED_FACTOR); + tmp = (adjusted_green + adjusted_blue) / (2.0f * RED_FACTOR); in_v.x = clamp(tmp, 0.0f, 1.0f); }
out[gid] = in_v;
diff --git a/opencl/red-eye-removal.cl.h b/opencl/red-eye-removal.cl.h index 0c517b5..66eeeed 100644
--- a/opencl/red-eye-removal.cl.h
+++ b/opencl/red-eye-removal.cl.h
@@ -17,9 +17,9 @@ static const char* red_eye_removal_cl_source = " * Copyright 2013 Carlos Zubieta \n" " */ \n" " \n" -"#define RED_FACTOR 0.5133333 \n" +"#define RED_FACTOR 0.5133333f \n" "#define GREEN_FACTOR 1 \n" -"#define BLUE_FACTOR 0.1933333 \n" +"#define BLUE_FACTOR 0.1933333f \n" " \n" "__kernel void cl_red_eye_removal(__global const float4 *in, \n" " __global float4 *out, \n" @@ -30,13 +30,13 @@ static const char* red_eye_removal_cl_source = " float adjusted_red = in_v.x * RED_FACTOR; \n" " float adjusted_green = in_v.y * GREEN_FACTOR; \n" " float adjusted_blue = in_v.z * BLUE_FACTOR; \n" -" float adjusted_threshold = (threshold - 0.4) * 2; \n" +" float adjusted_threshold = (threshold - 0.4f) * 2; \n" " float tmp; \n" " \n" " if (adjusted_red >= adjusted_green - adjusted_threshold && \n" " adjusted_red >= adjusted_blue - adjusted_threshold) \n" " { \n" -" tmp = (adjusted_green + adjusted_blue) / (2.0 * RED_FACTOR); \n" +" tmp = (adjusted_green + adjusted_blue) / (2.0f * RED_FACTOR); \n" " in_v.x = clamp(tmp, 0.0f, 1.0f); \n" " } \n" " out[gid] = in_v; \n"

1.9.0