From 683be5811940dc1b975e4da9d18fc9dd6a1f90ae Mon Sep 17 00:00:00 2001 From: Andrey Kamaev Date: Thu, 29 Dec 2011 11:55:26 +0000 Subject: [PATCH] Added perf test for INTER_AREA resize --- .../perf/perf_geometric_transformations.cpp | 33 ++++++++++++++++++++-- 1 file changed, 31 insertions(+), 2 deletions(-) diff --git a/modules/imgproc/perf/perf_geometric_transformations.cpp b/modules/imgproc/perf/perf_geometric_transformations.cpp index 07a3701..8f1ff20 100644 --- a/modules/imgproc/perf/perf_geometric_transformations.cpp +++ b/modules/imgproc/perf/perf_geometric_transformations.cpp @@ -24,7 +24,7 @@ PERF_TEST_P(MatInfo_Size_Size, resizeUpLinear, declare.in(src, WARMUP_RNG).out(dst); - TEST_CYCLE(100) cv::resize(src, dst, to); + SIMPLE_TEST_CYCLE() cv::resize(src, dst, to); SANITY_CHECK(dst, 1 + 1e-6); } @@ -48,8 +48,37 @@ PERF_TEST_P(MatInfo_Size_Size, resizeDownLinear, declare.in(src, WARMUP_RNG).out(dst); - TEST_CYCLE(100) cv::resize(src, dst, to); + SIMPLE_TEST_CYCLE() cv::resize(src, dst, to); SANITY_CHECK(dst, 1 + 1e-6); } + +typedef tr1::tuple MatInfo_Size_Scale_t; +typedef TestBaseWithParam MatInfo_Size_Scale; + +PERF_TEST_P( MatInfo_Size_Scale, resizeAreaFast, + testing::Combine( + testing::Values( CV_8UC1, CV_8UC4 ), + testing::Values( szVGA, szqHD, sz720p, sz1080p ), + testing::Values( 2, 4 ) + ) + ) +{ + int matType = tr1::get<0>(GetParam()); + Size from = tr1::get<1>(GetParam()); + int scale = tr1::get<2>(GetParam()); + + from.width = (from.width/scale)*scale; + from.height = (from.height/scale)*scale; + + cv::Mat src(from, matType); + cv::Mat dst(from.height / scale, from.width / scale, matType); + + declare.in(src, WARMUP_RNG).out(dst); + + SIMPLE_TEST_CYCLE() cv::resize(src, dst, dst.size(), 0, 0, INTER_AREA); + + //difference equal to 1 is allowed because of different possible rounding modes: round-to-nearest vs bankers' rounding + SANITY_CHECK(dst, 1); +} -- 2.7.4