else
OCL_PERF_ELSE
}
+
+///////////// Repeat ////////////////////////
+
+typedef Size_MatType RepeatFixture;
+
+PERF_TEST_P(RepeatFixture, Repeat,
+ ::testing::Combine(::testing::Values(OCL_SIZE_1000, OCL_SIZE_2000),
+ OCL_PERF_ENUM(CV_8UC1, CV_8UC4, CV_32FC1, CV_32FC4)))
+{
+ const Size_MatType_t params = GetParam();
+ const Size srcSize = get<0>(params);
+ const int type = get<1>(params);
+ const int nx = 3, ny = 2;
+ const Size dstSize(srcSize.width * nx, srcSize.height * ny);
+
+ Mat src(srcSize, type), dst(dstSize, type);
+ declare.in(src, WARMUP_RNG).out(dst);
+
+ if (RUN_OCL_IMPL)
+ {
+ ocl::oclMat oclSrc(src), oclDst(dstSize, type);
+
+ OCL_TEST_CYCLE() cv::ocl::repeat(oclSrc, ny, nx, oclDst);
+
+ oclDst.download(dst);
+
+ SANITY_CHECK(dst);
+ }
+ else if (RUN_PLAIN_IMPL)
+ {
+ TEST_CYCLE() cv::repeat(src, ny, nx, dst);
+
+ SANITY_CHECK(dst);
+ }
+ else
+ OCL_PERF_ELSE
+}
use_roi = GET_PARAM(2);
}
- void random_roi()
+ virtual void random_roi()
{
const int type = CV_MAKE_TYPE(depth, cn);
Size roiSize = randomSize(1, MAX_VALUE);
- Border srcBorder = randomBorder(0, use_roi ? MAX_VALUE : 0);
- randomSubMat(src1, src1_roi, roiSize, srcBorder, type, 2, 11);
+ Border src1Border = randomBorder(0, use_roi ? MAX_VALUE : 0);
+ randomSubMat(src1, src1_roi, roiSize, src1Border, type, 2, 11);
Border src2Border = randomBorder(0, use_roi ? MAX_VALUE : 0);
randomSubMat(src2, src2_roi, roiSize, src2Border, type, -1540, 1740);
cv::threshold(mask, mask, 0.5, 255., CV_8UC1);
- generateOclMat(gsrc1_whole, gsrc1_roi, src1, roiSize, srcBorder);
+ generateOclMat(gsrc1_whole, gsrc1_roi, src1, roiSize, src1Border);
generateOclMat(gsrc2_whole, gsrc2_roi, src2, roiSize, src2Border);
generateOclMat(gdst1_whole, gdst1_roi, dst1, roiSize, dst1Border);
generateOclMat(gdst2_whole, gdst2_roi, dst2, roiSize, dst2Border);
}
}
+//// Repeat
+
+struct RepeatTestCase :
+ public ArithmTestBase
+{
+ int nx, ny;
+
+ virtual void random_roi()
+ {
+ const int type = CV_MAKE_TYPE(depth, cn);
+
+ nx = randomInt(1, 4);
+ ny = randomInt(1, 4);
+
+ Size srcRoiSize = randomSize(1, MAX_VALUE);
+ Border srcBorder = randomBorder(0, use_roi ? MAX_VALUE : 0);
+ randomSubMat(src1, src1_roi, srcRoiSize, srcBorder, type, 2, 11);
+
+ Size dstRoiSize(srcRoiSize.width * nx, srcRoiSize.height * ny);
+ Border dst1Border = randomBorder(0, use_roi ? MAX_VALUE : 0);
+ randomSubMat(dst1, dst1_roi, dstRoiSize, dst1Border, type, 5, 16);
+
+ generateOclMat(gsrc1_whole, gsrc1_roi, src1, srcRoiSize, srcBorder);
+ generateOclMat(gdst1_whole, gdst1_roi, dst1, dstRoiSize, dst1Border);
+ }
+};
+
+typedef RepeatTestCase Repeat;
+
+OCL_TEST_P(Repeat, Mat)
+{
+ for (int i = 0; i < LOOP_TIMES; ++i)
+ {
+ random_roi();
+
+ cv::repeat(src1_roi, ny, nx, dst1_roi);
+ cv::ocl::repeat(gsrc1_roi, ny, nx, gdst1_roi);
+
+ Near();
+ }
+}
+
//////////////////////////////////////// Instantiation /////////////////////////////////////////
INSTANTIATE_TEST_CASE_P(Arithm, Lut, Combine(Values(CV_8U, CV_8S, CV_16U, CV_16S, CV_32S, CV_32F, CV_64F), Values(1, 2, 3, 4), Bool(), Bool()));
INSTANTIATE_TEST_CASE_P(Arithm, SetIdentity, Combine(Values(CV_8U, CV_8S, CV_16U, CV_16S, CV_32S, CV_32F, CV_64F), Values(1, 2, 3, 4), Bool()));
INSTANTIATE_TEST_CASE_P(Arithm, MeanStdDev, Combine(Values(CV_8U, CV_8S, CV_16U, CV_16S, CV_32S, CV_32F, CV_64F), Values(1, 2, 3, 4), Bool()));
INSTANTIATE_TEST_CASE_P(Arithm, Norm, Combine(Values(CV_8U, CV_8S, CV_16U, CV_16S, CV_32S, CV_32F, CV_64F), Values(1, 2, 3, 4), Bool()));
+INSTANTIATE_TEST_CASE_P(Arithm, Repeat, Combine(Values(CV_8U, CV_8S, CV_16U, CV_16S, CV_32S, CV_32F, CV_64F), Values(1, 2, 3, 4), Bool()));
#endif // HAVE_OPENCL