OCL_PERF_TEST_P(ConvertToFixture, ConvertTo, ::testing::Combine(OCL_TEST_SIZES, OCL_TEST_TYPES)) { const Size_MatType_t params = GetParam(); const Size srcSize = get<0>(params); const int type = get<1>(params), ddepth = CV_MAT_DEPTH(type) == CV_8U ? CV_32F : CV_8U, cn = CV_MAT_CN(type), dtype = CV_MAKE_TYPE(ddepth, cn); checkDeviceMaxMemoryAllocSize(srcSize, type); checkDeviceMaxMemoryAllocSize(srcSize, dtype); UMat src(srcSize, type), dst(srcSize, dtype); declare.in(src, WARMUP_RNG).out(dst); OCL_TEST_CYCLE() src.convertTo(dst, dtype); SANITY_CHECK(dst); }
OCL_PERF_TEST_P(UpdateMotionHistoryFixture, UpdateMotionHistory, OCL_TEST_SIZES) { const Size size = GetParam(); checkDeviceMaxMemoryAllocSize(size, CV_32FC1); UMat silhouette(size, CV_8UC1), mhi(size, CV_32FC1); randu(silhouette, -5, 5); declare.in(mhi, WARMUP_RNG); OCL_TEST_CYCLE() cv::updateMotionHistory(silhouette, mhi, 1, 0.5); SANITY_CHECK(mhi); }
OCL_PERF_TEST_P(CopyToFixture, CopyTo, ::testing::Combine(OCL_TEST_SIZES, OCL_TEST_TYPES)) { const Size_MatType_t params = GetParam(); const Size srcSize = get<0>(params); const int type = get<1>(params); checkDeviceMaxMemoryAllocSize(srcSize, type); UMat src(srcSize, type), dst(srcSize, type); declare.in(src, WARMUP_RNG).out(dst); OCL_TEST_CYCLE() src.copyTo(dst); SANITY_CHECK(dst); }
OCL_PERF_TEST_P(SetToFixture, SetToWithMask, ::testing::Combine(OCL_TEST_SIZES, OCL_TEST_TYPES)) { const Size_MatType_t params = GetParam(); const Size srcSize = get<0>(params); const int type = get<1>(params); const Scalar s = Scalar::all(17); checkDeviceMaxMemoryAllocSize(srcSize, type); UMat src(srcSize, type), mask(srcSize, CV_8UC1); declare.in(src, mask, WARMUP_RNG).out(src); OCL_TEST_CYCLE() src.setTo(s, mask); SANITY_CHECK(src); }
OCL_PERF_TEST_P(AddFixture, Add, ::testing::Combine(OCL_TEST_SIZES, OCL_TEST_TYPES)) { const Size srcSize = GET_PARAM(0); const int type = GET_PARAM(1); checkDeviceMaxMemoryAllocSize(srcSize, type); UMat src1(srcSize, type), src2(srcSize, type), dst(srcSize, type); randu(src1); randu(src2); declare.in(src1, src2).out(dst); OCL_TEST_CYCLE() cv::add(src1, src2, dst); SANITY_CHECK(dst); }
OCL_PERF_TEST_P(BlendLinearFixture, BlendLinear, ::testing::Combine(OCL_TEST_SIZES, OCL_TEST_TYPES_134)) { Size_MatType_t params = GetParam(); const Size srcSize = get<0>(params); const int srcType = get<1>(params); const double eps = CV_MAT_DEPTH(srcType) <= CV_32S ? 1.0 : 0.2; checkDeviceMaxMemoryAllocSize(srcSize, srcType); UMat src1(srcSize, srcType), src2(srcSize, srcType), dst(srcSize, srcType); UMat weights1(srcSize, CV_32FC1), weights2(srcSize, CV_32FC1); declare.in(src1, src2, WARMUP_RNG).in(weights1, weights2, WARMUP_READ).out(dst); randu(weights1, 0, 1); randu(weights2, 0, 1); OCL_TEST_CYCLE() cv::blendLinear(src1, src2, weights1, weights2, dst); SANITY_CHECK(dst, eps); }