Commit a1853472 authored by Roland Levillain's avatar Roland Levillain
Browse files

apps/bench: Simplify `fast_static' and `faster_static' cases.

	* apps/bench/trait.hh (mln_static_qixter, mln_static_qixter_)
	(mln_static_fwd_qixter, mln_static_fwd_qixter_)
	(mln_static_bkd_qixter, mln_static_bkd_qixter_):
	Remove macros.
	(mln::static_fwd_qixter, mln::static_bkd_qixter):
	Remove traits.
	(mln::fwd_qixter< image2d<T>, static_window<D, n> >)
	(mln::fwd_qixter< const image2d<T>, static_window<D, n> >)
	(mln::bkd_qixter< image2d<T>, static_window<D, n> >)
	(mln::bkd_qixter< const image2d<T>, static_window<D, n> >):
	New traits.
	* apps/bench/dilation-lena.hh
	(fast_static::dilation): Delegate to fast::dilation.
	(faster_static::dilation): Delegate to faster::dilation.
parent 091e1bec
2011-01-13 Roland Levillain <roland@lrde.epita.fr>
apps/bench: Simplify `fast_static' and `faster_static' cases.
* apps/bench/trait.hh (mln_static_qixter, mln_static_qixter_)
(mln_static_fwd_qixter, mln_static_fwd_qixter_)
(mln_static_bkd_qixter, mln_static_bkd_qixter_):
Remove macros.
(mln::static_fwd_qixter, mln::static_bkd_qixter):
Remove traits.
(mln::fwd_qixter< image2d<T>, static_window<D, n> >)
(mln::fwd_qixter< const image2d<T>, static_window<D, n> >)
(mln::bkd_qixter< image2d<T>, static_window<D, n> >)
(mln::bkd_qixter< const image2d<T>, static_window<D, n> >):
New traits.
* apps/bench/dilation-lena.hh
(fast_static::dilation): Delegate to fast::dilation.
(faster_static::dilation): Delegate to faster::dilation.
2011-01-11 Roland Levillain <roland@lrde.epita.fr>
 
apps/bench: Aesthetic changes in the output of list2table.
......@@ -293,22 +293,8 @@ namespace fast_static
template <typename I, typename W>
mln_concrete(I) dilation(const I& input, const W& win)
{
typedef mln_concrete(I) O;
O output; initialize(output, input); // Initialize output.
mln_pixter(const I) pi(input); // Iterator on the pixels of `input'.
mln_pixter(O) po(output); // Iterator on the pixels of `output'.
mln_static_qixter(const I, W) q(pi, win); // Iterator on the neighbors of `p' w.r.t. `win'.
for_all_2(pi, po)
{
// FIXME: Cheat: replace the accu::supremum by a maximum.
mln::accu::stat::max<mln_value(I)> sup; // Accumulator computing the supremum.
for_all(q)
sup.take(q.val());
po.val() = sup.to_result();
}
return output;
// `fast_static' has the same implementation as `fast'.
return ::fast::dilation(input, win);
}
}
......@@ -319,21 +305,8 @@ namespace faster_static
template <typename I, typename W>
mln_concrete(I) dilation(const I& input, const W& win)
{
typedef mln_concrete(I) O;
O output; initialize(output, input); // Initialize output.
mln_pixter(const I) p(input); // Iterator on the pixels of `input'.
mln_static_qixter(const I, W) q(p, win); // Iterator on the neighbors of `p' w.r.t. `win'.
for_all(p)
{
// FIXME: Cheat: replace the accu::supremum by a maximum.
mln::accu::stat::max<mln_value(I)> sup; // Accumulator computing the supremum.
for_all(q)
sup.take(q.val());
*(output.buffer() + p.offset()) = sup.to_result();
}
return output;
// `faster_static' has the same implementation as `faster'.
return ::faster::dilation(input, win);
}
}
......
......@@ -29,20 +29,10 @@
# include <mln/core/image/image2d.hh>
# include <mln/metal/none.hh>
# include "apps/bench/static_window.hh"
# include "apps/bench/static_dpoints_pixter.hh"
// FIXME: Move this into mln/core/macro.hh.
# define mln_static_fwd_qixter(I, W) typename mln::trait::static_fwd_qixter< I, W >::ret
# define mln_static_fwd_qixter_(I, W) mln::trait::static_fwd_qixter< I, W >::ret
# define mln_static_bkd_qixter(I, W) typename mln::trait::static_bkd_qixter< I, W >::ret
# define mln_static_bkd_qixter_(I, W) mln::trait::static_bkd_qixter< I, W >::ret
# define mln_static_qixter(I, W) mln_static_fwd_qixter(I, W)
# define mln_static_qixter_(I, W) mln_static_fwd_qixter_(I, W)
// FIXME: Move this into mln/trait/ (and mln/core/image/?)
namespace mln
{
......@@ -52,41 +42,28 @@ namespace mln
// qixter
template <typename I, typename W>
struct static_fwd_qixter
{
typedef metal::none ret;
};
template <typename I, typename W>
struct static_bkd_qixter
{
typedef metal::none ret;
};
template <typename T, typename W>
struct static_fwd_qixter< image2d<T>, W >
template <typename T, typename D, unsigned n>
struct fwd_qixter< image2d<T>, static_window<D, n> >
{
typedef static_dpoints_fwd_pixter< image2d<T>, W > ret;
typedef static_dpoints_fwd_pixter< image2d<T>, static_window<D, n> > ret;
};
template <typename T, typename W>
struct static_fwd_qixter< const image2d<T>, W >
template <typename T, typename D, unsigned n>
struct fwd_qixter< const image2d<T>, static_window<D, n> >
{
typedef static_dpoints_fwd_pixter< const image2d<T>, W > ret;
typedef static_dpoints_fwd_pixter< const image2d<T>, static_window<D, n> > ret;
};
template <typename T, typename W>
struct static_bkd_qixter< image2d<T>, W >
template <typename T, typename D, unsigned n>
struct bkd_qixter< image2d<T>, static_window<D, n> >
{
typedef static_dpoints_bkd_pixter< image2d<T>, W > ret;
typedef static_dpoints_bkd_pixter< image2d<T>, static_window<D, n> > ret;
};
template <typename T, typename W>
struct static_bkd_qixter< const image2d<T>, W >
template <typename T, typename D, unsigned n>
struct bkd_qixter< const image2d<T>, static_window<D, n> >
{
typedef static_dpoints_bkd_pixter< const image2d<T>, W > ret;
typedef static_dpoints_bkd_pixter< const image2d<T>, static_window<D, n> > ret;
};
// FIXME: Also handle mln::image1d<T> and mln::image3d<T>.
......
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