From: Ilya Lavrenov Date: Wed, 9 Oct 2013 15:37:09 +0000 (+0400) Subject: added perf tests for min, max, abs X-Git-Tag: accepted/tizen/ivi/20140515.103456~1^2~421^2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=39c1e5ff73b252d35dd0217d70b83785437dd6a6;p=profile%2Fivi%2Fopencv.git added perf tests for min, max, abs --- diff --git a/modules/ocl/perf/perf_arithm.cpp b/modules/ocl/perf/perf_arithm.cpp index d718ed5..12dcde9 100644 --- a/modules/ocl/perf/perf_arithm.cpp +++ b/modules/ocl/perf/perf_arithm.cpp @@ -877,3 +877,108 @@ PERF_TEST_P(AddWeightedFixture, AddWeighted, else OCL_PERF_ELSE } + +///////////// Min //////////////////////// + +typedef Size_MatType MinFixture; + +PERF_TEST_P(MinFixture, Min, + ::testing::Combine(OCL_TYPICAL_MAT_SIZES, + OCL_PERF_ENUM(CV_8UC1, CV_32FC1))) +{ + const Size_MatType_t params = GetParam(); + const Size srcSize = get<0>(params); + const int type = get<1>(params); + + Mat src1(srcSize, type), src2(srcSize, type), dst(srcSize, type); + declare.in(src1, src2, WARMUP_RNG).out(dst); + + if (RUN_OCL_IMPL) + { + ocl::oclMat oclSrc1(src1), oclSrc2(src2), oclDst(srcSize, type); + + OCL_TEST_CYCLE() cv::ocl::min(oclSrc1, oclSrc2, oclDst); + + oclDst.download(dst); + + SANITY_CHECK(dst); + } + else if (RUN_PLAIN_IMPL) + { + TEST_CYCLE() dst = cv::min(src1, src2); + + SANITY_CHECK(dst); + } + else + OCL_PERF_ELSE +} + +///////////// Max //////////////////////// + +typedef Size_MatType MaxFixture; + +PERF_TEST_P(MaxFixture, Max, + ::testing::Combine(OCL_TYPICAL_MAT_SIZES, + OCL_PERF_ENUM(CV_8UC1, CV_32FC1))) +{ + const Size_MatType_t params = GetParam(); + const Size srcSize = get<0>(params); + const int type = get<1>(params); + + Mat src1(srcSize, type), src2(srcSize, type), dst(srcSize, type); + declare.in(src1, src2, WARMUP_RNG).out(dst); + + if (RUN_OCL_IMPL) + { + ocl::oclMat oclSrc1(src1), oclSrc2(src2), oclDst(srcSize, type); + + OCL_TEST_CYCLE() cv::ocl::max(oclSrc1, oclSrc2, oclDst); + + oclDst.download(dst); + + SANITY_CHECK(dst); + } + else if (RUN_PLAIN_IMPL) + { + TEST_CYCLE() dst = cv::max(src1, src2); + + SANITY_CHECK(dst); + } + else + OCL_PERF_ELSE +} + +///////////// Max //////////////////////// + +typedef Size_MatType AbsFixture; + +PERF_TEST_P(AbsFixture, Abs, + ::testing::Combine(OCL_TYPICAL_MAT_SIZES, + OCL_PERF_ENUM(CV_8UC1, CV_32FC1))) +{ + const Size_MatType_t params = GetParam(); + const Size srcSize = get<0>(params); + const int type = get<1>(params); + + Mat src(srcSize, type), dst(srcSize, type); + declare.in(src, WARMUP_RNG).out(dst); + + if (RUN_OCL_IMPL) + { + ocl::oclMat oclSrc(src), oclDst(srcSize, type); + + OCL_TEST_CYCLE() cv::ocl::abs(oclSrc, oclDst); + + oclDst.download(dst); + + SANITY_CHECK(dst); + } + else if (RUN_PLAIN_IMPL) + { + TEST_CYCLE() dst = cv::abs(src); + + SANITY_CHECK(dst); + } + else + OCL_PERF_ELSE +}