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:
@@ -3,51 +3,45 @@
|
||||
using namespace std;
|
||||
using namespace cv;
|
||||
using namespace perf;
|
||||
using std::tr1::make_tuple;
|
||||
using std::tr1::get;
|
||||
|
||||
typedef std::tr1::tuple<Size, MatType, MatDepth> Size_MatType_OutMatDepth_t;
|
||||
typedef perf::TestBaseWithParam<Size_MatType_OutMatDepth_t> Size_MatType_OutMatDepth;
|
||||
|
||||
/*
|
||||
// void integral(InputArray image, OutputArray sum, int sdepth=-1 )
|
||||
*/
|
||||
PERF_TEST_P( Size_MatType_OutMatDepth, integral,
|
||||
testing::Combine(
|
||||
testing::Values( TYPICAL_MAT_SIZES ),
|
||||
testing::Values( CV_8UC1, CV_8UC4 ),
|
||||
testing::Values( CV_32S, CV_32F, CV_64F )
|
||||
)
|
||||
)
|
||||
PERF_TEST_P(Size_MatType_OutMatDepth, integral,
|
||||
testing::Combine(
|
||||
testing::Values(TYPICAL_MAT_SIZES),
|
||||
testing::Values(CV_8UC1, CV_8UC4),
|
||||
testing::Values(CV_32S, CV_32F, CV_64F)
|
||||
)
|
||||
)
|
||||
{
|
||||
Size sz = std::tr1::get<0>(GetParam());
|
||||
int matType = std::tr1::get<1>(GetParam());
|
||||
int sdepth = std::tr1::get<2>(GetParam());
|
||||
Size sz = get<0>(GetParam());
|
||||
int matType = get<1>(GetParam());
|
||||
int sdepth = get<2>(GetParam());
|
||||
|
||||
Mat src(sz, matType);
|
||||
Mat sum(sz, sdepth);
|
||||
|
||||
declare.in(src, WARMUP_RNG).out(sum);
|
||||
|
||||
TEST_CYCLE(100) { integral(src, sum, sdepth); }
|
||||
TEST_CYCLE() integral(src, sum, sdepth);
|
||||
|
||||
SANITY_CHECK(sum);
|
||||
SANITY_CHECK(sum, 1e-6);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
// void integral(InputArray image, OutputArray sum, OutputArray sqsum, int sdepth=-1 )
|
||||
*/
|
||||
PERF_TEST_P( Size_MatType_OutMatDepth, integral_sqsum,
|
||||
testing::Combine(
|
||||
testing::Values( TYPICAL_MAT_SIZES ),
|
||||
testing::Values( CV_8UC1, CV_8UC4 ),
|
||||
testing::Values( CV_32S, CV_32F, CV_64F )
|
||||
)
|
||||
)
|
||||
PERF_TEST_P(Size_MatType_OutMatDepth, integral_sqsum,
|
||||
testing::Combine(
|
||||
testing::Values(TYPICAL_MAT_SIZES),
|
||||
testing::Values(CV_8UC1, CV_8UC4),
|
||||
testing::Values(CV_32S, CV_32F, CV_64F)
|
||||
)
|
||||
)
|
||||
{
|
||||
Size sz = std::tr1::get<0>(GetParam());
|
||||
int matType = std::tr1::get<1>(GetParam());
|
||||
int sdepth = std::tr1::get<2>(GetParam());
|
||||
Size sz = get<0>(GetParam());
|
||||
int matType = get<1>(GetParam());
|
||||
int sdepth = get<2>(GetParam());
|
||||
|
||||
Mat src(sz, matType);
|
||||
Mat sum(sz, sdepth);
|
||||
@@ -55,28 +49,23 @@ PERF_TEST_P( Size_MatType_OutMatDepth, integral_sqsum,
|
||||
|
||||
declare.in(src, WARMUP_RNG).out(sum, sqsum);
|
||||
|
||||
TEST_CYCLE(100) { integral(src, sum, sqsum, sdepth); }
|
||||
TEST_CYCLE() integral(src, sum, sqsum, sdepth);
|
||||
|
||||
SANITY_CHECK(sum);
|
||||
SANITY_CHECK(sqsum);
|
||||
SANITY_CHECK(sum, 1e-6);
|
||||
SANITY_CHECK(sqsum, 1e-6);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
// void integral(InputArray image, OutputArray sum, OutputArray sqsum, OutputArray tilted, int sdepth=-1 )
|
||||
*/
|
||||
PERF_TEST_P( Size_MatType_OutMatDepth, integral_sqsum_tilted,
|
||||
testing::Combine(
|
||||
testing::Values( TYPICAL_MAT_SIZES ),
|
||||
testing::Values( CV_8UC1, CV_8UC4 ),
|
||||
testing::Values( CV_32S, CV_32F, CV_64F )
|
||||
)
|
||||
)
|
||||
testing::Combine(
|
||||
testing::Values( TYPICAL_MAT_SIZES ),
|
||||
testing::Values( CV_8UC1, CV_8UC4 ),
|
||||
testing::Values( CV_32S, CV_32F, CV_64F )
|
||||
)
|
||||
)
|
||||
{
|
||||
Size sz = std::tr1::get<0>(GetParam());
|
||||
int matType = std::tr1::get<1>(GetParam());
|
||||
int sdepth = std::tr1::get<2>(GetParam());
|
||||
Size sz = get<0>(GetParam());
|
||||
int matType = get<1>(GetParam());
|
||||
int sdepth = get<2>(GetParam());
|
||||
|
||||
Mat src(sz, matType);
|
||||
Mat sum(sz, sdepth);
|
||||
@@ -85,9 +74,9 @@ PERF_TEST_P( Size_MatType_OutMatDepth, integral_sqsum_tilted,
|
||||
|
||||
declare.in(src, WARMUP_RNG).out(sum, sqsum, tilted);
|
||||
|
||||
TEST_CYCLE(100) { integral(src, sum, sqsum, tilted, sdepth); }
|
||||
TEST_CYCLE() integral(src, sum, sqsum, tilted, sdepth);
|
||||
|
||||
SANITY_CHECK(sum);
|
||||
SANITY_CHECK(sqsum);
|
||||
SANITY_CHECK(tilted);
|
||||
SANITY_CHECK(sum, 1e-6);
|
||||
SANITY_CHECK(sqsum, 1e-6);
|
||||
SANITY_CHECK(tilted, 1e-6);
|
||||
}
|
||||
|
Reference in New Issue
Block a user