27 #ifndef MLN_DATA_PASTE_WITHOUT_LOCALIZATION_HH
28 # define MLN_DATA_PASTE_WITHOUT_LOCALIZATION_HH
35 # include <mln/core/concept/image.hh>
36 # include <mln/core/box_runstart_piter.hh>
38 # include <mln/border/get.hh>
55 template <
typename I,
typename J>
60 # ifndef MLN_INCLUDE_ONLY
69 template <
typename I,
typename J>
71 void paste_without_localization_tests(
const Image<I>& input,
74 mlc_converts_to(mln_value(I), mln_value(J))::check();
93 template <
typename I,
typename J>
98 mln_trace(
"data::impl::generic::paste_without_localization");
100 internal::paste_without_localization_tests(input_, output_);
102 const I& input =
exact(input_);
103 J& output =
exact(output_);
105 mln_fwd_piter(I)
pi(input.domain());
107 mln_fwd_piter(J) po(output.domain());
109 while (
pi.is_valid() && po.is_valid())
111 output(po) = input(
pi);
141 template <
typename I,
typename J>
143 void paste_without_localization_fastest(
const Image<I>& input_,
146 mln_trace(
"data::impl::paste_without_localization_fastest");
148 internal::paste_without_localization_tests(input_, output_);
150 const I& input =
exact(input_);
151 J& output =
exact(output_);
153 typedef mln_value(I) V;
154 memcpy(output.buffer(), input.buffer(), input.nelements() * sizeof(V));
177 template <typename I, typename J>
179 void paste_without_localization_lines(const Image<I>& input_,
182 mln_trace(
"data::impl::paste_without_localization_fastest");
184 internal::paste_without_localization_tests(input_, output_);
186 const I& input =
exact(input_);
187 J& output =
exact(output_);
189 box_runstart_piter<mln_site(I)>
pi(input.domain());
190 box_runstart_piter<mln_site(J)> po(output.domain());
192 typedef mln_value(I) V;
195 memcpy(&output(po), &input(pi), input.
ncols() * sizeof(V));
217 template <typename I, typename J>
219 void paste_without_localization_fast(const Image<I>& input_,
222 mln_trace(
"data::impl::paste_without_localization_fast");
224 internal::paste_without_localization_tests(input_, output_);
226 const I& input =
exact(input_);
227 J& output =
exact(output_);
229 mln_pixter(
const I) pi(input);
230 mln_pixter(J) po(output);
248 template <
typename I,
typename J>
250 void paste_without_localization_dispatch(
251 mln::trait::image::value_access::direct,
252 mln::trait::image::value_access::direct,
253 mln::trait::image::ext_domain::some,
254 mln::trait::image::ext_domain::some,
258 if (
sizeof(mln_value(I)) ==
sizeof(mln_value(J)))
261 && input.domain() == output.domain())
262 impl::paste_without_localization_fastest(input, output);
264 impl::paste_without_localization_lines(input, output);
267 impl::paste_without_localization_fast(input, output);
272 template <
typename I,
typename J>
274 void paste_without_localization_dispatch(
275 mln::trait::image::value_access::any,
276 mln::trait::image::value_access::any,
277 mln::trait::image::ext_domain::any,
278 mln::trait::image::ext_domain::any,
286 template <
typename I,
typename J>
288 void paste_without_localization_dispatch(
289 mln::trait::image::value_storage::any,
290 mln::trait::image::value_storage::any,
291 const Image<I>& input,
298 template <
typename I,
typename J>
300 void paste_without_localization_dispatch(
301 mln::trait::image::value_storage::one_block,
302 mln::trait::image::value_storage::one_block,
303 const Image<I>& input_,
306 const I& input =
exact(input_);
307 J& output =
exact(output_);
311 if (mlc_is(mln_trait_image_value_alignment(I),
312 trait::image::value_alignment::with_grid)::
value &&
313 mlc_is(mln_trait_image_value_alignment(J),
314 trait::image::value_alignment::with_grid)::
value)
316 paste_without_localization_dispatch(
317 mln_trait_image_value_access(I)(),
318 mln_trait_image_value_access(J)(),
319 mln_trait_image_ext_domain(I)(),
320 mln_trait_image_ext_domain(J)(),
328 template <
typename I,
typename J>
330 void paste_without_localization_dispatch(
const Image<I>& input,
333 paste_without_localization_dispatch(mln_trait_image_value_storage(I)(),
334 mln_trait_image_value_storage(J)(),
345 template <
typename I,
typename J>
349 mln_trace(
"data::paste_without_localization");
351 internal::paste_without_localization_tests(input, output);
353 internal::paste_without_localization_dispatch(input, output);
357 # endif // ! MLN_INCLUDE_ONLY
365 #endif // ! MLN_DATA_PASTE_WITHOUT_LOCALIZATION_HH