OCL_PERF_ELSE
}
-///////////// WarpAffine ////////////////////////
-
-typedef Size_MatType WarpAffineFixture;
-
-PERF_TEST_P(WarpAffineFixture, WarpAffine,
- ::testing::Combine(OCL_TYPICAL_MAT_SIZES,
- OCL_PERF_ENUM(CV_8UC1, CV_8UC4)))
-{
- static const double coeffs[2][3] =
- {
- { cos(CV_PI / 6), -sin(CV_PI / 6), 100.0 },
- { sin(CV_PI / 6), cos(CV_PI / 6), -100.0 }
- };
- Mat M(2, 3, CV_64F, (void *)coeffs);
- const int interpolation = INTER_NEAREST;
-
- 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::warpAffine(oclSrc, oclDst, M, srcSize, interpolation);
-
- oclDst.download(dst);
-
- SANITY_CHECK(dst);
- }
- else if (RUN_PLAIN_IMPL)
- {
- TEST_CYCLE() cv::warpAffine(src, dst, M, srcSize, interpolation);
-
- SANITY_CHECK(dst);
- }
- else
- OCL_PERF_ELSE
-}
-
-///////////// WarpPerspective ////////////////////////
-
-typedef Size_MatType WarpPerspectiveFixture;
-
-PERF_TEST_P(WarpPerspectiveFixture, WarpPerspective,
- ::testing::Combine(OCL_TYPICAL_MAT_SIZES,
- OCL_PERF_ENUM(CV_8UC1, CV_8UC4)))
-{
- static const double coeffs[3][3] =
- {
- {cos(CV_PI / 6), -sin(CV_PI / 6), 100.0},
- {sin(CV_PI / 6), cos(CV_PI / 6), -100.0},
- {0.0, 0.0, 1.0}
- };
- Mat M(3, 3, CV_64F, (void *)coeffs);
- const int interpolation = INTER_LINEAR;
-
- 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)
- .time(srcSize == OCL_SIZE_4000 ? 18 : srcSize == OCL_SIZE_2000 ? 5 : 2);
-
- if (RUN_OCL_IMPL)
- {
- ocl::oclMat oclSrc(src), oclDst(srcSize, type);
-
- OCL_TEST_CYCLE() cv::ocl::warpPerspective(oclSrc, oclDst, M, srcSize, interpolation);
-
- oclDst.download(dst);
-
- SANITY_CHECK(dst);
- }
- else if (RUN_PLAIN_IMPL)
- {
- TEST_CYCLE() cv::warpPerspective(src, dst, M, srcSize, interpolation);
-
- SANITY_CHECK(dst);
- }
- else
- OCL_PERF_ELSE
-}
-
-///////////// resize ////////////////////////
-
-CV_ENUM(resizeInterType, INTER_NEAREST, INTER_LINEAR)
-
-typedef tuple<Size, MatType, resizeInterType, double> resizeParams;
-typedef TestBaseWithParam<resizeParams> resizeFixture;
-
-PERF_TEST_P(resizeFixture, resize,
- ::testing::Combine(OCL_TYPICAL_MAT_SIZES,
- OCL_PERF_ENUM(CV_8UC1, CV_8UC4),
- resizeInterType::all(),
- ::testing::Values(0.5, 2.0)))
-{
- const resizeParams params = GetParam();
- const Size srcSize = get<0>(params);
- const int type = get<1>(params), interType = get<2>(params);
- double scale = get<3>(params);
-
- Mat src(srcSize, type), dst;
- const Size dstSize(cvRound(srcSize.width * scale), cvRound(srcSize.height * scale));
- dst.create(dstSize, type);
- declare.in(src, WARMUP_RNG).out(dst);
- if (interType == INTER_LINEAR && type == CV_8UC4 && OCL_SIZE_4000 == srcSize)
- declare.time(11);
-
- if (RUN_OCL_IMPL)
- {
- ocl::oclMat oclSrc(src), oclDst(dstSize, type);
-
- OCL_TEST_CYCLE() cv::ocl::resize(oclSrc, oclDst, Size(), scale, scale, interType);
-
- oclDst.download(dst);
-
- SANITY_CHECK(dst, 1 + DBL_EPSILON);
- }
- else if (RUN_PLAIN_IMPL)
- {
- TEST_CYCLE() cv::resize(src, dst, Size(), scale, scale, interType);
-
- SANITY_CHECK(dst, 1 + DBL_EPSILON);
- }
- else
- OCL_PERF_ELSE
-}
-
///////////// threshold////////////////////////
CV_ENUM(ThreshType, THRESH_BINARY, THRESH_TOZERO_INV)
OCL_PERF_ELSE
}
-///////////// remap////////////////////////
-
-CV_ENUM(RemapInterType, INTER_NEAREST, INTER_LINEAR)
-
-typedef tuple<Size, MatType, RemapInterType> remapParams;
-typedef TestBaseWithParam<remapParams> remapFixture;
-
-PERF_TEST_P(remapFixture, remap,
- ::testing::Combine(OCL_TYPICAL_MAT_SIZES,
- OCL_PERF_ENUM(CV_8UC1, CV_8UC4),
- RemapInterType::all()))
-{
- const remapParams params = GetParam();
- const Size srcSize = get<0>(params);
- const int type = get<1>(params), interpolation = get<2>(params);
-
- Mat src(srcSize, type), dst(srcSize, type);
- declare.in(src, WARMUP_RNG).out(dst);
-
- if (srcSize == OCL_SIZE_4000 && interpolation == INTER_LINEAR)
- declare.time(9);
-
- Mat xmap, ymap;
- xmap.create(srcSize, CV_32FC1);
- ymap.create(srcSize, CV_32FC1);
-
- for (int i = 0; i < srcSize.height; ++i)
- {
- float * const xmap_row = xmap.ptr<float>(i);
- float * const ymap_row = ymap.ptr<float>(i);
-
- for (int j = 0; j < srcSize.width; ++j)
- {
- xmap_row[j] = (j - srcSize.width * 0.5f) * 0.75f + srcSize.width * 0.5f;
- ymap_row[j] = (i - srcSize.height * 0.5f) * 0.75f + srcSize.height * 0.5f;
- }
- }
-
- const int borderMode = BORDER_CONSTANT;
-
- if (RUN_OCL_IMPL)
- {
- ocl::oclMat oclSrc(src), oclDst(srcSize, type);
- ocl::oclMat oclXMap(xmap), oclYMap(ymap);
-
- OCL_TEST_CYCLE() cv::ocl::remap(oclSrc, oclDst, oclXMap, oclYMap, interpolation, borderMode);
-
- oclDst.download(dst);
-
- SANITY_CHECK(dst, 1 + DBL_EPSILON);
- }
- else if (RUN_PLAIN_IMPL)
- {
- TEST_CYCLE() cv::remap(src, dst, xmap, ymap, interpolation, borderMode);
-
- SANITY_CHECK(dst, 1 + DBL_EPSILON);
- }
- else
- OCL_PERF_ELSE
-}
-
///////////// CLAHE ////////////////////////
typedef TestBaseWithParam<Size> CLAHEFixture;