From 973137c78e4b7af159b7540fb03d23dc7d5e98df Mon Sep 17 00:00:00 2001 From: konstantin Date: Mon, 28 Oct 2013 00:14:07 +0400 Subject: [PATCH] fix bugs on host and device sides for imgprog_sobel3.cl --- modules/ocl/src/imgproc.cpp | 6 +++++- modules/ocl/src/opencl/imgproc_sobel3.cl | 8 ++++---- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/modules/ocl/src/imgproc.cpp b/modules/ocl/src/imgproc.cpp index f550ea5295..31405ac96b 100644 --- a/modules/ocl/src/imgproc.cpp +++ b/modules/ocl/src/imgproc.cpp @@ -908,7 +908,11 @@ namespace cv Context* clCxt = Context::getContext(); if(clCxt->supportsFeature(FEATURE_CL_INTEL_DEVICE) && src.type() == CV_8UC1 && src.cols % 8 == 0 && src.rows % 8 == 0 && - ksize==3) + ksize==3 && + (borderType ==cv::BORDER_REFLECT || + borderType == cv::BORDER_REPLICATE || + borderType ==cv::BORDER_REFLECT101 || + borderType ==cv::BORDER_WRAP)) { Dx.create(src.size(), CV_32FC1); Dy.create(src.size(), CV_32FC1); diff --git a/modules/ocl/src/opencl/imgproc_sobel3.cl b/modules/ocl/src/opencl/imgproc_sobel3.cl index 0b27402a57..d6a995f552 100644 --- a/modules/ocl/src/opencl/imgproc_sobel3.cl +++ b/modules/ocl/src/opencl/imgproc_sobel3.cl @@ -55,11 +55,11 @@ __kernel void sobel3( lsmem[liy+1][lix+1] = convert_float(Src[ id_y * srcStride + id_x ]); - int id_y_h = ADDR_H(id_y-1, 0); - int id_y_b = ADDR_B(id_y+1, height); + int id_y_h = ADDR_H(id_y-1, 0,height); + int id_y_b = ADDR_B(id_y+1, height,id_y+1); - int id_x_l = ADDR_L(id_x-1, 0); - int id_x_r = ADDR_R(id_x+1, width); + int id_x_l = ADDR_L(id_x-1, 0,width); + int id_x_r = ADDR_R(id_x+1, width,id_x+1); if(liy==0) {