https://svn.lrde.epita.fr/svn/oln/trunk/milena
Index: ChangeLog
from Thierry Geraud <thierry.geraud(a)lrde.epita.fr>
Fast is Fastest and speed trait is used in inheritance.
Fast actually is fastEST.
* mln/core/concept/fast_image.hh: Rename as...
* mln/core/concept/fastest_image.hh: ...this new file.
* mln/core/concept/doc/fast_image.hh: Rename as...
* mln/core/concept/doc/fastest_image.hh: ...this new file.
* mln/core/internal/image_base.hh: Use speed trait for
inheritance.
* mln/core/trait/is_fast.hh: Remove; obsolete.
* mln/core/trait/all.hh: Update.
* mln/histo/compute.hh,
* mln/debug/iota.hh,
* mln/debug/println_with_border.hh,
* mln/core/image2d_b.hh,
* mln/core/concept/image.hh,
* mln/core/image1d_b.hh,
* mln/core/image3d_b.hh,
* mln/arith/plus.hh,
* mln/arith/min.hh,
* mln/arith/revert.hh,
* mln/arith/minus.hh,
* mln/level/take.hh,
* mln/level/assign.hh,
* mln/level/apply.hh,
* mln/level/fill.hh,
* mln/level/memcpy_.hh,
* mln/level/memset_.hh,
* mln/level/median.hh,
* mln/level/transform.hh,
* mln/linear/convolve.hh,
* mln/linear/local/convolve.hh,
* mln/accu/take.hh,
* mln/border/resize.hh,
* mln/border/fill.hh,
* mln/border/duplicate.hh,
* mln/border/mirror.hh,
* mln/border/get.hh,
* mln/test/predicate.hh,
* mln/morpho/erosion_fast.hh,
* mln/morpho/dilation_fast.hh,
* mln/io/internal/pnm/save.hh,
* mln/logical/and.hh,
* mln/logical/and_not.hh,
* mln/logical/or.hh,
* mln/logical/not.hh,
* mln/labeling/level.hh,
* mln/labeling/base.hh: Update.
* tests/image2d_b.cc: Augment.
Only keep the generic impl in the main file.
* mln/level/paste.hh: Split file into this and...
* mln/level/paste.spe.hh: ...this new file.
(paste_generic_): Rename as...
(paste_): ...this and move in impl::generic.
* tests/level_paste.cc: Update.
Misc.
* tests/literal_zero.cc,
* mln/core/macros.hh: Clean.
mln/accu/take.hh | 2
mln/arith/min.hh | 4 -
mln/arith/minus.hh | 4 -
mln/arith/plus.hh | 4 -
mln/arith/revert.hh | 2
mln/border/duplicate.hh | 10 ++--
mln/border/fill.hh | 8 +--
mln/border/get.hh | 2
mln/border/mirror.hh | 4 -
mln/border/resize.hh | 4 -
mln/core/concept/doc/fastest_image.hh | 10 ++--
mln/core/concept/fastest_image.hh | 22 ++++-----
mln/core/concept/image.hh | 2
mln/core/image1d_b.hh | 13 -----
mln/core/image2d_b.hh | 16 +++---
mln/core/image3d_b.hh | 11 ----
mln/core/internal/image_base.hh | 17 ++++---
mln/core/macros.hh | 11 +++-
mln/core/trait/all.hh | 1
mln/debug/iota.hh | 2
mln/debug/println_with_border.hh | 10 ++--
mln/histo/compute.hh | 2
mln/io/internal/pnm/save.hh | 12 ++---
mln/labeling/base.hh | 2
mln/labeling/level.hh | 18 +++----
mln/level/apply.hh | 2
mln/level/assign.hh | 2
mln/level/fill.hh | 4 -
mln/level/median.hh | 2
mln/level/memcpy_.hh | 4 -
mln/level/memset_.hh | 8 +--
mln/level/paste.hh | 59 +++++++------------------
mln/level/paste.spe.hh | 79 ++++++++--------------------------
mln/level/take.hh | 2
mln/level/transform.hh | 2
mln/linear/convolve.hh | 4 -
mln/linear/local/convolve.hh | 2
mln/logical/and.hh | 2
mln/logical/and_not.hh | 2
mln/logical/not.hh | 2
mln/logical/or.hh | 2
mln/morpho/dilation_fast.hh | 2
mln/morpho/erosion_fast.hh | 2
mln/test/predicate.hh | 2
tests/image2d_b.cc | 8 +++
tests/level_paste.cc | 2
tests/literal_zero.cc | 1
47 files changed, 158 insertions(+), 230 deletions(-)
Index: tests/literal_zero.cc
--- tests/literal_zero.cc (revision 1248)
+++ tests/literal_zero.cc (working copy)
@@ -31,7 +31,6 @@
*/
#include <mln/literal/zero.hh>
-// #include <mln/core/concept/object.hh>
int main()
Index: tests/image2d_b.cc
--- tests/image2d_b.cc (revision 1248)
+++ tests/image2d_b.cc (working copy)
@@ -36,6 +36,12 @@
#include <mln/core/init.hh>
+template <typename I>
+void check_fastest(const mln::Fastest_Image<I>&)
+{
+}
+
+
int main()
{
using namespace mln;
@@ -48,4 +54,6 @@
mln_assertion(f.npoints() = geom::nrows(f) * geom::ncols(f));
mln_assertion(f.ncells() = (nrows + 2 * border) * (ncols + 2 * border));
+
+ check_fastest(f);
}
Index: tests/level_paste.cc
--- tests/level_paste.cc (revision 1248)
+++ tests/level_paste.cc (working copy)
@@ -58,5 +58,5 @@
level::paste(ima, ima2); // Fast version.
debug::println(ima2);
- level::impl::paste_generic_(ima, ima2); // Not so fast version...
+ level::impl::generic::paste_(ima, ima2); // Not so fast version...
}
Index: mln/histo/compute.hh
--- mln/histo/compute.hh (revision 1248)
+++ mln/histo/compute.hh (working copy)
@@ -65,7 +65,7 @@
}
template <typename I>
- data<mln_vset(I)> compute(const Fast_Image<I>& input_)
+ data<mln_vset(I)> compute(const Fastest_Image<I>& input_)
{
const I& input = exact(input_);
data<mln_vset(I)> h(input.values());
Index: mln/debug/iota.hh
--- mln/debug/iota.hh (revision 1248)
+++ mln/debug/iota.hh (working copy)
@@ -63,7 +63,7 @@
}
template <typename I>
- void iota(Fast_Image<I>& input_)
+ void iota(Fastest_Image<I>& input_)
{
unsigned i = 0;
I& input = exact(input_);
Index: mln/debug/println_with_border.hh
--- mln/debug/println_with_border.hh (revision 1248)
+++ mln/debug/println_with_border.hh (working copy)
@@ -48,7 +48,7 @@
/// Print the image \p input on the standard output.
template <typename I>
- void println_with_border(const Fast_Image<I>& input);
+ void println_with_border(const Fastest_Image<I>& input);
# ifndef MLN_INCLUDE_ONLY
@@ -58,7 +58,7 @@
// generic version
template <typename S, typename I>
- void println_with_border(const S&, const Fast_Image<I>& input_)
+ void println_with_border(const S&, const Fastest_Image<I>& input_)
{
const I& input = exact(input_);
for (size_t i = 0; i < input.ncells(); i++)
@@ -68,7 +68,7 @@
// 2D version
template <typename I>
- void println_with_border(const box2d& b, const Fast_Image<I>&
input_)
+ void println_with_border(const box2d& b, const Fastest_Image<I>&
input_)
{
const I& input = exact(input_);
const std::size_t ncols = b.ncols() + 2 * input.border();
@@ -83,7 +83,7 @@
// 3D version
template <typename I>
- void println_with_border(const box3d& b, const Fast_Image<I>&
input_)
+ void println_with_border(const box3d& b, const Fastest_Image<I>&
input_)
{
const I& ima = exact(input_);
typedef mln_point(I) P;
@@ -115,7 +115,7 @@
// facade
template <typename I>
- void println_with_border(const Fast_Image<I>& input)
+ void println_with_border(const Fastest_Image<I>& input)
{
impl::println_with_border(exact(input).bbox(), exact(input));
}
Index: mln/core/macros.hh
--- mln/core/macros.hh (revision 1248)
+++ mln/core/macros.hh (working copy)
@@ -34,6 +34,13 @@
*/
+// a
+
+/// Shortcut to access the argument type associated to T.
+# define mln_argument(T) typename T::argument
+# define mln_argument_(T) T::argument
+
+
// b
/// Shortcut to access the bkd_niter type associated to T.
@@ -161,10 +168,6 @@
# define mln_value(T) typename T::value
# define mln_value_(T) T::value
-/// Shortcut to access the argument type associated to T.
-# define mln_argument(T) typename T::argument
-# define mln_argument_(T) T::argument
-
/// Shortcut to test if the values of an image with type \c I are lowly quantifized.
# define mln_is_value_lowq(I) mln_is_lowq( mln_value(I) )
Index: mln/core/internal/image_base.hh
--- mln/core/internal/image_base.hh (revision 1248)
+++ mln/core/internal/image_base.hh (working copy)
@@ -36,6 +36,7 @@
# include <mln/core/concept/image.hh>
# include <mln/core/grids.hh>
# include <mln/util/tracked_ptr.hh>
+# include <mln/metal/equal.hh>
@@ -77,16 +78,16 @@
};
- /*! \brief Selector for image inheritance (fast or regular).
+ /*! \brief Selector for image inheritance (fastest or not fastest).
*
* \internal
*/
- template <typename Is_fast, typename E>
+ template <typename Is_fastest, typename E>
struct select_image_concept_;
template <typename E>
struct select_image_concept_< metal::true_, E >
- : public Fast_Image<E>
+ : public Fastest_Image<E>
{};
template <typename E>
@@ -105,7 +106,8 @@
template <typename S, typename E>
struct image_base_
- : public select_image_concept_< typename trait::is_fast<E>::ret,
+ : public select_image_concept_< typename mlc_equal(mln_trait_image_speed(E),
+ trait::speed::fastest)::eval,
E >
{
/// Point_Set associated type.
@@ -169,6 +171,10 @@
// Internal data, sharable by several images.
util::tracked_ptr< internal::data_<E> > data_;
+
+ typedef select_image_concept_< typename mlc_equal(mln_trait_image_speed(E),
+ trait::speed::fastest)::eval,
+ E > super_;
};
@@ -182,8 +188,7 @@
template <typename S, typename E>
image_base_<S,E>::image_base_(const image_base_& rhs)
- : select_image_concept_< typename trait::is_fast<E>::ret,
- E >()
+ : super_()
{
mln_precondition(exact(rhs).has_data()); // FIXME: Is-it too restrictive?
this->data_ = rhs.data_;
Index: mln/core/image2d_b.hh
--- mln/core/image2d_b.hh (revision 1248)
+++ mln/core/image2d_b.hh (working copy)
@@ -104,16 +104,16 @@
- namespace trait
- {
+// namespace trait
+// {
- template <typename T>
- struct is_fast< image2d_b<T> >
- {
- typedef metal::true_ ret;
- };
+// template <typename T>
+// struct is_fast< image2d_b<T> >
+// {
+// typedef metal::true_ ret;
+// };
- } // end of mln::trait
+// } // end of mln::trait
Index: mln/core/trait/all.hh
--- mln/core/trait/all.hh (revision 1248)
+++ mln/core/trait/all.hh (working copy)
@@ -44,7 +44,6 @@
}
-# include <mln/core/trait/is_fast.hh>
# include <mln/core/trait/pixter.hh>
Index: mln/core/concept/image.hh
--- mln/core/concept/image.hh (revision 1248)
+++ mln/core/concept/image.hh (working copy)
@@ -193,7 +193,7 @@
} // end of namespace mln
-# include <mln/core/concept/fast_image.hh>
+# include <mln/core/concept/fastest_image.hh>
#endif // ! MLN_CORE_CONCEPT_IMAGE_HH
Index: mln/core/concept/doc/fastest_image.hh
--- mln/core/concept/doc/fastest_image.hh (revision 1248)
+++ mln/core/concept/doc/fastest_image.hh (working copy)
@@ -25,8 +25,8 @@
// reasons why the executable file might be covered by the GNU General
// Public License.
-/*! \file mln/core/concept/doc/fast_image.hh
- * \brief This file documents the concept of mln::Fast_Image.
+/*! \file mln/core/concept/doc/fastest_image.hh
+ * \brief This file documents the concept of mln::Fastest_Image.
*/
namespace mln
@@ -35,11 +35,11 @@
namespace doc
{
- /*! \brief Documentation class for mln::Fast_Image.
- * \see mln::Fast_Image
+ /*! \brief Documentation class for mln::Fastest_Image.
+ * \see mln::Fastest_Image
*/
template <typename E>
- struct Fast_Image : public Image<E>
+ struct Fastest_Image : public Image<E>
{
/*! \brief Give the border thickness.
Index: mln/core/concept/fastest_image.hh
--- mln/core/concept/fastest_image.hh (revision 1248)
+++ mln/core/concept/fastest_image.hh (working copy)
@@ -25,11 +25,11 @@
// reasons why the executable file might be covered by the GNU General
// Public License.
-#ifndef MLN_CORE_CONCEPT_FAST_IMAGE_HH
-# define MLN_CORE_CONCEPT_FAST_IMAGE_HH
+#ifndef MLN_CORE_CONCEPT_FASTEST_IMAGE_HH
+# define MLN_CORE_CONCEPT_FASTEST_IMAGE_HH
-/*! \file mln/core/concept/fast_image.hh
- * \brief Definition of the concept of mln::Fast_Image.
+/*! \file mln/core/concept/fastest_image.hh
+ * \brief Definition of the concept of mln::Fastest_Image.
*/
# include <mln/core/concept/image.hh>
@@ -40,13 +40,13 @@
namespace mln
{
- /*! \brief Base class for implementation of fast image classes.
+ /*! \brief Base class for implementation of fastest image classes.
*
- * \see mln::doc::Fast_Image for a complete documentation of this
+ * \see mln::doc::Fastest_Image for a complete documentation of this
* class contents.
*/
template <typename E>
- struct Fast_Image : public Image<E>
+ struct Fastest_Image : public Image<E>
{
/*
unsigned border();
@@ -78,7 +78,7 @@
offset_at(const Generalized_Point<P>& p) const;
protected:
- Fast_Image();
+ Fastest_Image();
};
@@ -87,7 +87,7 @@
template <typename E>
template <typename P>
unsigned // FIXME: std::size_t?
- Fast_Image<E>::offset_at(const Generalized_Point<P>& p_) const
+ Fastest_Image<E>::offset_at(const Generalized_Point<P>& p_) const
{
// FIXME: check that P is mln_point(E)
const E* this_ = exact(this);
@@ -101,7 +101,7 @@
}
template <typename E>
- Fast_Image<E>::Fast_Image()
+ Fastest_Image<E>::Fastest_Image()
{
typedef mln_point(E) point;
typedef mln_dpoint(E) dpoint;
@@ -142,4 +142,4 @@
} // end of namespace mln
-#endif // ! MLN_CORE_CONCEPT_FAST_IMAGE_HH
+#endif // ! MLN_CORE_CONCEPT_FASTEST_IMAGE_HH
Index: mln/core/image1d_b.hh
--- mln/core/image1d_b.hh (revision 1248)
+++ mln/core/image1d_b.hh (working copy)
@@ -56,19 +56,6 @@
template <typename T> struct image1d_b;
- namespace trait
- {
-
- template <typename T>
- struct is_fast< image1d_b<T> >
- {
- typedef metal::true_ ret;
- };
-
- } // end of mln::trait
-
-
-
namespace internal
{
Index: mln/core/image3d_b.hh
--- mln/core/image3d_b.hh (revision 1248)
+++ mln/core/image3d_b.hh (working copy)
@@ -56,17 +56,6 @@
template <typename T> struct image3d_b;
- namespace trait
- {
-
- template <typename T>
- struct is_fast< image3d_b<T> >
- {
- typedef metal::true_ ret;
- };
-
- } // end of mln::trait
-
namespace internal
{
Index: mln/arith/plus.hh
--- mln/arith/plus.hh (revision 1248)
+++ mln/arith/plus.hh (working copy)
@@ -118,7 +118,7 @@
}
template <typename L, typename R, typename O>
- void plus_(const Fast_Image<L>& lhs, const Fast_Image<R>& rhs,
Fast_Image<O>& output)
+ void plus_(const Fastest_Image<L>& lhs, const Fastest_Image<R>&
rhs, Fastest_Image<O>& output)
{
mln_pixter(const L) lp(exact(lhs));
mln_pixter(const R) rp(exact(rhs));
@@ -138,7 +138,7 @@
}
template <typename L, typename R>
- void plus_inplace_(Fast_Image<L>& lhs, const Fast_Image<R>&
rhs)
+ void plus_inplace_(Fastest_Image<L>& lhs, const
Fastest_Image<R>& rhs)
{
mln_pixter(L) lp(exact(lhs));
mln_pixter(const R) rp(exact(rhs));
Index: mln/arith/min.hh
--- mln/arith/min.hh (revision 1248)
+++ mln/arith/min.hh (working copy)
@@ -87,7 +87,7 @@
}
template <typename L, typename R, typename O>
- void min_(const Fast_Image<L>& lhs, const Fast_Image<R>& rhs,
Fast_Image<O>& output)
+ void min_(const Fastest_Image<L>& lhs, const Fastest_Image<R>&
rhs, Fastest_Image<O>& output)
{
mln_pixter(const L) lp(exact(lhs));
mln_pixter(const R) rp(exact(rhs));
@@ -108,7 +108,7 @@
}
template <typename L, typename R>
- void min_inplace_(Fast_Image<L>& lhs, const Fast_Image<R>&
rhs)
+ void min_inplace_(Fastest_Image<L>& lhs, const
Fastest_Image<R>& rhs)
{
mln_pixter(L) lp(exact(lhs));
mln_pixter(const R) rp(exact(rhs));
Index: mln/arith/revert.hh
--- mln/arith/revert.hh (revision 1248)
+++ mln/arith/revert.hh (working copy)
@@ -89,7 +89,7 @@
}
template <typename I, typename O>
- void revert_(const Fast_Image<I>& input, Fast_Image<O>&
output)
+ void revert_(const Fastest_Image<I>& input, Fastest_Image<O>&
output)
{
typedef mln_value(I) V;
mln_pixter(const I) ip(exact(input));
Index: mln/arith/minus.hh
--- mln/arith/minus.hh (revision 1248)
+++ mln/arith/minus.hh (working copy)
@@ -86,7 +86,7 @@
}
template <typename L, typename R, typename O>
- void minus_(const Fast_Image<L>& lhs, const Fast_Image<R>& rhs,
Fast_Image<O>& output)
+ void minus_(const Fastest_Image<L>& lhs, const
Fastest_Image<R>& rhs, Fastest_Image<O>& output)
{
mln_pixter(const L) lp(exact(lhs));
mln_pixter(const R) rp(exact(rhs));
@@ -106,7 +106,7 @@
}
template <typename L, typename R>
- void minus_inplace_(Fast_Image<L>& lhs, const Fast_Image<R>&
rhs)
+ void minus_inplace_(Fastest_Image<L>& lhs, const
Fastest_Image<R>& rhs)
{
mln_pixter(L) lp(exact(lhs));
mln_pixter(const R) rp(exact(rhs));
Index: mln/level/take.hh
--- mln/level/take.hh (revision 1248)
+++ mln/level/take.hh (working copy)
@@ -72,7 +72,7 @@
}
template <typename A, typename I>
- void take(const Fast_Image<I>& input_, A& a)
+ void take(const Fastest_Image<I>& input_, A& a)
{
const I& input = exact(input_);
mln_pixter(const I) pxl(input);
Index: mln/level/assign.hh
--- mln/level/assign.hh (revision 1248)
+++ mln/level/assign.hh (working copy)
@@ -75,7 +75,7 @@
}
template <typename L, typename R>
- void assign(Fast_Image<L>& target_, const Fast_Image<R>&
data_)
+ void assign(Fastest_Image<L>& target_, const Fastest_Image<R>&
data_)
{
L& target = exact(target_);
const R& data = exact(data_);
Index: mln/level/apply.hh
--- mln/level/apply.hh (revision 1248)
+++ mln/level/apply.hh (working copy)
@@ -76,7 +76,7 @@
}
template <typename I, typename F>
- void apply_(Fast_Image<I>& input_, const F& f)
+ void apply_(Fastest_Image<I>& input_, const F& f)
{
I& input = exact(input_);
mln_pixter(I) pxl(input);
Index: mln/level/fill.hh
--- mln/level/fill.hh (revision 1248)
+++ mln/level/fill.hh (working copy)
@@ -32,7 +32,7 @@
*
* \brief Fill an image, that is, set pixel values.
*
- * \todo Re-organize this file contents + Overload for fast images.
+ * \todo Re-organize this file contents + Overload for fastest images.
*/
# include <cstring>
@@ -141,7 +141,7 @@
}
template <typename I>
- void fill_with_value(Fast_Image<I>& ima_, const mln_value(I)& value)
+ void fill_with_value(Fastest_Image<I>& ima_, const mln_value(I)&
value)
{
I& ima = exact(ima_);
level::memset_(ima, ima.point_at_offset(0), value, ima.ncells());
Index: mln/level/memcpy_.hh
--- mln/level/memcpy_.hh (revision 1248)
+++ mln/level/memcpy_.hh (working copy)
@@ -30,12 +30,12 @@
/*! \file mln/level/memcpy_.hh
*
- * \brief Same as std::memcpy but for fast images.
+ * \brief Same as std::memcpy but for fastest images.
*
* \todo Overload with images and points; Cf. memset_.
*/
-# include <mln/core/concept/fast_image.hh>
+# include <mln/core/concept/image.hh>
# include <mln/core/pixel.hh>
Index: mln/level/memset_.hh
--- mln/level/memset_.hh (revision 1248)
+++ mln/level/memset_.hh (working copy)
@@ -30,10 +30,10 @@
/*! \file mln/level/memset_.hh
*
- * \brief Same as std::memset but for fast images.
+ * \brief Same as std::memset but for fastest images.
*/
-# include <mln/core/concept/fast_image.hh>
+# include <mln/core/concept/image.hh>
# include <mln/core/pixel.hh>
@@ -66,7 +66,7 @@
* \pre \p input has to be initialized. FIXME: More.
*/
template <typename I>
- void memset_(Fast_Image<I>& input, const mln_point(I)& p,
+ void memset_(Fastest_Image<I>& input, const mln_point(I)& p,
const mln_value(I)& v, std::size_t n);
@@ -111,7 +111,7 @@
}
template <typename I>
- void memset_(Fast_Image<I>& input_, const mln_point(I)& p,
+ void memset_(Fastest_Image<I>& input_, const mln_point(I)& p,
const mln_value(I)& v, std::size_t n)
{
I& input = exact(input_);
Index: mln/level/median.hh
--- mln/level/median.hh (revision 1248)
+++ mln/level/median.hh (working copy)
@@ -32,7 +32,7 @@
*
* \brief Median filtering of an image.
*
- * \todo Add Fast_Image versions.
+ * \todo Add Fastest_Image versions.
*/
# include <mln/core/concept/image.hh>
Index: mln/level/paste.spe.hh
--- mln/level/paste.spe.hh (revision 1247)
+++ mln/level/paste.spe.hh (working copy)
@@ -25,60 +25,37 @@
// reasons why the executable file might be covered by the GNU General
// Public License.
-#ifndef MLN_LEVEL_PASTE_HH
-# define MLN_LEVEL_PASTE_HH
+#ifndef MLN_LEVEL_PASTE_SPE_HH
+# define MLN_LEVEL_PASTE_SPE_HH
-/*! \file mln/level/paste.hh
+/*! \file mln/level/paste.spe.hh
*
- * \brief Paste the contents of an image into another one.
+ * \brief Specializations for mln::level::paste.
*/
-# include <mln/core/concept/image.hh>
-# include <mln/core/inplace.hh>
# include <mln/level/memcpy_.hh>
+
+# ifndef MLN_INCLUDE_ONLY
+
namespace mln
{
namespace level
{
- /*! Paste the contents of image \p data into the image \p
- * destination.
- *
- * \param[in] data The input image providing pixels values.
- * \param[in,out] destination The image in which values are
- * assigned.
- *
- * This routine runs: \n
- * for all p of \p data, \p destination(p) = \p data(p).
- *
- * \warning The definition domain of \p data has to be included in
- * the one of \p destination; so using mln::safe_image does not
- * make pasting outside the destination domain work.
- *
- * \pre \p data.domain <= \p destination.domain
- */
- template <typename I, typename J>
- void paste(const Image<I>& data, Image<J>& destination);
-
-
-# ifndef MLN_INCLUDE_ONLY
-
namespace impl
{
- template <typename I, typename J>
- void paste_generic_(const I& data, J& destination)
+
+ namespace generic
{
- trace::entering("level::impl::paste_generic_");
- mln_piter(I) p(data.domain());
- for_all(p)
- destination(p) = data(p);
- trace::exiting("level::impl::paste_generic_");
+ template <typename I, typename J>
+ void paste_(const I& data, J& destination);
}
+
template <typename I, typename J>
void paste_lines_(const I& data, J& destination)
{
@@ -96,13 +73,16 @@
trace::exiting("level::impl::paste_lines_");
}
+
// Disjunction.
+ // Remember: raw < linear < stored, computed.
+
template <typename I, typename J>
void paste_(mln::trait::data::any, const I& data,
mln::trait::data::any, J& destination)
{
- paste_generic_(data, destination);
+ generic::paste_(data, destination);
}
template <typename I, typename J>
@@ -112,36 +92,17 @@
if (sizeof(mln_value(I)) = sizeof(mln_value(J)))
paste_lines_(data, destination);
else
- paste_generic_(data, destination);
+ generic::paste_(data, destination);
}
- } // end of namespace mln::level::impl
-
- // Facade.
-
- template <typename I, typename J>
- void paste(const Image<I>& data_, Image<J>& destination_)
- {
- trace::entering("level::paste");
- mlc_is(mln_trait_image_io(J), trait::io::write)::check();
- mlc_converts_to(mln_value(I), mln_value(J))::check();
-
- const I& data = exact(data_);
- J& destination = exact(destination_);
- mln_precondition(data.domain() <= destination.domain());
-
- // Remember: raw < linear < stored, computed.
- impl::paste_(mln_trait_image_data(I)(), data,
- mln_trait_image_data(J)(), destination);
- trace::exiting("level::paste");
- }
-
-# endif // ! MLN_INCLUDE_ONLY
+ } // end of namespace mln::level::impl
} // end of namespace mln::level
} // end of namespace mln
+# endif // ! MLN_INCLUDE_ONLY
+
#endif // ! MLN_LEVEL_PASTE_HH
Index: mln/level/transform.hh
--- mln/level/transform.hh (revision 1248)
+++ mln/level/transform.hh (working copy)
@@ -100,7 +100,7 @@
// template <typename I, typename F, typename O>
// void transform(metal::true_, // low quantization
-// const Fast_Image<I>& input_, const Function_v2v<F>& f_,
Image<O>& output_)
+// const Fastest_Image<I>& input_, const Function_v2v<F>& f_,
Image<O>& output_)
// {
// const I& input = exact(input_);
// const F& f = exact(f_);
Index: mln/level/paste.hh
--- mln/level/paste.hh (revision 1248)
+++ mln/level/paste.hh (working copy)
@@ -35,7 +35,11 @@
# include <mln/core/concept/image.hh>
# include <mln/core/inplace.hh>
-# include <mln/level/memcpy_.hh>
+
+
+// Specializations are in:
+# include <mln/level/paste.spe.hh>
+
namespace mln
@@ -64,56 +68,28 @@
void paste(const Image<I>& data, Image<J>& destination);
+
# ifndef MLN_INCLUDE_ONLY
namespace impl
{
- template <typename I, typename J>
- void paste_generic_(const I& data, J& destination)
+ namespace generic
{
- trace::entering("level::impl::paste_generic_");
- mln_piter(I) p(data.domain());
- for_all(p)
- destination(p) = data(p);
- trace::exiting("level::impl::paste_generic_");
- }
template <typename I, typename J>
- void paste_lines_(const I& data, J& destination)
+ void paste_(const I& data, J& destination)
{
- trace::entering("level::impl::paste_lines_");
- typedef mln_point(I) P;
- std::size_t n = data.bbox().len(P::dim - 1);
- // FIXME: Works only for raw data images
- // FIXME: For linear data images, we should get the len for each line...
+ trace::entering("level::impl::generic::paste_");
- typename I::line_piter p(data.domain()); // FIXME: Alias mln_line_piter!
+ mln_piter(I) p(data.domain());
for_all(p)
- memcpy_(inplace(make::pixel(destination, p)),
- make::pixel(data, p),
- n);
- trace::exiting("level::impl::paste_lines_");
- }
-
- // Disjunction.
+ destination(p) = data(p);
- template <typename I, typename J>
- void paste_(mln::trait::data::any, const I& data,
- mln::trait::data::any, J& destination)
- {
- paste_generic_(data, destination);
+ trace::exiting("level::impl::generic::paste_");
}
- template <typename I, typename J>
- void paste_(mln::trait::data::raw, const I& data,
- mln::trait::data::raw, J& destination)
- {
- if (sizeof(mln_value(I)) = sizeof(mln_value(J)))
- paste_lines_(data, destination);
- else
- paste_generic_(data, destination);
- }
+ } // end of namespace mln::level::impl::generic
} // end of namespace mln::level::impl
@@ -123,17 +99,17 @@
template <typename I, typename J>
void paste(const Image<I>& data_, Image<J>& destination_)
{
+ const I& data = exact(data_);
+ J& destination = exact(destination_);
trace::entering("level::paste");
+
mlc_is(mln_trait_image_io(J), trait::io::write)::check();
mlc_converts_to(mln_value(I), mln_value(J))::check();
-
- const I& data = exact(data_);
- J& destination = exact(destination_);
mln_precondition(data.domain() <= destination.domain());
- // Remember: raw < linear < stored, computed.
impl::paste_(mln_trait_image_data(I)(), data,
mln_trait_image_data(J)(), destination);
+
trace::exiting("level::paste");
}
@@ -144,4 +120,5 @@
} // end of namespace mln
+
#endif // ! MLN_LEVEL_PASTE_HH
Index: mln/linear/convolve.hh
--- mln/linear/convolve.hh (revision 1248)
+++ mln/linear/convolve.hh (working copy)
@@ -87,8 +87,8 @@
}
template <typename I, typename W, typename O>
- void convolve_(const Fast_Image<I>& input_, const
Weighted_Window<W>& w_win_,
- Fast_Image<O>& output_)
+ void convolve_(const Fastest_Image<I>& input_, const
Weighted_Window<W>& w_win_,
+ Fastest_Image<O>& output_)
{
const I& input = exact(input_);
const W& w_win = exact(w_win_);
Index: mln/linear/local/convolve.hh
--- mln/linear/local/convolve.hh (revision 1248)
+++ mln/linear/local/convolve.hh (working copy)
@@ -103,7 +103,7 @@
}
template <typename I, typename P, typename W, typename R>
- void convolve(const Fast_Image<I>& input_,
+ void convolve(const Fastest_Image<I>& input_,
const Generalized_Point<P>& p_,
const W& w_win,
R& result)
Index: mln/accu/take.hh
--- mln/accu/take.hh (revision 1248)
+++ mln/accu/take.hh (working copy)
@@ -75,7 +75,7 @@
a.take(make::pix(input, p));
}
- // FIXME: We need an impl for pixels of fast images.
+ // FIXME: We need an impl for pixels of fastest images.
} // end of namespace mln::accu::impl
Index: mln/border/resize.hh
--- mln/border/resize.hh (revision 1248)
+++ mln/border/resize.hh (working copy)
@@ -57,13 +57,13 @@
* \todo Implement it.
*/
template <typename I>
- void resize(const Fast_Image<I>& ima, unsigned thickness);
+ void resize(const Fastest_Image<I>& ima, unsigned thickness);
# ifndef MLN_INCLUDE_ONLY
template <typename I>
- void resize(const Fast_Image<I>& ima_, unsigned thickness)
+ void resize(const Fastest_Image<I>& ima_, unsigned thickness)
{
const I& ima = exact(ima_);
mln_precondition(ima.has_data());
Index: mln/border/fill.hh
--- mln/border/fill.hh (revision 1248)
+++ mln/border/fill.hh (working copy)
@@ -53,7 +53,7 @@
* \todo Implement it + optimize with memset if possible.
*/
template <typename I>
- void fill(const Fast_Image<I>& ima, const mln_value(I)& v);
+ void fill(const Fastest_Image<I>& ima, const mln_value(I)& v);
# ifndef MLN_INCLUDE_ONLY
@@ -61,7 +61,7 @@
{
template <typename I>
- void fill_size_1_(const Fast_Image<I>& ima_, const mln_value(I)& v)
+ void fill_size_1_(const Fastest_Image<I>& ima_, const mln_value(I)&
v)
{
typedef mln_point(I) P;
const I& ima = exact(ima_);
@@ -84,7 +84,7 @@
}
template <typename I>
- void fill_size_n_(const Fast_Image<I>& ima_, const mln_value(I)& v)
+ void fill_size_n_(const Fastest_Image<I>& ima_, const mln_value(I)&
v)
{
typedef mln_point(I) P;
const I& ima = exact(ima_);
@@ -108,7 +108,7 @@
// Facade.
template <typename I>
- void fill(const Fast_Image<I>& ima_, const mln_value(I)& v)
+ void fill(const Fastest_Image<I>& ima_, const mln_value(I)& v)
{
trace::entering("border::fill");
typedef mln_point(I) P;
Index: mln/border/duplicate.hh
--- mln/border/duplicate.hh (revision 1248)
+++ mln/border/duplicate.hh (working copy)
@@ -55,7 +55,7 @@
* \todo Implement it + optimize with memcpy if possible.
*/
template <typename I>
- void duplicate(const Fast_Image<I>& ima);
+ void duplicate(const Fastest_Image<I>& ima);
# ifndef MLN_INCLUDE_ONLY
@@ -64,7 +64,7 @@
{
template <typename I>
- void duplicate_1d_(const Fast_Image<I>& ima_)
+ void duplicate_1d_(const Fastest_Image<I>& ima_)
{
const I& ima = exact(ima_);
mln_precondition(ima.has_data());
@@ -83,7 +83,7 @@
}
template <typename I>
- void duplicate_2d_(const Fast_Image<I>& ima_)
+ void duplicate_2d_(const Fastest_Image<I>& ima_)
{
const I& ima = exact(ima_);
mln_precondition(ima.has_data());
@@ -122,7 +122,7 @@
}
template <typename I>
- void duplicate_3d_(const Fast_Image<I>& ima_)
+ void duplicate_3d_(const Fastest_Image<I>& ima_)
{
const I& ima = exact(ima_);
mln_precondition(ima.has_data());
@@ -190,7 +190,7 @@
// Facade.
template <typename I>
- void duplicate(const Fast_Image<I>& ima_)
+ void duplicate(const Fastest_Image<I>& ima_)
{
trace::entering("border::duplicate");
typedef mln_point(I) P;
Index: mln/border/mirror.hh
--- mln/border/mirror.hh (revision 1248)
+++ mln/border/mirror.hh (working copy)
@@ -53,13 +53,13 @@
* \todo Implement it + optimize with memset if possible.
*/
template <typename I>
- void mirror(const Fast_Image<I>& ima);
+ void mirror(const Fastest_Image<I>& ima);
# ifndef MLN_INCLUDE_ONLY
template <typename I>
- void mirror(const Fast_Image<I>& ima_)
+ void mirror(const Fastest_Image<I>& ima_)
{
const I& ima = exact(ima_);
mln_precondition(ima.has_data());
Index: mln/border/get.hh
--- mln/border/get.hh (revision 1248)
+++ mln/border/get.hh (working copy)
@@ -75,7 +75,7 @@
}
template <typename I>
- unsigned get_(const Fast_Image<I>& ima)
+ unsigned get_(const Fastest_Image<I>& ima)
{
return exact(ima).border();
}
Index: mln/test/predicate.hh
--- mln/test/predicate.hh (revision 1248)
+++ mln/test/predicate.hh (working copy)
@@ -80,7 +80,7 @@
}
template <typename I, typename F>
- bool predicate_(const Fast_Image<I>& ima_, const F& f)
+ bool predicate_(const Fastest_Image<I>& ima_, const F& f)
{
const I& ima = exact(ima_);
mln_pixter(const I) pxl(ima);
Index: mln/morpho/erosion_fast.hh
--- mln/morpho/erosion_fast.hh (revision 1248)
+++ mln/morpho/erosion_fast.hh (working copy)
@@ -32,7 +32,7 @@
*
* \brief Ero filtering of an image.
*
- * \todo Add Fast_Image versions.
+ * \todo Add Fastest_Image versions.
*/
# include <mln/core/concept/image.hh>
Index: mln/morpho/dilation_fast.hh
--- mln/morpho/dilation_fast.hh (revision 1248)
+++ mln/morpho/dilation_fast.hh (working copy)
@@ -32,7 +32,7 @@
*
* \brief Ero filtering of an image.
*
- * \todo Add Fast_Image versions.
+ * \todo Add Fastest_Image versions.
*/
# include <mln/core/concept/image.hh>
Index: mln/io/internal/pnm/save.hh
--- mln/io/internal/pnm/save.hh (revision 1248)
+++ mln/io/internal/pnm/save.hh (working copy)
@@ -93,7 +93,7 @@
file.write((char*)(&c), sizeof(E));
}
- // save data for (sizeof(int_u8) != 1) and non fast images
+ // save data for (sizeof(int_u8) != 1) and non fastest images
template <typename I>
void save_data_uncontiguous(std::ofstream& file,
const Image< I >& ima_)
@@ -112,11 +112,11 @@
write_value(file, ima(p));
}
- // save data when (sizeof(int_u8) = 1) with fast images
+ // save data when (sizeof(int_u8) = 1) with fastest images
// (faster)
template <typename I>
void save_data_contiguous(std::ofstream& file,
- const Fast_Image<I>& ima_)
+ const Fastest_Image<I>& ima_)
{
const I& ima = exact(ima_);
const int
@@ -130,10 +130,10 @@
}
- // caller for fast images
+ // caller for fastest images
template <typename I>
void save_data(std::ofstream& file,
- const Fast_Image<I>& ima)
+ const Fastest_Image<I>& ima)
{
if (sizeof(value::int_u8) = 1)
save_data_contiguous(file, ima);
@@ -141,7 +141,7 @@
save_data_uncontiguous(file, ima);
}
- // caller for non fast images
+ // caller for non fastest images
template <typename I>
void save_data(std::ofstream& file,
const Image<I>& ima)
Index: mln/logical/and.hh
--- mln/logical/and.hh (revision 1248)
+++ mln/logical/and.hh (working copy)
@@ -88,7 +88,7 @@
}
template <typename L, typename R, typename O>
- void and__(const Fast_Image<L>& lhs, const Fast_Image<R>& rhs,
Fast_Image<O>& output)
+ void and__(const Fastest_Image<L>& lhs, const Fastest_Image<R>&
rhs, Fastest_Image<O>& output)
{
mln_pixter(const L) lp(exact(lhs));
mln_pixter(const R) rp(exact(rhs));
Index: mln/logical/and_not.hh
--- mln/logical/and_not.hh (revision 1248)
+++ mln/logical/and_not.hh (working copy)
@@ -88,7 +88,7 @@
}
template <typename L, typename R, typename O>
- void and_not_(const Fast_Image<L>& lhs, const Fast_Image<R>&
rhs, Fast_Image<O>& output)
+ void and_not_(const Fastest_Image<L>& lhs, const
Fastest_Image<R>& rhs, Fastest_Image<O>& output)
{
mln_pixter(const L) lp(exact(lhs));
mln_pixter(const R) rp(exact(rhs));
Index: mln/logical/or.hh
--- mln/logical/or.hh (revision 1248)
+++ mln/logical/or.hh (working copy)
@@ -88,7 +88,7 @@
}
template <typename L, typename R, typename O>
- void or__(const Fast_Image<L>& lhs, const Fast_Image<R>& rhs,
Fast_Image<O>& output)
+ void or__(const Fastest_Image<L>& lhs, const Fastest_Image<R>&
rhs, Fastest_Image<O>& output)
{
mln_pixter(const L) lp(exact(lhs));
mln_pixter(const R) rp(exact(rhs));
Index: mln/logical/not.hh
--- mln/logical/not.hh (revision 1248)
+++ mln/logical/not.hh (working copy)
@@ -83,7 +83,7 @@
}
template <typename I, typename O>
- void not__(const Fast_Image<I>& input, Fast_Image<O>& output)
+ void not__(const Fastest_Image<I>& input, Fastest_Image<O>&
output)
{
mln_pixter(const I) ip(exact(input));
mln_pixter(O) op(exact(output));
Index: mln/labeling/level.hh
--- mln/labeling/level.hh (revision 1248)
+++ mln/labeling/level.hh (working copy)
@@ -34,7 +34,7 @@
* level.
*/
-# include <mln/core/concept/fast_image.hh>
+# include <mln/core/concept/image.hh>
# include <mln/labeling/base.hh>
# include <mln/level/fill.hh>
@@ -62,8 +62,8 @@
Image<O>& output, unsigned& nlabels);
template <typename I, typename N, typename O>
- bool level_fast(const Fast_Image<I>& input, const mln_value(I)& val,
const Neighborhood<N>& nbh,
- Fast_Image<O>& output, unsigned& nlabels);
+ bool level_fast(const Fastest_Image<I>& input, const mln_value(I)& val,
const Neighborhood<N>& nbh,
+ Fastest_Image<O>& output, unsigned& nlabels);
# ifndef MLN_INCLUDE_ONLY
@@ -83,7 +83,7 @@
typedef mln_pset(I_) S;
const S& s;
- void init() { mln::level::fill(this->output, 0); }
+ void init() { mln::level::fill(this->output, 0); } //
FIXME: use literal::zero
bool handles(const P& p) const { return input(p) = val; }
bool equiv(const P& n, const P&) const { return input(n) = val; }
@@ -121,7 +121,7 @@
// typedef mln_pset(I_) S;
// const S& s;
- void init() { level::fill(this->output, 0); }
+ void init() { mln::level::fill(this->output, 0); }
bool handles(unsigned p) const { return this->input[p] = val; }
bool equiv(unsigned n, unsigned) const { return this->input[n] = val; }
@@ -136,8 +136,8 @@
template <typename I, typename N, typename O>
- bool level_fast_(const Fast_Image<I>& input, const mln_value(I)& val,
const Neighborhood<N>& nbh,
- Fast_Image<O>& output, unsigned& nlabels)
+ bool level_fast_(const Fastest_Image<I>& input, const mln_value(I)&
val, const Neighborhood<N>& nbh,
+ Fastest_Image<O>& output, unsigned& nlabels)
{
typedef level_fast_t<I,N,O> F;
F f(exact(input), val, exact(nbh), exact(output));
@@ -161,8 +161,8 @@
}
template <typename I, typename N, typename O>
- bool level_fast(const Fast_Image<I>& input, const mln_value(I)& val,
const Neighborhood<N>& nbh,
- Fast_Image<O>& output, unsigned& nlabels)
+ bool level_fast(const Fastest_Image<I>& input, const mln_value(I)& val,
const Neighborhood<N>& nbh,
+ Fastest_Image<O>& output, unsigned& nlabels)
{
mln_precondition(exact(output).domain() = exact(input).domain());
return impl::level_fast_(exact(input), val, nbh, output, nlabels);
Index: mln/labeling/base.hh
--- mln/labeling/base.hh (revision 1248)
+++ mln/labeling/base.hh (working copy)
@@ -84,7 +84,7 @@
};
- /// Base class for labeling functors on fast images.
+ /// Base class for labeling functors on fastest images.
template <typename I_, typename N_, typename O_>
struct base_fast_