https://svn.lrde.epita.fr/svn/oln/trunk/milena/sandbox
Index: ChangeLog
from Thierry Geraud <thierry.geraud(a)lrde.epita.fr>
Fix sorted labeling fastest canvas.
* fabien/labeling.hh: Fix.
(labeling_video_fastest): Handle extension.
(labeling_sorted_fastest): Likewise.
labeling.hh | 21 ++++++++++++++-------
1 file changed, 14 insertions(+), 7 deletions(-)
Index: fabien/labeling.hh
--- fabien/labeling.hh (revision 3302)
+++ fabien/labeling.hh (working copy)
@@ -39,6 +39,7 @@
# include <mln/data/fill.hh>
# include <mln/literal/zero.hh>
# include <mln/convert/to_upper_window.hh>
+# include <mln/extension/adjust_fill.hh>
# include <mln/level/sort_psites.hh>
# include <mln/level/sort_offsets.hh>
@@ -233,13 +234,15 @@
labeling_video_fastest(const Image<I>& input_, const
Neighborhood<N>& nbh_,
F& f, L& nlabels)
{
- trace::entering("canvas::impl::labeling");
+ trace::entering("canvas::impl::labeling_video_fastest");
// FIXME: Test?!
const I& input = exact(input_);
const N& nbh = exact(nbh_);
+ extension::adjust(input, nbh);
+
// Local type.
typedef mln_psite(I) P;
@@ -255,6 +258,7 @@
{
initialize(deja_vu, input);
mln::data::fill(deja_vu, false);
+ extension::fill(deja_vu, false); // So that the extension is ignored.
initialize(parent, input);
@@ -276,7 +280,7 @@
f.init_attr(p);
for_all(n)
- if (input.has(n) && deja_vu(n))
+ if (input.domain().has(n) && deja_vu(n))
{
if (f.equiv_(n, p))
{
@@ -290,8 +294,8 @@
}
else
f.do_no_union_(n, p);
- (p) = true;
}
+ deja_vu(p) = true;
}
}
@@ -318,7 +322,7 @@
status = true;
}
- trace::exiting("canvas::impl::labeling");
+ trace::exiting("canvas::impl::labeling_video_fastest");
return output;
}
@@ -332,13 +336,15 @@
labeling_sorted_fastest(const Image<I>& input_, const
Neighborhood<N>& nbh_, L& nlabels,
const S& s, F& f)
{
- trace::entering("canvas::impl::labeling");
+ trace::entering("canvas::impl::labeling_sorted_fastest");
// FIXME: Test?!
const I& input = exact(input_);
const N& nbh = exact(nbh_);
+ extension::adjust(input, nbh);
+
// Local type.
typedef mln_psite(I) P;
@@ -354,6 +360,7 @@
{
initialize(deja_vu, input);
mln::data::fill(deja_vu, false);
+ extension::fill(deja_vu, false); // So that the extension is ignored.
initialize(parent, input);
@@ -392,7 +399,7 @@
{
// Do-Union.
unsigned r = find_root_fastest(parent, n);
- if (input.element(r) != input.element(p))
+ if (r != p)
{
parent.element(r) = p;
f.merge_attr_(r, p);
@@ -432,7 +439,7 @@
status = true;
}
- trace::exiting("canvas::impl::labeling");
+ trace::exiting("canvas::impl::labeling_sorted_fastest");
return output;
}