1 #include "perf_precomp.hpp"
2
3 using namespace std;
4 using namespace cv;
5 using namespace perf;
6 using std::tr1::make_tuple;
7 using std::tr1::get;
8
9 #define TYPICAL_MAT_SIZES_BITW_ARITHM TYPICAL_MAT_SIZES
10 #define TYPICAL_MAT_TYPES_BITW_ARITHM CV_8UC1, CV_8SC1, CV_8UC4, CV_32SC1, CV_32SC4
11 #define TYPICAL_MATS_BITW_ARITHM testing::Combine(testing::Values(TYPICAL_MAT_SIZES_BITW_ARITHM), testing::Values(TYPICAL_MAT_TYPES_BITW_ARITHM))
12
PERF_TEST_P(Size_MatType,bitwise_not,TYPICAL_MATS_BITW_ARITHM)13 PERF_TEST_P(Size_MatType, bitwise_not, TYPICAL_MATS_BITW_ARITHM)
14 {
15 Size sz = get<0>(GetParam());
16 int type = get<1>(GetParam());
17
18 cv::Mat a = Mat(sz, type);
19 cv::Mat c = Mat(sz, type);
20
21 declare.in(a, WARMUP_RNG).out(c);
22 declare.iterations(200);
23
24 TEST_CYCLE() cv::bitwise_not(a, c);
25
26 SANITY_CHECK(c);
27 }
28
PERF_TEST_P(Size_MatType,bitwise_and,TYPICAL_MATS_BITW_ARITHM)29 PERF_TEST_P(Size_MatType, bitwise_and, TYPICAL_MATS_BITW_ARITHM)
30 {
31 Size sz = get<0>(GetParam());
32 int type = get<1>(GetParam());
33 cv::Mat a = Mat(sz, type);
34 cv::Mat b = Mat(sz, type);
35 cv::Mat c = Mat(sz, type);
36
37 declare.in(a, b, WARMUP_RNG).out(c);
38 declare.time(100);
39
40 TEST_CYCLE() bitwise_and(a, b, c);
41
42 SANITY_CHECK(c);
43 }
44
PERF_TEST_P(Size_MatType,bitwise_or,TYPICAL_MATS_BITW_ARITHM)45 PERF_TEST_P(Size_MatType, bitwise_or, TYPICAL_MATS_BITW_ARITHM)
46 {
47 Size sz = get<0>(GetParam());
48 int type = get<1>(GetParam());
49 cv::Mat a = Mat(sz, type);
50 cv::Mat b = Mat(sz, type);
51 cv::Mat c = Mat(sz, type);
52
53 declare.in(a, b, WARMUP_RNG).out(c);
54 declare.time(100);
55
56 TEST_CYCLE() bitwise_or(a, b, c);
57
58 SANITY_CHECK(c);
59 }
60
PERF_TEST_P(Size_MatType,bitwise_xor,TYPICAL_MATS_BITW_ARITHM)61 PERF_TEST_P(Size_MatType, bitwise_xor, TYPICAL_MATS_BITW_ARITHM)
62 {
63 Size sz = get<0>(GetParam());
64 int type = get<1>(GetParam());
65 cv::Mat a = Mat(sz, type);
66 cv::Mat b = Mat(sz, type);
67 cv::Mat c = Mat(sz, type);
68
69 declare.in(a, b, WARMUP_RNG).out(c);
70 declare.time(100);
71
72 TEST_CYCLE() bitwise_xor(a, b, c);
73
74 SANITY_CHECK(c);
75 }
76