Commit bd9f98e2 authored by Jan Vesely's avatar Jan Vesely Committed by Daniel Sabo

red-eye-removal: Use f suffix for float constants

parent 1fb0a80f
...@@ -16,9 +16,9 @@ ...@@ -16,9 +16,9 @@
* Copyright 2013 Carlos Zubieta <czubieta.dev@gmail.com> * Copyright 2013 Carlos Zubieta <czubieta.dev@gmail.com>
*/ */
#define RED_FACTOR 0.5133333 #define RED_FACTOR 0.5133333f
#define GREEN_FACTOR 1 #define GREEN_FACTOR 1
#define BLUE_FACTOR 0.1933333 #define BLUE_FACTOR 0.1933333f
__kernel void cl_red_eye_removal(__global const float4 *in, __kernel void cl_red_eye_removal(__global const float4 *in,
__global float4 *out, __global float4 *out,
...@@ -29,13 +29,13 @@ __kernel void cl_red_eye_removal(__global const float4 *in, ...@@ -29,13 +29,13 @@ __kernel void cl_red_eye_removal(__global const float4 *in,
float adjusted_red = in_v.x * RED_FACTOR; float adjusted_red = in_v.x * RED_FACTOR;
float adjusted_green = in_v.y * GREEN_FACTOR; float adjusted_green = in_v.y * GREEN_FACTOR;
float adjusted_blue = in_v.z * BLUE_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; float tmp;
if (adjusted_red >= adjusted_green - adjusted_threshold && if (adjusted_red >= adjusted_green - adjusted_threshold &&
adjusted_red >= adjusted_blue - 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); in_v.x = clamp(tmp, 0.0f, 1.0f);
} }
out[gid] = in_v; out[gid] = in_v;
......
...@@ -17,9 +17,9 @@ static const char* red_eye_removal_cl_source = ...@@ -17,9 +17,9 @@ static const char* red_eye_removal_cl_source =
" * Copyright 2013 Carlos Zubieta <czubieta.dev@gmail.com> \n" " * Copyright 2013 Carlos Zubieta <czubieta.dev@gmail.com> \n"
" */ \n" " */ \n"
" \n" " \n"
"#define RED_FACTOR 0.5133333 \n" "#define RED_FACTOR 0.5133333f \n"
"#define GREEN_FACTOR 1 \n" "#define GREEN_FACTOR 1 \n"
"#define BLUE_FACTOR 0.1933333 \n" "#define BLUE_FACTOR 0.1933333f \n"
" \n" " \n"
"__kernel void cl_red_eye_removal(__global const float4 *in, \n" "__kernel void cl_red_eye_removal(__global const float4 *in, \n"
" __global float4 *out, \n" " __global float4 *out, \n"
...@@ -30,13 +30,13 @@ static const char* red_eye_removal_cl_source = ...@@ -30,13 +30,13 @@ static const char* red_eye_removal_cl_source =
" float adjusted_red = in_v.x * RED_FACTOR; \n" " float adjusted_red = in_v.x * RED_FACTOR; \n"
" float adjusted_green = in_v.y * GREEN_FACTOR; \n" " float adjusted_green = in_v.y * GREEN_FACTOR; \n"
" float adjusted_blue = in_v.z * BLUE_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" " float tmp; \n"
" \n" " \n"
" if (adjusted_red >= adjusted_green - adjusted_threshold && \n" " if (adjusted_red >= adjusted_green - adjusted_threshold && \n"
" adjusted_red >= adjusted_blue - adjusted_threshold) \n" " adjusted_red >= adjusted_blue - adjusted_threshold) \n"
" { \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" " in_v.x = clamp(tmp, 0.0f, 1.0f); \n"
" } \n" " } \n"
" out[gid] = in_v; \n" " out[gid] = in_v; \n"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment