From 43c48e2ed153579744fd768c97664db760c6c135 Mon Sep 17 00:00:00 2001 From: Alexander Alekhin Date: Wed, 19 Oct 2016 14:56:29 +0300 Subject: [PATCH] test: update Div and ConvertScaleAbs perf tests --- modules/core/perf/opencl/perf_arithm.cpp | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/modules/core/perf/opencl/perf_arithm.cpp b/modules/core/perf/opencl/perf_arithm.cpp index 9cb5ac9821..d596605b50 100644 --- a/modules/core/perf/opencl/perf_arithm.cpp +++ b/modules/core/perf/opencl/perf_arithm.cpp @@ -193,9 +193,21 @@ OCL_PERF_TEST_P(DivFixture, Divide, UMat src1(srcSize, type), src2(srcSize, type), dst(srcSize, type); declare.in(src1, src2, WARMUP_RNG).out(dst); + // remove zeros from src2 + { + Mat m2 = src2.getMat(ACCESS_RW); + Mat zero_mask = m2 == 0; + Mat fix; + zero_mask.convertTo(fix, type); // 0 or 255 + cv::add(m2, fix, m2); + } + OCL_TEST_CYCLE() cv::divide(src1, src2, dst); - SANITY_CHECK(dst, 1e-6, ERROR_RELATIVE); + if (CV_MAT_DEPTH(type) >= CV_32F) + SANITY_CHECK(dst, 1e-6, ERROR_RELATIVE); + else + SANITY_CHECK(dst, 1); } ///////////// Absdiff //////////////////////// @@ -983,7 +995,7 @@ OCL_PERF_TEST_P(ConvertScaleAbsFixture, ConvertScaleAbs, OCL_TEST_CYCLE() cv::convertScaleAbs(src, dst, 0.5, 2); - SANITY_CHECK(dst); + SANITY_CHECK(dst, 1); // CV_8U } ///////////// PatchNaNs ////////////////////////