olena: olena-2.0-553-g493bf10 Add data::fill_without_localization.

* mln/data/fill_without_localization.hh, * tests/data/fill_without_localization.cc: New. * tests/data/Makefile.am: Add a new target. --- milena/ChangeLog | 9 + ...ocalization.hh => fill_without_localization.hh} | 173 ++++++++++---------- milena/tests/data/Makefile.am | 3 +- ...ocalization.cc => fill_without_localization.cc} | 14 +- 4 files changed, 104 insertions(+), 95 deletions(-) copy milena/mln/data/{paste_without_localization.hh => fill_without_localization.hh} (54%) copy milena/tests/data/{paste_without_localization.cc => fill_without_localization.cc} (81%) diff --git a/milena/ChangeLog b/milena/ChangeLog index edf3a65..ec9e11e 100644 --- a/milena/ChangeLog +++ b/milena/ChangeLog @@ -1,5 +1,14 @@ 2013-04-17 Guillaume Lazzara <z@lrde.epita.fr> + Add data::fill_without_localization. + + * mln/data/fill_without_localization.hh, + * tests/data/fill_without_localization.cc: New. + + * tests/data/Makefile.am: Add a new target. + +2013-04-17 Guillaume Lazzara <z@lrde.epita.fr> + * doc/mln/convert.dox: Fix from_to_ module name. 2013-04-17 Guillaume Lazzara <z@lrde.epita.fr> diff --git a/milena/mln/data/paste_without_localization.hh b/milena/mln/data/fill_without_localization.hh similarity index 54% copy from milena/mln/data/paste_without_localization.hh copy to milena/mln/data/fill_without_localization.hh index c2f48f1..c5eef2e 100644 --- a/milena/mln/data/paste_without_localization.hh +++ b/milena/mln/data/fill_without_localization.hh @@ -1,5 +1,4 @@ -// Copyright (C) 2009, 2010, 2012 EPITA Research and Development -// Laboratory (LRDE) +// Copyright (C) 2013 EPITA Research and Development Laboratory (LRDE) // // This file is part of Olena. // @@ -24,12 +23,12 @@ // exception does not however invalidate any other reasons why the // executable file might be covered by the GNU General Public License. -#ifndef MLN_DATA_PASTE_WITHOUT_LOCALIZATION_HH -# define MLN_DATA_PASTE_WITHOUT_LOCALIZATION_HH +#ifndef MLN_DATA_FILL_WITHOUT_LOCALIZATION_HH +# define MLN_DATA_FILL_WITHOUT_LOCALIZATION_HH /// \file /// -/// Paste the contents of an image into another one without taking +/// Fill the contents of an image with another one without taking /// into account the localization of sites. # include <mln/core/concept/image.hh> @@ -43,17 +42,17 @@ namespace mln namespace data { - /*!\brief Paste the contents of image \p input into the image \p - * output without taking into account the localization of sites. + /*!\brief Fill the contents of image \p ima with the image \p + * data without taking into account the localization of sites. * - * \param[in] input The input image providing pixels values. - * \param[in,out] output The image in which values are + * \param[in] ima data The image in which values are * assigned. + * \param[in,out] The image providing pixels values. * * \ingroup mlndata */ template <typename I, typename J> - void paste_without_localization(const Image<I>& input, Image<J>& output); + void fill_without_localization(Image<I>& ima, const Image<J>& data); @@ -68,13 +67,13 @@ namespace mln template <typename I, typename J> inline - void paste_without_localization_tests(const Image<I>& input, - Image<J>& output) + void fill_without_localization_tests(Image<I>& ima, + const Image<J>& data) { mlc_converts_to(mln_value(I), mln_value(J))::check(); - (void) input; - (void) output; + (void) ima; + (void) data; } } // end of namespace mln::data::internal @@ -92,23 +91,23 @@ namespace mln template <typename I, typename J> inline - void paste_without_localization(const Image<I>& input_, - Image<J>& output_) + void fill_without_localization(Image<I>& ima_, + const Image<J>& data_) { - mln_trace("data::impl::generic::paste_without_localization"); + mln_trace("data::impl::generic::fill_without_localization"); - internal::paste_without_localization_tests(input_, output_); + internal::fill_without_localization_tests(ima_, data_); - const I& input = exact(input_); - J& output = exact(output_); + I& ima = exact(ima_); + const J& data = exact(data_); - mln_fwd_piter(I) pi(input.domain()); + mln_fwd_piter(I) pi(ima.domain()); pi.start(); - mln_fwd_piter(J) po(output.domain()); + mln_fwd_piter(J) po(data.domain()); po.start(); while (pi.is_valid() && po.is_valid()) { - output(po) = input(pi); + ima(pi) = data(po); pi.next(); po.next(); } @@ -120,10 +119,10 @@ namespace mln - /*! \brief Paste data to an image without using localization. + /*! \brief Fill data to an image without using localization. Performs a one-block memory copy. - \p input and \p output must have both the following properties: + \p ima and \p data must have both the following properties: - mln::trait::image::value_alignment::with_grid - mln::trait::image::value_storage::one_block @@ -140,27 +139,27 @@ namespace mln */ template <typename I, typename J> inline - void paste_without_localization_fastest(const Image<I>& input_, - Image<J>& output_) + void fill_without_localization_fastest(Image<I>& ima_, + const Image<J>& data_) { - mln_trace("data::impl::paste_without_localization_fastest"); + mln_trace("data::impl::fill_without_localization_fastest"); - internal::paste_without_localization_tests(input_, output_); + internal::fill_without_localization_tests(ima_, data_); - const I& input = exact(input_); - J& output = exact(output_); + I& ima = exact(ima_); + const J& data = exact(data_); typedef mln_value(I) V; - memcpy(output.buffer(), input.buffer(), input.nelements() * sizeof(V)); + memcpy(ima.buffer(), data.buffer(), ima.nelements() * sizeof(V)); } - /*! \brief Paste data to an image without using localization. + /*! \brief Fill data to an image without using localization. Performs a line-per-line memory copy. - \p input and \p output must have both the following properties: + \p ima and \p data must have both the following properties: - mln::trait::image::value_alignment::with_grid - mln::trait::image::value_storage::one_block @@ -176,32 +175,32 @@ namespace mln */ template <typename I, typename J> inline - void paste_without_localization_lines(const Image<I>& input_, - Image<J>& output_) + void fill_without_localization_lines(Image<I>& ima_, + const Image<J>& data_) { - mln_trace("data::impl::paste_without_localization_fastest"); + mln_trace("data::impl::fill_without_localization_fastest"); - internal::paste_without_localization_tests(input_, output_); + internal::fill_without_localization_tests(ima_, data_); - const I& input = exact(input_); - J& output = exact(output_); + I& ima = exact(ima_); + const J& data = exact(data_); - box_runstart_piter<mln_site(I)> pi(input.domain()); - box_runstart_piter<mln_site(J)> po(output.domain()); + box_runstart_piter<mln_site(I)> pi(ima.domain()); + box_runstart_piter<mln_site(J)> po(data.domain()); typedef mln_value(I) V; for_all_2(pi, po) - memcpy(&output(po), &input(pi), input.ncols() * sizeof(V)); + memcpy(&ima(pi), &data(po), ima.ncols() * sizeof(V)); } - /*! \brief Paste data to an image without using localization. + /*! \brief Fill data to an image without using localization. Performs a point-wise copy. - \p input and \p output must have both the following properties: + \p ima and \p data must have both the following properties: - mln::trait::image::value_alignment::with_grid - mln::trait::image::value_storage::one_block @@ -216,21 +215,21 @@ namespace mln */ template <typename I, typename J> inline - void paste_without_localization_fast(const Image<I>& input_, - Image<J>& output_) + void fill_without_localization_fast(Image<I>& ima_, + const Image<J>& data_) { - mln_trace("data::impl::paste_without_localization_fast"); + mln_trace("data::impl::fill_without_localization_fast"); - internal::paste_without_localization_tests(input_, output_); + internal::fill_without_localization_tests(ima_, data_); - const I& input = exact(input_); - J& output = exact(output_); + I& ima = exact(ima_); + const J& data = exact(data_); - mln_pixter(const I) pi(input); - mln_pixter(J) po(output); + mln_pixter(I) pi(ima); + mln_pixter(const J) po(data); for_all_2(pi, po) - po.val() = pi.val(); + pi.val() = po.val(); } @@ -247,64 +246,64 @@ namespace mln template <typename I, typename J> inline - void paste_without_localization_dispatch( + void fill_without_localization_dispatch( mln::trait::image::value_access::direct, mln::trait::image::value_access::direct, mln::trait::image::ext_domain::some, mln::trait::image::ext_domain::some, - const I& input, - J& output) + I& ima, + const J& data) { if (sizeof(mln_value(I)) == sizeof(mln_value(J))) { - if (border::get(input) == border::get(output) - && input.domain() == output.domain()) - impl::paste_without_localization_fastest(input, output); + if (border::get(ima) == border::get(data) + && ima.domain() == data.domain()) + impl::fill_without_localization_fastest(ima, data); else - impl::paste_without_localization_lines(input, output); + impl::fill_without_localization_lines(ima, data); } else - impl::paste_without_localization_fast(input, output); + impl::fill_without_localization_fast(ima, data); } template <typename I, typename J> inline - void paste_without_localization_dispatch( + void fill_without_localization_dispatch( mln::trait::image::value_access::any, mln::trait::image::value_access::any, mln::trait::image::ext_domain::any, mln::trait::image::ext_domain::any, - const I& input, - J& output) + I& ima, + const J& data) { - impl::generic::paste_without_localization(input, output); + impl::generic::fill_without_localization(ima, data); } template <typename I, typename J> inline - void paste_without_localization_dispatch( + void fill_without_localization_dispatch( mln::trait::image::value_storage::any, mln::trait::image::value_storage::any, - const Image<I>& input, - Image<J>& output) + Image<I>& ima, + const Image<J>& data) { - impl::generic::paste_without_localization(input, output); + impl::generic::fill_without_localization(ima, data); } template <typename I, typename J> inline - void paste_without_localization_dispatch( + void fill_without_localization_dispatch( mln::trait::image::value_storage::one_block, mln::trait::image::value_storage::one_block, - const Image<I>& input_, - Image<J>& output_) + Image<I>& ima_, + const Image<J>& data_) { - const I& input = exact(input_); - J& output = exact(output_); + I& ima = exact(ima_); + const J& data = exact(data_); /// Check basic properties @@ -313,26 +312,26 @@ namespace mln mlc_is(mln_trait_image_value_alignment(J), trait::image::value_alignment::with_grid)::value) { - paste_without_localization_dispatch( + fill_without_localization_dispatch( mln_trait_image_value_access(I)(), mln_trait_image_value_access(J)(), mln_trait_image_ext_domain(I)(), mln_trait_image_ext_domain(J)(), - input, output); + ima, data); } else - impl::generic::paste_without_localization(input, output); + impl::generic::fill_without_localization(ima, data); } template <typename I, typename J> inline - void paste_without_localization_dispatch(const Image<I>& input, - Image<J>& output) + void fill_without_localization_dispatch(Image<I>& ima, + const Image<J>& data) { - paste_without_localization_dispatch(mln_trait_image_value_storage(I)(), + fill_without_localization_dispatch(mln_trait_image_value_storage(I)(), mln_trait_image_value_storage(J)(), - input, output); + ima, data); } } // end of namespace mln::data::internal @@ -344,13 +343,13 @@ namespace mln template <typename I, typename J> inline - void paste_without_localization(const Image<I>& input, Image<J>& output) + void fill_without_localization(Image<I>& ima, const Image<J>& data) { - mln_trace("data::paste_without_localization"); + mln_trace("data::fill_without_localization"); - internal::paste_without_localization_tests(input, output); + internal::fill_without_localization_tests(ima, data); - internal::paste_without_localization_dispatch(input, output); + internal::fill_without_localization_dispatch(ima, data); } @@ -362,4 +361,4 @@ namespace mln -#endif // ! MLN_DATA_PASTE_WITHOUT_LOCALIZATION_HH +#endif // ! MLN_DATA_FILL_WITHOUT_LOCALIZATION_HH diff --git a/milena/tests/data/Makefile.am b/milena/tests/data/Makefile.am index b733718..52c9368 100644 --- a/milena/tests/data/Makefile.am +++ b/milena/tests/data/Makefile.am @@ -1,4 +1,4 @@ -# Copyright (C) 2008, 2009, 2010 EPITA Research and Development +# Copyright (C) 2008, 2009, 2010, 2013 EPITA Research and Development # Laboratory (LRDE) # # This file is part of Olena. @@ -29,6 +29,7 @@ check_PROGRAMS = \ fill \ fill_with_image \ fill_with_value \ + fill_without_localization \ median \ median_fast \ memcpy_ \ diff --git a/milena/tests/data/paste_without_localization.cc b/milena/tests/data/fill_without_localization.cc similarity index 81% copy from milena/tests/data/paste_without_localization.cc copy to milena/tests/data/fill_without_localization.cc index dd0f479..c96f6d3 100644 --- a/milena/tests/data/paste_without_localization.cc +++ b/milena/tests/data/fill_without_localization.cc @@ -1,4 +1,4 @@ -// Copyright (C) 2010 EPITA Research and Development Laboratory (LRDE) +// Copyright (C) 2013 EPITA Research and Development Laboratory (LRDE) // // This file is part of Olena. // @@ -25,7 +25,7 @@ #include <mln/core/image/image2d.hh> -#include <mln/data/paste_without_localization.hh> +#include <mln/data/fill_without_localization.hh> #include <mln/data/compare.hh> #include <mln/debug/iota.hh> @@ -47,33 +47,33 @@ int main() // Lines { - data::impl::paste_without_localization_lines(ima, tmp); + data::impl::fill_without_localization_lines(tmp, ima); mln_assertion(tmp == ref); } // Fastest { - data::impl::paste_without_localization_fastest(ima, tmp); + data::impl::fill_without_localization_fastest(tmp, ima); mln_assertion(tmp == ref); } // Fast { - data::impl::paste_without_localization_fast(ima, tmp); + data::impl::fill_without_localization_fast(tmp, ima); mln_assertion(tmp == ref); } // Generic { - data::impl::generic::paste_without_localization(ima, tmp); + data::impl::generic::fill_without_localization(tmp, ima); mln_assertion(tmp == ref); } // Dispatch { - data::paste_without_localization(ima, tmp); + data::fill_without_localization(tmp, ima); mln_assertion(tmp == ref); } -- 1.7.2.5
participants (1)
-
Guillaume Lazzara