Refactored performance tests. TEST_CYCLE macro is renamed to TEST_CYCLE_N; SIMPLE_TEST_CYCLE is renamed to TEST_CYCLE; from now 100 iterations are default for performance tests

This commit is contained in:
Andrey Kamaev
2011-12-29 16:46:16 +00:00
parent 80f422a531
commit 65f5343ed5
39 changed files with 1062 additions and 1039 deletions

View File

@@ -3,6 +3,8 @@
using namespace std;
using namespace cv;
using namespace perf;
using std::tr1::make_tuple;
using std::tr1::get;
CV_ENUM(ThreshType, THRESH_BINARY, THRESH_BINARY_INV, THRESH_TRUNC, THRESH_TOZERO, THRESH_TOZERO_INV)
@@ -14,48 +16,41 @@ PERF_TEST_P(Size_MatType_ThreshType, threshold,
testing::Values(TYPICAL_MAT_SIZES),
testing::Values(CV_8UC1, CV_16SC1),
testing::ValuesIn(ThreshType::all())
)
)
)
{
Size sz = std::tr1::get<0>(GetParam());
int type = std::tr1::get<1>(GetParam());
ThreshType threshType = std::tr1::get<2>(GetParam());
Size sz = get<0>(GetParam());
int type = get<1>(GetParam());
ThreshType threshType = get<2>(GetParam());
Mat src(sz, type);
Mat dst(sz, type);
double thresh = cv::theRNG().uniform(1, 254);
double maxval = cv::theRNG().uniform(1, 254);
double thresh = theRNG().uniform(1, 254);
double maxval = theRNG().uniform(1, 254);
declare.in(src, WARMUP_RNG).out(dst);
TEST_CYCLE(100)
{
cv::threshold(src, dst, thresh, maxval, threshType);
}
TEST_CYCLE() threshold(src, dst, thresh, maxval, threshType);
SANITY_CHECK(dst);
}
typedef perf::TestBaseWithParam<Size> Size_Only;
PERF_TEST_P(Size_Only, threshold_otsu, testing::Values(TYPICAL_MAT_SIZES) )
PERF_TEST_P(Size_Only, threshold_otsu, testing::Values(TYPICAL_MAT_SIZES))
{
Size sz = GetParam();
Mat src(sz, CV_8UC1);
Mat dst(sz, CV_8UC1);
double maxval = cv::theRNG().uniform(1, 254);
double maxval = theRNG().uniform(1, 254);
declare.in(src, WARMUP_RNG).out(dst);
TEST_CYCLE(100)
{
cv::threshold(src, dst, 0, maxval, THRESH_BINARY|THRESH_OTSU);
}
TEST_CYCLE() threshold(src, dst, 0, maxval, THRESH_BINARY|THRESH_OTSU);
SANITY_CHECK(dst);
}