From b8e08d5d3c033cc630e00f4a532d50c87b074026 Mon Sep 17 00:00:00 2001 From: Alexander Alekhin Date: Tue, 9 Aug 2016 12:48:06 +0300 Subject: [PATCH] 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)) --- modules/imgproc/src/opencl/canny.cl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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] = { -- 2.7.4