From: Alexander Alekhin Date: Tue, 9 Aug 2016 09:48:06 +0000 (+0300) Subject: ocl: fix Canny for Intel devices X-Git-Tag: accepted/tizen/6.0/unified/20201030.111113~1675^2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=b8e08d5d3c033cc630e00f4a532d50c87b074026;p=platform%2Fupstream%2Fopencv.git ocl: fix Canny for Intel devices There is an issue with processing of abs(short) function for negative argument. Affected OpenCL devices: - iGPU: Intel(R) HD Graphics 520 (OpenCL 2.0 ) - CPU: Intel(R) Core(TM) i5-6300U CPU @ 2.40GHz (OpenCL 2.0 (Build 10094)) --- diff --git a/modules/imgproc/src/opencl/canny.cl b/modules/imgproc/src/opencl/canny.cl index 584cf9e..1388504 100644 --- a/modules/imgproc/src/opencl/canny.cl +++ b/modules/imgproc/src/opencl/canny.cl @@ -260,7 +260,7 @@ __kernel void stage1_with_sobel(__global const uchar *src, int src_step, int src #ifdef L2GRAD #define dist(x, y) ((int)(x) * (x) + (int)(y) * (y)) #else -#define dist(x, y) (abs(x) + abs(y)) +#define dist(x, y) (abs((int)(x)) + abs((int)(y))) #endif __constant int prev[4][2] = {