From 3eff05e3eb9297d0be9bb72f1131eee5947c209c Mon Sep 17 00:00:00 2001 From: Ilya Lavrenov Date: Fri, 7 Mar 2014 14:35:51 +0400 Subject: [PATCH] added performance tests for cv::ocl::calcHist --- modules/ocl/perf/perf_imgproc.cpp | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/modules/ocl/perf/perf_imgproc.cpp b/modules/ocl/perf/perf_imgproc.cpp index e6f6a05..051ff2d 100644 --- a/modules/ocl/perf/perf_imgproc.cpp +++ b/modules/ocl/perf/perf_imgproc.cpp @@ -81,6 +81,45 @@ OCL_PERF_TEST_P(EqualizeHistFixture, EqualizeHist, OCL_TEST_SIZES) OCL_PERF_ELSE } +///////////// 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; + + Mat src(srcSize, CV_8UC1), dst(srcSize, CV_32FC1); + declare.in(src, WARMUP_RNG).out(dst); + + if (RUN_OCL_IMPL) + { + ocl::oclMat oclSrc(src), oclDst(srcSize, CV_32SC1); + + OCL_TEST_CYCLE() cv::ocl::calcHist(oclSrc, oclDst); + + oclDst.download(dst); + SANITY_CHECK(dst); + } + else if (RUN_PLAIN_IMPL) + { + TEST_CYCLE() cv::calcHist(std::vector(1, src), channels, + noArray(), dst, histSize, ranges, false); + + dst.convertTo(dst, CV_32S); + dst = dst.reshape(1, 1); + + SANITY_CHECK(dst); + } + else + OCL_PERF_ELSE +} + /////////// CopyMakeBorder ////////////////////// CV_ENUM(Border, BORDER_CONSTANT, BORDER_REPLICATE, BORDER_REFLECT, BORDER_WRAP, BORDER_REFLECT_101) -- 2.7.4