1
0
mirror of https://github.com/opencv/opencv.git synced 2026-07-30 15:53:03 +04:00

Merge pull request #16608 from vpisarev:fix_mac_ocl_tests

* fixed several problems when running tests on Mac:
* OCL_pyrUp
* OCL_flip
* some basic UMat tests
* histogram badarg test (out of range access)

* retained the storepix fix in ocl_flip only for 16U/16S datatype, where the OpenCL compiler on Mac generates incorrect code

* moved deletion of ACCESS_FAST flag to non-SVM branch (where SVM is shared virtual memory (in OpenCL 2.x), not support vector machine)

* force OpenCL to use read/write for GPU<=>CPU memory transfers on machines with discrete video only on Macs. On Windows/Linux the drivers are seemingly smart enough to implement map/unmap properly (and maybe more efficiently than explicit read/write)
This commit is contained in:
Vadim Pisarevsky
2020-02-21 16:13:41 +03:00
committed by GitHub
parent 150c29356a
commit 07b475062f
5 changed files with 41 additions and 25 deletions
+9 -14
View File
@@ -1078,7 +1078,7 @@ static bool ocl_pyrUp( InputArray _src, OutputArray _dst, const Size& _dsz, int
UMat dst = _dst.getUMat();
int float_depth = depth == CV_64F ? CV_64F : CV_32F;
const int local_size = 16;
const int local_size = channels == 1 ? 16 : 8;
char cvt[2][50];
String buildOptions = format(
"-D T=%s -D FT=%s -D convertToT=%s -D convertToFT=%s%s "
@@ -1092,22 +1092,17 @@ static bool ocl_pyrUp( InputArray _src, OutputArray _dst, const Size& _dsz, int
size_t globalThreads[2] = { (size_t)dst.cols, (size_t)dst.rows };
size_t localThreads[2] = { (size_t)local_size, (size_t)local_size };
ocl::Kernel k;
if (ocl::Device::getDefault().isIntel() && channels == 1)
if (type == CV_8UC1 && src.cols % 2 == 0)
{
if (type == CV_8UC1 && src.cols % 2 == 0)
{
buildOptions.clear();
k.create("pyrUp_cols2", ocl::imgproc::pyramid_up_oclsrc, buildOptions);
globalThreads[0] = dst.cols/4; globalThreads[1] = dst.rows/2;
}
else
{
k.create("pyrUp_unrolled", ocl::imgproc::pyr_up_oclsrc, buildOptions);
globalThreads[0] = dst.cols/2; globalThreads[1] = dst.rows/2;
}
buildOptions.clear();
k.create("pyrUp_cols2", ocl::imgproc::pyramid_up_oclsrc, buildOptions);
globalThreads[0] = dst.cols/4; globalThreads[1] = dst.rows/2;
}
else
k.create("pyrUp", ocl::imgproc::pyr_up_oclsrc, buildOptions);
{
k.create("pyrUp_unrolled", ocl::imgproc::pyr_up_oclsrc, buildOptions);
globalThreads[0] = dst.cols/2; globalThreads[1] = dst.rows/2;
}
if (k.empty())
return false;