From: Zhigang Gong Date: Wed, 12 Feb 2014 03:23:27 +0000 (+0800) Subject: Workaround a LLVM/Clang 3.3 bug. X-Git-Tag: accepted/tizen/6.0/unified/20201030.111113~1314^2~610^2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=9aef26e2ad05dea8a5203e01a2de148ba86cfdf2;p=platform%2Fupstream%2Fopencv.git Workaround a LLVM/Clang 3.3 bug. The LLVM/Clang 3.3 has a bug when compile a cl kernel with assignment of a scalar to a vector data type. This patch could work around this bug. Signed-off-by: Zhigang Gong --- diff --git a/modules/ocl/src/opencl/arithm_pow.cl b/modules/ocl/src/opencl/arithm_pow.cl index 385e4cc..fe24553 100644 --- a/modules/ocl/src/opencl/arithm_pow.cl +++ b/modules/ocl/src/opencl/arithm_pow.cl @@ -66,7 +66,7 @@ __kernel void arithm_pow(__global VT * src, int src_step, int src_offset, int dst_index = mad24(y, dst_step, x + dst_offset); VT src_data = src[src_index]; - VT tmp = src_data > 0 ? exp(p * log(src_data)) : (src_data == 0 ? 0 : exp(p * log(fabs(src_data)))); + VT tmp = src_data > (VT)0 ? (VT)exp(p * log(src_data)) : (src_data == (VT)0 ? (VT)0 : (VT)exp(p * log(fabs(src_data)))); dst[dst_index] = tmp; } diff --git a/modules/ocl/src/opencl/imgproc_resize.cl b/modules/ocl/src/opencl/imgproc_resize.cl index ebf8c71..100d687 100644 --- a/modules/ocl/src/opencl/imgproc_resize.cl +++ b/modules/ocl/src/opencl/imgproc_resize.cl @@ -83,10 +83,10 @@ __kernel void resizeLN_C1_D0(__global uchar * dst, __global uchar const * restri int y = floor(sy); float v = sy - y; - u = x < 0 ? 0 : u; - u = (x >= src_cols) ? 0 : u; - x = x < 0 ? 0 : x; - x = (x >= src_cols) ? src_cols-1 : x; + u = x < (int4)0 ? (float4)0 : u; + u = (x >= (int4)src_cols) ? (float4)0 : u; + x = x < (int4)0 ? (int4)0 : x; + x = (x >= (int4)src_cols) ? (int4)(src_cols-1) : x; y<0 ? y=0,v=0 : y; y>=src_rows ? y=src_rows-1,v=0 : y;