ocl: perf: use RELATIVE_ERROR in SANITY_CHECK for exp/log/pow

pull/1640/head
Alexander Alekhin 11 years ago
parent 578e984739
commit 4bfeeb0738
  1. 23
      modules/ocl/perf/perf_arithm.cpp

@ -99,7 +99,7 @@ PERF_TEST_P(ExpFixture, Exp, OCL_TYPICAL_MAT_SIZES)
{ {
// getting params // getting params
const Size srcSize = GetParam(); const Size srcSize = GetParam();
const double eps = 3e-1; const double eps = 1e-6;
// creating src data // creating src data
Mat src(srcSize, CV_32FC1), dst(srcSize, CV_32FC1); Mat src(srcSize, CV_32FC1), dst(srcSize, CV_32FC1);
@ -114,17 +114,15 @@ PERF_TEST_P(ExpFixture, Exp, OCL_TYPICAL_MAT_SIZES)
OCL_TEST_CYCLE() cv::ocl::exp(oclSrc, oclDst); OCL_TEST_CYCLE() cv::ocl::exp(oclSrc, oclDst);
oclDst.download(dst); oclDst.download(dst);
SANITY_CHECK(dst, eps);
} }
else if (RUN_PLAIN_IMPL) else if (RUN_PLAIN_IMPL)
{ {
TEST_CYCLE() cv::exp(src, dst); TEST_CYCLE() cv::exp(src, dst);
SANITY_CHECK(dst, eps);
} }
else else
OCL_PERF_ELSE OCL_PERF_ELSE
SANITY_CHECK(dst, eps, ERROR_RELATIVE);
} }
///////////// LOG //////////////////////// ///////////// LOG ////////////////////////
@ -135,7 +133,7 @@ PERF_TEST_P(LogFixture, Log, OCL_TYPICAL_MAT_SIZES)
{ {
// getting params // getting params
const Size srcSize = GetParam(); const Size srcSize = GetParam();
const double eps = 1e-5; const double eps = 1e-6;
// creating src data // creating src data
Mat src(srcSize, CV_32F), dst(srcSize, src.type()); Mat src(srcSize, CV_32F), dst(srcSize, src.type());
@ -153,17 +151,15 @@ PERF_TEST_P(LogFixture, Log, OCL_TYPICAL_MAT_SIZES)
OCL_TEST_CYCLE() cv::ocl::log(oclSrc, oclDst); OCL_TEST_CYCLE() cv::ocl::log(oclSrc, oclDst);
oclDst.download(dst); oclDst.download(dst);
SANITY_CHECK(dst, eps);
} }
else if (RUN_PLAIN_IMPL) else if (RUN_PLAIN_IMPL)
{ {
TEST_CYCLE() cv::log(src, dst); TEST_CYCLE() cv::log(src, dst);
SANITY_CHECK(dst, eps);
} }
else else
OCL_PERF_ELSE OCL_PERF_ELSE
SANITY_CHECK(dst, eps, ERROR_RELATIVE);
} }
///////////// Add //////////////////////// ///////////// Add ////////////////////////
@ -818,6 +814,7 @@ typedef TestBaseWithParam<Size> PowFixture;
PERF_TEST_P(PowFixture, pow, OCL_TYPICAL_MAT_SIZES) PERF_TEST_P(PowFixture, pow, OCL_TYPICAL_MAT_SIZES)
{ {
const Size srcSize = GetParam(); const Size srcSize = GetParam();
const double eps = 1e-6;
Mat src(srcSize, CV_32F), dst(srcSize, CV_32F); Mat src(srcSize, CV_32F), dst(srcSize, CV_32F);
declare.in(src, WARMUP_RNG).out(dst); declare.in(src, WARMUP_RNG).out(dst);
@ -829,17 +826,15 @@ PERF_TEST_P(PowFixture, pow, OCL_TYPICAL_MAT_SIZES)
OCL_TEST_CYCLE() cv::ocl::pow(oclSrc, -2.0, oclDst); OCL_TEST_CYCLE() cv::ocl::pow(oclSrc, -2.0, oclDst);
oclDst.download(dst); oclDst.download(dst);
SANITY_CHECK(dst, 5e-2);
} }
else if (RUN_PLAIN_IMPL) else if (RUN_PLAIN_IMPL)
{ {
TEST_CYCLE() cv::pow(src, -2.0, dst); TEST_CYCLE() cv::pow(src, -2.0, dst);
SANITY_CHECK(dst, 5e-2);
} }
else else
OCL_PERF_ELSE OCL_PERF_ELSE
SANITY_CHECK(dst, eps, ERROR_RELATIVE);
} }
///////////// AddWeighted//////////////////////// ///////////// AddWeighted////////////////////////

Loading…
Cancel
Save