27 #ifndef MLN_CORE_STATIC_DPOINTS_PIXTER_HH
28 # define MLN_CORE_STATIC_DPOINTS_PIXTER_HH
42 # include <mln/core/concept/proxy.hh>
43 # include <mln/core/concept/pixel_iterator.hh>
44 # include <mln/core/internal/pixel_impl.hh>
45 # include <mln/metal/converts_to.hh>
47 # include "apps/bench/static_array.hh"
60 template <
typename I,
typename W>
75 template <
typename Dps,
typename Pref>
85 template <
typename Dps,
typename Pref>
110 template <
typename Dps>
111 void init_(
const Dps& dps);
114 enum { n = W::length };
130 mln_qlf_value(I)** value_ref_;
132 const mln_psite(I)* p_ref_;
145 template <
typename I,
typename W>
160 template <
typename Dps,
typename Pref>
170 template <
typename Dps,
typename Pref>
195 template <
typename Dps>
196 void init_(
const Dps& dps);
199 enum { n = W::length };
215 mln_qlf_value(I)** value_ref_;
217 const mln_psite(I)* p_ref_;
223 #ifndef MLN_INCLUDE_ONLY
229 template <
typename I,
typename W>
230 template <
typename Dps,
typename Pref>
237 mln_precondition(image.is_valid());
239 mlc_converts_to(Pref,
const mln_psite(I)&)::check();
240 p_ref_ = &
static_cast< const mln_psite(I)&
>(p_ref);
246 template <
typename I,
typename W>
247 template <
typename Dps,
typename Pref>
251 : super_(internal::force_exact<Pref>(pxl_ref_).ima())
253 const Pref& pxl_ref = internal::force_exact<Pref>(pxl_ref_);
254 mln_precondition(pxl_ref.ima().is_valid());
257 value_ref_ =
const_cast<mln_qlf_value(I)**
>(pxl_ref.address_());
261 template <
typename I,
typename W>
266 mln_invariant(value_ref_ != 0 || p_ref_ != 0);
268 return this->image_(*p_ref_);
273 template <
typename I,
typename W>
274 template <
typename Dps>
277 static_dpoints_fwd_pixter<I, W>::init_(
const Dps& dps)
279 for (
unsigned i = 0; i < dps.size(); ++i)
280 offset_[i] = this->image_.delta_offset(dps.dp(i));
284 for (
unsigned i = dps.size() - 1; i > 0; --i)
285 offset_[i] -= offset_[i - 1];
289 template <
typename I,
typename W>
297 this->value_ptr_ = & this->image_(*p_ref_) + offset_[i_];
299 this->value_ptr_ = * value_ref_ + offset_[i_];
303 template <
typename I,
typename W>
312 template <
typename I,
typename W>
319 this->value_ptr_ += offset_[i_];
322 template <
typename I,
typename W>
330 template <
typename I,
typename W>
343 template <
typename I,
typename W>
344 template <
typename Dps,
typename Pref>
351 mln_precondition(image.is_valid());
352 internal::get_adr(p_ref_, p_ref);
357 template <
typename I,
typename W>
358 template <
typename Dps,
typename Pref>
362 : super_(internal::
force_exact<Pref>(pxl_ref_).ima())
364 const Pref& pxl_ref = internal::force_exact<Pref>(pxl_ref_);
365 mln_precondition(pxl_ref.ima().is_valid());
368 value_ref_ =
const_cast<mln_qlf_value(I)**
>(pxl_ref.address_());
372 template <
typename I,
typename W>
377 mln_invariant(value_ref_ != 0 || p_ref_ != 0);
379 return this->image_(*p_ref_);
384 template <
typename I,
typename W>
385 template <
typename Dps>
388 static_dpoints_bkd_pixter<I, W>::init_(
const Dps& dps)
390 for (
unsigned i = 0; i < dps.size(); ++i)
391 offset_[i] = this->image_.delta_offset(dps.dp(i));
395 for (
unsigned i = 0; i < dps.size() - 1; ++i)
396 offset_[i] -= offset_[i + 1];
400 template <
typename I,
typename W>
408 this->value_ptr_ = & this->image_(*p_ref_) + offset_[n - 1 - i_];
410 this->value_ptr_ = * value_ref_ + offset_[n - 1 - i_];
414 template <
typename I,
typename W>
423 template <
typename I,
typename W>
430 this->value_ptr_ += offset_[n - 1 - i_];
433 template <
typename I,
typename W>
441 template <
typename I,
typename W>
449 #endif // ! MLN_INCLUDE_ONLY
454 #endif // ! MLN_CORE_STATIC_DPOINTS_PIXTER_HH