Skip to content

Commit cc8d3d3

Browse files
committed
Add IPP flip benchmark
1 parent be6d09a commit cc8d3d3

File tree

2 files changed

+105
-0
lines changed

2 files changed

+105
-0
lines changed

bench/ipp/CMakeLists.txt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,14 @@ target_link_libraries(bench_ipp_transpose
1313
ipp::ipp
1414
)
1515

16+
add_executable(bench_ipp_flip
17+
bench_flip.cpp
18+
)
19+
20+
target_link_libraries(bench_ipp_flip
21+
benchmark::benchmark
22+
ipp::ipp
23+
)
1624

1725
add_executable(test_ipp_transpose
1826
test_transpose.cpp

bench/ipp/bench_flip.cpp

Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
// Copyright (C) 2020 Samuel Debionne, ESRF.
2+
3+
// Use, modification and distribution is subject to the Boost Software
4+
// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
5+
// http://www.boost.org/LICENSE_1_0.txt)
6+
7+
#include <benchmark/benchmark.h>
8+
9+
#include <ipp.h>
10+
11+
#include <boost/gil.hpp>
12+
13+
static void ipp_flip_left_right(benchmark::State& state)
14+
{
15+
using namespace boost::gil;
16+
17+
size_t dim = state.range(0);
18+
19+
gray8_image_t in(dim, dim);
20+
gray8_image_t out(dim, dim);
21+
22+
IppiSize srcRoi = { dim, dim };
23+
24+
for (auto _ : state) {
25+
// The code to benchmark
26+
ippiMirror_8u_C1R(
27+
boost::gil::interleaved_view_get_raw_data(const_view(in)), (int) in.width(),
28+
boost::gil::interleaved_view_get_raw_data(view(out)), (int) out.width(),
29+
srcRoi,
30+
ippAxsVertical);
31+
}
32+
}
33+
BENCHMARK(ipp_flip_left_right)->RangeMultiplier(2)->Range(256, 8 << 10);
34+
35+
static void ipp_flip_left_right_inplace(benchmark::State& state)
36+
{
37+
using namespace boost::gil;
38+
39+
size_t dim = state.range(0);
40+
41+
gray8_image_t in(dim, dim);
42+
43+
IppiSize srcRoi = { dim, dim };
44+
45+
for (auto _ : state) {
46+
// The code to benchmark
47+
ippiMirror_8u_C1IR(
48+
boost::gil::interleaved_view_get_raw_data(view(in)), (int) in.width(),
49+
srcRoi,
50+
ippAxsVertical);
51+
}
52+
}
53+
BENCHMARK(ipp_flip_left_right_inplace)->RangeMultiplier(2)->Range(256, 8 << 10);
54+
55+
static void ipp_flip_up_down(benchmark::State& state)
56+
{
57+
using namespace boost::gil;
58+
59+
size_t dim = state.range(0);
60+
61+
gray8_image_t in(dim, dim);
62+
gray8_image_t out(dim, dim);
63+
64+
IppiSize srcRoi = { dim, dim };
65+
66+
for (auto _ : state) {
67+
// The code to benchmark
68+
ippiMirror_8u_C1R(
69+
boost::gil::interleaved_view_get_raw_data(const_view(in)), (int) in.width(),
70+
boost::gil::interleaved_view_get_raw_data(view(out)), (int) out.width(),
71+
srcRoi,
72+
ippAxsHorizontal);
73+
}
74+
}
75+
BENCHMARK(ipp_flip_up_down)->RangeMultiplier(2)->Range(256, 8 << 10);
76+
77+
static void ipp_flip_up_down_inplace(benchmark::State& state)
78+
{
79+
using namespace boost::gil;
80+
81+
size_t dim = state.range(0);
82+
83+
gray8_image_t in(dim, dim);
84+
85+
IppiSize srcRoi = { dim, dim };
86+
87+
for (auto _ : state) {
88+
// The code to benchmark
89+
ippiMirror_8u_C1IR(
90+
boost::gil::interleaved_view_get_raw_data(view(in)), (int) in.width(),
91+
srcRoi,
92+
ippAxsHorizontal);
93+
}
94+
}
95+
BENCHMARK(ipp_flip_up_down_inplace)->RangeMultiplier(2)->Range(256, 8 << 10);
96+
97+
BENCHMARK_MAIN();

0 commit comments

Comments
 (0)