27
27
28
28
// declare major namespaces to avoid errors on unknown namespace
29
29
namespace cv { namespace cuda {} namespace ocl {} }
30
+ namespace cvtest { }
30
31
31
32
namespace perf
32
33
{
34
+
35
+ // Tuple stuff from Google Tests
36
+ using testing::get;
37
+ using testing::make_tuple;
38
+ using testing::tuple;
39
+ using testing::tuple_size;
40
+ using testing::tuple_element;
41
+
33
42
class TestBase ;
34
43
35
44
/* ****************************************************************************************\
36
45
* Predefined typical frame sizes and typical test parameters *
37
46
\*****************************************************************************************/
38
- const cv::Size szQVGA = cv::Size(320 , 240 );
39
- const cv::Size szVGA = cv::Size(640 , 480 );
40
- const cv::Size szSVGA = cv::Size(800 , 600 );
41
- const cv::Size szXGA = cv::Size(1024 , 768 );
42
- const cv::Size szSXGA = cv::Size(1280 , 1024 );
43
- const cv::Size szWQHD = cv::Size(2560 , 1440 );
44
-
45
- const cv::Size sznHD = cv::Size(640 , 360 );
46
- const cv::Size szqHD = cv::Size(960 , 540 );
47
- const cv::Size sz240p = szQVGA;
48
- const cv::Size sz720p = cv::Size(1280 , 720 );
49
- const cv::Size sz1080p = cv::Size(1920 , 1080 );
50
- const cv::Size sz1440p = szWQHD;
51
- const cv::Size sz2160p = cv::Size(3840 , 2160 );// UHDTV1 4K
52
- const cv::Size sz4320p = cv::Size(7680 , 4320 );// UHDTV2 8K
53
-
54
- const cv::Size sz3MP = cv::Size(2048 , 1536 );
55
- const cv::Size sz5MP = cv::Size(2592 , 1944 );
56
- const cv::Size sz2K = cv::Size(2048 , 2048 );
57
-
58
- const cv::Size szODD = cv::Size(127 , 61 );
59
-
60
- const cv::Size szSmall24 = cv::Size(24 , 24 );
61
- const cv::Size szSmall32 = cv::Size(32 , 32 );
62
- const cv::Size szSmall64 = cv::Size(64 , 64 );
63
- const cv::Size szSmall128 = cv::Size(128 , 128 );
47
+ const static cv::Size szQVGA = cv::Size(320 , 240 );
48
+ const static cv::Size szVGA = cv::Size(640 , 480 );
49
+ const static cv::Size szSVGA = cv::Size(800 , 600 );
50
+ const static cv::Size szXGA = cv::Size(1024 , 768 );
51
+ const static cv::Size szSXGA = cv::Size(1280 , 1024 );
52
+ const static cv::Size szWQHD = cv::Size(2560 , 1440 );
53
+
54
+ const static cv::Size sznHD = cv::Size(640 , 360 );
55
+ const static cv::Size szqHD = cv::Size(960 , 540 );
56
+ const static cv::Size sz240p = szQVGA;
57
+ const static cv::Size sz720p = cv::Size(1280 , 720 );
58
+ const static cv::Size sz1080p = cv::Size(1920 , 1080 );
59
+ const static cv::Size sz1440p = szWQHD;
60
+ const static cv::Size sz2160p = cv::Size(3840 , 2160 );// UHDTV1 4K
61
+ const static cv::Size sz4320p = cv::Size(7680 , 4320 );// UHDTV2 8K
62
+
63
+ const static cv::Size sz3MP = cv::Size(2048 , 1536 );
64
+ const static cv::Size sz5MP = cv::Size(2592 , 1944 );
65
+ const static cv::Size sz2K = cv::Size(2048 , 2048 );
66
+
67
+ const static cv::Size szODD = cv::Size(127 , 61 );
68
+
69
+ const static cv::Size szSmall24 = cv::Size(24 , 24 );
70
+ const static cv::Size szSmall32 = cv::Size(32 , 32 );
71
+ const static cv::Size szSmall64 = cv::Size(64 , 64 );
72
+ const static cv::Size szSmall128 = cv::Size(128 , 128 );
64
73
65
74
#define SZ_ALL_VGA ::testing::Values (::perf::szQVGA, ::perf::szVGA, ::perf::szSVGA)
66
75
#define SZ_ALL_GA ::testing::Values (::perf::szQVGA, ::perf::szVGA, ::perf::szSVGA, ::perf::szXGA, ::perf::szSXGA)
@@ -492,7 +501,7 @@ class CV_EXPORTS TestBase: public ::testing::Test
492
501
493
502
template <typename T> class TestBaseWithParam : public TestBase , public ::testing::WithParamInterface<T> {};
494
503
495
- typedef std::tr1:: tuple<cv::Size, MatType> Size_MatType_t;
504
+ typedef tuple<cv::Size, MatType> Size_MatType_t;
496
505
typedef TestBaseWithParam<Size_MatType_t> Size_MatType;
497
506
498
507
/* ****************************************************************************************\
@@ -514,6 +523,13 @@ CV_EXPORTS void PrintTo(const Size& sz, ::std::ostream* os);
514
523
/* ****************************************************************************************\
515
524
* Macro definitions for performance tests *
516
525
\*****************************************************************************************/
526
+
527
+ #define CV__PERF_TEST_BODY_IMPL (name ) \
528
+ { \
529
+ CV__TRACE_APP_FUNCTION_NAME (" PERF_TEST: " name); \
530
+ RunPerfTestBody (); \
531
+ }
532
+
517
533
#define PERF_PROXY_NAMESPACE_NAME_ (test_case_name, test_name ) \
518
534
test_case_name##_##test_name##_perf_namespace_proxy
519
535
@@ -538,7 +554,7 @@ CV_EXPORTS void PrintTo(const Size& sz, ::std::ostream* os);
538
554
protected: \
539
555
virtual void PerfTestBody ();\
540
556
};\
541
- TEST_F (test_case_name, test_name){ CV_TRACE_REGION ( " PERF_TEST: " #test_case_name " _" #test_name); RunPerfTestBody ( ); }\
557
+ TEST_F (test_case_name, test_name){ CV__PERF_TEST_BODY_IMPL ( #test_case_name " _" #test_name); }\
542
558
}\
543
559
void PERF_PROXY_NAMESPACE_NAME_ (test_case_name, test_name)::test_case_name::PerfTestBody()
544
560
@@ -576,12 +592,20 @@ CV_EXPORTS void PrintTo(const Size& sz, ::std::ostream* os);
576
592
protected: \
577
593
virtual void PerfTestBody ();\
578
594
};\
579
- TEST_F (fixture, testname){ CV_TRACE_REGION ( " PERF_TEST: " #fixture " _" #testname); RunPerfTestBody ( ); }\
595
+ TEST_F (fixture, testname){ CV__PERF_TEST_BODY_IMPL ( #fixture " _" #testname); }\
580
596
}\
581
597
void PERF_PROXY_NAMESPACE_NAME_ (fixture, testname)::fixture::PerfTestBody()
582
598
583
599
// Defines a parametrized performance test.
584
600
//
601
+ // @Note PERF_TEST_P() below violates behavior of original Google Tests - there is no tests instantiation in original TEST_P()
602
+ // This macro is intended for usage with separate INSTANTIATE_TEST_CASE_P macro
603
+ #define PERF_TEST_P_ (test_case_name, test_name ) CV__TEST_P(test_case_name, test_name, PerfTestBody, CV__PERF_TEST_BODY_IMPL)
604
+
605
+ // Defines a parametrized performance test.
606
+ //
607
+ // @Note Original TEST_P() macro doesn't instantiate tests with parameters. To keep original usage use PERF_TEST_P_() macro
608
+ //
585
609
// The first parameter is the name of the test fixture class, which
586
610
// also doubles as the test case name. The second parameter is the
587
611
// name of the test within the test case.
@@ -609,7 +633,7 @@ CV_EXPORTS void PrintTo(const Size& sz, ::std::ostream* os);
609
633
protected: \
610
634
virtual void PerfTestBody ();\
611
635
};\
612
- TEST_P (fixture##_##name, name /* perf */ ){ CV_TRACE_REGION ( " PERF_TEST: " #fixture " _ " #name); RunPerfTestBody (); } \
636
+ CV__TEST_P (fixture##_##name, name, PerfTestBodyDummy, CV__PERF_TEST_BODY_IMPL){} \
613
637
INSTANTIATE_TEST_CASE_P (/* none*/ , fixture##_##name, params);\
614
638
void fixture##_##name::PerfTestBody()
615
639
0 commit comments