[gegl] colors.cl: Fix clipping in RGBA float -> RaGaBaA float



commit 059646e6609cc3ff32c51ec0c29f033858381747
Author: Daniel Sabo <DanielSabo gmail com>
Date:   Sat Nov 2 15:55:22 2013 -0700

    colors.cl: Fix clipping in RGBA float -> RaGaBaA float

 opencl/colors.cl   |    4 ++--
 opencl/colors.cl.h |    4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)
---
diff --git a/opencl/colors.cl b/opencl/colors.cl
index 4c4edff..382cee9 100644
--- a/opencl/colors.cl
+++ b/opencl/colors.cl
@@ -318,8 +318,8 @@ __kernel void rgbu8_to_rgbaf (__global const uchar  * in,
   out_v.xyz = convert_float3(in_v) / 255.0f;
   out_v.w   = 1.0f;
 #else
-  uchar4 in_v = (uchar4) (in[3 * gid], in[3 * gid + 1], in[3 * gid + 2], 255);
-  float4 out_v = convert_float4 (in_v) / 255.0f;
+  float4 in_v = (float4) (in[3 * gid], in[3 * gid + 1], in[3 * gid + 2], 255.0f);
+  float4 out_v = in_v / (float4) (255.0f);
 #endif
   out[gid]  = out_v;
 }
diff --git a/opencl/colors.cl.h b/opencl/colors.cl.h
index 6bc293a..1acbbc6 100644
--- a/opencl/colors.cl.h
+++ b/opencl/colors.cl.h
@@ -319,8 +319,8 @@ static const char* colors_cl_source =
 "  out_v.xyz = convert_float3(in_v) / 255.0f;                                  \n"
 "  out_v.w   = 1.0f;                                                           \n"
 "#else                                                                         \n"
-"  uchar4 in_v = (uchar4) (in[3 * gid], in[3 * gid + 1], in[3 * gid + 2], 255);\n"
-"  float4 out_v = convert_float4 (in_v) / 255.0f;                              \n"
+"  float4 in_v = (float4) (in[3 * gid], in[3 * gid + 1], in[3 * gid + 2], 255.0f);\n"
+"  float4 out_v = in_v / (float4) (255.0f);                                    \n"
 "#endif                                                                        \n"
 "  out[gid]  = out_v;                                                          \n"
 "}                                                                             \n"


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