fixed optical flow test for devices with cc >= 2.0
authorVladislav Vinogradov <no@email>
Mon, 7 Nov 2011 06:23:22 +0000 (06:23 +0000)
committerVladislav Vinogradov <no@email>
Mon, 7 Nov 2011 06:23:22 +0000 (06:23 +0000)
modules/gpu/test/test_video.cpp

index 76d8aeb..f643290 100644 (file)
 \r
 //#define DUMP\r
 \r
+#define OPTICAL_FLOW_DUMP_FILE            "opticalflow/opticalflow_gold.bin"\r
+#define OPTICAL_FLOW_DUMP_FILE_CC20       "opticalflow/opticalflow_gold_cc20.bin"\r
+#define INTERPOLATE_FRAMES_DUMP_FILE      "opticalflow/interpolate_frames_gold.bin"\r
+#define INTERPOLATE_FRAMES_DUMP_FILE_CC20 "opticalflow/interpolate_frames_gold_cc20.bin"\r
+\r
 struct BroxOpticalFlow : testing::TestWithParam< cv::gpu::DeviceInfo >\r
 {\r
     cv::gpu::DeviceInfo devInfo;\r
@@ -71,7 +76,13 @@ struct BroxOpticalFlow : testing::TestWithParam< cv::gpu::DeviceInfo >
 \r
 #ifndef DUMP\r
 \r
-        std::ifstream f((std::string(cvtest::TS::ptr()->get_data_path()) + "opticalflow/opticalflow_gold.bin").c_str(), std::ios_base::binary);\r
+        std::string fname(cvtest::TS::ptr()->get_data_path());\r
+        if (devInfo.majorVersion() >= 2)\r
+            fname += OPTICAL_FLOW_DUMP_FILE_CC20;\r
+        else\r
+            fname += OPTICAL_FLOW_DUMP_FILE;\r
+\r
+        std::ifstream f(fname.c_str(), std::ios_base::binary);\r
 \r
         int rows, cols;\r
 \r
@@ -118,7 +129,13 @@ TEST_P(BroxOpticalFlow, Regression)
 \r
 #else\r
 \r
-    std::ofstream f((std::string(cvtest::TS::ptr()->get_data_path()) + "opticalflow/opticalflow_gold.bin").c_str(), std::ios_base::binary);\r
+    std::string fname(cvtest::TS::ptr()->get_data_path());\r
+    if (devInfo.majorVersion() >= 2)\r
+        fname += OPTICAL_FLOW_DUMP_FILE_CC20;\r
+    else\r
+        fname += OPTICAL_FLOW_DUMP_FILE;\r
+\r
+    std::ofstream f(fname.c_str(), std::ios_base::binary);\r
 \r
     f.write((char*)&u.rows, sizeof(u.rows));\r
     f.write((char*)&u.cols, sizeof(u.cols));\r
@@ -134,11 +151,6 @@ TEST_P(BroxOpticalFlow, Regression)
 \r
 INSTANTIATE_TEST_CASE_P(Video, BroxOpticalFlow, testing::ValuesIn(devices()));\r
 \r
-\r
-\r
-\r
-\r
-\r
 struct InterpolateFrames : testing::TestWithParam< cv::gpu::DeviceInfo >\r
 {\r
     cv::gpu::DeviceInfo devInfo;\r
@@ -164,7 +176,13 @@ struct InterpolateFrames : testing::TestWithParam< cv::gpu::DeviceInfo >
 \r
 #ifndef DUMP\r
 \r
-        std::ifstream f((std::string(cvtest::TS::ptr()->get_data_path()) + "opticalflow/interpolate_frames_gold.bin").c_str(), std::ios_base::binary);\r
+        std::string fname(cvtest::TS::ptr()->get_data_path());\r
+        if (devInfo.majorVersion() >= 2)\r
+            fname += INTERPOLATE_FRAMES_DUMP_FILE_CC20;\r
+        else\r
+            fname += INTERPOLATE_FRAMES_DUMP_FILE;\r
+\r
+        std::ifstream f(fname.c_str(), std::ios_base::binary);\r
 \r
         int rows, cols;\r
 \r
@@ -211,7 +229,13 @@ TEST_P(InterpolateFrames, Regression)
 \r
 #else\r
 \r
-    std::ofstream f((std::string(cvtest::TS::ptr()->get_data_path()) + "opticalflow/interpolate_frames_gold.bin").c_str(), std::ios_base::binary);\r
+    std::string fname(cvtest::TS::ptr()->get_data_path());\r
+    if (devInfo.majorVersion() >= 2)\r
+        fname += INTERPOLATE_FRAMES_DUMP_FILE_CC20;\r
+    else\r
+        fname += INTERPOLATE_FRAMES_DUMP_FILE;\r
+\r
+    std::ofstream f(fname.c_str(), std::ios_base::binary);\r
 \r
     f.write((char*)&newFrame.rows, sizeof(newFrame.rows));\r
     f.write((char*)&newFrame.cols, sizeof(newFrame.cols));\r