Added perf test for INTER_AREA resize
authorAndrey Kamaev <no@email>
Thu, 29 Dec 2011 11:55:26 +0000 (11:55 +0000)
committerAndrey Kamaev <no@email>
Thu, 29 Dec 2011 11:55:26 +0000 (11:55 +0000)
modules/imgproc/perf/perf_geometric_transformations.cpp

index 07a3701..8f1ff20 100644 (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);
+}