Commit 8ef2a2ba authored by Michaël Roynard's avatar Michaël Roynard
Browse files

Fix benchmarks

parent 9519650b
Pipeline #12383 passed with stages
in 14 minutes and 37 seconds
...@@ -36,8 +36,8 @@ void erode_c8_cstyle(const mln::image2d<mln::uint8>& f, mln::image2d<mln::uint8> ...@@ -36,8 +36,8 @@ void erode_c8_cstyle(const mln::image2d<mln::uint8>& f, mln::image2d<mln::uint8>
constexpr int sz = 9; constexpr int sz = 9;
auto dpoints = winc8_t::dpoints; auto dpoints = winc8_t::dpoints;
const uint8* __restrict__ inptr = &f({0, 0}); const uint8* __restrict__ inptr = &f(mln::point2d{0, 0});
uint8* __restrict__ outptr = &out({0, 0}); uint8* __restrict__ outptr = &out(mln::point2d{0, 0});
ptrdiff_t offsets[sz]; ptrdiff_t offsets[sz];
wrt_offset(f, dpoints, offsets); wrt_offset(f, dpoints, offsets);
...@@ -65,8 +65,8 @@ void erode_c8_cstyle_restrict(const mln::image2d<mln::uint8>& f, mln::image2d<ml ...@@ -65,8 +65,8 @@ void erode_c8_cstyle_restrict(const mln::image2d<mln::uint8>& f, mln::image2d<ml
constexpr int sz = 9; constexpr int sz = 9;
auto dpoints = winc8_t::dpoints; auto dpoints = winc8_t::dpoints;
const uint8* __restrict__ inptr = &f({0, 0}); const uint8* __restrict__ inptr = &f(mln::point2d{0, 0});
uint8* __restrict__ outptr = &out({0, 0}); uint8* __restrict__ outptr = &out(mln::point2d{0, 0});
ptrdiff_t offsets[sz]; ptrdiff_t offsets[sz];
wrt_offset(f, dpoints, offsets); wrt_offset(f, dpoints, offsets);
......
...@@ -13,7 +13,7 @@ unsigned threshold1(const image2d<uint8>& f, uint8 v) ...@@ -13,7 +13,7 @@ unsigned threshold1(const image2d<uint8>& f, uint8 v)
int nr = f.nrows(); int nr = f.nrows();
int nc = f.ncols(); int nc = f.ncols();
const char* ptr_in = (const char*)&f({0, 0}); const char* ptr_in = (const char*)&f(point2d{0, 0});
unsigned count = 0; unsigned count = 0;
int istride = (int)(f.strides()[0] - nc * sizeof(T)); int istride = (int)(f.strides()[0] - nc * sizeof(T));
...@@ -35,7 +35,7 @@ unsigned threshold1_bis(const image2d<uint8>& f, uint8 v) ...@@ -35,7 +35,7 @@ unsigned threshold1_bis(const image2d<uint8>& f, uint8 v)
int nr = f.nrows(); int nr = f.nrows();
int nc = f.ncols(); int nc = f.ncols();
const char* ptr_in = (const char*)&f({0, 0}); const char* ptr_in = (const char*)&f(point2d{0, 0});
unsigned count = 0; unsigned count = 0;
int istride = (int)(f.strides()[0] - nc * sizeof(T)); int istride = (int)(f.strides()[0] - nc * sizeof(T));
...@@ -89,8 +89,8 @@ void threshold5(const image2d<uint8>& f, image2d<bool>& out, uint8 v) ...@@ -89,8 +89,8 @@ void threshold5(const image2d<uint8>& f, image2d<bool>& out, uint8 v)
int nr = f.nrows(); int nr = f.nrows();
int nc = f.ncols(); int nc = f.ncols();
const char* ptr_in = (const char*)&f({0, 0}); const char* ptr_in = (const char*)&f(point2d{0, 0});
char* ptr_out = (char*)&out({0, 0}); char* ptr_out = (char*)&out(point2d{0, 0});
int istride = (int)(f.strides()[0] - nc * sizeof(T)); int istride = (int)(f.strides()[0] - nc * sizeof(T));
for (int i = 0; i < nr; ++i) for (int i = 0; i < nr; ++i)
......
...@@ -72,7 +72,7 @@ long bench_indexes(const image2d<int>& ima) ...@@ -72,7 +72,7 @@ long bench_indexes(const image2d<int>& ima)
int p = idx + j; // * ima.index_strides()[1]; int p = idx + j; // * ima.index_strides()[1];
int sum = 0; int sum = 0;
for (int offset : offsets) for (int offset : offsets)
sum += ima[p + offset]; sum += ima[image2d<int>::size_type(p + offset)];
u += sum; u += sum;
} }
idx += static_cast<int>(ima.index_strides()[0]); idx += static_cast<int>(ima.index_strides()[0]);
......
...@@ -39,11 +39,11 @@ __attribute__((noinline)) void rotate_ptr(const image2d<T>& f, image2d<T>& out) ...@@ -39,11 +39,11 @@ __attribute__((noinline)) void rotate_ptr(const image2d<T>& f, image2d<T>& out)
int nc = f.ncols(); int nc = f.ncols();
int istride = static_cast<int>(f.strides()[0]); int istride = static_cast<int>(f.strides()[0]);
int ostride = static_cast<int>(out.strides()[0]); int ostride = static_cast<int>(out.strides()[0]);
const T* ptr_in = &f({0, 0}); const T* ptr_in = &f(point2d{0, 0});
for (int i = 0; i < nr; ++i) for (int i = 0; i < nr; ++i)
{ {
T* ptr_out = &out({0, (short)i}); T* ptr_out = &out(point2d{0, (short)i});
for (int j = 0; j < nc; ++j) for (int j = 0; j < nc; ++j)
{ {
*ptr_out = ptr_in[j]; *ptr_out = ptr_in[j];
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment