Skip to content

Commit 454bc7a

Browse files
committed
Merge pull request opencv#9063 from alalek:hamming_perf_test
2 parents 8f4b534 + 582bb3c commit 454bc7a

File tree

1 file changed

+57
-1
lines changed

1 file changed

+57
-1
lines changed

modules/core/perf/perf_norm.cpp

Lines changed: 57 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,10 @@ using namespace perf;
66
using std::tr1::make_tuple;
77
using std::tr1::get;
88

9+
#define HAMMING_NORM_SIZES cv::Size(640, 480), cv::Size(1920, 1080)
10+
#define HAMMING_NORM_TYPES CV_8UC1
911

10-
CV_FLAGS(NormType, NORM_INF, NORM_L1, NORM_L2, NORM_TYPE_MASK, NORM_RELATIVE, NORM_MINMAX)
12+
CV_FLAGS(NormType, NORM_HAMMING2, NORM_HAMMING, NORM_INF, NORM_L1, NORM_L2, NORM_TYPE_MASK, NORM_RELATIVE, NORM_MINMAX)
1113
typedef std::tr1::tuple<Size, MatType, NormType> Size_MatType_NormType_t;
1214
typedef perf::TestBaseWithParam<Size_MatType_NormType_t> Size_MatType_NormType;
1315

@@ -103,6 +105,60 @@ PERF_TEST_P(Size_MatType_NormType, norm2_mask,
103105
SANITY_CHECK(n, 1e-5, ERROR_RELATIVE);
104106
}
105107

108+
namespace {
109+
typedef std::tr1::tuple<NormType, MatType, Size> PerfHamming_t;
110+
typedef perf::TestBaseWithParam<PerfHamming_t> PerfHamming;
111+
112+
PERF_TEST_P(PerfHamming, norm,
113+
testing::Combine(
114+
testing::Values(NORM_HAMMING, NORM_HAMMING2),
115+
testing::Values(HAMMING_NORM_TYPES),
116+
testing::Values(HAMMING_NORM_SIZES)
117+
)
118+
)
119+
{
120+
Size sz = get<2>(GetParam());
121+
int matType = get<1>(GetParam());
122+
int normType = get<0>(GetParam());
123+
124+
Mat src(sz, matType);
125+
double n;
126+
127+
declare.in(src, WARMUP_RNG);
128+
129+
TEST_CYCLE() n = norm(src, normType);
130+
131+
(void)n;
132+
SANITY_CHECK_NOTHING();
133+
}
134+
135+
PERF_TEST_P(PerfHamming, norm2,
136+
testing::Combine(
137+
testing::Values(NORM_HAMMING, NORM_HAMMING2),
138+
testing::Values(HAMMING_NORM_TYPES),
139+
testing::Values(HAMMING_NORM_SIZES)
140+
)
141+
)
142+
{
143+
Size sz = get<2>(GetParam());
144+
int matType = get<1>(GetParam());
145+
int normType = get<0>(GetParam());
146+
147+
Mat src1(sz, matType);
148+
Mat src2(sz, matType);
149+
double n;
150+
151+
declare.in(src1, src2, WARMUP_RNG);
152+
153+
TEST_CYCLE() n = norm(src1, src2, normType);
154+
155+
(void)n;
156+
SANITY_CHECK_NOTHING();
157+
}
158+
159+
}
160+
161+
106162
PERF_TEST_P(Size_MatType_NormType, normalize,
107163
testing::Combine(
108164
testing::Values(TYPICAL_MAT_SIZES),

0 commit comments

Comments
 (0)