This commit is contained in:
Daniel Fernandes 2014-05-21 17:59:10 -05:00
commit a0459c2352
2 changed files with 56 additions and 0 deletions

View File

@ -701,6 +701,36 @@ OCL_PERF_TEST_P(MeanStdDevFixture, MeanStdDev,
SANITY_CHECK(stddev3, eps, ERROR_RELATIVE);
}
OCL_PERF_TEST_P(MeanStdDevFixture, MeanStdDevWithMask,
::testing::Combine(OCL_PERF_ENUM(OCL_SIZE_1, OCL_SIZE_2, OCL_SIZE_3),
OCL_TEST_TYPES_134))
{
const Size_MatType_t params = GetParam();
const Size srcSize = get<0>(params);
const int type = get<1>(params);
const double eps = 2e-5;
checkDeviceMaxMemoryAllocSize(srcSize, type);
UMat src(srcSize, type), mask(srcSize, CV_8UC1);
Scalar mean, stddev;
declare.in(src, mask, WARMUP_RNG);
OCL_TEST_CYCLE() cv::meanStdDev(src, mean, stddev, mask);
double mean0 = mean[0], mean1 = mean[1], mean2 = mean[2], mean3 = mean[3];
double stddev0 = stddev[0], stddev1 = stddev[1], stddev2 = stddev[2], stddev3 = stddev[3];
SANITY_CHECK(mean0, eps, ERROR_RELATIVE);
SANITY_CHECK(mean1, eps, ERROR_RELATIVE);
SANITY_CHECK(mean2, eps, ERROR_RELATIVE);
SANITY_CHECK(mean3, eps, ERROR_RELATIVE);
SANITY_CHECK(stddev0, eps, ERROR_RELATIVE);
SANITY_CHECK(stddev1, eps, ERROR_RELATIVE);
SANITY_CHECK(stddev2, eps, ERROR_RELATIVE);
SANITY_CHECK(stddev3, eps, ERROR_RELATIVE);
}
///////////// Norm ////////////////////////
CV_ENUM(NormType, NORM_INF, NORM_L1, NORM_L2)
@ -728,6 +758,26 @@ OCL_PERF_TEST_P(NormFixture, Norm,
SANITY_CHECK(res, 1e-5, ERROR_RELATIVE);
}
OCL_PERF_TEST_P(NormFixture, NormRel,
::testing::Combine(OCL_PERF_ENUM(OCL_SIZE_1, OCL_SIZE_2, OCL_SIZE_3),
OCL_TEST_TYPES_134, NormType::all()))
{
const NormParams params = GetParam();
const Size srcSize = get<0>(params);
const int type = get<1>(params);
const int normType = get<2>(params);
checkDeviceMaxMemoryAllocSize(srcSize, type);
UMat src1(srcSize, type), src2(srcSize, type);
double res;
declare.in(src1, src2, WARMUP_RNG);
OCL_TEST_CYCLE() res = cv::norm(src1, src2, normType | cv::NORM_RELATIVE);
SANITY_CHECK(res, 1e-5, ERROR_RELATIVE);
}
///////////// UMat::dot ////////////////////////
typedef Size_MatType UMatDotFixture;

View File

@ -4427,6 +4427,12 @@ int predictOptimalVectorWidth(InputArray src1, InputArray src2, InputArray src3,
d.preferredVectorWidthShort(), d.preferredVectorWidthShort(),
d.preferredVectorWidthInt(), d.preferredVectorWidthFloat(),
d.preferredVectorWidthDouble(), -1 }, width = vectorWidths[depth];
if (d.isIntel())
{
// it's heuristic
int vectorWidthsIntel[] = { 16, 16, 8, 8, 1, 1, 1, -1 };
width = vectorWidthsIntel[depth];
}
if (ssize.width * cn < width || width <= 0)
return 1;