* 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.
---
milena/ChangeLog | 19 ++++++++++++++
milena/apps/bench/dilation-lena.hh | 35 +++----------------------
milena/apps/bench/trait.hh | 49 +++++++++--------------------------
3 files changed, 36 insertions(+), 67 deletions(-)
diff --git a/milena/ChangeLog b/milena/ChangeLog
index 77e5cc3..e3321f2 100644
--- a/milena/ChangeLog
+++ b/milena/ChangeLog
@@ -1,3 +1,22 @@
+2011-01-13 Roland Levillain <roland(a)lrde.epita.fr>
+
+ Simplify `fast_static' and `faster_static' cases in apps/bench/.
+
+ * 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.
+
2010-12-10 Roland Levillain <roland(a)lrde.epita.fr>
Ensure non implemented reconstructions on sets abort at run time.
diff --git a/milena/apps/bench/dilation-lena.hh b/milena/apps/bench/dilation-lena.hh
index 47e76dd..888affd 100644
--- a/milena/apps/bench/dilation-lena.hh
+++ b/milena/apps/bench/dilation-lena.hh
@@ -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);
}
}
diff --git a/milena/apps/bench/trait.hh b/milena/apps/bench/trait.hh
index e3e5004..dd2d7e5 100644
--- a/milena/apps/bench/trait.hh
+++ b/milena/apps/bench/trait.hh
@@ -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>.
--
1.7.2.5