Merge pull request #19810 from aarongreig:aaron/core/relaxClArithmTest

This commit is contained in:
Alexander Alekhin 2021-04-06 19:56:45 +00:00
commit 3a8154051f
3 changed files with 22 additions and 5 deletions

View File

@ -678,7 +678,12 @@ OCL_PERF_TEST_P(SqrtFixture, Sqrt, ::testing::Combine(
OCL_TEST_CYCLE() cv::sqrt(src, dst);
if (CV_MAT_DEPTH(type) >= CV_32F)
// To square root 32 bit floats we use native_sqrt, which has implementation
// defined accuracy. We know intel devices have accurate native_sqrt, but
// otherwise stick to a relaxed sanity check. For types larger than 32 bits
// we can do the accuracy check for all devices as normal.
if (CV_MAT_DEPTH(type) > CV_32F || !ocl::useOpenCL() ||
ocl::Device::getDefault().isIntel())
SANITY_CHECK(dst, 1e-5, ERROR_RELATIVE);
else
SANITY_CHECK(dst, 1);

View File

@ -166,7 +166,17 @@ OCL_PERF_TEST_P(CornerMinEigenValFixture, CornerMinEigenVal,
OCL_TEST_CYCLE() cv::cornerMinEigenVal(src, dst, blockSize, apertureSize, borderType);
SANITY_CHECK(dst, 1e-6, ERROR_RELATIVE);
#ifdef HAVE_OPENCL
bool strictCheck = !ocl::useOpenCL() || ocl::Device::getDefault().isIntel();
#else
bool strictCheck = true;
#endif
// using native_* OpenCL functions on non-intel devices may lose accuracy
if (strictCheck)
SANITY_CHECK(dst, 1e-6, ERROR_RELATIVE);
else
SANITY_CHECK(dst, 0.1, ERROR_RELATIVE);
}
///////////// CornerHarris ////////////////////////

View File

@ -234,10 +234,12 @@ OCL_TEST_P(CornerMinEigenVal, Mat)
OCL_OFF(cv::cornerMinEigenVal(src_roi, dst_roi, blockSize, apertureSize, borderType));
OCL_ON(cv::cornerMinEigenVal(usrc_roi, udst_roi, blockSize, apertureSize, borderType));
if (ocl::Device::getDefault().isIntel())
Near(1e-5, true);
// The corner kernel uses native_sqrt() which has implementation defined accuracy.
// If we're using a CL implementation that isn't intel, test with relaxed accuracy.
if (!ocl::useOpenCL() || ocl::Device::getDefault().isIntel())
Near(1e-5, true);
else
Near(0.1, true); // using native_* OpenCL functions may lose accuracy
Near(0.1, true);
}
}