master-like performance tests

pull/2429/head
Ilya Lavrenov 11 years ago
parent 7dc22b4ea6
commit c1c3139368
  1. 289
      modules/ocl/perf/perf_arithm.cpp
  2. 24
      modules/ocl/perf/perf_bgfg.cpp
  3. 6
      modules/ocl/perf/perf_blend.cpp
  4. 35
      modules/ocl/perf/perf_brute_force_matcher.cpp
  5. 19
      modules/ocl/perf/perf_canny.cpp
  6. 50
      modules/ocl/perf/perf_color.cpp
  7. 17
      modules/ocl/perf/perf_fft.cpp
  8. 231
      modules/ocl/perf/perf_filters.cpp
  9. 15
      modules/ocl/perf/perf_gemm.cpp
  10. 28
      modules/ocl/perf/perf_gftt.cpp
  11. 38
      modules/ocl/perf/perf_haar.cpp
  12. 4
      modules/ocl/perf/perf_hog.cpp
  13. 79
      modules/ocl/perf/perf_imgproc.cpp
  14. 97
      modules/ocl/perf/perf_imgwarp.cpp
  15. 12
      modules/ocl/perf/perf_match_template.cpp
  16. 30
      modules/ocl/perf/perf_matrix_operation.cpp
  17. 20
      modules/ocl/perf/perf_moments.cpp
  18. 27
      modules/ocl/perf/perf_norm.cpp
  19. 62
      modules/ocl/perf/perf_opticalflow.cpp
  20. 41
      modules/ocl/perf/perf_precomp.hpp
  21. 18
      modules/ocl/perf/perf_pyramid.cpp
  22. 81
      modules/ocl/perf/perf_split_merge.cpp

@ -54,9 +54,8 @@ using std::tr1::tuple;
typedef Size_MatType LUTFixture;
PERF_TEST_P(LUTFixture, LUT,
::testing::Combine(OCL_TYPICAL_MAT_SIZES,
OCL_PERF_ENUM(CV_8UC1, CV_8UC3)))
OCL_PERF_TEST_P(LUTFixture, LUT,
::testing::Combine(OCL_TEST_SIZES, OCL_PERF_ENUM(CV_8UC1, CV_32FC1)))
{
// getting params
const Size_MatType_t params = GetParam();
@ -64,7 +63,7 @@ PERF_TEST_P(LUTFixture, LUT,
const int type = get<1>(params);
// creating src data
Mat src(srcSize, type), lut(1, 256, CV_8UC1);
Mat src(srcSize, CV_8UC1), lut(1, 256, type);
int dstType = CV_MAKETYPE(lut.depth(), src.channels());
Mat dst(srcSize, dstType);
@ -93,16 +92,19 @@ PERF_TEST_P(LUTFixture, LUT,
///////////// Exp ////////////////////////
typedef TestBaseWithParam<Size> ExpFixture;
typedef Size_MatType ExpFixture;
PERF_TEST_P(ExpFixture, Exp, OCL_TYPICAL_MAT_SIZES)
OCL_PERF_TEST_P(ExpFixture, Exp, ::testing::Combine(
OCL_TEST_SIZES, OCL_PERF_ENUM(CV_32FC1, CV_32FC4)))
{
// getting params
const Size srcSize = GetParam();
const Size_MatType_t params = GetParam();
const Size srcSize = get<0>(params);
const int type = get<1>(params);
const double eps = 1e-6;
// creating src data
Mat src(srcSize, CV_32FC1), dst(srcSize, CV_32FC1);
Mat src(srcSize, type), dst(srcSize, type);
declare.in(src).out(dst);
randu(src, 5, 16);
@ -125,18 +127,21 @@ PERF_TEST_P(ExpFixture, Exp, OCL_TYPICAL_MAT_SIZES)
SANITY_CHECK(dst, eps, ERROR_RELATIVE);
}
///////////// LOG ////////////////////////
///////////// Log ////////////////////////
typedef TestBaseWithParam<Size> LogFixture;
typedef Size_MatType LogFixture;
PERF_TEST_P(LogFixture, Log, OCL_TYPICAL_MAT_SIZES)
OCL_PERF_TEST_P(LogFixture, Log, ::testing::Combine(
OCL_TEST_SIZES, OCL_PERF_ENUM(CV_32FC1, CV_32FC4)))
{
// getting params
const Size srcSize = GetParam();
const Size_MatType_t params = GetParam();
const Size srcSize = get<0>(params);
const int type = get<1>(params);
const double eps = 1e-6;
// creating src data
Mat src(srcSize, CV_32F), dst(srcSize, src.type());
Mat src(srcSize, type), dst(srcSize, type);
randu(src, 1, 10);
declare.in(src).out(dst);
@ -166,9 +171,8 @@ PERF_TEST_P(LogFixture, Log, OCL_TYPICAL_MAT_SIZES)
typedef Size_MatType AddFixture;
PERF_TEST_P(AddFixture, Add,
::testing::Combine(OCL_TYPICAL_MAT_SIZES,
OCL_PERF_ENUM(CV_8UC1, CV_32FC1)))
OCL_PERF_TEST_P(AddFixture, Add,
::testing::Combine(OCL_TEST_SIZES, OCL_TEST_TYPES_134))
{
// getting params
const Size_MatType_t params = GetParam();
@ -202,12 +206,51 @@ PERF_TEST_P(AddFixture, Add,
OCL_PERF_ELSE
}
///////////// Subtract ////////////////////////
typedef Size_MatType SubtractFixture;
OCL_PERF_TEST_P(SubtractFixture, Subtract,
::testing::Combine(OCL_TEST_SIZES, OCL_TEST_TYPES_134))
{
// getting params
const Size_MatType_t params = GetParam();
const Size srcSize = get<0>(params);
const int type = get<1>(params);
// creating src data
Mat src1(srcSize, type), src2(srcSize, type), dst(srcSize, type);
randu(src1, 0, 1);
randu(src2, 0, 1);
declare.in(src1, src2).out(dst);
// select implementation
if (RUN_OCL_IMPL)
{
ocl::oclMat oclSrc1(src1), oclSrc2(src2), oclDst(srcSize, type);
OCL_TEST_CYCLE() cv::ocl::subtract(oclSrc1, oclSrc2, oclDst);
oclDst.download(dst);
SANITY_CHECK(dst);
}
else if (RUN_PLAIN_IMPL)
{
TEST_CYCLE() cv::subtract(src1, src2, dst);
SANITY_CHECK(dst);
}
else
OCL_PERF_ELSE
}
///////////// Mul ////////////////////////
typedef Size_MatType MulFixture;
PERF_TEST_P(MulFixture, Mul, ::testing::Combine(OCL_TYPICAL_MAT_SIZES,
OCL_PERF_ENUM(CV_8UC1, CV_8UC4)))
OCL_PERF_TEST_P(MulFixture, Multiply, ::testing::Combine(OCL_TEST_SIZES, OCL_TEST_TYPES_134))
{
// getting params
const Size_MatType_t params = GetParam();
@ -245,9 +288,8 @@ PERF_TEST_P(MulFixture, Mul, ::testing::Combine(OCL_TYPICAL_MAT_SIZES,
typedef Size_MatType DivFixture;
PERF_TEST_P(DivFixture, Div,
::testing::Combine(OCL_TYPICAL_MAT_SIZES,
OCL_PERF_ENUM(CV_8UC1, CV_8UC4)))
OCL_PERF_TEST_P(DivFixture, Divide,
::testing::Combine(OCL_TEST_SIZES, OCL_TEST_TYPES_134))
{
// getting params
const Size_MatType_t params = GetParam();
@ -260,12 +302,6 @@ PERF_TEST_P(DivFixture, Div,
randu(src1, 0, 256);
randu(src2, 0, 256);
if ((srcSize == OCL_SIZE_4000 && type == CV_8UC1) ||
(srcSize == OCL_SIZE_2000 && type == CV_8UC4))
declare.time(4.2);
else if (srcSize == OCL_SIZE_4000 && type == CV_8UC4)
declare.time(16.6);
// select implementation
if (RUN_OCL_IMPL)
{
@ -275,13 +311,13 @@ PERF_TEST_P(DivFixture, Div,
oclDst.download(dst);
SANITY_CHECK(dst);
SANITY_CHECK(dst, 1e-6, ERROR_RELATIVE);
}
else if (RUN_PLAIN_IMPL)
{
TEST_CYCLE() cv::divide(src1, src2, dst);
SANITY_CHECK(dst);
SANITY_CHECK(dst, 1e-6, ERROR_RELATIVE);
}
else
OCL_PERF_ELSE
@ -291,9 +327,8 @@ PERF_TEST_P(DivFixture, Div,
typedef Size_MatType AbsDiffFixture;
PERF_TEST_P(AbsDiffFixture, Absdiff,
::testing::Combine(OCL_TYPICAL_MAT_SIZES,
OCL_PERF_ENUM(CV_8UC1, CV_8UC4)))
OCL_PERF_TEST_P(AbsDiffFixture, Absdiff,
::testing::Combine(OCL_TEST_SIZES, OCL_TEST_TYPES_134))
{
const Size_MatType_t params = GetParam();
const Size srcSize = get<0>(params);
@ -326,15 +361,18 @@ PERF_TEST_P(AbsDiffFixture, Absdiff,
///////////// CartToPolar ////////////////////////
typedef TestBaseWithParam<Size> CartToPolarFixture;
typedef Size_MatType CartToPolarFixture;
PERF_TEST_P(CartToPolarFixture, CartToPolar, OCL_TYPICAL_MAT_SIZES)
OCL_PERF_TEST_P(CartToPolarFixture, CartToPolar, ::testing::Combine(
OCL_TEST_SIZES, OCL_PERF_ENUM(CV_32FC1, CV_32FC4)))
{
const Size srcSize = GetParam();
const Size_MatType_t params = GetParam();
const Size srcSize = get<0>(params);
const int type = get<1>(params);
const double eps = 8e-3;
Mat src1(srcSize, CV_32FC1), src2(srcSize, CV_32FC1),
dst1(srcSize, CV_32FC1), dst2(srcSize, CV_32FC1);
Mat src1(srcSize, type), src2(srcSize, type),
dst1(srcSize, type), dst2(srcSize, type);
declare.in(src1, src2).out(dst1, dst2);
randu(src1, 0, 256);
randu(src2, 0, 256);
@ -368,14 +406,17 @@ PERF_TEST_P(CartToPolarFixture, CartToPolar, OCL_TYPICAL_MAT_SIZES)
///////////// PolarToCart ////////////////////////
typedef TestBaseWithParam<Size> PolarToCartFixture;
typedef Size_MatType PolarToCartFixture;
PERF_TEST_P(PolarToCartFixture, PolarToCart, OCL_TYPICAL_MAT_SIZES)
OCL_PERF_TEST_P(PolarToCartFixture, PolarToCart, ::testing::Combine(
OCL_TEST_SIZES, OCL_PERF_ENUM(CV_32FC1, CV_32FC4)))
{
const Size srcSize = GetParam();
const Size_MatType_t params = GetParam();
const Size srcSize = get<0>(params);
const int type = get<1>(params);
Mat src1(srcSize, CV_32FC1), src2(srcSize, CV_32FC1),
dst1(srcSize, CV_32FC1), dst2(srcSize, CV_32FC1);
Mat src1(srcSize, type), src2(srcSize, type),
dst1(srcSize, type), dst2(srcSize, type);
declare.in(src1, src2).out(dst1, dst2);
randu(src1, 0, 256);
randu(src2, 0, 256);
@ -409,14 +450,17 @@ PERF_TEST_P(PolarToCartFixture, PolarToCart, OCL_TYPICAL_MAT_SIZES)
///////////// Magnitude ////////////////////////
typedef TestBaseWithParam<Size> MagnitudeFixture;
typedef Size_MatType MagnitudeFixture;
PERF_TEST_P(MagnitudeFixture, Magnitude, OCL_TYPICAL_MAT_SIZES)
OCL_PERF_TEST_P(MagnitudeFixture, Magnitude, ::testing::Combine(
OCL_TEST_SIZES, OCL_PERF_ENUM(CV_32FC1, CV_32FC4)))
{
const Size srcSize = GetParam();
const Size_MatType_t params = GetParam();
const Size srcSize = get<0>(params);
const int type = get<1>(params);
Mat src1(srcSize, CV_32FC1), src2(srcSize, CV_32FC1),
dst(srcSize, CV_32FC1);
Mat src1(srcSize, type), src2(srcSize, type),
dst(srcSize, type);
randu(src1, 0, 1);
randu(src2, 0, 1);
declare.in(src1, src2).out(dst);
@ -446,9 +490,8 @@ PERF_TEST_P(MagnitudeFixture, Magnitude, OCL_TYPICAL_MAT_SIZES)
typedef Size_MatType TransposeFixture;
PERF_TEST_P(TransposeFixture, Transpose,
::testing::Combine(OCL_TYPICAL_MAT_SIZES,
OCL_PERF_ENUM(CV_8UC1, CV_8UC4)))
OCL_PERF_TEST_P(TransposeFixture, Transpose, ::testing::Combine(
OCL_TEST_SIZES, OCL_TEST_TYPES))
{
const Size_MatType_t params = GetParam();
const Size srcSize = get<0>(params);
@ -479,15 +522,24 @@ PERF_TEST_P(TransposeFixture, Transpose,
///////////// Flip ////////////////////////
typedef Size_MatType FlipFixture;
enum
{
FLIP_BOTH = 0, FLIP_ROWS, FLIP_COLS
};
PERF_TEST_P(FlipFixture, Flip,
::testing::Combine(OCL_TYPICAL_MAT_SIZES,
OCL_PERF_ENUM(CV_8UC1, CV_8UC4)))
CV_ENUM(FlipType, FLIP_BOTH, FLIP_ROWS, FLIP_COLS)
typedef std::tr1::tuple<Size, MatType, FlipType> FlipParams;
typedef TestBaseWithParam<FlipParams> FlipFixture;
OCL_PERF_TEST_P(FlipFixture, Flip,
::testing::Combine(OCL_TEST_SIZES,
OCL_TEST_TYPES, FlipType::all()))
{
const Size_MatType_t params = GetParam();
const FlipParams params = GetParam();
const Size srcSize = get<0>(params);
const int type = get<1>(params);
const int flipType = get<2>(params);
Mat src(srcSize, type), dst(srcSize, type);
declare.in(src, WARMUP_RNG).out(dst);
@ -496,7 +548,7 @@ PERF_TEST_P(FlipFixture, Flip,
{
ocl::oclMat oclSrc(src), oclDst(srcSize, type);
OCL_TEST_CYCLE() cv::ocl::flip(oclSrc, oclDst, 0);
OCL_TEST_CYCLE() cv::ocl::flip(oclSrc, oclDst, flipType - 1);
oclDst.download(dst);
@ -504,7 +556,7 @@ PERF_TEST_P(FlipFixture, Flip,
}
else if (RUN_PLAIN_IMPL)
{
TEST_CYCLE() cv::flip(src, dst, 0);
TEST_CYCLE() cv::flip(src, dst, flipType - 1);
SANITY_CHECK(dst);
}
@ -512,11 +564,11 @@ PERF_TEST_P(FlipFixture, Flip,
OCL_PERF_ELSE
}
///////////// minMax ////////////////////////
///////////// MinMax ////////////////////////
typedef Size_MatType minMaxFixture;
typedef Size_MatType MinMaxFixture;
PERF_TEST_P(minMaxFixture, minMax,
PERF_TEST_P(MinMaxFixture, MinMax,
::testing::Combine(OCL_TYPICAL_MAT_SIZES,
OCL_PERF_ENUM(CV_8UC1, CV_32FC1)))
{
@ -554,13 +606,12 @@ PERF_TEST_P(minMaxFixture, minMax,
OCL_PERF_ELSE
}
///////////// minMaxLoc ////////////////////////
///////////// MinMaxLoc ////////////////////////
typedef Size_MatType minMaxLocFixture;
typedef Size_MatType MinMaxLocFixture;
PERF_TEST_P(minMaxLocFixture, minMaxLoc,
::testing::Combine(OCL_TYPICAL_MAT_SIZES,
OCL_PERF_ENUM(CV_8UC1, CV_32FC1)))
OCL_PERF_TEST_P(MinMaxLocFixture, MinMaxLoc,
::testing::Combine(OCL_TEST_SIZES, OCL_PERF_ENUM(CV_8UC1, CV_32FC1)))
{
const Size_MatType_t params = GetParam();
const Size srcSize = get<0>(params);
@ -599,9 +650,9 @@ PERF_TEST_P(minMaxLocFixture, minMaxLoc,
typedef Size_MatType SumFixture;
PERF_TEST_P(SumFixture, Sum,
::testing::Combine(OCL_TYPICAL_MAT_SIZES,
OCL_PERF_ENUM(CV_8UC1, CV_32SC1)))
OCL_PERF_TEST_P(SumFixture, Sum,
::testing::Combine(OCL_TEST_SIZES,
OCL_TEST_TYPES))
{
const Size_MatType_t params = GetParam();
const Size srcSize = get<0>(params);
@ -618,13 +669,13 @@ PERF_TEST_P(SumFixture, Sum,
OCL_TEST_CYCLE() result = cv::ocl::sum(oclSrc);
SANITY_CHECK(result);
SANITY_CHECK(result, 1e-6, ERROR_RELATIVE);
}
else if (RUN_PLAIN_IMPL)
{
TEST_CYCLE() result = cv::sum(src);
SANITY_CHECK(result);
SANITY_CHECK(result, 1e-6, ERROR_RELATIVE);
}
else
OCL_PERF_ELSE
@ -632,10 +683,10 @@ PERF_TEST_P(SumFixture, Sum,
///////////// countNonZero ////////////////////////
typedef Size_MatType countNonZeroFixture;
typedef Size_MatType CountNonZeroFixture;
PERF_TEST_P(countNonZeroFixture, countNonZero,
::testing::Combine(OCL_TYPICAL_MAT_SIZES,
OCL_PERF_TEST_P(CountNonZeroFixture, CountNonZero,
::testing::Combine(OCL_TEST_SIZES,
OCL_PERF_ENUM(CV_8UC1, CV_32FC1)))
{
const Size_MatType_t params = GetParam();
@ -667,14 +718,16 @@ PERF_TEST_P(countNonZeroFixture, countNonZero,
///////////// Phase ////////////////////////
typedef TestBaseWithParam<Size> PhaseFixture;
typedef Size_MatType PhaseFixture;
PERF_TEST_P(PhaseFixture, Phase, OCL_TYPICAL_MAT_SIZES)
OCL_PERF_TEST_P(PhaseFixture, Phase, ::testing::Combine(
OCL_TEST_SIZES, OCL_PERF_ENUM(CV_32FC1, CV_32FC4)))
{
const Size srcSize = GetParam();
const Size_MatType_t params = GetParam();
const Size srcSize = get<0>(params);
const int type = get<1>(params);
Mat src1(srcSize, CV_32FC1), src2(srcSize, CV_32FC1),
dst(srcSize, CV_32FC1);
Mat src1(srcSize, type), src2(srcSize, type), dst(srcSize, type);
declare.in(src1, src2).out(dst);
randu(src1, 0, 256);
randu(src2, 0, 256);
@ -704,9 +757,8 @@ PERF_TEST_P(PhaseFixture, Phase, OCL_TYPICAL_MAT_SIZES)
typedef Size_MatType BitwiseAndFixture;
PERF_TEST_P(BitwiseAndFixture, bitwise_and,
::testing::Combine(OCL_TYPICAL_MAT_SIZES,
OCL_PERF_ENUM(CV_8UC1, CV_32SC1)))
OCL_PERF_TEST_P(BitwiseAndFixture, Bitwise_and,
::testing::Combine(OCL_TEST_SIZES, OCL_TEST_TYPES_134))
{
const Size_MatType_t params = GetParam();
const Size srcSize = get<0>(params);
@ -741,9 +793,8 @@ PERF_TEST_P(BitwiseAndFixture, bitwise_and,
typedef Size_MatType BitwiseXorFixture;
PERF_TEST_P(BitwiseXorFixture, bitwise_xor,
::testing::Combine(OCL_TYPICAL_MAT_SIZES,
OCL_PERF_ENUM(CV_8UC1, CV_32SC1)))
OCL_PERF_TEST_P(BitwiseXorFixture, Bitwise_xor,
::testing::Combine(OCL_TEST_SIZES, OCL_TEST_TYPES_134))
{
const Size_MatType_t params = GetParam();
const Size srcSize = get<0>(params);
@ -778,9 +829,8 @@ PERF_TEST_P(BitwiseXorFixture, bitwise_xor,
typedef Size_MatType BitwiseOrFixture;
PERF_TEST_P(BitwiseOrFixture, bitwise_or,
::testing::Combine(OCL_TYPICAL_MAT_SIZES,
OCL_PERF_ENUM(CV_8UC1, CV_32SC1)))
OCL_PERF_TEST_P(BitwiseOrFixture, Bitwise_or,
::testing::Combine(OCL_TEST_SIZES, OCL_TEST_TYPES_134))
{
const Size_MatType_t params = GetParam();
const Size srcSize = get<0>(params);
@ -798,26 +848,25 @@ PERF_TEST_P(BitwiseOrFixture, bitwise_or,
OCL_TEST_CYCLE() cv::ocl::bitwise_or(oclSrc1, oclSrc2, oclDst);
oclDst.download(dst);
SANITY_CHECK(dst);
}
else if (RUN_PLAIN_IMPL)
{
TEST_CYCLE() cv::bitwise_or(src1, src2, dst);
SANITY_CHECK(dst);
}
else
OCL_PERF_ELSE
if (CV_MAT_DEPTH(type) >= CV_32F)
cv::patchNaNs(dst, 17);
SANITY_CHECK(dst);
}
///////////// bitwise_not////////////////////////
typedef Size_MatType BitwiseNotFixture;
PERF_TEST_P(BitwiseAndFixture, bitwise_not,
::testing::Combine(OCL_TYPICAL_MAT_SIZES,
OCL_PERF_ENUM(CV_8UC1, CV_32SC1)))
OCL_PERF_TEST_P(BitwiseNotFixture, Bitwise_not,
::testing::Combine(OCL_TEST_SIZES, OCL_TEST_TYPES_134))
{
const Size_MatType_t params = GetParam();
const Size srcSize = get<0>(params);
@ -848,15 +897,19 @@ PERF_TEST_P(BitwiseAndFixture, bitwise_not,
///////////// compare////////////////////////
typedef Size_MatType CompareFixture;
CV_ENUM(CmpCode, CMP_LT, CMP_LE, CMP_EQ, CMP_NE, CMP_GE, CMP_GT)
PERF_TEST_P(CompareFixture, compare,
::testing::Combine(OCL_TYPICAL_MAT_SIZES,
OCL_PERF_ENUM(CV_8UC1, CV_32FC1)))
typedef std::tr1::tuple<Size, MatType, CmpCode> CompareParams;
typedef TestBaseWithParam<CompareParams> CompareFixture;
OCL_PERF_TEST_P(CompareFixture, Compare,
::testing::Combine(OCL_TEST_SIZES,
OCL_PERF_ENUM(CV_8UC1, CV_32FC1), CmpCode::all()))
{
const Size_MatType_t params = GetParam();
const CompareParams params = GetParam();
const Size srcSize = get<0>(params);
const int type = get<1>(params);
const int cmpCode = get<2>(params);
Mat src1(srcSize, type), src2(srcSize, type), dst(srcSize, CV_8UC1);
declare.in(src1, src2, WARMUP_RNG).out(dst);
@ -865,7 +918,7 @@ PERF_TEST_P(CompareFixture, compare,
{
ocl::oclMat oclSrc1(src1), oclSrc2(src2), oclDst(srcSize, CV_8UC1);
OCL_TEST_CYCLE() cv::ocl::compare(oclSrc1, oclSrc2, oclDst, CMP_EQ);
OCL_TEST_CYCLE() cv::ocl::compare(oclSrc1, oclSrc2, oclDst, cmpCode);
oclDst.download(dst);
@ -873,7 +926,7 @@ PERF_TEST_P(CompareFixture, compare,
}
else if (RUN_PLAIN_IMPL)
{
TEST_CYCLE() cv::compare(src1, src2, dst, CMP_EQ);
TEST_CYCLE() cv::compare(src1, src2, dst, cmpCode);
SANITY_CHECK(dst);
}
@ -883,14 +936,17 @@ PERF_TEST_P(CompareFixture, compare,
///////////// pow ////////////////////////
typedef TestBaseWithParam<Size> PowFixture;
typedef Size_MatType PowFixture;
PERF_TEST_P(PowFixture, pow, OCL_TYPICAL_MAT_SIZES)
OCL_PERF_TEST_P(PowFixture, Pow, ::testing::Combine(
OCL_TEST_SIZES, OCL_PERF_ENUM(CV_32FC1, CV_32FC4)))
{
const Size srcSize = GetParam();
const Size_MatType_t params = GetParam();
const Size srcSize = get<0>(params);
const int type = get<1>(params);
const double eps = 1e-6;
Mat src(srcSize, CV_32F), dst(srcSize, CV_32F);
Mat src(srcSize, type), dst(srcSize, type);
declare.in(src, WARMUP_RNG).out(dst);
if (RUN_OCL_IMPL)
@ -915,9 +971,8 @@ PERF_TEST_P(PowFixture, pow, OCL_TYPICAL_MAT_SIZES)
typedef Size_MatType AddWeightedFixture;
PERF_TEST_P(AddWeightedFixture, AddWeighted,
::testing::Combine(OCL_TYPICAL_MAT_SIZES,
OCL_PERF_ENUM(CV_8UC1, CV_32FC1)))
OCL_PERF_TEST_P(AddWeightedFixture, AddWeighted,
::testing::Combine(OCL_TEST_SIZES, OCL_TEST_TYPES_134))
{
const Size_MatType_t params = GetParam();
const Size srcSize = get<0>(params);
@ -951,9 +1006,8 @@ PERF_TEST_P(AddWeightedFixture, AddWeighted,
typedef Size_MatType MinFixture;
PERF_TEST_P(MinFixture, Min,
::testing::Combine(OCL_TYPICAL_MAT_SIZES,
OCL_PERF_ENUM(CV_8UC1, CV_32FC1)))
OCL_PERF_TEST_P(MinFixture, Min,
::testing::Combine(OCL_TEST_SIZES, OCL_TEST_TYPES))
{
const Size_MatType_t params = GetParam();
const Size srcSize = get<0>(params);
@ -986,9 +1040,8 @@ PERF_TEST_P(MinFixture, Min,
typedef Size_MatType MaxFixture;
PERF_TEST_P(MaxFixture, Max,
::testing::Combine(OCL_TYPICAL_MAT_SIZES,
OCL_PERF_ENUM(CV_8UC1, CV_32FC1)))
OCL_PERF_TEST_P(MaxFixture, Max,
::testing::Combine(OCL_TEST_SIZES, OCL_TEST_TYPES))
{
const Size_MatType_t params = GetParam();
const Size srcSize = get<0>(params);
@ -1017,7 +1070,7 @@ PERF_TEST_P(MaxFixture, Max,
OCL_PERF_ELSE
}
///////////// Max ////////////////////////
///////////// Abs ////////////////////////
typedef Size_MatType AbsFixture;
@ -1056,9 +1109,9 @@ PERF_TEST_P(AbsFixture, Abs,
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)))
OCL_PERF_TEST_P(RepeatFixture, Repeat,
::testing::Combine(OCL_PERF_ENUM(OCL_SIZE_1, OCL_SIZE_2, OCL_SIZE_3),
OCL_TEST_TYPES))
{
const Size_MatType_t params = GetParam();
const Size srcSize = get<0>(params);

@ -165,11 +165,11 @@ PERF_TEST_P(VideoMOGFixture, MOG,
///////////// MOG2 ////////////////////////
typedef tuple<string, int> VideoMOG2ParamType;
typedef TestBaseWithParam<VideoMOG2ParamType> VideoMOG2Fixture;
typedef TestBaseWithParam<VideoMOG2ParamType> MOG2_Apply;
PERF_TEST_P(VideoMOG2Fixture, DISABLED_MOG2, // TODO Disabled: random hungs on buildslave
::testing::Combine(::testing::Values("gpu/video/768x576.avi", "gpu/video/1920x1080.avi"),
::testing::Values(1, 3)))
OCL_PERF_TEST_P(MOG2_Apply, Mog2,
testing::Combine(testing::Values("gpu/video/768x576.avi", "gpu/video/1920x1080.avi"),
testing::Values(1, 3)))
{
VideoMOG2ParamType params = GetParam();
@ -195,9 +195,7 @@ PERF_TEST_P(VideoMOG2Fixture, DISABLED_MOG2, // TODO Disabled: random hungs on b
foreground.release();
for (int i = 0; i < nFrame; i++)
{
mog2(frame_buffer[i], foreground);
}
}
SANITY_CHECK(foreground);
}
@ -210,9 +208,7 @@ PERF_TEST_P(VideoMOG2Fixture, DISABLED_MOG2, // TODO Disabled: random hungs on b
cv::ocl::MOG2 d_mog2;
foreground_d.release();
for (int i = 0; i < nFrame; i++)
{
d_mog2(frame_buffer_ocl[i], foreground_d);
}
}
foreground_d.download(foreground);
SANITY_CHECK(foreground);
@ -223,11 +219,11 @@ PERF_TEST_P(VideoMOG2Fixture, DISABLED_MOG2, // TODO Disabled: random hungs on b
///////////// MOG2_GetBackgroundImage //////////////////
typedef TestBaseWithParam<VideoMOG2ParamType> Video_MOG2GetBackgroundImage;
typedef TestBaseWithParam<VideoMOG2ParamType> MOG2_GetBackgroundImage;
PERF_TEST_P(Video_MOG2GetBackgroundImage, MOG2,
::testing::Combine(::testing::Values("gpu/video/768x576.avi", "gpu/video/1920x1080.avi"),
::testing::Values(3)))
OCL_PERF_TEST_P(MOG2_GetBackgroundImage, Mog2,
testing::Combine(testing::Values("gpu/video/768x576.avi", "gpu/video/1920x1080.avi"),
testing::Values(3)))
{
VideoMOG2ParamType params = GetParam();
@ -248,7 +244,7 @@ PERF_TEST_P(Video_MOG2GetBackgroundImage, MOG2,
cv::ocl::oclMat foreground_d;
cv::ocl::oclMat background_d;
if(RUN_PLAIN_IMPL)
if (RUN_PLAIN_IMPL)
{
TEST_CYCLE()
{
@ -264,7 +260,7 @@ PERF_TEST_P(Video_MOG2GetBackgroundImage, MOG2,
}
SANITY_CHECK(background);
}
else if(RUN_OCL_IMPL)
else if (RUN_OCL_IMPL)
{
prepareData(frame_buffer, frame_buffer_ocl);
CV_Assert((int)(frame_buffer_ocl.size()) == nFrame);

@ -88,10 +88,10 @@ typedef void (*blendFunction)(const Mat &img1, const Mat &img2,
const Mat &weights1, const Mat &weights2,
Mat &result_gold);
typedef Size_MatType blendLinearFixture;
typedef Size_MatType BlendLinearFixture;
PERF_TEST_P(blendLinearFixture, blendLinear, ::testing::Combine(
OCL_TYPICAL_MAT_SIZES, testing::Values(CV_8UC1, CV_8UC3, CV_32FC1)))
OCL_PERF_TEST_P(BlendLinearFixture, BlendLinear,
::testing::Combine(OCL_TEST_SIZES, OCL_PERF_ENUM(CV_32FC1, CV_32FC4)))
{
Size_MatType_t params = GetParam();
const Size srcSize = get<0>(params);

@ -47,20 +47,17 @@
using namespace perf;
#define OCL_BFMATCHER_TYPICAL_MAT_SIZES ::testing::Values(cv::Size(128, 500), cv::Size(128, 1000), cv::Size(128, 2000))
//////////////////// BruteForceMatch /////////////////
typedef TestBaseWithParam<Size> BruteForceMatcherFixture;
PERF_TEST_P(BruteForceMatcherFixture, match,
OCL_BFMATCHER_TYPICAL_MAT_SIZES)
OCL_PERF_TEST_P(BruteForceMatcherFixture, Match, OCL_PERF_ENUM(OCL_SIZE_1, OCL_SIZE_2, OCL_SIZE_3))
{
const Size srcSize = GetParam();
vector<DMatch> matches;
Mat query(srcSize, CV_32F), train(srcSize, CV_32F);
declare.in(query, train).time(srcSize.height == 2000 ? 9 : 4 );
Mat query(srcSize, CV_32FC1), train(srcSize, CV_32FC1);
declare.in(query, train);
randu(query, 0.0f, 1.0f);
randu(train, 0.0f, 1.0f);
@ -75,12 +72,9 @@ PERF_TEST_P(BruteForceMatcherFixture, match,
{
ocl::BruteForceMatcher_OCL_base oclMatcher(ocl::BruteForceMatcher_OCL_base::L2Dist);
ocl::oclMat oclQuery(query), oclTrain(train);
ocl::oclMat oclTrainIdx, oclDistance;
OCL_TEST_CYCLE()
oclMatcher.matchSingle(oclQuery, oclTrain, oclTrainIdx, oclDistance);
oclMatcher.matchDownload(oclTrainIdx, oclDistance, matches);
oclMatcher.match(oclQuery, oclTrain, matches);
SANITY_CHECK_MATCHES(matches, 1e-5);
}
@ -88,8 +82,7 @@ PERF_TEST_P(BruteForceMatcherFixture, match,
OCL_PERF_ELSE
}
PERF_TEST_P(BruteForceMatcherFixture, knnMatch,
OCL_BFMATCHER_TYPICAL_MAT_SIZES)
OCL_PERF_TEST_P(BruteForceMatcherFixture, KnnMatch, OCL_PERF_ENUM(OCL_SIZE_1, OCL_SIZE_2, OCL_SIZE_3))
{
const Size srcSize = GetParam();
@ -99,8 +92,6 @@ PERF_TEST_P(BruteForceMatcherFixture, knnMatch,
randu(train, 0.0f, 1.0f);
declare.in(query, train);
if (srcSize.height == 2000)
declare.time(9);
if (RUN_PLAIN_IMPL)
{
@ -115,10 +106,10 @@ PERF_TEST_P(BruteForceMatcherFixture, knnMatch,
{
ocl::BruteForceMatcher_OCL_base oclMatcher(ocl::BruteForceMatcher_OCL_base::L2Dist);
ocl::oclMat oclQuery(query), oclTrain(train);
ocl::oclMat oclTrainIdx, oclDistance, oclAllDist;
ocl::oclMat oclTrainIdx, oclDistance;
OCL_TEST_CYCLE()
oclMatcher.knnMatchSingle(oclQuery, oclTrain, oclTrainIdx, oclDistance, oclAllDist, 2);
oclMatcher.knnMatch(oclQuery, oclTrain, matches, 2);
oclMatcher.knnMatchDownload(oclTrainIdx, oclDistance, matches);
@ -130,22 +121,18 @@ PERF_TEST_P(BruteForceMatcherFixture, knnMatch,
OCL_PERF_ELSE
}
PERF_TEST_P(BruteForceMatcherFixture, radiusMatch,
OCL_BFMATCHER_TYPICAL_MAT_SIZES)
OCL_PERF_TEST_P(BruteForceMatcherFixture, RadiusMatch, OCL_PERF_ENUM(OCL_SIZE_1, OCL_SIZE_2, OCL_SIZE_3))
{
const Size srcSize = GetParam();
const float max_distance = 2.0f;
vector<vector<DMatch> > matches(2);
Mat query(srcSize, CV_32F), train(srcSize, CV_32F);
Mat query(srcSize, CV_32FC1), train(srcSize, CV_32FC1);
declare.in(query, train);
randu(query, 0.0f, 1.0f);
randu(train, 0.0f, 1.0f);
if (srcSize.height == 2000)
declare.time(9.15);
if (RUN_PLAIN_IMPL)
{
cv::BFMatcher matcher(NORM_L2);
@ -162,7 +149,7 @@ PERF_TEST_P(BruteForceMatcherFixture, radiusMatch,
ocl::oclMat oclTrainIdx, oclDistance, oclNMatches;
OCL_TEST_CYCLE()
oclMatcher.radiusMatchSingle(oclQuery, oclTrain, oclTrainIdx, oclDistance, oclNMatches, max_distance);
oclMatcher.radiusMatch(oclQuery, oclTrain, matches, max_distance);
oclMatcher.radiusMatchDownload(oclTrainIdx, oclDistance, oclNMatches, matches);
@ -173,5 +160,3 @@ PERF_TEST_P(BruteForceMatcherFixture, radiusMatch,
else
OCL_PERF_ELSE
}
#undef OCL_BFMATCHER_TYPICAL_MAT_SIZES

@ -46,11 +46,21 @@
#include "perf_precomp.hpp"
using namespace perf;
using std::tr1::tuple;
using std::tr1::get;
///////////// Canny ////////////////////////
PERF_TEST(CannyFixture, Canny)
typedef tuple<int, bool> CannyParams;
typedef TestBaseWithParam<CannyParams> CannyFixture;
OCL_PERF_TEST_P(CannyFixture, Canny,
::testing::Combine(OCL_PERF_ENUM(3, 5), testing::Bool()))
{
const CannyParams params = GetParam();
int apertureSize = get<0>(params);
bool L2Grad = get<1>(params);
Mat img = imread(getDataPath("gpu/stereobm/aloe-L.png"), cv::IMREAD_GRAYSCALE),
edges(img.size(), CV_8UC1);
ASSERT_TRUE(!img.empty()) << "can't open aloe-L.png";
@ -61,16 +71,15 @@ PERF_TEST(CannyFixture, Canny)
{
ocl::oclMat oclImg(img), oclEdges(img.size(), CV_8UC1);
OCL_TEST_CYCLE() ocl::Canny(oclImg, oclEdges, 50.0, 100.0);
OCL_TEST_CYCLE() ocl::Canny(oclImg, oclEdges, 50.0, 100.0, apertureSize, L2Grad);
oclEdges.download(edges);
}
else if (RUN_PLAIN_IMPL)
{
TEST_CYCLE() Canny(img, edges, 50.0, 100.0);
TEST_CYCLE() Canny(img, edges, 50.0, 100.0, apertureSize, L2Grad);
}
else
OCL_PERF_ELSE
int value = 0;
SANITY_CHECK(value);
SANITY_CHECK_NOTHING();
}

@ -52,36 +52,36 @@ using std::tr1::make_tuple;
///////////// cvtColor////////////////////////
CV_ENUM(ConversionTypes, CV_RGB2GRAY, CV_RGB2BGR, CV_RGB2YUV, CV_YUV2RGB, CV_RGB2YCrCb,
CV_YCrCb2RGB, CV_RGB2XYZ, CV_XYZ2RGB, CV_RGB2HSV, CV_HSV2RGB, CV_RGB2HLS,
CV_HLS2RGB, CV_BGR5652BGR, CV_BGR2BGR565, CV_RGBA2mRGBA, CV_mRGBA2RGBA, CV_YUV2RGB_NV12)
CV_ENUM(ConversionTypes, COLOR_RGB2GRAY, COLOR_RGB2BGR, COLOR_RGB2YUV, COLOR_YUV2RGB, COLOR_RGB2YCrCb,
COLOR_YCrCb2RGB, COLOR_RGB2XYZ, COLOR_XYZ2RGB, COLOR_RGB2HSV, COLOR_HSV2RGB, COLOR_RGB2HLS,
COLOR_HLS2RGB, COLOR_BGR5652BGR, COLOR_BGR2BGR565, COLOR_RGBA2mRGBA, COLOR_mRGBA2RGBA, COLOR_YUV2RGB_NV12)
typedef tuple<Size, tuple<ConversionTypes, int, int> > cvtColorParams;
typedef TestBaseWithParam<cvtColorParams> cvtColorFixture;
typedef tuple<Size, tuple<ConversionTypes, int, int> > CvtColorParams;
typedef TestBaseWithParam<CvtColorParams> CvtColorFixture;
PERF_TEST_P(cvtColorFixture, cvtColor, testing::Combine(
testing::Values(Size(1000, 1002), Size(2000, 2004), Size(4000, 4008)),
OCL_PERF_TEST_P(CvtColorFixture, CvtColor, testing::Combine(
OCL_TEST_SIZES,
testing::Values(
make_tuple(ConversionTypes(CV_RGB2GRAY), 3, 1),
make_tuple(ConversionTypes(CV_RGB2BGR), 3, 3),
make_tuple(ConversionTypes(CV_RGB2YUV), 3, 3),
make_tuple(ConversionTypes(CV_YUV2RGB), 3, 3),
make_tuple(ConversionTypes(CV_RGB2YCrCb), 3, 3),
make_tuple(ConversionTypes(CV_YCrCb2RGB), 3, 3),
make_tuple(ConversionTypes(CV_RGB2XYZ), 3, 3),
make_tuple(ConversionTypes(CV_XYZ2RGB), 3, 3),
make_tuple(ConversionTypes(CV_RGB2HSV), 3, 3),
make_tuple(ConversionTypes(CV_HSV2RGB), 3, 3),
make_tuple(ConversionTypes(CV_RGB2HLS), 3, 3),
make_tuple(ConversionTypes(CV_HLS2RGB), 3, 3),
make_tuple(ConversionTypes(CV_BGR5652BGR), 2, 3),
make_tuple(ConversionTypes(CV_BGR2BGR565), 3, 2),
make_tuple(ConversionTypes(CV_RGBA2mRGBA), 4, 4),
make_tuple(ConversionTypes(CV_mRGBA2RGBA), 4, 4),
make_tuple(ConversionTypes(CV_YUV2RGB_NV12), 1, 3)
make_tuple(ConversionTypes(COLOR_RGB2GRAY), 3, 1),
make_tuple(ConversionTypes(COLOR_RGB2BGR), 3, 3),
make_tuple(ConversionTypes(COLOR_RGB2YUV), 3, 3),
make_tuple(ConversionTypes(COLOR_YUV2RGB), 3, 3),
make_tuple(ConversionTypes(COLOR_RGB2YCrCb), 3, 3),
make_tuple(ConversionTypes(COLOR_YCrCb2RGB), 3, 3),
make_tuple(ConversionTypes(COLOR_RGB2XYZ), 3, 3),
make_tuple(ConversionTypes(COLOR_XYZ2RGB), 3, 3),
make_tuple(ConversionTypes(COLOR_RGB2HSV), 3, 3),
make_tuple(ConversionTypes(COLOR_HSV2RGB), 3, 3),
make_tuple(ConversionTypes(COLOR_RGB2HLS), 3, 3),
make_tuple(ConversionTypes(COLOR_HLS2RGB), 3, 3),
make_tuple(ConversionTypes(COLOR_BGR5652BGR), 2, 3),
make_tuple(ConversionTypes(COLOR_BGR2BGR565), 3, 2),
make_tuple(ConversionTypes(COLOR_RGBA2mRGBA), 4, 4),
make_tuple(ConversionTypes(COLOR_mRGBA2RGBA), 4, 4),
make_tuple(ConversionTypes(COLOR_YUV2RGB_NV12), 1, 3)
)))
{
cvtColorParams params = GetParam();
CvtColorParams params = GetParam();
const Size srcSize = get<0>(params);
const tuple<int, int, int> conversionParams = get<1>(params);
const int code = get<0>(conversionParams), scn = get<1>(conversionParams),

@ -47,6 +47,8 @@
#include "perf_precomp.hpp"
using namespace perf;
using std::tr1::tuple;
using std::tr1::get;
///////////// dft ////////////////////////
@ -54,9 +56,16 @@ typedef TestBaseWithParam<Size> dftFixture;
#ifdef HAVE_CLAMDFFT
PERF_TEST_P(dftFixture, dft, OCL_TYPICAL_MAT_SIZES)
typedef tuple<Size, int> DftParams;
typedef TestBaseWithParam<DftParams> DftFixture;
OCL_PERF_TEST_P(DftFixture, Dft, ::testing::Combine(testing::Values(OCL_SIZE_1, OCL_SIZE_2, OCL_SIZE_3),
::testing::Values((int)DFT_ROWS, (int)DFT_SCALE, (int)DFT_INVERSE,
(int)DFT_INVERSE | DFT_SCALE, (int)DFT_ROWS | DFT_INVERSE)))
{
const Size srcSize = GetParam();
const Size_MatType_t params = GetParam();
const Size srcSize = get<0>(params);
const int flags = get<1>(params);
Mat src(srcSize, CV_32FC2), dst;
randu(src, 0.0f, 1.0f);
@ -69,7 +78,7 @@ PERF_TEST_P(dftFixture, dft, OCL_TYPICAL_MAT_SIZES)
{
ocl::oclMat oclSrc(src), oclDst;
OCL_TEST_CYCLE() cv::ocl::dft(oclSrc, oclDst);
OCL_TEST_CYCLE() cv::ocl::dft(oclSrc, oclDst, Size(), flags | DFT_COMPLEX_OUTPUT);
oclDst.download(dst);
@ -77,7 +86,7 @@ PERF_TEST_P(dftFixture, dft, OCL_TYPICAL_MAT_SIZES)
}
else if (RUN_PLAIN_IMPL)
{
TEST_CYCLE() cv::dft(src, dst);
TEST_CYCLE() cv::dft(src, dst, flags | DFT_COMPLEX_OUTPUT);
SANITY_CHECK(dst);
}

@ -49,31 +49,30 @@ using namespace perf;
using std::tr1::get;
using std::tr1::tuple;
typedef tuple<Size, MatType, int> FilterParams;
typedef TestBaseWithParam<FilterParams> FilterFixture;
///////////// Blur////////////////////////
typedef Size_MatType BlurFixture;
typedef FilterFixture BlurFixture;
PERF_TEST_P(BlurFixture, Blur,
::testing::Combine(OCL_TYPICAL_MAT_SIZES,
OCL_PERF_ENUM(CV_8UC1, CV_8UC4)))
OCL_PERF_TEST_P(BlurFixture, Blur,
::testing::Combine(OCL_TEST_SIZES, OCL_TEST_TYPES, OCL_PERF_ENUM(3, 5)))
{
const Size_MatType_t params = GetParam();
const Size srcSize = get<0>(params), ksize(3, 3);
const int type = get<1>(params), bordertype = BORDER_CONSTANT;
const FilterParams params = GetParam();
const Size srcSize = get<0>(params);
const int type = get<1>(params), ksize = get<2>(params), bordertype = BORDER_CONSTANT;
checkDeviceMaxMemoryAllocSize(srcSize, type);
Mat src(srcSize, type), dst(srcSize, type);
declare.in(src, WARMUP_RNG).out(dst);
if (srcSize == OCL_SIZE_4000 && type == CV_8UC4)
declare.time(5);
if (RUN_OCL_IMPL)
{
ocl::oclMat oclSrc(src), oclDst(srcSize, type);
OCL_TEST_CYCLE() cv::ocl::blur(oclSrc, oclDst, ksize, Point(-1, -1), bordertype);
OCL_TEST_CYCLE() cv::ocl::blur(oclSrc, oclDst, Size(ksize, ksize), Point(-1, -1), bordertype);
oclDst.download(dst);
@ -81,7 +80,7 @@ PERF_TEST_P(BlurFixture, Blur,
}
else if (RUN_PLAIN_IMPL)
{
TEST_CYCLE() cv::blur(src, dst, ksize, Point(-1, -1), bordertype);
TEST_CYCLE() cv::blur(src, dst, Size(ksize, ksize), Point(-1, -1), bordertype);
SANITY_CHECK(dst, 1 + DBL_EPSILON);
}
@ -91,24 +90,20 @@ PERF_TEST_P(BlurFixture, Blur,
///////////// Laplacian////////////////////////
typedef Size_MatType LaplacianFixture;
typedef FilterFixture LaplacianFixture;
PERF_TEST_P(LaplacianFixture, Laplacian,
::testing::Combine(OCL_TYPICAL_MAT_SIZES,
OCL_PERF_ENUM(CV_8UC1, CV_8UC4)))
OCL_PERF_TEST_P(LaplacianFixture, Laplacian,
::testing::Combine(OCL_TEST_SIZES, OCL_TEST_TYPES, OCL_PERF_ENUM(1, 3)))
{
const Size_MatType_t params = GetParam();
const FilterParams params = GetParam();
const Size srcSize = get<0>(params);
const int type = get<1>(params), ksize = 3;
const int type = get<1>(params), ksize = get<2>(params);
checkDeviceMaxMemoryAllocSize(srcSize, type);
Mat src(srcSize, type), dst(srcSize, type);
declare.in(src, WARMUP_RNG).out(dst);
if (srcSize == OCL_SIZE_4000 && type == CV_8UC4)
declare.time(6);
if (RUN_OCL_IMPL)
{
ocl::oclMat oclSrc(src), oclDst(srcSize, type);
@ -117,13 +112,13 @@ PERF_TEST_P(LaplacianFixture, Laplacian,
oclDst.download(dst);
SANITY_CHECK(dst);
SANITY_CHECK(dst, 5e-3);
}
else if (RUN_PLAIN_IMPL)
{
TEST_CYCLE() cv::Laplacian(src, dst, -1, ksize, 1);
SANITY_CHECK(dst);
SANITY_CHECK(dst, 5e-3);
}
else
OCL_PERF_ELSE
@ -131,15 +126,14 @@ PERF_TEST_P(LaplacianFixture, Laplacian,
///////////// Erode ////////////////////
typedef Size_MatType ErodeFixture;
typedef FilterFixture ErodeFixture;
PERF_TEST_P(ErodeFixture, Erode,
::testing::Combine(OCL_TYPICAL_MAT_SIZES,
OCL_PERF_ENUM(CV_8UC1, CV_8UC4, CV_32FC1, CV_32FC4)))
OCL_PERF_TEST_P(ErodeFixture, Erode,
::testing::Combine(OCL_TEST_SIZES, OCL_TEST_TYPES, OCL_PERF_ENUM(3, 5)))
{
const Size_MatType_t params = GetParam();
const FilterParams params = GetParam();
const Size srcSize = get<0>(params);
const int type = get<1>(params), ksize = 3;
const int type = get<1>(params), ksize = get<2>(params);
const Mat ker = getStructuringElement(MORPH_RECT, Size(ksize, ksize));
checkDeviceMaxMemoryAllocSize(srcSize, type);
@ -147,9 +141,6 @@ PERF_TEST_P(ErodeFixture, Erode,
Mat src(srcSize, type), dst(srcSize, type);
declare.in(src, WARMUP_RNG).out(dst).in(ker);
if (srcSize == OCL_SIZE_4000 && type == CV_8UC4)
declare.time(5);
if (RUN_OCL_IMPL)
{
ocl::oclMat oclSrc(src), oclDst(srcSize, type), oclKer(ker);
@ -170,13 +161,89 @@ PERF_TEST_P(ErodeFixture, Erode,
OCL_PERF_ELSE
}
///////////// Dilate ////////////////////
typedef FilterFixture DilateFixture;
OCL_PERF_TEST_P(DilateFixture, Dilate,
::testing::Combine(OCL_TEST_SIZES, OCL_TEST_TYPES, OCL_PERF_ENUM(3, 5)))
{
const FilterParams params = GetParam();
const Size srcSize = get<0>(params);
const int type = get<1>(params), ksize = get<2>(params);
const Mat ker = getStructuringElement(MORPH_RECT, Size(ksize, ksize));
checkDeviceMaxMemoryAllocSize(srcSize, type);
Mat src(srcSize, type), dst(srcSize, type);
declare.in(src, WARMUP_RNG).out(dst).in(ker);
if (RUN_OCL_IMPL)
{
ocl::oclMat oclSrc(src), oclDst(srcSize, type), oclKer(ker);
OCL_TEST_CYCLE() cv::ocl::dilate(oclSrc, oclDst, oclKer);
oclDst.download(dst);
SANITY_CHECK(dst);
}
else if (RUN_PLAIN_IMPL)
{
TEST_CYCLE() cv::dilate(src, dst, ker);
SANITY_CHECK(dst);
}
else
OCL_PERF_ELSE
}
///////////// MorphologyEx ////////////////////
CV_ENUM(MorphOp, MORPH_OPEN, MORPH_CLOSE, MORPH_GRADIENT, MORPH_TOPHAT, MORPH_BLACKHAT)
typedef tuple<Size, MatType, MorphOp, int> MorphologyExParams;
typedef TestBaseWithParam<MorphologyExParams> MorphologyExFixture;
OCL_PERF_TEST_P(MorphologyExFixture, MorphologyEx,
::testing::Combine(OCL_TEST_SIZES, OCL_TEST_TYPES, MorphOp::all(), OCL_PERF_ENUM(3, 5)))
{
const MorphologyExParams params = GetParam();
const Size srcSize = get<0>(params);
const int type = get<1>(params), op = get<2>(params), ksize = get<3>(params);
const Mat ker = getStructuringElement(MORPH_RECT, Size(ksize, ksize));
checkDeviceMaxMemoryAllocSize(srcSize, type);
Mat src(srcSize, type), dst(srcSize, type);
declare.in(src, WARMUP_RNG).out(dst).in(ker);
if (RUN_OCL_IMPL)
{
ocl::oclMat oclSrc(src), oclDst(srcSize, type), oclKer(ker);
OCL_TEST_CYCLE() cv::ocl::morphologyEx(oclSrc, oclDst, op, oclKer);
oclDst.download(dst);
SANITY_CHECK(dst);
}
else if (RUN_PLAIN_IMPL)
{
TEST_CYCLE() cv::morphologyEx(src, dst, op, ker);
SANITY_CHECK(dst);
}
else
OCL_PERF_ELSE
}
///////////// Sobel ////////////////////////
typedef Size_MatType SobelFixture;
PERF_TEST_P(SobelFixture, Sobel,
::testing::Combine(OCL_TYPICAL_MAT_SIZES,
OCL_PERF_ENUM(CV_8UC1, CV_8UC4)))
OCL_PERF_TEST_P(SobelFixture, Sobel,
::testing::Combine(OCL_TEST_SIZES, OCL_TEST_TYPES))
{
const Size_MatType_t params = GetParam();
const Size srcSize = get<0>(params);
@ -187,12 +254,6 @@ PERF_TEST_P(SobelFixture, Sobel,
Mat src(srcSize, type), dst(srcSize, type);
declare.in(src, WARMUP_RNG).out(dst);
if ((srcSize == OCL_SIZE_2000 && type == CV_8UC4) ||
(srcSize == OCL_SIZE_4000 && type == CV_8UC1))
declare.time(5.5);
else if (srcSize == OCL_SIZE_4000 && type == CV_8UC4)
declare.time(20);
if (RUN_OCL_IMPL)
{
ocl::oclMat oclSrc(src), oclDst(srcSize, type);
@ -217,9 +278,8 @@ PERF_TEST_P(SobelFixture, Sobel,
typedef Size_MatType ScharrFixture;
PERF_TEST_P(ScharrFixture, Scharr,
::testing::Combine(OCL_TYPICAL_MAT_SIZES,
OCL_PERF_ENUM(CV_8UC1, CV_8UC4)))
OCL_PERF_TEST_P(ScharrFixture, Scharr,
::testing::Combine(OCL_TEST_SIZES, OCL_TEST_TYPES))
{
const Size_MatType_t params = GetParam();
const Size srcSize = get<0>(params);
@ -230,12 +290,6 @@ PERF_TEST_P(ScharrFixture, Scharr,
Mat src(srcSize, type), dst(srcSize, type);
declare.in(src, WARMUP_RNG).out(dst);
if ((srcSize == OCL_SIZE_2000 && type == CV_8UC4) ||
(srcSize == OCL_SIZE_4000 && type == CV_8UC1))
declare.time(5.5);
else if (srcSize == OCL_SIZE_4000 && type == CV_8UC4)
declare.time(21);
if (RUN_OCL_IMPL)
{
ocl::oclMat oclSrc(src), oclDst(srcSize, type);
@ -244,7 +298,7 @@ PERF_TEST_P(ScharrFixture, Scharr,
oclDst.download(dst);
SANITY_CHECK(dst);
SANITY_CHECK(dst, 3e-3);
}
else if (RUN_PLAIN_IMPL)
{
@ -258,15 +312,14 @@ PERF_TEST_P(ScharrFixture, Scharr,
///////////// GaussianBlur ////////////////////////
typedef Size_MatType GaussianBlurFixture;
typedef FilterFixture GaussianBlurFixture;
PERF_TEST_P(GaussianBlurFixture, GaussianBlur,
::testing::Combine(::testing::Values(OCL_SIZE_1000, OCL_SIZE_2000),
OCL_PERF_ENUM(CV_8UC1, CV_8UC4, CV_32FC1, CV_32FC4)))
OCL_PERF_TEST_P(GaussianBlurFixture, GaussianBlur,
::testing::Combine(OCL_TEST_SIZES, OCL_TEST_TYPES, OCL_PERF_ENUM(3, 5, 7)))
{
const Size_MatType_t params = GetParam();
const FilterParams params = GetParam();
const Size srcSize = get<0>(params);
const int type = get<1>(params), ksize = 7;
const int type = get<1>(params), ksize = get<2>(params);
checkDeviceMaxMemoryAllocSize(srcSize, type);
@ -297,15 +350,14 @@ PERF_TEST_P(GaussianBlurFixture, GaussianBlur,
///////////// filter2D////////////////////////
typedef Size_MatType filter2DFixture;
typedef FilterFixture Filter2DFixture;
PERF_TEST_P(filter2DFixture, filter2D,
::testing::Combine(OCL_TYPICAL_MAT_SIZES,
OCL_PERF_ENUM(CV_8UC1, CV_8UC4)))
OCL_PERF_TEST_P(Filter2DFixture, Filter2D,
::testing::Combine(OCL_TEST_SIZES, OCL_TEST_TYPES, OCL_PERF_ENUM(3, 5)))
{
const Size_MatType_t params = GetParam();
const FilterParams params = GetParam();
const Size srcSize = get<0>(params);
const int type = get<1>(params), ksize = 3;
const int type = get<1>(params), ksize = get<2>(params);
checkDeviceMaxMemoryAllocSize(srcSize, type);
@ -313,9 +365,6 @@ PERF_TEST_P(filter2DFixture, filter2D,
declare.in(src, WARMUP_RNG).in(kernel).out(dst);
randu(kernel, -3.0, 3.0);
if (srcSize == OCL_SIZE_4000 && type == CV_8UC4)
declare.time(8);
if (RUN_OCL_IMPL)
{
ocl::oclMat oclSrc(src), oclDst(srcSize, type), oclKernel(kernel);
@ -324,13 +373,13 @@ PERF_TEST_P(filter2DFixture, filter2D,
oclDst.download(dst);
SANITY_CHECK(dst);
SANITY_CHECK(dst, 3e-2);
}
else if (RUN_PLAIN_IMPL)
{
TEST_CYCLE() cv::filter2D(src, dst, -1, kernel);
SANITY_CHECK(dst);
SANITY_CHECK(dst, 1e-2);
}
else
OCL_PERF_ELSE
@ -338,28 +387,22 @@ PERF_TEST_P(filter2DFixture, filter2D,
///////////// Bilateral////////////////////////
typedef Size_MatType BilateralFixture;
typedef TestBaseWithParam<Size> BilateralFixture;
PERF_TEST_P(BilateralFixture, Bilateral,
::testing::Combine(OCL_TYPICAL_MAT_SIZES,
OCL_PERF_ENUM(CV_8UC1, CV_8UC3)))
OCL_PERF_TEST_P(BilateralFixture, Bilateral, OCL_TEST_SIZES)
{
const Size_MatType_t params = GetParam();
const Size srcSize = get<0>(params);
const int type = get<1>(params), d = 7;
const Size srcSize = GetParam();
const int d = 7;
const double sigmacolor = 50.0, sigmaspace = 50.0;
checkDeviceMaxMemoryAllocSize(srcSize, type);
checkDeviceMaxMemoryAllocSize(srcSize, CV_8UC1);
Mat src(srcSize, type), dst(srcSize, type);
Mat src(srcSize, CV_8UC1), dst(srcSize, CV_8UC1);
declare.in(src, WARMUP_RNG).out(dst);
if (srcSize == OCL_SIZE_4000)
declare.time(type == CV_8UC3 ? 8 : 4.5);
if (RUN_OCL_IMPL)
{
ocl::oclMat oclSrc(src), oclDst(srcSize, type);
ocl::oclMat oclSrc(src), oclDst(srcSize, CV_8UC1);
OCL_TEST_CYCLE() cv::ocl::bilateralFilter(oclSrc, oclDst, d, sigmacolor, sigmaspace);
@ -377,37 +420,35 @@ PERF_TEST_P(BilateralFixture, Bilateral,
OCL_PERF_ELSE
}
///////////// adaptiveBilateral////////////////////////
///////////// MedianBlur////////////////////////
typedef Size_MatType adaptiveBilateralFixture;
typedef tuple<Size, int> MedianBlurParams;
typedef TestBaseWithParam<MedianBlurParams> MedianBlurFixture;
PERF_TEST_P(adaptiveBilateralFixture, DISABLED_adaptiveBilateral,
::testing::Combine(::testing::Values(OCL_SIZE_1000), OCL_PERF_ENUM(CV_8UC1, CV_8UC3)))
OCL_PERF_TEST_P(MedianBlurFixture, Bilateral, ::testing::Combine(OCL_TEST_SIZES, OCL_PERF_ENUM(3, 5)))
{
const Size_MatType_t params = GetParam();
MedianBlurParams params = GetParam();
const Size srcSize = get<0>(params);
const int type = get<1>(params);
const double sigmaspace = 10.0;
Size ksize(9, 9);
const int ksize = get<1>(params);
checkDeviceMaxMemoryAllocSize(srcSize, type);
checkDeviceMaxMemoryAllocSize(srcSize, CV_8UC1);
Mat src(srcSize, type), dst(srcSize, type);
Mat src(srcSize, CV_8UC1), dst(srcSize, CV_8UC1);
declare.in(src, WARMUP_RNG).out(dst);
if (RUN_OCL_IMPL)
{
ocl::oclMat oclSrc(src), oclDst(srcSize, type);
ocl::oclMat oclSrc(src), oclDst(srcSize, CV_8UC1);
OCL_TEST_CYCLE() cv::ocl::adaptiveBilateralFilter(oclSrc, oclDst, ksize, sigmaspace);
OCL_TEST_CYCLE() cv::ocl::medianFilter(oclSrc, oclDst, ksize);
oclDst.download(dst);
SANITY_CHECK(dst, 1.0);
SANITY_CHECK(dst);
}
else if (RUN_PLAIN_IMPL)
{
TEST_CYCLE() cv::adaptiveBilateralFilter(src, dst, ksize, sigmaspace);
TEST_CYCLE() cv::medianBlur(src, dst, ksize);
SANITY_CHECK(dst);
}

@ -46,16 +46,21 @@
#include "perf_precomp.hpp"
using namespace perf;
using std::tr1::get;
///////////// gemm ////////////////////////
typedef TestBaseWithParam<Size> gemmFixture;
typedef Size_MatType GemmFixture;
#ifdef HAVE_CLAMDBLAS
PERF_TEST_P(gemmFixture, gemm, ::testing::Values(OCL_SIZE_1000, OCL_SIZE_2000))
OCL_PERF_TEST_P(GemmFixture, Gemm, ::testing::Combine(
::testing::Values(Size(1000, 1000), Size(1500, 1500)),
::testing::Values((int)cv::GEMM_1_T, (int)cv::GEMM_1_T | (int)cv::GEMM_2_T)))
{
const Size srcSize = GetParam();
const Size_MatType_t params = GetParam();
const Size srcSize = get<0>(params);
const int type = get<1>(params);
Mat src1(srcSize, CV_32FC1), src2(srcSize, CV_32FC1),
src3(srcSize, CV_32FC1), dst(srcSize, CV_32FC1);
@ -69,7 +74,7 @@ PERF_TEST_P(gemmFixture, gemm, ::testing::Values(OCL_SIZE_1000, OCL_SIZE_2000))
ocl::oclMat oclSrc1(src1), oclSrc2(src2),
oclSrc3(src3), oclDst(srcSize, CV_32FC1);
OCL_TEST_CYCLE() cv::ocl::gemm(oclSrc1, oclSrc2, 1.0, oclSrc3, 1.0, oclDst);
OCL_TEST_CYCLE() cv::ocl::gemm(oclSrc1, oclSrc2, 1.0, oclSrc3, 1.0, oclDst, type);
oclDst.download(dst);
@ -77,7 +82,7 @@ PERF_TEST_P(gemmFixture, gemm, ::testing::Values(OCL_SIZE_1000, OCL_SIZE_2000))
}
else if (RUN_PLAIN_IMPL)
{
TEST_CYCLE() cv::gemm(src1, src2, 1.0, src3, 1.0, dst);
TEST_CYCLE() cv::gemm(src1, src2, 1.0, src3, 1.0, dst, type);
SANITY_CHECK(dst, 0.01);
}

@ -52,22 +52,21 @@ using std::tr1::get;
///////////// GoodFeaturesToTrack ////////////////////////
typedef tuple<string, double> GoodFeaturesToTrackParams;
typedef tuple<String, double, bool> GoodFeaturesToTrackParams;
typedef TestBaseWithParam<GoodFeaturesToTrackParams> GoodFeaturesToTrackFixture;
PERF_TEST_P(GoodFeaturesToTrackFixture, GoodFeaturesToTrack,
::testing::Combine(::testing::Values(string("gpu/opticalflow/rubberwhale1.png"),
string("gpu/stereobm/aloe-L.png")),
::testing::Range(0.0, 4.0, 3.0)))
OCL_PERF_TEST_P(GoodFeaturesToTrackFixture, GoodFeaturesToTrack,
::testing::Combine(OCL_PERF_ENUM(String("gpu/opticalflow/rubberwhale1.png")),
OCL_PERF_ENUM(0.0, 3.0), testing::Bool()))
{
const GoodFeaturesToTrackParams params = GetParam();
const String fileName = get<0>(params);
const double minDistance = get<1>(params), qualityLevel = 0.01;
const bool harrisDetector = get<2>(params);
const int maxCorners = 1000;
const GoodFeaturesToTrackParams param = GetParam();
const string fileName = getDataPath(get<0>(param));
const int maxCorners = 2000;
const double qualityLevel = 0.01, minDistance = get<1>(param);
Mat frame = imread(fileName, IMREAD_GRAYSCALE);
ASSERT_TRUE(!frame.empty()) << "no input image";
Mat frame = imread(getDataPath(fileName), IMREAD_GRAYSCALE);
ASSERT_FALSE(frame.empty()) << "no input image";
vector<Point2f> pts_gold;
declare.in(frame);
@ -75,7 +74,8 @@ PERF_TEST_P(GoodFeaturesToTrackFixture, GoodFeaturesToTrack,
if (RUN_OCL_IMPL)
{
ocl::oclMat oclFrame(frame), pts_oclmat;
ocl::GoodFeaturesToTrackDetector_OCL detector(maxCorners, qualityLevel, minDistance);
ocl::GoodFeaturesToTrackDetector_OCL detector(maxCorners, qualityLevel, minDistance, 3,
harrisDetector);
OCL_TEST_CYCLE() detector(oclFrame, pts_oclmat);
@ -86,7 +86,7 @@ PERF_TEST_P(GoodFeaturesToTrackFixture, GoodFeaturesToTrack,
else if (RUN_PLAIN_IMPL)
{
TEST_CYCLE() cv::goodFeaturesToTrack(frame, pts_gold,
maxCorners, qualityLevel, minDistance);
maxCorners, qualityLevel, minDistance, noArray(), 3, harrisDetector);
SANITY_CHECK(pts_gold);
}

@ -46,8 +46,13 @@
#include "perf_precomp.hpp"
using namespace perf;
using namespace std;
using namespace cv;
using std::tr1::make_tuple;
using std::tr1::get;
///////////// Haar ////////////////////////
PERF_TEST(HaarFixture, Haar)
{
vector<Rect> faces;
@ -84,23 +89,16 @@ PERF_TEST(HaarFixture, Haar)
OCL_PERF_ELSE
}
using namespace std;
using namespace cv;
using namespace perf;
using std::tr1::make_tuple;
using std::tr1::get;
typedef std::tr1::tuple<std::string, std::string, int> Cascade_Image_MinSize_t;
typedef perf::TestBaseWithParam<Cascade_Image_MinSize_t> Cascade_Image_MinSize;
typedef std::tr1::tuple<std::string, std::string, int> OCL_Cascade_Image_MinSize_t;
typedef perf::TestBaseWithParam<OCL_Cascade_Image_MinSize_t> OCL_Cascade_Image_MinSize;
PERF_TEST_P( OCL_Cascade_Image_MinSize, CascadeClassifier,
testing::Combine(
testing::Values( string("cv/cascadeandhog/cascades/haarcascade_frontalface_alt.xml"),
string("cv/cascadeandhog/cascades/haarcascade_frontalface_alt2.xml") ),
testing::Values( string("cv/shared/lena.png"),
string("cv/cascadeandhog/images/bttf301.png")/*,
string("cv/cascadeandhog/images/class57.png")*/ ),
testing::Values(30, 64, 90) ) )
OCL_PERF_TEST_P(Cascade_Image_MinSize, DISABLED_CascadeClassifier,
testing::Combine(testing::Values( string("cv/cascadeandhog/cascades/haarcascade_frontalface_alt.xml"),
string("cv/cascadeandhog/cascades/haarcascade_frontalface_alt2.xml") ),
testing::Values(string("cv/shared/lena.png"),
string("cv/cascadeandhog/images/bttf301.png")/*,
string("cv/cascadeandhog/images/class57.png")*/ ),
testing::Values(30, 64, 90)))
{
const string cascasePath = get<0>(GetParam());
const string imagePath = get<1>(GetParam());
@ -109,7 +107,7 @@ PERF_TEST_P( OCL_Cascade_Image_MinSize, CascadeClassifier,
vector<Rect> faces;
Mat img = imread(getDataPath(imagePath), IMREAD_GRAYSCALE);
ASSERT_TRUE(!img.empty()) << "Can't load source image: " << getDataPath(imagePath);
ASSERT_FALSE(img.empty()) << "Can't load source image: " << getDataPath(imagePath);
equalizeHist(img, img);
declare.in(img);
@ -146,7 +144,7 @@ PERF_TEST_P( OCL_Cascade_Image_MinSize, CascadeClassifier,
else
OCL_PERF_ELSE
//sort(faces.begin(), faces.end(), comparators::RectLess());
SANITY_CHECK_NOTHING();//(faces, min_size/5);
// using SANITY_CHECK_NOTHING() since OCL and PLAIN version may find different faces number
//sort(faces.begin(), faces.end(), comparators::RectLess());
SANITY_CHECK_NOTHING();//(faces, min_size/5);
// using SANITY_CHECK_NOTHING() since OCL and PLAIN version may find different faces number
}

@ -43,7 +43,9 @@
// the use of this software, even if advised of the possibility of such damage.
//
//M*/
#include "perf_precomp.hpp"
#include <functional>
using namespace perf;
@ -66,7 +68,7 @@ struct RectLess :
}
};
PERF_TEST(HOGFixture, HOG)
OCL_PERF_TEST(HOGFixture, HOG)
{
Mat src = imread(getDataPath("gpu/hog/road.png"), cv::IMREAD_GRAYSCALE);
ASSERT_TRUE(!src.empty()) << "can't open input image road.png";

@ -51,9 +51,9 @@ using std::tr1::get;
///////////// equalizeHist ////////////////////////
typedef TestBaseWithParam<Size> equalizeHistFixture;
typedef TestBaseWithParam<Size> EqualizeHistFixture;
PERF_TEST_P(equalizeHistFixture, equalizeHist, OCL_TYPICAL_MAT_SIZES)
OCL_PERF_TEST_P(EqualizeHistFixture, EqualizeHist, OCL_TEST_SIZES)
{
const Size srcSize = GetParam();
const double eps = 1 + DBL_EPSILON;
@ -83,16 +83,13 @@ PERF_TEST_P(equalizeHistFixture, equalizeHist, OCL_TYPICAL_MAT_SIZES)
/////////// CopyMakeBorder //////////////////////
CV_ENUM(Border, BORDER_CONSTANT, BORDER_REPLICATE, BORDER_REFLECT,
BORDER_WRAP, BORDER_REFLECT_101)
CV_ENUM(Border, BORDER_CONSTANT, BORDER_REPLICATE, BORDER_REFLECT, BORDER_WRAP, BORDER_REFLECT_101)
typedef tuple<Size, MatType, Border> CopyMakeBorderParamType;
typedef TestBaseWithParam<CopyMakeBorderParamType> CopyMakeBorderFixture;
PERF_TEST_P(CopyMakeBorderFixture, CopyMakeBorder,
::testing::Combine(OCL_TYPICAL_MAT_SIZES,
OCL_PERF_ENUM(CV_8UC1, CV_8UC4),
Border::all()))
OCL_PERF_TEST_P(CopyMakeBorderFixture, CopyMakeBorder,
::testing::Combine(OCL_TEST_SIZES, OCL_TEST_TYPES, Border::all()))
{
const CopyMakeBorderParamType params = GetParam();
const Size srcSize = get<0>(params);
@ -125,11 +122,10 @@ PERF_TEST_P(CopyMakeBorderFixture, CopyMakeBorder,
///////////// cornerMinEigenVal ////////////////////////
typedef Size_MatType cornerMinEigenValFixture;
typedef Size_MatType CornerMinEigenValFixture;
PERF_TEST_P(cornerMinEigenValFixture, cornerMinEigenVal,
::testing::Combine(OCL_TYPICAL_MAT_SIZES,
OCL_PERF_ENUM(CV_8UC1, CV_32FC1)))
OCL_PERF_TEST_P(CornerMinEigenValFixture, CornerMinEigenVal,
::testing::Combine(OCL_TEST_SIZES, OCL_PERF_ENUM(CV_8UC1, CV_32FC1)))
{
const Size_MatType_t params = GetParam();
const Size srcSize = get<0>(params);
@ -165,11 +161,10 @@ PERF_TEST_P(cornerMinEigenValFixture, cornerMinEigenVal,
///////////// cornerHarris ////////////////////////
typedef Size_MatType cornerHarrisFixture;
typedef Size_MatType CornerHarrisFixture;
PERF_TEST_P(cornerHarrisFixture, cornerHarris,
::testing::Combine(OCL_TYPICAL_MAT_SIZES,
OCL_PERF_ENUM(CV_8UC1, CV_32FC1)))
OCL_PERF_TEST_P(CornerHarrisFixture, CornerHarris,
::testing::Combine(OCL_TEST_SIZES, OCL_PERF_ENUM(CV_8UC1, CV_32FC1)))
{
const Size_MatType_t params = GetParam();
const Size srcSize = get<0>(params);
@ -202,11 +197,14 @@ PERF_TEST_P(cornerHarrisFixture, cornerHarris,
///////////// integral ////////////////////////
typedef TestBaseWithParam<Size> integralFixture;
typedef tuple<Size, MatDepth> IntegralParams;
typedef TestBaseWithParam<IntegralParams> IntegralFixture;
PERF_TEST_P(integralFixture, integral, OCL_TYPICAL_MAT_SIZES)
OCL_PERF_TEST_P(IntegralFixture, Integral1, ::testing::Combine(OCL_TEST_SIZES, OCL_PERF_ENUM(CV_32S, CV_32F)))
{
const Size srcSize = GetParam();
const IntegralParams params = GetParam();
const Size srcSize = get<0>(params);
const int sdepth = get<1>(params);
Mat src(srcSize, CV_8UC1), dst;
declare.in(src, WARMUP_RNG);
@ -215,17 +213,17 @@ PERF_TEST_P(integralFixture, integral, OCL_TYPICAL_MAT_SIZES)
{
ocl::oclMat oclSrc(src), oclDst;
OCL_TEST_CYCLE() cv::ocl::integral(oclSrc, oclDst);
OCL_TEST_CYCLE() cv::ocl::integral(oclSrc, oclDst, sdepth);
oclDst.download(dst);
SANITY_CHECK(dst);
SANITY_CHECK(dst, 1e-6, ERROR_RELATIVE);
}
else if (RUN_PLAIN_IMPL)
{
TEST_CYCLE() cv::integral(src, dst);
TEST_CYCLE() cv::integral(src, dst, sdepth);
SANITY_CHECK(dst);
SANITY_CHECK(dst, 1e-6, ERROR_RELATIVE);
}
else
OCL_PERF_ELSE
@ -233,15 +231,13 @@ PERF_TEST_P(integralFixture, integral, OCL_TYPICAL_MAT_SIZES)
///////////// threshold////////////////////////
CV_ENUM(ThreshType, THRESH_BINARY, THRESH_TOZERO_INV)
CV_ENUM(ThreshType, THRESH_BINARY, THRESH_BINARY_INV, THRESH_TRUNC, THRESH_TOZERO_INV)
typedef tuple<Size, MatType, ThreshType> ThreshParams;
typedef TestBaseWithParam<ThreshParams> ThreshFixture;
PERF_TEST_P(ThreshFixture, threshold,
::testing::Combine(OCL_TYPICAL_MAT_SIZES,
OCL_PERF_ENUM(CV_8UC1, CV_8UC4, CV_16SC1, CV_16SC4, CV_32FC1),
ThreshType::all()))
OCL_PERF_TEST_P(ThreshFixture, Threshold,
::testing::Combine(OCL_TEST_SIZES, OCL_TEST_TYPES, ThreshType::all()))
{
const ThreshParams params = GetParam();
const Size srcSize = get<0>(params);
@ -463,9 +459,9 @@ static void meanShiftFiltering_(const Mat &src_roi, Mat &dst_roi, int sp, int sr
}
}
typedef TestBaseWithParam<Size> meanShiftFilteringFixture;
typedef TestBaseWithParam<Size> MeanShiftFilteringFixture;
PERF_TEST_P(meanShiftFilteringFixture, meanShiftFiltering,
PERF_TEST_P(MeanShiftFilteringFixture, MeanShiftFiltering,
OCL_TYPICAL_MAT_SIZES)
{
const Size srcSize = GetParam();
@ -556,9 +552,9 @@ static void meanShiftProc_(const Mat &src_roi, Mat &dst_roi, Mat &dstCoor_roi, i
}
typedef TestBaseWithParam<Size> meanShiftProcFixture;
typedef TestBaseWithParam<Size> MeanShiftProcFixture;
PERF_TEST_P(meanShiftProcFixture, meanShiftProc,
PERF_TEST_P(MeanShiftProcFixture, MeanShiftProc,
OCL_TYPICAL_MAT_SIZES)
{
const Size srcSize = GetParam();
@ -598,7 +594,7 @@ PERF_TEST_P(meanShiftProcFixture, meanShiftProc,
typedef TestBaseWithParam<Size> CLAHEFixture;
PERF_TEST_P(CLAHEFixture, CLAHE, OCL_TYPICAL_MAT_SIZES)
OCL_PERF_TEST_P(CLAHEFixture, CLAHE, OCL_TEST_SIZES)
{
const Size srcSize = GetParam();
const string impl = getSelectedImpl();
@ -632,9 +628,9 @@ PERF_TEST_P(CLAHEFixture, CLAHE, OCL_TYPICAL_MAT_SIZES)
OCL_PERF_ELSE
}
///////////// columnSum////////////////////////
///////////// ColumnSum////////////////////////
typedef TestBaseWithParam<Size> columnSumFixture;
typedef TestBaseWithParam<Size> ColumnSumFixture;
static void columnSumPerfTest(const Mat & src, Mat & dst)
{
@ -646,7 +642,7 @@ static void columnSumPerfTest(const Mat & src, Mat & dst)
dst.at<float>(i, j) = dst.at<float>(i - 1 , j) + src.at<float>(i , j);
}
PERF_TEST_P(columnSumFixture, columnSum, OCL_TYPICAL_MAT_SIZES)
PERF_TEST_P(ColumnSumFixture, ColumnSum, OCL_TYPICAL_MAT_SIZES)
{
const Size srcSize = GetParam();
@ -680,8 +676,8 @@ PERF_TEST_P(columnSumFixture, columnSum, OCL_TYPICAL_MAT_SIZES)
CV_ENUM(DistType, NORM_L1, NORM_L2SQR)
typedef tuple<Size, DistType> distanceToCentersParameters;
typedef TestBaseWithParam<distanceToCentersParameters> distanceToCentersFixture;
typedef tuple<Size, DistType> DistanceToCentersParams;
typedef TestBaseWithParam<DistanceToCentersParams> DistanceToCentersFixture;
static void distanceToCentersPerfTest(Mat& src, Mat& centers, Mat& dists, Mat& labels, int distType)
{
@ -706,10 +702,11 @@ static void distanceToCentersPerfTest(Mat& src, Mat& centers, Mat& dists, Mat& l
Mat(labels_v).copyTo(labels);
}
PERF_TEST_P(distanceToCentersFixture, distanceToCenters, ::testing::Combine(::testing::Values(cv::Size(256,256), cv::Size(512,512)), DistType::all()) )
PERF_TEST_P(DistanceToCentersFixture, DistanceToCenters, ::testing::Combine(::testing::Values(cv::Size(256,256), cv::Size(512,512)), DistType::all()) )
{
Size size = get<0>(GetParam());
int distType = get<1>(GetParam());
const DistanceToCentersParams params = GetParam();
Size size = get<0>(params);
int distType = get<1>(params);
Mat src(size, CV_32FC1), centers(size, CV_32FC1);
Mat dists(src.rows, 1, CV_32FC1), labels(src.rows, 1, CV_32SC1);

@ -51,11 +51,13 @@ using std::tr1::get;
///////////// WarpAffine ////////////////////////
typedef Size_MatType WarpAffineFixture;
CV_ENUM(InterType, INTER_NEAREST, INTER_LINEAR)
PERF_TEST_P(WarpAffineFixture, WarpAffine,
::testing::Combine(OCL_TYPICAL_MAT_SIZES,
OCL_PERF_ENUM(CV_8UC1, CV_8UC4)))
typedef tuple<Size, MatType, InterType> WarpAffineParams;
typedef TestBaseWithParam<WarpAffineParams> WarpAffineFixture;
OCL_PERF_TEST_P(WarpAffineFixture, WarpAffine,
::testing::Combine(OCL_TEST_SIZES, OCL_TEST_TYPES_134, InterType::all()))
{
static const double coeffs[2][3] =
{
@ -63,11 +65,12 @@ PERF_TEST_P(WarpAffineFixture, WarpAffine,
{ 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 WarpAffineParams params = GetParam();
const Size srcSize = get<0>(params);
const int type = get<1>(params);
const int type = get<1>(params), interpolation = get<2>(params);
checkDeviceMaxMemoryAllocSize(srcSize, type);
Mat src(srcSize, type), dst(srcSize, type);
declare.in(src, WARMUP_RNG).out(dst);
@ -80,13 +83,13 @@ PERF_TEST_P(WarpAffineFixture, WarpAffine,
oclDst.download(dst);
SANITY_CHECK(dst);
SANITY_CHECK(dst, 5e-4);
}
else if (RUN_PLAIN_IMPL)
{
TEST_CYCLE() cv::warpAffine(src, dst, M, srcSize, interpolation);
SANITY_CHECK(dst);
SANITY_CHECK(dst, 5e-4);
}
else
OCL_PERF_ELSE
@ -94,11 +97,11 @@ PERF_TEST_P(WarpAffineFixture, WarpAffine,
///////////// WarpPerspective ////////////////////////
typedef Size_MatType WarpPerspectiveFixture;
typedef WarpAffineParams WarpPerspectiveParams;
typedef TestBaseWithParam<WarpPerspectiveParams> WarpPerspectiveFixture;
PERF_TEST_P(WarpPerspectiveFixture, WarpPerspective,
::testing::Combine(OCL_TYPICAL_MAT_SIZES,
OCL_PERF_ENUM(CV_8UC1, CV_8UC4)))
OCL_PERF_TEST_P(WarpPerspectiveFixture, WarpPerspective,
::testing::Combine(OCL_TEST_SIZES, OCL_TEST_TYPES_134, InterType::all()))
{
static const double coeffs[3][3] =
{
@ -107,15 +110,15 @@ PERF_TEST_P(WarpPerspectiveFixture, WarpPerspective,
{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 WarpPerspectiveParams params = GetParam();
const Size srcSize = get<0>(params);
const int type = get<1>(params);
const int type = get<1>(params), interpolation = get<2>(params);
checkDeviceMaxMemoryAllocSize(srcSize, type);
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);
declare.in(src, WARMUP_RNG).out(dst);
if (RUN_OCL_IMPL)
{
@ -125,32 +128,28 @@ PERF_TEST_P(WarpPerspectiveFixture, WarpPerspective,
oclDst.download(dst);
SANITY_CHECK(dst);
SANITY_CHECK(dst, 5e-4);
}
else if (RUN_PLAIN_IMPL)
{
TEST_CYCLE() cv::warpPerspective(src, dst, M, srcSize, interpolation);
SANITY_CHECK(dst);
SANITY_CHECK(dst, 5e-4);
}
else
OCL_PERF_ELSE
}
///////////// resize ////////////////////////
CV_ENUM(resizeInterType, INTER_NEAREST, INTER_LINEAR)
///////////// Resize ////////////////////////
typedef tuple<Size, MatType, resizeInterType, double> resizeParams;
typedef TestBaseWithParam<resizeParams> resizeFixture;
typedef tuple<Size, MatType, InterType, 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)))
OCL_PERF_TEST_P(ResizeFixture, Resize,
::testing::Combine(OCL_TEST_SIZES, OCL_TEST_TYPES_134,
InterType::all(), ::testing::Values(0.5, 2.0)))
{
const resizeParams params = GetParam();
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);
@ -162,8 +161,6 @@ PERF_TEST_P(resizeFixture, resize,
Mat src(srcSize, type), dst;
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)
{
@ -185,15 +182,13 @@ PERF_TEST_P(resizeFixture, resize,
OCL_PERF_ELSE
}
typedef tuple<Size, MatType, double> resizeAreaParams;
typedef TestBaseWithParam<resizeAreaParams> resizeAreaFixture;
typedef tuple<Size, MatType, double> ResizeAreaParams;
typedef TestBaseWithParam<ResizeAreaParams> ResizeAreaFixture;
PERF_TEST_P(resizeAreaFixture, resize,
::testing::Combine(OCL_TYPICAL_MAT_SIZES,
OCL_PERF_ENUM(CV_8UC1, CV_8UC4, CV_32FC1, CV_32FC4),
::testing::Values(0.3, 0.5, 0.6)))
OCL_PERF_TEST_P(ResizeAreaFixture, Resize,
::testing::Combine(OCL_TEST_SIZES, OCL_TEST_TYPES_134, ::testing::Values(0.3, 0.5, 0.6)))
{
const resizeAreaParams params = GetParam();
const ResizeAreaParams params = GetParam();
const Size srcSize = get<0>(params);
const int type = get<1>(params);
double scale = get<2>(params);
@ -225,19 +220,15 @@ PERF_TEST_P(resizeAreaFixture, resize,
OCL_PERF_ELSE
}
///////////// remap////////////////////////
CV_ENUM(RemapInterType, INTER_NEAREST, INTER_LINEAR)
///////////// Remap ////////////////////////
typedef tuple<Size, MatType, RemapInterType> remapParams;
typedef TestBaseWithParam<remapParams> remapFixture;
typedef tuple<Size, MatType, InterType> 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()))
OCL_PERF_TEST_P(RemapFixture, Remap,
::testing::Combine(OCL_TEST_SIZES, OCL_TEST_TYPES, InterType::all()))
{
const remapParams params = GetParam();
const RemapParams params = GetParam();
const Size srcSize = get<0>(params);
const int type = get<1>(params), interpolation = get<2>(params);
@ -287,7 +278,7 @@ PERF_TEST_P(remapFixture, remap,
}
///////////// buildWarpPerspectiveMaps ////////////////////////
///////////// BuildWarpPerspectiveMaps ////////////////////////
static void buildWarpPerspectiveMaps(const Mat &M, bool inverse, Size dsize, Mat &xmap, Mat &ymap)
{
@ -323,9 +314,9 @@ static void buildWarpPerspectiveMaps(const Mat &M, bool inverse, Size dsize, Mat
}
}
typedef TestBaseWithParam<Size> buildWarpPerspectiveMapsFixture;
typedef TestBaseWithParam<Size> BuildWarpPerspectiveMapsFixture;
PERF_TEST_P(buildWarpPerspectiveMapsFixture, Inverse, OCL_TYPICAL_MAT_SIZES)
PERF_TEST_P(BuildWarpPerspectiveMapsFixture, Inverse, OCL_TYPICAL_MAT_SIZES)
{
static const double coeffs[3][3] =
{

@ -43,6 +43,7 @@
// the use of this software, even if advised of the possibility of such damage.
//
//M*/
#include "perf_precomp.hpp"
using namespace perf;
@ -53,8 +54,8 @@ using std::tr1::get;
typedef Size_MatType CV_TM_CCORRFixture;
PERF_TEST_P(CV_TM_CCORRFixture, matchTemplate,
::testing::Combine(::testing::Values(OCL_SIZE_1000, OCL_SIZE_2000),
OCL_PERF_TEST_P(CV_TM_CCORRFixture, matchTemplate,
::testing::Combine(::testing::Values(Size(1000, 1000), Size(2000, 2000)),
OCL_PERF_ENUM(CV_32FC1, CV_32FC4)))
{
const Size_MatType_t params = GetParam();
@ -66,7 +67,7 @@ PERF_TEST_P(CV_TM_CCORRFixture, matchTemplate,
Mat dst(dstSize, CV_32F);
randu(src, 0.0f, 1.0f);
randu(templ, 0.0f, 1.0f);
declare.time(srcSize == OCL_SIZE_2000 ? 20 : 6).in(src, templ).out(dst);
declare.in(src, templ).out(dst);
if (RUN_OCL_IMPL)
{
@ -90,7 +91,8 @@ PERF_TEST_P(CV_TM_CCORRFixture, matchTemplate,
typedef TestBaseWithParam<Size> CV_TM_CCORR_NORMEDFixture;
PERF_TEST_P(CV_TM_CCORR_NORMEDFixture, matchTemplate, OCL_TYPICAL_MAT_SIZES)
OCL_PERF_TEST_P(CV_TM_CCORR_NORMEDFixture, matchTemplate,
::testing::Values(Size(1000, 1000), Size(2000, 2000), Size(4000, 4000)))
{
const Size srcSize = GetParam(), templSize(5, 5);
@ -125,7 +127,7 @@ CV_ENUM(MethodType, TM_SQDIFF, TM_SQDIFF_NORMED, TM_CCORR, TM_CCORR_NORMED, TM_C
typedef std::tr1::tuple<Size, Size, MethodType> ImgSize_TmplSize_Method_t;
typedef TestBaseWithParam<ImgSize_TmplSize_Method_t> ImgSize_TmplSize_Method;
PERF_TEST_P(ImgSize_TmplSize_Method, MatchTemplate,
OCL_PERF_TEST_P(ImgSize_TmplSize_Method, MatchTemplate,
::testing::Combine(
testing::Values(szSmall128, cv::Size(320, 240),
cv::Size(640, 480), cv::Size(800, 600),

@ -53,9 +53,7 @@ using std::tr1::get;
typedef Size_MatType ConvertToFixture;
PERF_TEST_P(ConvertToFixture, ConvertTo,
::testing::Combine(OCL_TYPICAL_MAT_SIZES,
OCL_PERF_ENUM(CV_8UC1, CV_8UC4)))
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);
@ -92,11 +90,9 @@ PERF_TEST_P(ConvertToFixture, ConvertTo,
///////////// copyTo////////////////////////
typedef Size_MatType copyToFixture;
typedef Size_MatType CopyToFixture;
PERF_TEST_P(copyToFixture, copyTo,
::testing::Combine(OCL_TYPICAL_MAT_SIZES,
OCL_PERF_ENUM(CV_8UC1, CV_8UC4)))
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);
@ -127,11 +123,9 @@ PERF_TEST_P(copyToFixture, copyTo,
///////////// setTo////////////////////////
typedef Size_MatType setToFixture;
typedef Size_MatType SetToFixture;
PERF_TEST_P(setToFixture, setTo,
::testing::Combine(OCL_TYPICAL_MAT_SIZES,
OCL_PERF_ENUM(CV_8UC1, CV_8UC4)))
OCL_PERF_TEST_P(SetToFixture, SetTo, ::testing::Combine(OCL_TEST_SIZES, OCL_TEST_TYPES))
{
const Size_MatType_t params = GetParam();
const Size srcSize = get<0>(params);
@ -164,16 +158,16 @@ PERF_TEST_P(setToFixture, setTo,
/////////////////// upload ///////////////////////////
typedef tuple<Size, MatDepth, int> uploadParams;
typedef TestBaseWithParam<uploadParams> uploadFixture;
typedef tuple<Size, MatDepth, int> UploadParams;
typedef TestBaseWithParam<uploadParams> UploadFixture;
PERF_TEST_P(uploadFixture, upload,
PERF_TEST_P(UploadFixture, Upload,
testing::Combine(
OCL_TYPICAL_MAT_SIZES,
testing::Values(CV_8U, CV_8S, CV_16U, CV_16S, CV_32S, CV_32F),
testing::Range(1, 5)))
{
const uploadParams params = GetParam();
const UploadParams params = GetParam();
const Size srcSize = get<0>(params);
const int depth = get<1>(params), cn = get<2>(params);
const int type = CV_MAKE_TYPE(depth, cn);
@ -201,15 +195,15 @@ PERF_TEST_P(uploadFixture, upload,
/////////////////// download ///////////////////////////
typedef TestBaseWithParam<uploadParams> downloadFixture;
typedef TestBaseWithParam<uploadParams> DownloadFixture;
PERF_TEST_P(downloadFixture, download,
PERF_TEST_P(DownloadFixture, Download,
testing::Combine(
OCL_TYPICAL_MAT_SIZES,
testing::Values(CV_8U, CV_8S, CV_16U, CV_16S, CV_32S, CV_32F),
testing::Range(1, 5)))
{
const uploadParams params = GetParam();
const UploadParams params = GetParam();
const Size srcSize = get<0>(params);
const int depth = get<1>(params), cn = get<2>(params);
const int type = CV_MAKE_TYPE(depth, cn);

@ -55,22 +55,19 @@ using namespace cvtest;
using namespace testing;
using namespace std;
///////////// Moments ////////////////////////
//*! performance of image
typedef tuple<Size, MatType, bool> MomentsParamType;
typedef TestBaseWithParam<MomentsParamType> MomentsFixture;
PERF_TEST_P(MomentsFixture, Moments,
::testing::Combine(OCL_TYPICAL_MAT_SIZES,
OCL_PERF_ENUM(CV_8UC1, CV_16SC1, CV_16UC1, CV_32FC1), ::testing::Bool()))
typedef tuple<Size, bool> MomentsParams;
typedef TestBaseWithParam<MomentsParams> MomentsFixture;
OCL_PERF_TEST_P(MomentsFixture, Moments,
::testing::Combine(OCL_TEST_SIZES, ::testing::Bool()))
{
const MomentsParamType params = GetParam();
const MomentsParams params = GetParam();
const Size srcSize = get<0>(params);
const int type = get<1>(params);
const bool binaryImage = get<2>(params);
const bool binaryImage = get<1>(params);
Mat src(srcSize, type), dst(7, 1, CV_64F);
Mat src(srcSize, CV_8UC1), dst(7, 1, CV_64F);
randu(src, 0, 255);
cv::Moments mom;
@ -85,6 +82,7 @@ PERF_TEST_P(MomentsFixture, Moments,
}
else
OCL_PERF_ELSE
cv::HuMoments(mom, dst);
SANITY_CHECK(dst, 2e-1);
}

@ -51,18 +51,21 @@ using std::tr1::get;
///////////// norm////////////////////////
typedef tuple<Size, MatType> normParams;
typedef TestBaseWithParam<normParams> normFixture;
CV_ENUM(NormType, NORM_INF, NORM_L1, NORM_L2)
PERF_TEST_P(normFixture, norm, testing::Combine(
OCL_TYPICAL_MAT_SIZES,
OCL_PERF_ENUM(CV_8UC1, CV_32FC1)))
typedef std::tr1::tuple<Size, MatType, NormType> NormParams;
typedef TestBaseWithParam<NormParams> NormFixture;
OCL_PERF_TEST_P(NormFixture, Norm,
::testing::Combine(OCL_PERF_ENUM(OCL_SIZE_1, OCL_SIZE_2, OCL_SIZE_3),
OCL_TEST_TYPES, NormType::all()))
{
const normParams params = GetParam();
const NormParams params = GetParam();
const Size srcSize = get<0>(params);
const int type = get<1>(params);
double value = 0.0;
const double eps = CV_MAT_DEPTH(type) == CV_8U ? DBL_EPSILON : 1e-3;
const int normType = get<2>(params);
perf::ERROR_TYPE errorType = type != NORM_INF ? ERROR_RELATIVE : ERROR_ABSOLUTE;
double eps = 1e-5, value;
Mat src1(srcSize, type), src2(srcSize, type);
declare.in(src1, src2, WARMUP_RNG);
@ -71,15 +74,15 @@ PERF_TEST_P(normFixture, norm, testing::Combine(
{
ocl::oclMat oclSrc1(src1), oclSrc2(src2);
OCL_TEST_CYCLE() value = cv::ocl::norm(oclSrc1, oclSrc2, NORM_INF);
OCL_TEST_CYCLE() value = cv::ocl::norm(oclSrc1, oclSrc2, normType);
SANITY_CHECK(value, eps);
SANITY_CHECK(value, eps, errorType);
}
else if (RUN_PLAIN_IMPL)
{
TEST_CYCLE() value = cv::norm(src1, src2, NORM_INF);
TEST_CYCLE() value = cv::norm(src1, src2, normType);
SANITY_CHECK(value);
SANITY_CHECK(value, eps, errorType);
}
else
OCL_PERF_ELSE

@ -52,55 +52,28 @@ using std::tr1::get;
using std::tr1::tuple;
using std::tr1::make_tuple;
CV_ENUM(LoadMode, IMREAD_GRAYSCALE, IMREAD_COLOR)
typedef tuple<int, tuple<string, string, LoadMode> > PyrLKOpticalFlowParamType;
typedef TestBaseWithParam<PyrLKOpticalFlowParamType> PyrLKOpticalFlowFixture;
PERF_TEST_P(PyrLKOpticalFlowFixture,
PyrLKOpticalFlow,
::testing::Combine(
::testing::Values(1000, 2000, 4000),
::testing::Values(
make_tuple<string, string, LoadMode>
(
string("gpu/opticalflow/rubberwhale1.png"),
string("gpu/opticalflow/rubberwhale2.png"),
LoadMode(IMREAD_COLOR)
),
make_tuple<string, string, LoadMode>
(
string("gpu/stereobm/aloe-L.png"),
string("gpu/stereobm/aloe-R.png"),
LoadMode(IMREAD_GRAYSCALE)
)
)
)
)
typedef tuple<int> PyrLKOpticalFlowParamType;
typedef TestBaseWithParam<int> PyrLKOpticalFlowFixture;
OCL_PERF_TEST_P(PyrLKOpticalFlowFixture,
PyrLKOpticalFlow, ::testing::Values(1000, 2000, 4000))
{
PyrLKOpticalFlowParamType params = GetParam();
tuple<string, string, LoadMode> fileParam = get<1>(params);
const int pointsCount = get<0>(params);
const int openMode = static_cast<int>(get<2>(fileParam));
const string fileName0 = get<0>(fileParam), fileName1 = get<1>(fileParam);
Mat frame0 = imread(getDataPath(fileName0), openMode);
Mat frame1 = imread(getDataPath(fileName1), openMode);
const int pointsCount = GetParam();
const string fileName0 = "gpu/opticalflow/rubberwhale1.png",
fileName1 = "gpu/opticalflow/rubberwhale2.png";
Mat frame0 = imread(getDataPath(fileName0), cv::IMREAD_GRAYSCALE);
Mat frame1 = imread(getDataPath(fileName1), cv::IMREAD_GRAYSCALE);
declare.in(frame0, frame1);
ASSERT_FALSE(frame0.empty()) << "can't load " << fileName0;
ASSERT_FALSE(frame1.empty()) << "can't load " << fileName1;
Mat grayFrame;
if (openMode == IMREAD_COLOR)
cvtColor(frame0, grayFrame, COLOR_BGR2GRAY);
else
grayFrame = frame0;
vector<Point2f> pts, nextPts;
vector<unsigned char> status;
vector<float> err;
goodFeaturesToTrack(grayFrame, pts, pointsCount, 0.01, 0.0);
goodFeaturesToTrack(frame0, pts, pointsCount, 0.01, 0.0);
Mat ptsMat(1, static_cast<int>(pts.size()), CV_32FC2, (void *)&pts[0]);
if (RUN_PLAIN_IMPL)
@ -178,12 +151,11 @@ CV_ENUM(farneFlagType, 0, OPTFLOW_FARNEBACK_GAUSSIAN)
typedef tuple<tuple<int, double>, farneFlagType, bool> FarnebackOpticalFlowParams;
typedef TestBaseWithParam<FarnebackOpticalFlowParams> FarnebackOpticalFlowFixture;
PERF_TEST_P(FarnebackOpticalFlowFixture, FarnebackOpticalFlow,
::testing::Combine(
::testing::Values(make_tuple<int, double>(5, 1.1),
make_tuple<int, double>(7, 1.5)),
farneFlagType::all(),
::testing::Bool()))
OCL_PERF_TEST_P(FarnebackOpticalFlowFixture, FarnebackOpticalFlow,
::testing::Combine(
::testing::Values(make_tuple<int, double>(5, 1.1),
make_tuple<int, double>(7, 1.5)),
farneFlagType::all(), ::testing::Bool()))
{
Mat frame0 = imread(getDataPath("gpu/opticalflow/rubberwhale1.png"), cv::IMREAD_GRAYSCALE);
ASSERT_FALSE(frame0.empty()) << "can't load rubberwhale1.png";

@ -70,8 +70,7 @@
#include "opencv2/ocl/ocl.hpp"
#include "opencv2/ts/ts.hpp"
using namespace std;
using namespace cv;
// TODO remove it
#define OCL_SIZE_1000 Size(1000, 1000)
#define OCL_SIZE_2000 Size(2000, 2000)
@ -79,6 +78,19 @@ using namespace cv;
#define OCL_TYPICAL_MAT_SIZES ::testing::Values(OCL_SIZE_1000, OCL_SIZE_2000, OCL_SIZE_4000)
using namespace std;
using namespace cv;
#define OCL_SIZE_1 szVGA
#define OCL_SIZE_2 sz720p
#define OCL_SIZE_3 sz1080p
#define OCL_SIZE_4 sz2160p
#define OCL_TEST_SIZES ::testing::Values(OCL_SIZE_1, OCL_SIZE_2, OCL_SIZE_3, OCL_SIZE_4)
#define OCL_TEST_TYPES ::testing::Values(CV_8UC1, CV_32FC1, CV_8UC4, CV_32FC4)
#define OCL_TEST_TYPES_14 OCL_TEST_TYPES
#define OCL_TEST_TYPES_134 ::testing::Values(CV_8UC1, CV_32FC1, CV_8UC3, CV_32FC3, CV_8UC4, CV_32FC4)
#define OCL_PERF_ENUM(type, ...) ::testing::Values(type, ## __VA_ARGS__ )
#define IMPL_OCL "ocl"
@ -103,6 +115,31 @@ using namespace cv;
CV_TEST_FAIL_NO_IMPL();
#endif
#define OCL_PERF_TEST(fixture, name) \
class OCL##_##fixture##_##name : \
public ::perf::TestBase \
{ \
public: \
OCL##_##fixture##_##name() { } \
protected: \
virtual void PerfTestBody(); \
}; \
TEST_F(OCL##_##fixture##_##name, name) { RunPerfTestBody(); } \
void OCL##_##fixture##_##name::PerfTestBody()
#define OCL_PERF_TEST_P(fixture, name, params) \
class OCL##_##fixture##_##name : \
public fixture \
{ \
public: \
OCL##_##fixture##_##name() { } \
protected: \
virtual void PerfTestBody(); \
}; \
TEST_P(OCL##_##fixture##_##name, name) { RunPerfTestBody(); } \
INSTANTIATE_TEST_CASE_P(/*none*/, OCL##_##fixture##_##name, params); \
void OCL##_##fixture##_##name::PerfTestBody()
#define OCL_TEST_CYCLE_N(n) for(declare.iterations(n); startTimer(), next(); cv::ocl::finish(), stopTimer())
#define OCL_TEST_CYCLE() for(; startTimer(), next(); cv::ocl::finish(), stopTimer())
#define OCL_TEST_CYCLE_MULTIRUN(runsNum) for(declare.runs(runsNum); startTimer(), next(); stopTimer()) for(int r = 0; r < runsNum; cv::ocl::finish(), ++r)

@ -51,11 +51,10 @@ using std::tr1::get;
///////////// pyrDown //////////////////////
typedef Size_MatType pyrDownFixture;
typedef Size_MatType PyrDownFixture;
PERF_TEST_P(pyrDownFixture, pyrDown,
::testing::Combine(OCL_TYPICAL_MAT_SIZES,
OCL_PERF_ENUM(CV_8UC1, CV_8UC4)))
OCL_PERF_TEST_P(PyrDownFixture, PyrDown,
::testing::Combine(OCL_TEST_SIZES, OCL_TEST_TYPES))
{
const Size_MatType_t params = GetParam();
const Size srcSize = get<0>(params);
@ -77,7 +76,7 @@ PERF_TEST_P(pyrDownFixture, pyrDown,
oclDst.download(dst);
SANITY_CHECK(dst);
SANITY_CHECK(dst, 5e-4);
}
else if (RUN_PLAIN_IMPL)
{
@ -91,11 +90,10 @@ PERF_TEST_P(pyrDownFixture, pyrDown,
///////////// pyrUp ////////////////////////
typedef Size_MatType pyrUpFixture;
typedef Size_MatType PyrUpFixture;
PERF_TEST_P(pyrUpFixture, pyrUp,
::testing::Combine(OCL_TYPICAL_MAT_SIZES,
OCL_PERF_ENUM(CV_8UC1, CV_8UC4)))
OCL_PERF_TEST_P(PyrUpFixture, PyrUp,
::testing::Combine(OCL_TEST_SIZES, OCL_TEST_TYPES))
{
const Size_MatType_t params = GetParam();
const Size srcSize = get<0>(params);
@ -117,7 +115,7 @@ PERF_TEST_P(pyrUpFixture, pyrUp,
oclDst.download(dst);
SANITY_CHECK(dst);
SANITY_CHECK(dst, 5e-4);
}
else if (RUN_PLAIN_IMPL)
{

@ -51,21 +51,22 @@ using std::tr1::get;
///////////// Merge////////////////////////
typedef Size_MatType MergeFixture;
typedef tuple<Size, MatDepth, int> MergeParams;
typedef TestBaseWithParam<MergeParams> MergeFixture;
PERF_TEST_P(MergeFixture, Merge,
::testing::Combine(::testing::Values(OCL_SIZE_1000, OCL_SIZE_2000),
OCL_PERF_ENUM(CV_8U, CV_32F)))
OCL_PERF_TEST_P(MergeFixture, Merge,
::testing::Combine(OCL_TEST_SIZES, OCL_PERF_ENUM(CV_8U, CV_32F),
OCL_PERF_ENUM(2, 3)))
{
const Size_MatType_t params = GetParam();
const MergeParams params = GetParam();
const Size srcSize = get<0>(params);
const int depth = get<1>(params), channels = 3;
const int dstType = CV_MAKE_TYPE(depth, channels);
const int depth = get<1>(params), cn = get<2>(params),
dtype = CV_MAKE_TYPE(depth, cn);
checkDeviceMaxMemoryAllocSize(srcSize, dstType);
checkDeviceMaxMemoryAllocSize(srcSize, dtype);
Mat dst(srcSize, dstType);
vector<Mat> src(channels);
Mat dst(srcSize, dtype);
vector<Mat> src(cn);
for (vector<Mat>::iterator i = src.begin(), end = src.end(); i != end; ++i)
{
i->create(srcSize, CV_MAKE_TYPE(depth, 1));
@ -75,7 +76,7 @@ PERF_TEST_P(MergeFixture, Merge,
if (RUN_OCL_IMPL)
{
ocl::oclMat oclDst(srcSize, dstType);
ocl::oclMat oclDst(srcSize, dtype);
vector<ocl::oclMat> oclSrc(src.size());
for (vector<ocl::oclMat>::size_type i = 0, end = src.size(); i < end; ++i)
oclSrc[i] = src[i];
@ -98,49 +99,69 @@ PERF_TEST_P(MergeFixture, Merge,
///////////// Split////////////////////////
typedef Size_MatType SplitFixture;
typedef MergeParams SplitParams;
typedef TestBaseWithParam<SplitParams> SplitFixture;
PERF_TEST_P(SplitFixture, Split,
::testing::Combine(OCL_TYPICAL_MAT_SIZES,
OCL_PERF_ENUM(CV_8U, CV_32F)))
OCL_PERF_TEST_P(SplitFixture, Split,
::testing::Combine(OCL_TEST_SIZES, OCL_PERF_ENUM(CV_8U, CV_32F),
OCL_PERF_ENUM(2, 3)))
{
const Size_MatType_t params = GetParam();
const SplitParams params = GetParam();
const Size srcSize = get<0>(params);
const int depth = get<1>(params), channels = 3;
const int type = CV_MAKE_TYPE(depth, channels);
const int depth = get<1>(params), cn = get<2>(params);
const int type = CV_MAKE_TYPE(depth, cn);
checkDeviceMaxMemoryAllocSize(srcSize, type);
Mat src(srcSize, type);
Mat dst0, dst1, dst2;
declare.in(src, WARMUP_RNG);
ASSERT_TRUE(cn == 3 || cn == 2);
if (RUN_OCL_IMPL)
{
ocl::oclMat oclSrc(src);
vector<ocl::oclMat> oclDst(channels, ocl::oclMat(srcSize, CV_MAKE_TYPE(depth, 1)));
vector<ocl::oclMat> oclDst(cn);
oclDst[0] = ocl::oclMat(srcSize, depth);
oclDst[1] = ocl::oclMat(srcSize, depth);
if (cn == 3)
oclDst[2] = ocl::oclMat(srcSize, depth);
OCL_TEST_CYCLE() cv::ocl::split(oclSrc, oclDst);
ASSERT_EQ(3, channels);
Mat dst0, dst1, dst2;
oclDst[0].download(dst0);
oclDst[1].download(dst1);
oclDst[2].download(dst2);
SANITY_CHECK(dst0);
SANITY_CHECK(dst1);
SANITY_CHECK(dst2);
if (cn == 3)
oclDst[2].download(dst2);
}
else if (RUN_PLAIN_IMPL)
{
vector<Mat> dst(channels, Mat(srcSize, CV_MAKE_TYPE(depth, 1)));
vector<Mat> dst(cn);
dst[0] = Mat(srcSize, depth);
dst[1] = Mat(srcSize, depth);
if (cn == 3)
dst[2] = Mat(srcSize, depth);
TEST_CYCLE() cv::split(src, dst);
ASSERT_EQ(3, channels);
Mat & dst0 = dst[0], & dst1 = dst[1], & dst2 = dst[2];
dst0 = dst[0];
dst1 = dst[1];
if (cn == 3)
dst2 = dst[2];
}
else
OCL_PERF_ELSE
if (cn == 2)
{
SANITY_CHECK(dst0);
SANITY_CHECK(dst1);
}
else if (cn == 3)
{
SANITY_CHECK(dst0);
SANITY_CHECK(dst1);
SANITY_CHECK(dst2);
}
else
OCL_PERF_ELSE
}

Loading…
Cancel
Save