From 488e6aafaf89efe0fcd46d04ad490e488c15b11d Mon Sep 17 00:00:00 2001 From: Ilya Lavrenov Date: Wed, 9 Oct 2013 14:07:24 +0400 Subject: [PATCH 1/2] fixed the PR 1582 --- modules/ocl/src/opencl/arithm_add_scalar.cl | 2 +- modules/ocl/test/test_arithm.cpp | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/modules/ocl/src/opencl/arithm_add_scalar.cl b/modules/ocl/src/opencl/arithm_add_scalar.cl index f908b89f5a..671bd1295a 100644 --- a/modules/ocl/src/opencl/arithm_add_scalar.cl +++ b/modules/ocl/src/opencl/arithm_add_scalar.cl @@ -70,7 +70,7 @@ #if defined (FUNC_ABS) #define EXPRESSION \ - T value = (src1[src1_index] > 0) ? src1[src1_index] : -src1[src1_index]; \ + T value = src1[src1_index] > (T)(0) ? src1[src1_index] : -src1[src1_index]; \ dst[dst_index] = value; #endif diff --git a/modules/ocl/test/test_arithm.cpp b/modules/ocl/test/test_arithm.cpp index db05f45565..6eb513fa79 100644 --- a/modules/ocl/test/test_arithm.cpp +++ b/modules/ocl/test/test_arithm.cpp @@ -462,7 +462,7 @@ TEST_P(Min, Mat) random_roi(); dst1_roi = cv::min(src1_roi, src2_roi); - cv::ocl::min(gsrc1, gsrc2, gdst1); + cv::ocl::min(gsrc1_roi, gsrc2_roi, gdst1_roi); Near(0); } } @@ -476,7 +476,7 @@ TEST_P(Max, Mat) random_roi(); dst1_roi = cv::min(src1_roi, src2_roi); - cv::ocl::min(gsrc1, gsrc2, gdst1); + cv::ocl::min(gsrc1_roi, gsrc2_roi, gdst1_roi); Near(0); } } @@ -492,7 +492,7 @@ TEST_P(Abs, Abs) random_roi(); dst1_roi = cv::abs(src1_roi); - cv::ocl::abs(gsrc1, gdst1); + cv::ocl::abs(gsrc1_roi, gdst1_roi); Near(0); } } From fccd37de7e05e9d4c824c9ea1ce0f1e733e49f5f Mon Sep 17 00:00:00 2001 From: Ilya Lavrenov Date: Wed, 9 Oct 2013 14:18:07 +0400 Subject: [PATCH 2/2] changes eps for NORM_L1 --- modules/ocl/test/test_arithm.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/ocl/test/test_arithm.cpp b/modules/ocl/test/test_arithm.cpp index 6eb513fa79..a5d4e08db4 100644 --- a/modules/ocl/test/test_arithm.cpp +++ b/modules/ocl/test/test_arithm.cpp @@ -1466,7 +1466,7 @@ TEST_P(Norm, NORM_L1) const double cpuRes = cv::norm(src1_roi, src2_roi, type); const double gpuRes = cv::ocl::norm(gsrc1_roi, gsrc2_roi, type); - EXPECT_NEAR(cpuRes, gpuRes, 0.1); + EXPECT_NEAR(cpuRes, gpuRes, 0.2); } }