add sanity checks into the matop gpu performance tests
authormarina.kolpakova <marina.kolpakova@itseez.com>
Wed, 10 Oct 2012 05:04:38 +0000 (09:04 +0400)
committermarina.kolpakova <marina.kolpakova@itseez.com>
Wed, 10 Oct 2012 12:13:25 +0000 (16:13 +0400)
modules/gpu/perf/perf_matop.cpp

index 83e2787..87dc285 100644 (file)
@@ -18,7 +18,7 @@ PERF_TEST_P(Sz_Depth_Cn, MatOp_SetTo, Combine(GPU_TYPICAL_MAT_SIZES, Values(CV_8
 \r
     cv::Scalar val(1, 2, 3, 4);\r
 \r
-    if (runOnGpu)\r
+    if (PERF_RUN_GPU())\r
     {\r
         cv::gpu::GpuMat d_src(size, type);\r
 \r
@@ -28,6 +28,8 @@ PERF_TEST_P(Sz_Depth_Cn, MatOp_SetTo, Combine(GPU_TYPICAL_MAT_SIZES, Values(CV_8
         {\r
             d_src.setTo(val);\r
         }\r
+\r
+        GPU_SANITY_CHECK(d_src);\r
     }\r
     else\r
     {\r
@@ -39,6 +41,8 @@ PERF_TEST_P(Sz_Depth_Cn, MatOp_SetTo, Combine(GPU_TYPICAL_MAT_SIZES, Values(CV_8
         {\r
             src.setTo(val);\r
         }\r
+\r
+        CPU_SANITY_CHECK(src);\r
     }\r
 }\r
 \r
@@ -61,7 +65,7 @@ PERF_TEST_P(Sz_Depth_Cn, MatOp_SetToMasked, Combine(GPU_TYPICAL_MAT_SIZES, Value
 \r
     cv::Scalar val(1, 2, 3, 4);\r
 \r
-    if (runOnGpu)\r
+    if (PERF_RUN_GPU())\r
     {\r
         cv::gpu::GpuMat d_src(src);\r
         cv::gpu::GpuMat d_mask(mask);\r
@@ -72,6 +76,8 @@ PERF_TEST_P(Sz_Depth_Cn, MatOp_SetToMasked, Combine(GPU_TYPICAL_MAT_SIZES, Value
         {\r
             d_src.setTo(val, d_mask);\r
         }\r
+\r
+        GPU_SANITY_CHECK(d_src);\r
     }\r
     else\r
     {\r
@@ -81,6 +87,8 @@ PERF_TEST_P(Sz_Depth_Cn, MatOp_SetToMasked, Combine(GPU_TYPICAL_MAT_SIZES, Value
         {\r
             src.setTo(val, mask);\r
         }\r
+\r
+        CPU_SANITY_CHECK(src);\r
     }\r
 }\r
 \r
@@ -101,7 +109,7 @@ PERF_TEST_P(Sz_Depth_Cn, MatOp_CopyToMasked, Combine(GPU_TYPICAL_MAT_SIZES, Valu
     cv::Mat mask(size, CV_8UC1);\r
     fillRandom(mask, 0, 2);\r
 \r
-    if (runOnGpu)\r
+    if (PERF_RUN_GPU())\r
     {\r
         cv::gpu::GpuMat d_src(src);\r
         cv::gpu::GpuMat d_mask(mask);\r
@@ -113,6 +121,8 @@ PERF_TEST_P(Sz_Depth_Cn, MatOp_CopyToMasked, Combine(GPU_TYPICAL_MAT_SIZES, Valu
         {\r
             d_src.copyTo(d_dst, d_mask);\r
         }\r
+\r
+        GPU_SANITY_CHECK(d_dst);\r
     }\r
     else\r
     {\r
@@ -124,6 +134,8 @@ PERF_TEST_P(Sz_Depth_Cn, MatOp_CopyToMasked, Combine(GPU_TYPICAL_MAT_SIZES, Valu
         {\r
             src.copyTo(dst, mask);\r
         }\r
+\r
+        CPU_SANITY_CHECK(dst);\r
     }\r
 }\r
 \r
@@ -141,7 +153,7 @@ PERF_TEST_P(Sz_2Depth, MatOp_ConvertTo, Combine(GPU_TYPICAL_MAT_SIZES, Values(CV
     cv::Mat src(size, depth1);\r
     fillRandom(src);\r
 \r
-    if (runOnGpu)\r
+    if (PERF_RUN_GPU())\r
     {\r
         cv::gpu::GpuMat d_src(src);\r
         cv::gpu::GpuMat d_dst;\r
@@ -152,6 +164,8 @@ PERF_TEST_P(Sz_2Depth, MatOp_ConvertTo, Combine(GPU_TYPICAL_MAT_SIZES, Values(CV
         {\r
             d_src.convertTo(d_dst, depth2, 0.5, 1.0);\r
         }\r
+\r
+        GPU_SANITY_CHECK(d_dst);\r
     }\r
     else\r
     {\r
@@ -163,6 +177,8 @@ PERF_TEST_P(Sz_2Depth, MatOp_ConvertTo, Combine(GPU_TYPICAL_MAT_SIZES, Values(CV
         {\r
             src.convertTo(dst, depth2, 0.5, 1.0);\r
         }\r
+\r
+        CPU_SANITY_CHECK(dst);\r
     }\r
 }\r
 \r