diff --git a/modules/core/perf/opencl/perf_arithm.cpp b/modules/core/perf/opencl/perf_arithm.cpp index 7e0e00edc4..1fb9265488 100644 --- a/modules/core/perf/opencl/perf_arithm.cpp +++ b/modules/core/perf/opencl/perf_arithm.cpp @@ -701,6 +701,36 @@ OCL_PERF_TEST_P(MeanStdDevFixture, MeanStdDev, SANITY_CHECK(stddev3, eps, ERROR_RELATIVE); } +OCL_PERF_TEST_P(MeanStdDevFixture, MeanStdDevWithMask, + ::testing::Combine(OCL_PERF_ENUM(OCL_SIZE_1, OCL_SIZE_2, OCL_SIZE_3), + OCL_TEST_TYPES_134)) +{ + const Size_MatType_t params = GetParam(); + const Size srcSize = get<0>(params); + const int type = get<1>(params); + const double eps = 2e-5; + + checkDeviceMaxMemoryAllocSize(srcSize, type); + + UMat src(srcSize, type), mask(srcSize, CV_8UC1); + Scalar mean, stddev; + declare.in(src, mask, WARMUP_RNG); + + OCL_TEST_CYCLE() cv::meanStdDev(src, mean, stddev, mask); + + double mean0 = mean[0], mean1 = mean[1], mean2 = mean[2], mean3 = mean[3]; + double stddev0 = stddev[0], stddev1 = stddev[1], stddev2 = stddev[2], stddev3 = stddev[3]; + + SANITY_CHECK(mean0, eps, ERROR_RELATIVE); + SANITY_CHECK(mean1, eps, ERROR_RELATIVE); + SANITY_CHECK(mean2, eps, ERROR_RELATIVE); + SANITY_CHECK(mean3, eps, ERROR_RELATIVE); + SANITY_CHECK(stddev0, eps, ERROR_RELATIVE); + SANITY_CHECK(stddev1, eps, ERROR_RELATIVE); + SANITY_CHECK(stddev2, eps, ERROR_RELATIVE); + SANITY_CHECK(stddev3, eps, ERROR_RELATIVE); +} + ///////////// Norm //////////////////////// CV_ENUM(NormType, NORM_INF, NORM_L1, NORM_L2) @@ -728,6 +758,26 @@ OCL_PERF_TEST_P(NormFixture, Norm, SANITY_CHECK(res, 1e-5, ERROR_RELATIVE); } +OCL_PERF_TEST_P(NormFixture, NormRel, + ::testing::Combine(OCL_PERF_ENUM(OCL_SIZE_1, OCL_SIZE_2, OCL_SIZE_3), + OCL_TEST_TYPES_134, NormType::all())) +{ + const NormParams params = GetParam(); + const Size srcSize = get<0>(params); + const int type = get<1>(params); + const int normType = get<2>(params); + + checkDeviceMaxMemoryAllocSize(srcSize, type); + + UMat src1(srcSize, type), src2(srcSize, type); + double res; + declare.in(src1, src2, WARMUP_RNG); + + OCL_TEST_CYCLE() res = cv::norm(src1, src2, normType | cv::NORM_RELATIVE); + + SANITY_CHECK(res, 1e-5, ERROR_RELATIVE); +} + ///////////// UMat::dot //////////////////////// typedef Size_MatType UMatDotFixture; diff --git a/modules/core/src/ocl.cpp b/modules/core/src/ocl.cpp index 672b9cb035..9d6a1b549f 100644 --- a/modules/core/src/ocl.cpp +++ b/modules/core/src/ocl.cpp @@ -4427,6 +4427,12 @@ int predictOptimalVectorWidth(InputArray src1, InputArray src2, InputArray src3, d.preferredVectorWidthShort(), d.preferredVectorWidthShort(), d.preferredVectorWidthInt(), d.preferredVectorWidthFloat(), d.preferredVectorWidthDouble(), -1 }, width = vectorWidths[depth]; + if (d.isIntel()) + { + // it's heuristic + int vectorWidthsIntel[] = { 16, 16, 8, 8, 1, 1, 1, -1 }; + width = vectorWidthsIntel[depth]; + } if (ssize.width * cn < width || width <= 0) return 1;