Added perf test for INTER_AREA resize

This commit is contained in:
Andrey Kamaev 2011-12-29 11:55:26 +00:00
parent 7fafa3b00a
commit 683be58119

View File

@ -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<MatType, Size, int> MatInfo_Size_Scale_t;
typedef TestBaseWithParam<MatInfo_Size_Scale_t> 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);
}