master-like performance tests

This commit is contained in:
Ilya Lavrenov
2014-02-28 14:15:56 +04:00
parent 7dc22b4ea6
commit c1c3139368
22 changed files with 667 additions and 556 deletions

View File

@@ -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);