diff --git a/modules/imgproc/perf/opencl/perf_imgproc.cpp b/modules/imgproc/perf/opencl/perf_imgproc.cpp index 8d4b5c2cd3..7e5a817da5 100644 --- a/modules/imgproc/perf/opencl/perf_imgproc.cpp +++ b/modules/imgproc/perf/opencl/perf_imgproc.cpp @@ -61,6 +61,8 @@ OCL_PERF_TEST_P(EqualizeHistFixture, EqualizeHist, OCL_TEST_SIZES) const Size srcSize = GetParam(); const double eps = 1; + checkDeviceMaxMemoryAllocSize(srcSize, CV_8UC1); + UMat src(srcSize, CV_8UC1), dst(srcSize, CV_8UC1); declare.in(src, WARMUP_RNG).out(dst); @@ -69,6 +71,30 @@ OCL_PERF_TEST_P(EqualizeHistFixture, EqualizeHist, OCL_TEST_SIZES) SANITY_CHECK(dst, eps); } +///////////// calcHist //////////////////////// + +typedef TestBaseWithParam CalcHistFixture; + +OCL_PERF_TEST_P(CalcHistFixture, CalcHist, OCL_TEST_SIZES) +{ + const Size srcSize = GetParam(); + + const std::vector channels(1, 0); + std::vector ranges(2); + std::vector histSize(1, 256); + ranges[0] = 0; + ranges[1] = 256; + + checkDeviceMaxMemoryAllocSize(srcSize, CV_8UC1); + + UMat src(srcSize, CV_8UC1), hist(256, 1, CV_32FC1); + declare.in(src, WARMUP_RNG).out(hist); + + OCL_TEST_CYCLE() cv::calcHist(std::vector(1, src), channels, noArray(), hist, histSize, ranges, false); + + SANITY_CHECK(hist); +} + /////////// CopyMakeBorder ////////////////////// CV_ENUM(Border, BORDER_CONSTANT, BORDER_REPLICATE, BORDER_REFLECT, BORDER_WRAP, BORDER_REFLECT_101) @@ -83,6 +109,8 @@ OCL_PERF_TEST_P(CopyMakeBorderFixture, CopyMakeBorder, const Size srcSize = get<0>(params); const int type = get<1>(params), borderType = get<2>(params); + checkDeviceMaxMemoryAllocSize(srcSize, type); + UMat src(srcSize, type), dst; const Size dstSize = srcSize + Size(12, 12); dst.create(dstSize, type); @@ -105,6 +133,8 @@ OCL_PERF_TEST_P(CornerMinEigenValFixture, CornerMinEigenVal, const int type = get<1>(params), borderType = BORDER_REFLECT; const int blockSize = 7, apertureSize = 1 + 2 * 3; + checkDeviceMaxMemoryAllocSize(srcSize, type); + UMat src(srcSize, type), dst(srcSize, CV_32FC1); declare.in(src, WARMUP_RNG).out(dst); @@ -124,6 +154,8 @@ OCL_PERF_TEST_P(CornerHarrisFixture, CornerHarris, const Size srcSize = get<0>(params); const int type = get<1>(params), borderType = BORDER_REFLECT; + checkDeviceMaxMemoryAllocSize(srcSize, type); + UMat src(srcSize, type), dst(srcSize, CV_32FC1); declare.in(src, WARMUP_RNG).out(dst); @@ -143,6 +175,8 @@ OCL_PERF_TEST_P(PreCornerDetectFixture, PreCornerDetect, const Size srcSize = get<0>(params); const int type = get<1>(params), borderType = BORDER_REFLECT; + checkDeviceMaxMemoryAllocSize(srcSize, type); + UMat src(srcSize, type), dst(srcSize, CV_32FC1); declare.in(src, WARMUP_RNG).out(dst); @@ -162,6 +196,8 @@ OCL_PERF_TEST_P(IntegralFixture, Integral1, ::testing::Combine(OCL_TEST_SIZES, O const Size srcSize = get<0>(params); const int ddepth = get<1>(params); + checkDeviceMaxMemoryAllocSize(srcSize, ddepth); + UMat src(srcSize, CV_8UC1), dst(srcSize + Size(1, 1), ddepth); declare.in(src, WARMUP_RNG).out(dst); @@ -186,6 +222,8 @@ OCL_PERF_TEST_P(ThreshFixture, Threshold, const int threshType = get<2>(params); const double maxValue = 220.0, threshold = 50; + checkDeviceMaxMemoryAllocSize(srcSize, srcType); + UMat src(srcSize, srcType), dst(srcSize, srcType); declare.in(src, WARMUP_RNG).out(dst); @@ -202,6 +240,8 @@ OCL_PERF_TEST_P(CLAHEFixture, CLAHE, OCL_TEST_SIZES) { const Size srcSize = GetParam(); + checkDeviceMaxMemoryAllocSize(srcSize, CV_8UC1); + UMat src(srcSize, CV_8UC1), dst(srcSize, CV_8UC1); const double clipLimit = 40.0; declare.in(src, WARMUP_RNG).out(dst); diff --git a/modules/imgproc/src/histogram.cpp b/modules/imgproc/src/histogram.cpp index 1a91119b9a..e5b5cc76b7 100644 --- a/modules/imgproc/src/histogram.cpp +++ b/modules/imgproc/src/histogram.cpp @@ -1414,7 +1414,7 @@ static bool ocl_calcHist1(InputArrayOfArrays _src, OutputArray _hist, int ddepth if (k1.empty()) return false; - _hist.create(1, BINS, ddepth); + _hist.create(BINS, 1, ddepth); UMat src = _src.getUMat(), ghist(1, BINS * compunits, CV_32SC1), hist = ddepth == CV_32S ? _hist.getUMat() : UMat(BINS, 1, CV_32SC1);