This source file includes following definitions.
- OCL_PERF_TEST_P
- OCL_PERF_TEST_P
- OCL_PERF_TEST_P
- OCL_PERF_TEST_P
- OCL_PERF_TEST_P
#include "../perf_precomp.hpp"
#include "opencv2/ts/ocl_perf.hpp"
#ifdef HAVE_OPENCL
namespace cvtest {
namespace ocl {
typedef tuple<Size, MatDepth, int> MergeParams;
typedef TestBaseWithParam<MergeParams> MergeFixture;
OCL_PERF_TEST_P(MergeFixture, Merge,
::testing::Combine(OCL_TEST_SIZES, OCL_PERF_ENUM(CV_8U, CV_32F), Values(2, 3)))
{
const MergeParams params = GetParam();
const Size srcSize = get<0>(params);
const int depth = get<1>(params), cn = get<2>(params), dtype = CV_MAKE_TYPE(depth, cn);
checkDeviceMaxMemoryAllocSize(srcSize, dtype);
UMat dst(srcSize, dtype);
vector<UMat> src(cn);
for (vector<UMat>::iterator i = src.begin(), end = src.end(); i != end; ++i)
{
i->create(srcSize, CV_MAKE_TYPE(depth, 1));
declare.in(*i, WARMUP_RNG);
}
declare.out(dst);
OCL_TEST_CYCLE() cv::merge(src, dst);
SANITY_CHECK(dst);
}
typedef MergeParams SplitParams;
typedef TestBaseWithParam<SplitParams> SplitFixture;
OCL_PERF_TEST_P(SplitFixture, Split,
::testing::Combine(OCL_TEST_SIZES, OCL_PERF_ENUM(CV_8U, CV_32F), Values(2, 3)))
{
const SplitParams params = GetParam();
const Size srcSize = get<0>(params);
const int depth = get<1>(params), cn = get<2>(params), type = CV_MAKE_TYPE(depth, cn);
ASSERT_TRUE(cn == 3 || cn == 2);
checkDeviceMaxMemoryAllocSize(srcSize, type);
UMat src(srcSize, type);
std::vector<UMat> dst(cn, UMat(srcSize, CV_MAKE_TYPE(depth, 1)));
declare.in(src, WARMUP_RNG);
for (int i = 0; i < cn; ++i)
declare.in(dst[i]);
OCL_TEST_CYCLE() cv::split(src, dst);
ASSERT_EQ(cn, (int)dst.size());
if (cn == 2)
{
UMat & dst0 = dst[0], & dst1 = dst[1];
SANITY_CHECK(dst0);
SANITY_CHECK(dst1);
}
else
{
UMat & dst0 = dst[0], & dst1 = dst[1], & dst2 = dst[2];
SANITY_CHECK(dst0);
SANITY_CHECK(dst1);
SANITY_CHECK(dst2);
}
}
typedef tuple<Size, MatDepth> MixChannelsParams;
typedef TestBaseWithParam<MixChannelsParams> MixChannelsFixture;
OCL_PERF_TEST_P(MixChannelsFixture, MixChannels,
::testing::Combine(Values(OCL_SIZE_1, OCL_SIZE_2, OCL_SIZE_3),
OCL_PERF_ENUM(CV_8U, CV_32F)))
{
const MixChannelsParams params = GetParam();
const Size srcSize = get<0>(params);
const int depth = get<1>(params), type = CV_MAKE_TYPE(depth, 2), n = 2;
checkDeviceMaxMemoryAllocSize(srcSize, type);
std::vector<UMat> src(n), dst(n);
for (int i = 0; i < n; ++i)
{
src[i] = UMat(srcSize, type);
dst[i] = UMat(srcSize, type);
declare.in(src[i], WARMUP_RNG).out(dst[i]);
}
int fromTo[] = { 1,2, 2,0, 0,3, 3,1 };
OCL_TEST_CYCLE() cv::mixChannels(src, dst, fromTo, 4);
UMat & dst0 = dst[0], & dst1 = dst[1];
SANITY_CHECK(dst0);
SANITY_CHECK(dst1);
}
typedef Size_MatDepth InsertChannelFixture;
OCL_PERF_TEST_P(InsertChannelFixture, InsertChannel,
::testing::Combine(Values(OCL_SIZE_1, OCL_SIZE_2, OCL_SIZE_3),
OCL_PERF_ENUM(CV_8U, CV_32F)))
{
const Size_MatDepth_t params = GetParam();
const Size srcSize = get<0>(params);
const int depth = get<1>(params), type = CV_MAKE_TYPE(depth, 3);
checkDeviceMaxMemoryAllocSize(srcSize, type);
UMat src(srcSize, depth), dst(srcSize, type, Scalar::all(17));
declare.in(src, WARMUP_RNG).out(dst);
OCL_TEST_CYCLE() cv::insertChannel(src, dst, 1);
SANITY_CHECK(dst);
}
typedef Size_MatDepth ExtractChannelFixture;
OCL_PERF_TEST_P(ExtractChannelFixture, ExtractChannel,
::testing::Combine(Values(OCL_SIZE_1, OCL_SIZE_2, OCL_SIZE_3),
OCL_PERF_ENUM(CV_8U, CV_32F)))
{
const Size_MatDepth_t params = GetParam();
const Size srcSize = get<0>(params);
const int depth = get<1>(params), type = CV_MAKE_TYPE(depth, 3);
checkDeviceMaxMemoryAllocSize(srcSize, type);
UMat src(srcSize, type), dst(srcSize, depth);
declare.in(src, WARMUP_RNG).out(dst);
OCL_TEST_CYCLE() cv::extractChannel(src, dst, 1);
SANITY_CHECK(dst);
}
} }
#endif