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);
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 ////////////////////////
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);
}
}