https://svn.lrde.epita.fr/svn/oln/trunk/milena
Index: ChangeLog
from Roland Levillain <roland(a)lrde.epita.fr>
* mln/linear/sobel.hh: Fix dates in copyright header.
sobel.hh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
Index: mln/linear/sobel.hh
--- mln/linear/sobel.hh (revision 1650)
+++ mln/linear/sobel.hh (working copy)
@@ -1,4 +1,4 @@
-// Copyright (C) 2007 EPITA Research and Development Laboratory
+// Copyright (C) 2007, 2008 EPITA Research and Development Laboratory (LRDE)
//
// This file is part of the Olena Library. This library is free
// software; you can redistribute it and/or modify it under the terms
https://svn.lrde.epita.fr/svn/oln/trunk/milena
Index: ChangeLog
from Roland Levillain <roland(a)lrde.epita.fr>
Solve infinite recursive calls in linear::impl::convolve_.
* mln/linear/convolve.hh
(convolve_(any, const I&, const Weighted_Window<W>&, any, O&)):
Move the body of this function...
(convolve_(const I&, const Weighted_Window<W>&, O&)):
...here (new function).
Use it to factor...
(convolve_(Speed_I, const I&, const Weighted_Window<W>&, Speed_O, O&))
(convolve_(any, const I&, const Weighted_Window<W>&, any, O&)):
...the implementations of these functions.
convolve.hh | 62 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-
1 file changed, 61 insertions(+), 1 deletion(-)
Index: mln/linear/convolve.hh
--- mln/linear/convolve.hh (revision 1647)
+++ mln/linear/convolve.hh (working copy)
@@ -1,4 +1,4 @@
-// Copyright (C) 2007 EPITA Research and Development Laboratory
+// Copyright (C) 2007, 2008 EPITA Research and Development Laboratory (LRDE)
//
// This file is part of the Olena Library. This library is free
// software; you can redistribute it and/or modify it under the terms
@@ -65,6 +65,54 @@
namespace impl
{
+ /* FIXME: We must clean up the interface of
+ mln::linear::impl::convolve_:
+
+ - either allow certain patterns of speed traits (e.g.,
+ any/any, fastest/fastest, fastest/any, etc.). In this
+ case, the generic version should abort at compile time;
+
+ - or accept all combinations (which is the current case), and
+ default to the slowest one (presumably any/any).
+ */
+
+ // Fwd decl.
+ template <typename I, typename W, typename O>
+ inline
+ void convolve_(const I& input,
+ const Weighted_Window<W>& w_win_,
+ O& output);
+
+ /// Default version, delegating to the generic version.
+ template <typename Speed_I, typename I, typename W,
+ typename Speed_O, typename O>
+ inline
+ void convolve_(Speed_I, const I& input,
+ const Weighted_Window<W>& w_win_,
+ Speed_O, O& output)
+ {
+ /* Don't delegate using such a call:
+
+ \code
+ impl::convolve_(trait::image::speed::any(), input,
+ w_win_,
+ trait::image::speed::any(), output);
+ \endcode
+
+ since it would end up with infinite recursion. The reason
+ is that the compiler would select this function (in which
+ you read this very comment), instead of the next one (with
+ input and output speed traits set to `any'), to resolve the
+ call. This is because C++ overloading rules favor the
+ generic function over the more specialized one. And we
+ cannot use explicit partial specialization, since it just
+ doesn't exist for functions.
+
+ Hence the chosen solution: create and call another
+ overloading for mln::linear::impl::convolve_, with no
+ unnatural selection behavior. */
+ impl::convolve_(input, w_win_, output);
+ }
template <typename I, typename W, typename O>
inline
@@ -72,6 +120,18 @@
const Weighted_Window<W>& w_win_,
trait::image::speed::any, O& output)
{
+ // Delegate the call to the generic version.
+ impl::convolve_(input, w_win_, output);
+ }
+
+ /// A factored implementation of the most generic version of
+ /// mln::linear::impl::convolve_.
+ template <typename I, typename W, typename O>
+ inline
+ void convolve_(const I& input,
+ const Weighted_Window<W>& w_win_,
+ O& output)
+ {
const W& w_win = exact(w_win_);
mln_piter(I) p(input.domain());
https://svn.lrde.epita.fr/svn/oln/trunk/milena
Index: ChangeLog
from Roland Levillain <roland(a)lrde.epita.fr>
Add image traits for mln::value::stack_image.
* mln/value/stack.hh
(mln::trait::image_< mln::value::stack_image<n, I> >):
New specialization.
stack.hh | 39 ++++++++++++++++++++++++++++++++++++++-
1 file changed, 38 insertions(+), 1 deletion(-)
Index: mln/value/stack.hh
--- mln/value/stack.hh (revision 1646)
+++ mln/value/stack.hh (working copy)
@@ -1,4 +1,4 @@
-// Copyright (C) 2007 EPITA Research and Development Laboratory
+// Copyright (C) 2007, 2008 EPITA Research and Development Laboratory (LRDE)
//
// This file is part of the Olena Library. This library is free
// software; you can redistribute it and/or modify it under the terms
@@ -93,7 +93,44 @@
} // end of namespace mln::value::internal
+ } // end of namespace mln::value
+
+
+ namespace trait
+ {
+ template <unsigned n, typename I>
+ struct image_< mln::value::stack_image<n, I> >
+ : default_image_morpher_< I,
+ metal::vec<n, mln_value(I)>,
+ mln::value::stack_image<n, I> >
+ {
+ // FIXME: We shall carefully define the missing required traits
+ // here.
+ typedef trait::image::category::value_morpher category;
+
+ typedef trait::image::value::vectorial value;
+ /* FIXME: Setting the speed trait of a stack_image to `fast' is
+ a bad approximation.
+
+ The value cannot reasonnably be `fastest', as several images
+ in different memory locations are involved in a stack image.
+ So we cannot just rely on the speed trait of I.
+ Nevertheless, we cannot guarantee that a stack_image will be
+ a least `fast': think of a stack_image over a ``slow''
+ image_type (e.g., an image whose values are computed). That
+ image would retain the `slow' value of the speed trait.
+
+ In conclusion, this value of the speed trait should be
+ computed too. */
+ typedef trait::image::speed::fast speed;
+ };
+
+ } // end of namespace mln::trait
+
+
+ namespace value
+ {
/*! \brief stack image class. stack_image stores a
* vector of n images of the same domain.
*
https://svn.lrde.epita.fr/svn/oln/trunk/milena
Index: ChangeLog
from Roland Levillain <roland(a)lrde.epita.fr>
Fix the definition of static abortion.
* mln/metal/abort.hh (mln::metal::abort): Rename as...
(mln::metal::abort_): ...this, to avoid name clashes with the
homonym (standard) macro.
abort.hh | 10 ++++------
1 file changed, 4 insertions(+), 6 deletions(-)
Index: mln/metal/abort.hh
--- mln/metal/abort.hh (revision 1645)
+++ mln/metal/abort.hh (working copy)
@@ -1,4 +1,4 @@
-// Copyright (C) 2007 EPITA Research and Development Laboratory
+// Copyright (C) 2007, 2008 EPITA Research and Development Laboratory (LRDE)
//
// This file is part of the Olena Library. This library is free
// software; you can redistribute it and/or modify it under the terms
@@ -28,10 +28,9 @@
#ifndef MLN_METAL_ABORT_HH
# define MLN_METAL_ABORT_HH
-/*!
- * \file mln/metal/abort.hh
+/*! \file mln/metal/abort.hh
*
- * \brief FIXME.
+ * \brief FIXME: Document.
*/
# include <mln/metal/bool.hh>
@@ -44,10 +43,9 @@
{
template <typename T>
- struct abort : false_
+ struct abort_ : false_
{};
-
} // end of namespace mln::metal
} // end of namespace mln