Olena-patches
Threads by month
- ----- 2025 -----
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2010 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2009 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2008 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2007 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2006 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2005 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2004 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
September 2009
- 9 participants
- 188 discussions
[PATCH 3/8] Fix the topological watershed transform algorithm (mostly).
by Roland Levillain 04 Sep '09
by Roland Levillain 04 Sep '09
04 Sep '09
* abraham/mln/morpho/topo_wst.hh
(topo_wst<I, N>::topo_wst(const Image<I>&, const Neighborhood<N>&)):
Properly initialize image new image members in this ctor.
(topo_watershed): Likewise.
(topo_wst<I, N>::BuildComponentTree): Do not assume the first site
of the domain is point2d(0,0).
Remove useless #include's.
Wrap long lines.
Some aesthetic changes.
---
milena/sandbox/ChangeLog | 14 +++
milena/sandbox/abraham/mln/morpho/topo_wst.hh | 108 +++++++++++++++----------
2 files changed, 78 insertions(+), 44 deletions(-)
diff --git a/milena/sandbox/ChangeLog b/milena/sandbox/ChangeLog
index 16aa288..7003772 100644
--- a/milena/sandbox/ChangeLog
+++ b/milena/sandbox/ChangeLog
@@ -1,3 +1,17 @@
+2009-09-03 Roland Levillain <roland(a)lrde.epita.fr>
+
+ Fix the topological watershed transform algorithm (mostly).
+
+ * abraham/mln/morpho/topo_wst.hh
+ (topo_wst<I, N>::topo_wst(const Image<I>&, const Neighborhood<N>&)):
+ Properly initialize image new image members in this ctor.
+ (topo_watershed): Likewise.
+ (topo_wst<I, N>::BuildComponentTree): Do not assume the first site
+ of the domain is point2d(0,0).
+ Remove useless #include's.
+ Wrap long lines.
+ Some aesthetic changes.
+
2009-09-04 Fabien Freling <fabien.freling(a)lrde.epita.fr>
Fix red component bug.
diff --git a/milena/sandbox/abraham/mln/morpho/topo_wst.hh b/milena/sandbox/abraham/mln/morpho/topo_wst.hh
index 2b643d5..7e9fb64 100644
--- a/milena/sandbox/abraham/mln/morpho/topo_wst.hh
+++ b/milena/sandbox/abraham/mln/morpho/topo_wst.hh
@@ -28,24 +28,19 @@
#ifndef MLN_MORPHO_TOPO_WST_HH
# define MLN_MORPHO_TOPO_WST_HH
+# include <vector>
+# include <map>
+# include <queue>
+# include <mln/core/site_set/p_set.hh>
+# include <mln/core/site_set/p_priority.hh>
+# include <mln/core/site_set/p_queue_fast.hh>
-#include <mln/data/sort_psites.hh>
-#include <mln/data/fill.hh>
-#include <mln/core/image/image2d.hh>
-#include <mln/core/site_set/p_set.hh>
-#include <mln/estim/min_max.hh>
-#include <mln/math/sqr.hh>
-#include <mln/util/greater_psite.hh>
-#include <mln/util/ord.hh>
-#include <mln/arith/revert.hh>
+# include <mln/util/ord.hh>
-#include <mln/core/site_set/p_priority.hh>
-#include <mln/core/site_set/p_queue_fast.hh>
+# include <mln/data/sort_psites.hh>
+# include <mln/data/fill.hh>
-#include <queue>
-#include <vector>
-#include <map>
namespace mln
{
@@ -87,7 +82,7 @@ namespace mln
}
-
+ // Actually, this structure is a tree, despite its confusing name.
template <class I, class N>
struct topo_wst
{
@@ -195,22 +190,23 @@ namespace mln
void compressTree();
}; // struct topo_wst
+
+
# ifndef MLN_INCLUDE_ONLY
// Ctor
template <class I, class N>
topo_wst<I, N>::topo_wst(const Image<I>& i,
- const Neighborhood<N>& n)
- : Par_node(exact(i).domain(), exact(i).border()),
- Par_tree(exact(i).domain(), exact(i).border()),
- Rnk_tree(exact(i).domain(), exact(i).border()),
- Rnk_node(exact(i).domain(), exact(i).border()),
- subtreeRoot(exact(i).domain(), exact(i).border()),
- nodes(exact(i).domain(), exact(i).border()),
- isproc(exact(i).domain(), exact(i).border()),
- ima(exact(i)),
- nbh(exact(n))
+ const Neighborhood<N>& n)
+ : ima(exact(i)), nbh(exact(n))
{
+ initialize(Par_node, i);
+ initialize(Par_tree, i);
+ initialize(Rnk_tree, i);
+ initialize(Rnk_node, i);
+ initialize(subtreeRoot, i);
+ initialize(nodes, i);
+ initialize(isproc, i);
}
template <class I, class N>
@@ -285,6 +281,7 @@ namespace mln
site curCanonicalElt = Find_tree(p);
site curNode = Find_node(subtreeRoot(curCanonicalElt));
+ // FIXME: Should be `n' instead of `q'.
mln_niter(N) q(nbh, ip);
for_all(q)
if (ima.has(q) and isproc(q) and ima(q) <= ima(p))
@@ -319,12 +316,18 @@ namespace mln
for_all(r)
Par_node(r) = Find_node(r);
- Root = subtreeRoot(Find_tree(Find_node(site(0, 0))));
+ // Find the ``first'' site of ima, according to the forward
+ // traversal order.
+ mln_fwd_piter(I) rp(Par_node.domain());;
+ rp.start();
+
+ Root = subtreeRoot(Find_tree(Find_node(rp)));
}
template <class I, class N>
- typename topo_wst<I, N>::site topo_wst<I, N>::MergeNode(site& node1, site& node2)
+ typename topo_wst<I, N>::site topo_wst<I, N>::MergeNode(site& node1,
+ site& node2)
{
site tmpNode = Link_node(node1, node2);
site tmpNode2;
@@ -513,7 +516,8 @@ namespace mln
//Minim[j][i] = size - 1;
}
else {
- if (depth[euler[Minim[j - 1][i]]] <= depth[euler[Minim[j - 1][i + k]]])
+ if (depth[euler[Minim[j - 1][i]]]
+ <= depth[euler[Minim[j - 1][i + k]]])
Minim[j][i] = Minim[j - 1][i];
else
Minim[j][i] = Minim[j - 1][i + k];
@@ -553,7 +557,8 @@ namespace mln
template <class I, class N>
- void topo_wst<I, N>::removeOneSonNodes(site *p, mln_ch_value(I, site) &newPar_node)
+ void topo_wst<I, N>::removeOneSonNodes(site *p,
+ mln_ch_value(I, site) &newPar_node)
{
node &n = nodes(*p);
@@ -575,7 +580,8 @@ namespace mln
template <class I, class N>
void topo_wst<I, N>::compressTree()
{
- mln_ch_value(I, site) newPar_node(Par_node.domain(), Par_node.border());
+ mln_ch_value(I, site) newPar_node;
+ initialize(newPar_node, Par_node);
// Remove the nodes with one son
removeOneSonNodes(&Root, newPar_node);
@@ -597,24 +603,27 @@ namespace mln
const I &ima = exact(tree.ima);
const N &nbh = exact(tree.nbh);
+ // FIXME: Should be `n' instead of `q'.
mln_niter(N) q(nbh, p);
p_set<mln_site(I)> v;
for_all(q)
+ // FIXME: Shouldn't it be: `ima.has(q)' instead of
+ // `ima.domain().has(q)'?
if (ima.domain().has(q) && ima(q) < ima(p))
v.insert(tree.Par_node(q));
if (v.nsites() == 0)
return false;
- if (v.nsites() == 1) {
- r = v[0];
- return true;
- }
+ if (v.nsites() == 1)
+ {
+ r = v[0];
+ return true;
+ }
- mln_site(I)
- c = min(ima, v),
- cmin = c;
+ mln_site(I) c = min(ima, v);
+ mln_site(I) cmin = c;
typename p_set<mln_site(I)>::fwd_piter it(v);
for_all(it)
@@ -655,10 +664,12 @@ namespace mln
const N &nbh = exact(tree.nbh);
// Maxima components
- mln_ch_value(I, bool) cmax(ima.domain(), ima.border());
+ mln_ch_value(I, bool) cmax;
+ initialize(cmax, ima);
// Mark enqueued sites
- mln_ch_value(I, bool) enqueued(ima.domain(), ima.border());
+ mln_ch_value(I, bool) enqueued;
+ initialize(enqueued, ima);
p_priority< mln_value(I), p_queue_fast<mln_site(I)> > l;
// p_queue < site > m;
@@ -682,7 +693,10 @@ namespace mln
while (!m.empty())
{
+ // FIXME: Should be `n' instead of `q'.
mln_niter(N) q(nbh, m.front());
+ // FIXME: Shouldn't it be: `cmax.has(q)' instead of
+ // `cmax.domain().has(q)'?
for_all(q)
if (cmax.domain().has(q) && !cmax(q) && !enqueued(q))
{
@@ -716,15 +730,23 @@ namespace mln
else
// if (nodes(c).children.nsites() > 1)
if (tree.nodes(c).children.size() == 1)
- std::cerr << "ERREUR COMPOSANTE BRANCHE " << tree.nodes(c).children.size() << std::endl;
+ std::cerr << "ERREUR COMPOSANTE BRANCHE "
+ << tree.nodes(c).children.size() << std::endl;
+ // FIXME: Should be `n' instead of `q'.
mln_niter(N) q(nbh, x);
+ // FIXME: Shouldn't it be: `ima.has(q)' instead of
+ // `ima.domain().has(q)'?
for_all(q)
if (ima.domain().has(q) && !cmax(q) && !enqueued(q))
{
enqueued(q) = true;
- l.push(mln_max(mln_value(I)) - ima(q), q); // FIXME : just invert the priority
+ l.push(mln_max(mln_value(I)) - ima(q), q); // FIXME:
+ // Just
+ // invert
+ // the
+ // priority.
}
}
} // while(!l.empty())
@@ -736,8 +758,6 @@ namespace mln
}
-
-
# endif // MLN_INCLUDE_ONLY
@@ -745,4 +765,4 @@ namespace mln
}; // namespace mln
-#endif // MLN_MORPHO_TOPO_WST_HH
+#endif // ! MLN_MORPHO_TOPO_WST_HH
--
1.6.4.2
1
0
---
milena/ChangeLog | 4 ++
milena/mln/debug/println.spe.hh | 88 +++++++++++++++++++-------------------
2 files changed, 48 insertions(+), 44 deletions(-)
diff --git a/milena/ChangeLog b/milena/ChangeLog
index 940e501..654dd5c 100644
--- a/milena/ChangeLog
+++ b/milena/ChangeLog
@@ -1,3 +1,7 @@
+2009-09-03 Roland Levillain <roland(a)lrde.epita.fr>
+
+ * mln/debug/println.spe.hh: Reindent.
+
2009-09-01 Roland Levillain <roland(a)lrde.epita.fr>
Aesthetic changes in mln::win::multiple_qiter<W,F>.
diff --git a/milena/mln/debug/println.spe.hh b/milena/mln/debug/println.spe.hh
index 2a44177..257ddf4 100644
--- a/milena/mln/debug/println.spe.hh
+++ b/milena/mln/debug/println.spe.hh
@@ -45,7 +45,7 @@
# include <mln/accu/stat/max.hh>
# include <mln/opt/at.hh>
-//FIXME: do not include all these headers
+// FIXME: do not include all these headers
# include <mln/core/alias/box2d.hh>
# include <mln/core/alias/box2d_h.hh>
# include <mln/core/alias/box3d.hh>
@@ -82,11 +82,11 @@ namespace mln
println(const box2d& b, const image2d<char>& input)
{
for (def::coord row = b.min_row(); row <= b.max_row(); ++row)
- {
- for (def::coord col = b.min_col(); col <= b.max_col(); ++col)
- std::cout << opt::at(input, row, col) << ' ';
- std::cout << std::endl;
- }
+ {
+ for (def::coord col = b.min_col(); col <= b.max_col(); ++col)
+ std::cout << opt::at(input, row, col) << ' ';
+ std::cout << std::endl;
+ }
std::cout << std::endl;
}
@@ -99,32 +99,32 @@ namespace mln
accu::stat::max<unsigned> len_;
mln_piter(I) p(input.domain());
for_all(p)
- {
- std::ostringstream o;
- o << format(input(p));
- len_.take(o.str().length());
- }
+ {
+ std::ostringstream o;
+ o << format(input(p));
+ len_.take(o.str().length());
+ }
unsigned len = len_ + 1;
image2d<char> output(b.nrows(), b.ncols() * len, 0);
data::fill(output, ' ');
for_all(p)
- {
- std::ostringstream oss;
- oss << format(input(p));
- def::coord
- row = static_cast<def::coord>(p.row() - b.min_row()),
- col = static_cast<def::coord>((p.col() - b.min_col()) * len);
- point2d w(row, col);
- put_word(output, w, oss.str());
- }
-
- for (def::coord row = 0; row < def::coord(b.nrows()); ++row)
{
- for (def::coord col = 0; col < def::coord(b.ncols() * len); ++col)
- std::cout << opt::at(output, row, col);
- std::cout << std::endl;
+ std::ostringstream oss;
+ oss << format(input(p));
+ def::coord
+ row = static_cast<def::coord>(p.row() - b.min_row()),
+ col = static_cast<def::coord>((p.col() - b.min_col()) * len);
+ point2d w(row, col);
+ put_word(output, w, oss.str());
}
+
+ for (def::coord row = 0; row < def::coord(b.nrows()); ++row)
+ {
+ for (def::coord col = 0; col < def::coord(b.ncols() * len); ++col)
+ std::cout << opt::at(output, row, col);
+ std::cout << std::endl;
+ }
std::cout << std::endl;
}
@@ -140,13 +140,13 @@ namespace mln
int row_len = 1 + (b.max_col() - b.min_col()) / 2;
for_all(p)
- {
- if (input.domain().has(p))
- std::cout << format(input(p)) << " ";
- else
- std::cout << " ";
+ {
+ if (input.domain().has(p))
+ std::cout << format(input(p)) << " ";
+ else
+ std::cout << " ";
- if (c >= row_len)
+ if (c >= row_len)
{
std::cout << std::endl;
if (r % 2)
@@ -154,8 +154,8 @@ namespace mln
c = 0;
r++;
}
- c++;
- }
+ c++;
+ }
std::cout << std::endl;
}
@@ -174,20 +174,20 @@ namespace mln
max_col = b.max_col();
for (sli = b.min_sli(); sli <= max_sli; ++sli)
- {
- for (row = b.min_row(); row <= max_row; ++row)
{
- for (int i = max_row; i >= row; --i)
- std::cout << ' ';
- for (col = b.min_col(); col <= max_col; ++col)
- if (input.domain().has(p))
- std::cout << format(input(p)) << ' ';
- else
- std::cout << " ";
+ for (row = b.min_row(); row <= max_row; ++row)
+ {
+ for (int i = max_row; i >= row; --i)
+ std::cout << ' ';
+ for (col = b.min_col(); col <= max_col; ++col)
+ if (input.domain().has(p))
+ std::cout << format(input(p)) << ' ';
+ else
+ std::cout << " ";
+ std::cout << std::endl;
+ }
std::cout << std::endl;
}
- std::cout << std::endl;
- }
}
# endif // ! MLN_INCLUDE_ONLY
--
1.6.4.2
1
0
04 Sep '09
* mln/win/multiple.hh: Here.
---
milena/ChangeLog | 6 ++++++
milena/mln/win/multiple.hh | 22 +++++++++++-----------
2 files changed, 17 insertions(+), 11 deletions(-)
diff --git a/milena/ChangeLog b/milena/ChangeLog
index 60f3ad7..940e501 100644
--- a/milena/ChangeLog
+++ b/milena/ChangeLog
@@ -1,3 +1,9 @@
+2009-09-01 Roland Levillain <roland(a)lrde.epita.fr>
+
+ Aesthetic changes in mln::win::multiple_qiter<W,F>.
+
+ * mln/win/multiple.hh: Here.
+
2009-08-24 Guillaume Lazzara <lazzara(a)lrde.epita.fr>
* mln/win/multiple.hh: Add a missing init_ member.
diff --git a/milena/mln/win/multiple.hh b/milena/mln/win/multiple.hh
index a3632f5..a12bf83 100644
--- a/milena/mln/win/multiple.hh
+++ b/milena/mln/win/multiple.hh
@@ -139,15 +139,15 @@ namespace mln
public:
multiple_qiter();
+ template <typename Pref>
+ multiple_qiter(const multiple<W,F>& w, const Pref& c);
- template <typename P>
- multiple_qiter(const multiple<W,F>& w, const P& c);
-
- void change_target(const multiple<W,F>& w); // Overridden to initialize size_.
+ /// Overridden to initialize size_.
+ void change_target(const multiple<W,F>& w);
/// Delegated initialization.
- template <typename P>
- void init_(const multiple<W,F>& w, const P& c);
+ template <typename Pref>
+ void init_(const multiple<W,F>& w, const Pref& c);
/// Test the iterator validity.
bool is_valid_() const;
@@ -316,18 +316,18 @@ namespace mln
}
template <typename W, typename F>
- template <typename P>
+ template <typename Pref>
inline
- multiple_qiter<W,F>::multiple_qiter(const multiple<W,F>& w, const P& c)
+ multiple_qiter<W,F>::multiple_qiter(const multiple<W,F>& w, const Pref& c)
{
- this->init_(w, c);
+ init_(w, c);
}
template <typename W, typename F>
- template <typename P>
+ template <typename Pref>
inline
void
- multiple_qiter<W,F>::init_(const multiple<W,F>& w, const P& c)
+ multiple_qiter<W,F>::init_(const multiple<W,F>& w, const Pref& c)
{
this->center_at(c);
// We have to first change the center so that 'invalidate' can
--
1.6.4.2
1
0
URL: https://svn.lrde.epita.fr/svn/oln/trunk/milena/sandbox
ChangeLog:
2009-09-04 Fabien Freling <fabien.freling(a)lrde.epita.fr>
Fix red component bug.
* fabien/mln/upsampling/hq3x.hh: Fix red component bug, still not
working properly because of blue artifacts.
---
hq3x.hh | 10 ++--------
1 file changed, 2 insertions(+), 8 deletions(-)
Index: trunk/milena/sandbox/fabien/mln/upsampling/hq3x.hh
===================================================================
--- trunk/milena/sandbox/fabien/mln/upsampling/hq3x.hh (revision 4421)
+++ trunk/milena/sandbox/fabien/mln/upsampling/hq3x.hh (revision 4422)
@@ -74,7 +74,7 @@
unsigned short result = 0;
result += val.red() >> 3;
- result = result << 11;
+ result = result << 6;
result += val.green() >> 2;
result = result << 5;
result += val.blue() >> 3;
@@ -91,7 +91,7 @@
result += (val.red() + val.green() + val.blue()) / 3;
result = result << 8;
result = result << 8;
- result = result << 8;
+ //result = result << 8;
return result;
}
@@ -126,9 +126,6 @@
void
Interp3(image2d<T>& output, int row, int col, int c1, int c2)
{
- //*((int*)output) = (c1*7+c2)/8;
- //*((int*)output) = ((((c1 & 0x00FF00)*7 + (c2 & 0x00FF00)) & 0x0007F800) +
- // (((c1 & 0xFF00FF)*7 + (c2 & 0xFF00FF)) & 0x07F807F8)) >> 3;
intToRgb8((c1 * 7 + c2) / 8, output.at_(row, col));
}
@@ -137,9 +134,6 @@
void
Interp4(image2d<T>& output, int row, int col, int c1, int c2, int c3)
{
- //*((int*)output) = (c1*2+(c2+c3)*7)/16;
- //*((int*)output) = ((((c1 & 0x00FF00)*2 + ((c2 & 0x00FF00) + (c3 & 0x00FF00))*7) & 0x000FF000) +
- // (((c1 & 0xFF00FF)*2 + ((c2 & 0xFF00FF) + (c3 & 0xFF00FF))*7) & 0x0FF00FF0)) >> 4;
intToRgb8((c1 * 2 + (c2 + c3) * 7) / 16, output.at_(row, col));
}
1
0
URL: https://svn.lrde.epita.fr/svn/oln/trunk/milena/sandbox
ChangeLog:
2009-09-04 Fabien Freling <fabien.freling(a)lrde.epita.fr>
Add implementation of HQ3x algorithm.
* fabien/mln/core/image/magick_tiled2d.hh: Small update.
* fabien/mln/core/image/tiled2d.hh: Small update.
* fabien/mln/upsampling/hq3x.hh: Implement HQ3x algorithm, not working
properly with colors.
* fabien/tests/core/image/tiled2d.cc: Update test.
* fabien/tests/upsampling/Makefile: New Makefile for target hq3x.
* fabien/tests/upsampling/hq3x.cc: New test for algorithm HQ3x.
---
mln/core/image/magick_tiled2d.hh | 5
mln/upsampling/hq3x.hh | 3981 +++++++++++++++++++++++++++++++++++++++
tests/core/image/tiled2d.cc | 2
tests/upsampling/Makefile | 6
tests/upsampling/hq3x.cc | 29
5 files changed, 4019 insertions(+), 4 deletions(-)
Index: trunk/milena/sandbox/fabien/tests/upsampling/hq3x.cc
===================================================================
--- trunk/milena/sandbox/fabien/tests/upsampling/hq3x.cc (revision 0)
+++ trunk/milena/sandbox/fabien/tests/upsampling/hq3x.cc (revision 4421)
@@ -0,0 +1,29 @@
+#include <mln/core/image/image2d.hh>
+
+#include <mln/io/ppm/all.hh>
+#include <mln/value/rgb8.hh>
+
+#include <mln/upsampling/hq3x.hh>
+
+
+using namespace mln;
+using value::rgb8;
+
+
+int main(int argc, char* argv[])
+{
+ if (argc != 3)
+ {
+ std::cout << "Usage: " << argv[0] << " input output" << std::endl;
+ return 1;
+ }
+
+ image2d<rgb8> ima;
+ io::ppm::load(ima, argv[1]);
+
+ image2d<rgb8> hq3x_ima;
+ hq3x_ima = upsampling::hq3x(ima);
+ io::ppm::save(hq3x_ima, argv[2]);
+
+ return 0;
+}
Index: trunk/milena/sandbox/fabien/tests/upsampling/Makefile
===================================================================
--- trunk/milena/sandbox/fabien/tests/upsampling/Makefile (revision 0)
+++ trunk/milena/sandbox/fabien/tests/upsampling/Makefile (revision 4421)
@@ -0,0 +1,6 @@
+CXX = g++
+CXXFLAGS = -DNDEBUG -O1
+INC = -I../../ -I../../../../
+
+hq3x: hq3x.cc
+ ${CXX} ${CXXFLAGS} ${INC} $^ -o hq3x
Index: trunk/milena/sandbox/fabien/tests/core/image/tiled2d.cc
===================================================================
--- trunk/milena/sandbox/fabien/tests/core/image/tiled2d.cc (revision 4420)
+++ trunk/milena/sandbox/fabien/tests/core/image/tiled2d.cc (revision 4421)
@@ -16,7 +16,7 @@
{
if (argc != 2)
{
- std::cout << "Usage: " << argv[0] << " input output" << std::endl;
+ std::cout << "Usage: " << argv[0] << " input" << std::endl;
return 1;
}
Index: trunk/milena/sandbox/fabien/mln/upsampling/hq3x.hh
===================================================================
--- trunk/milena/sandbox/fabien/mln/upsampling/hq3x.hh (revision 0)
+++ trunk/milena/sandbox/fabien/mln/upsampling/hq3x.hh (revision 4421)
@@ -0,0 +1,3981 @@
+// Copyright (C) 2009 EPITA Research and Development Laboratory (LRDE)
+//
+// This file is part of Olena.
+//
+// Olena is free software: you can redistribute it and/or modify it under
+// the terms of the GNU General Public License as published by the Free
+// Software Foundation, version 2 of the License.
+//
+// Olena is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with Olena. If not, see <http://www.gnu.org/licenses/>.
+//
+// As a special exception, you may use this file as part of a free
+// software project without restriction. Specifically, if other files
+// instantiate templates or use macros or inline functions from this
+// file, or you compile this file and link it with other files to produce
+// an executable, this file does not by itself cause the resulting
+// executable to be covered by the GNU General Public License. This
+// exception does not however invalidate any other reasons why the
+// executable file might be covered by the GNU General Public License.
+
+#ifndef MLN_UPSAMPLING_HQ3X_HH
+# define MLN_UPSAMPLING_HQ3X_HH
+
+/// \file
+///
+/// Produce an up-scaled image using hq3x algorithm.
+
+# include <mln/geom/ncols.hh>
+# include <mln/geom/nrows.hh>
+# include <mln/value/rgb8.hh>
+
+
+namespace mln
+{
+
+ namespace upsampling
+ {
+
+ /// Subsampling FIXME : doxy
+ template <typename I>
+ inline
+ mln_concrete(I)
+ hq3x(const Image<I>& input);
+
+# ifndef MLN_INCLUDE_ONLY
+
+ namespace impl
+ {
+ inline
+ int
+ rgb8toInt(value::rgb8 val)
+ {
+ int result = 0;
+
+ result += val.blue();
+ result = result << 8;
+ result += val.green();
+ result = result << 8;
+ result += val.red();
+ //result = result << 8;
+
+ return result;
+ }
+
+ inline
+ unsigned short
+ rgb8toShort(value::rgb8 val)
+ {
+ unsigned short result = 0;
+
+ result += val.red() >> 3;
+ result = result << 11;
+ result += val.green() >> 2;
+ result = result << 5;
+ result += val.blue() >> 3;
+
+ return result;
+ }
+
+ inline
+ unsigned int
+ rgb8toYuv(value::rgb8 val)
+ {
+ unsigned int result = 0;
+
+ result += (val.red() + val.green() + val.blue()) / 3;
+ result = result << 8;
+ result = result << 8;
+ result = result << 8;
+
+ return result;
+ }
+
+ inline
+ void
+ intToRgb8(int in, value::rgb8& out)
+ {
+ out.blue() = in % 256;
+ out.green() = (in >> 8) % 256;
+ out.red() = (in >> 16) % 256;
+ }
+
+ template<typename T>
+ inline
+ void
+ Interp1(image2d<T>& output, int row, int col, int c1, int c2)
+ {
+ intToRgb8((c1 * 3 + c2) >> 2, output.at_(row, col));
+ }
+
+ template<typename T>
+ inline
+ void
+ Interp2(image2d<T>& output, int row, int col, int c1, int c2, int c3)
+ {
+ intToRgb8((c1 * 2 + c2 + c3) >> 2, output.at_(row, col));
+ }
+
+ template<typename T>
+ inline
+ void
+ Interp3(image2d<T>& output, int row, int col, int c1, int c2)
+ {
+ //*((int*)output) = (c1*7+c2)/8;
+ //*((int*)output) = ((((c1 & 0x00FF00)*7 + (c2 & 0x00FF00)) & 0x0007F800) +
+ // (((c1 & 0xFF00FF)*7 + (c2 & 0xFF00FF)) & 0x07F807F8)) >> 3;
+ intToRgb8((c1 * 7 + c2) / 8, output.at_(row, col));
+ }
+
+ template<typename T>
+ inline
+ void
+ Interp4(image2d<T>& output, int row, int col, int c1, int c2, int c3)
+ {
+ //*((int*)output) = (c1*2+(c2+c3)*7)/16;
+ //*((int*)output) = ((((c1 & 0x00FF00)*2 + ((c2 & 0x00FF00) + (c3 & 0x00FF00))*7) & 0x000FF000) +
+ // (((c1 & 0xFF00FF)*2 + ((c2 & 0xFF00FF) + (c3 & 0xFF00FF))*7) & 0x0FF00FF0)) >> 4;
+ intToRgb8((c1 * 2 + (c2 + c3) * 7) / 16, output.at_(row, col));
+ }
+
+ template<typename T>
+ inline
+ void
+ Interp5(image2d<T>& output, int row, int col, int c1, int c2)
+ {
+ intToRgb8((c1 + c2) >> 1, output.at_(row, col));
+ }
+
+ template<typename T>
+ inline
+ void
+ Interp6(image2d<T>& output, int row, int col, int c1)
+ {
+ intToRgb8(c1, output.at_(row, col));
+ }
+
+
+# define PIXEL00_1M Interp1(output, i * 3, j * 3, c[5], c[1]);
+# define PIXEL00_1U Interp1(output, i * 3, j * 3, c[5], c[2]);
+# define PIXEL00_1L Interp1(output, i * 3, j * 3, c[5], c[4]);
+# define PIXEL00_2 Interp2(output, i * 3, j * 3, c[5], c[4], c[2]);
+# define PIXEL00_4 Interp4(output, i * 3, j * 3, c[5], c[4], c[2]);
+# define PIXEL00_5 Interp5(output, i * 3, j * 3, c[4], c[2]);
+# define PIXEL00_C Interp6(output, i * 3, j * 3, c[5]);
+
+# define PIXEL01_1 Interp1(output, i * 3, j * 3 + 1, c[5], c[2]);
+# define PIXEL01_3 Interp3(output, i * 3, j * 3 + 1, c[5], c[2]);
+# define PIXEL01_6 Interp1(output, i * 3, j * 3 + 1, c[2], c[5]);
+# define PIXEL01_C Interp6(output, i * 3, j * 3 + 1, c[5]);
+
+# define PIXEL02_1M Interp1(output, i * 3, j * 3 + 2, c[5], c[3]);
+# define PIXEL02_1U Interp1(output, i * 3, j * 3 + 2, c[5], c[2]);
+# define PIXEL02_1R Interp1(output, i * 3, j * 3 + 2, c[5], c[6]);
+# define PIXEL02_2 Interp2(output, i * 3, j * 3 + 2, c[5], c[2], c[6]);
+# define PIXEL02_4 Interp4(output, i * 3, j * 3 + 2, c[5], c[2], c[6]);
+# define PIXEL02_5 Interp5(output, i * 3, j * 3 + 2, c[2], c[6]);
+# define PIXEL02_C Interp6(output, i * 3, j * 3 + 2, c[5]);
+
+# define PIXEL10_1 Interp1(output, i * 3 + 1, j * 3, c[5], c[4]);
+# define PIXEL10_3 Interp3(output, i * 3 + 1, j * 3, c[5], c[4]);
+# define PIXEL10_6 Interp1(output, i * 3 + 1, j * 3, c[4], c[5]);
+# define PIXEL10_C Interp6(output, i * 3 + 1, j * 3, c[5]);
+
+# define PIXEL11 Interp6(output, i * 3 + 1, j * 3 + 1, c[5]);
+
+# define PIXEL12_1 Interp1(output, i * 3 + 1, j * 3 + 2, c[5], c[6]);
+# define PIXEL12_3 Interp3(output, i * 3 + 1, j * 3 + 2, c[5], c[6]);
+# define PIXEL12_6 Interp1(output, i * 3 + 1, j * 3 + 2, c[6], c[5]);
+# define PIXEL12_C Interp6(output, i * 3 + 1, j * 3 + 2, c[5]);
+
+# define PIXEL20_1M Interp1(output, i * 3 + 2, j * 3, c[5], c[7]);
+# define PIXEL20_1D Interp1(output, i * 3 + 2, j * 3, c[5], c[8]);
+# define PIXEL20_1L Interp1(output, i * 3 + 2, j * 3, c[5], c[4]);
+# define PIXEL20_2 Interp2(output, i * 3 + 2, j * 3, c[5], c[8], c[4]);
+# define PIXEL20_4 Interp4(output, i * 3 + 2, j * 3, c[5], c[8], c[4]);
+# define PIXEL20_5 Interp5(output, i * 3 + 2, j * 3, c[8], c[4]);
+# define PIXEL20_C Interp6(output, i * 3 + 2, j * 3, c[5]);
+
+# define PIXEL21_1 Interp1(output, i * 3 + 2, j * 3 + 1, c[5], c[8]);
+# define PIXEL21_3 Interp3(output, i * 3 + 2, j * 3 + 1, c[5], c[8]);
+# define PIXEL21_6 Interp1(output, i * 3 + 2, j * 3 + 1, c[8], c[5]);
+# define PIXEL21_C Interp6(output, i * 3 + 2, j * 3 + 1, c[5]);
+
+# define PIXEL22_1M Interp1(output, i * 3 + 2, j * 3 + 2, c[5], c[9]);
+# define PIXEL22_1D Interp1(output, i * 3 + 2, j * 3 + 2, c[5], c[8]);
+# define PIXEL22_1R Interp1(output, i * 3 + 2, j * 3 + 2, c[5], c[6]);
+# define PIXEL22_2 Interp2(output, i * 3 + 2, j * 3 + 2, c[5], c[6], c[8]);
+# define PIXEL22_4 Interp4(output, i * 3 + 2, j * 3 + 2, c[5], c[6], c[8]);
+# define PIXEL22_5 Interp5(output, i * 3 + 2, j * 3 + 2, c[6], c[8]);
+# define PIXEL22_C Interp6(output, i * 3 + 2, j * 3 + 2, c[5]);
+
+ inline
+ bool
+ Diff(int& YUV1, int& YUV2, int* RGBtoYUV,
+ const int trY, const int trU, const int trV,
+ const int Ymask, const int Umask, const int Vmask,
+ unsigned int w1, unsigned int w2)
+ {
+ YUV1 = RGBtoYUV[w1];
+ YUV2 = RGBtoYUV[w2];
+ return ((abs((YUV1 & Ymask) - (YUV2 & Ymask)) > trY) ||
+ (abs((YUV1 & Umask) - (YUV2 & Umask)) > trU) ||
+ (abs((YUV1 & Vmask) - (YUV2 & Vmask)) > trV));
+ }
+
+ inline
+ void
+ initLUTs(int LUT16to32[65536], int RGBtoYUV[65536])
+ {
+ int i, j, k, r, g, b, Y, u, v;
+
+ for (i=0; i<65536; i++)
+ LUT16to32[i] = ((i & 0xF800) << 8) + ((i & 0x07E0) << 5) + ((i & 0x001F) << 3);
+
+ for (i=0; i<32; i++)
+ for (j=0; j<64; j++)
+ for (k=0; k<32; k++)
+ {
+ r = i << 3;
+ g = j << 2;
+ b = k << 3;
+ Y = (r + g + b) >> 2;
+ u = 128 + ((r - b) >> 2);
+ v = 128 + ((-r + 2*g -b)>>3);
+ RGBtoYUV[ (i << 11) + (j << 5) + k ] = (Y<<16) + (u<<8) + v;
+ }
+ }
+
+
+ //FIXME: In Milena, nrows != row max
+ template <typename T>
+ inline
+ mln_concrete(image2d<T>)
+ hq3x_(const image2d<T>& input)
+ {
+ trace::entering("upsampling::impl::hq3x_");
+
+ int nrows = geom::nrows(input);
+ int ncols = geom::ncols(input);
+ mln_concrete(image2d<T>) output(nrows * 3, ncols * 3);
+
+ int LUT16to32[65536];
+ int RGBtoYUV[65536];
+ int YUV1, YUV2;
+ const int Ymask = 0x00FF0000;
+ const int Umask = 0x0000FF00;
+ const int Vmask = 0x000000FF;
+ const int trY = 0x00300000;
+ const int trU = 0x00000700;
+ const int trV = 0x00000006;
+
+ initLUTs(LUT16to32, RGBtoYUV);
+
+ unsigned int w[10];
+ unsigned int c[10];
+
+ // +----+----+----+
+ // | | | |
+ // | w1 | w2 | w3 |
+ // +----+----+----+
+ // | | | |
+ // | w4 | w5 | w6 |
+ // +----+----+----+
+ // | | | |
+ // | w7 | w8 | w9 |
+ // +----+----+----+
+ //
+ // w5 is the current point.
+
+ for (int j = 0; j < ncols; j++)
+ {
+ for (int i = 0; i < nrows; i++)
+ {
+ w[1] = rgb8toShort(input.at_(i - 1, j - 1));
+ w[2] = rgb8toShort(input.at_(i - 1, j));
+ w[3] = rgb8toShort(input.at_(i - 1, j + 1));
+ w[4] = rgb8toShort(input.at_(i, j - 1));
+ w[5] = rgb8toShort(input.at_(i, j));
+ w[6] = rgb8toShort(input.at_(i, j + 1));
+ w[7] = rgb8toShort(input.at_(i + 1, j - 1));
+ w[8] = rgb8toShort(input.at_(i + 1, j));
+ w[9] = rgb8toShort(input.at_(i + 1, j + 1));
+
+ int pattern = 0;
+ int flag = 1;
+
+ YUV1 = RGBtoYUV[w[5]];
+
+ for (int k = 1; k <= 9; k++)
+ {
+ if (k == 5)
+ continue;
+
+ if (w[k] != w[5])
+ {
+ YUV2 = RGBtoYUV[w[k]];
+ if ((abs((YUV1 & Ymask) - (YUV2 & Ymask)) > trY) ||
+ (abs((YUV1 & Umask) - (YUV2 & Umask)) > trU) ||
+ (abs((YUV1 & Vmask) - (YUV2 & Vmask)) > trV))
+ pattern |= flag;
+ }
+ flag <<= 1;
+ }
+
+ for (int k = 1; k <= 9; k++)
+ c[k] = LUT16to32[w[k]];
+
+ switch (pattern)
+ {
+ case 0:
+ case 1:
+ case 4:
+ case 32:
+ case 128:
+ case 5:
+ case 132:
+ case 160:
+ case 33:
+ case 129:
+ case 36:
+ case 133:
+ case 164:
+ case 161:
+ case 37:
+ case 165:
+ {
+ PIXEL00_2
+ PIXEL01_1
+ PIXEL02_2
+ PIXEL10_1
+ PIXEL11
+ PIXEL12_1
+ PIXEL20_2
+ PIXEL21_1
+ PIXEL22_2
+ break;
+ }
+ case 2:
+ case 34:
+ case 130:
+ case 162:
+ {
+ PIXEL00_1M
+ PIXEL01_C
+ PIXEL02_1M
+ PIXEL10_1
+ PIXEL11
+ PIXEL12_1
+ PIXEL20_2
+ PIXEL21_1
+ PIXEL22_2
+ break;
+ }
+ case 16:
+ case 17:
+ case 48:
+ case 49:
+ {
+ PIXEL00_2
+ PIXEL01_1
+ PIXEL02_1M
+ PIXEL10_1
+ PIXEL11
+ PIXEL12_C
+ PIXEL20_2
+ PIXEL21_1
+ PIXEL22_1M
+ break;
+ }
+ case 64:
+ case 65:
+ case 68:
+ case 69:
+ {
+ PIXEL00_2
+ PIXEL01_1
+ PIXEL02_2
+ PIXEL10_1
+ PIXEL11
+ PIXEL12_1
+ PIXEL20_1M
+ PIXEL21_C
+ PIXEL22_1M
+ break;
+ }
+ case 8:
+ case 12:
+ case 136:
+ case 140:
+ {
+ PIXEL00_1M
+ PIXEL01_1
+ PIXEL02_2
+ PIXEL10_C
+ PIXEL11
+ PIXEL12_1
+ PIXEL20_1M
+ PIXEL21_1
+ PIXEL22_2
+ break;
+ }
+ case 3:
+ case 35:
+ case 131:
+ case 163:
+ {
+ PIXEL00_1L
+ PIXEL01_C
+ PIXEL02_1M
+ PIXEL10_1
+ PIXEL11
+ PIXEL12_1
+ PIXEL20_2
+ PIXEL21_1
+ PIXEL22_2
+ break;
+ }
+ case 6:
+ case 38:
+ case 134:
+ case 166:
+ {
+ PIXEL00_1M
+ PIXEL01_C
+ PIXEL02_1R
+ PIXEL10_1
+ PIXEL11
+ PIXEL12_1
+ PIXEL20_2
+ PIXEL21_1
+ PIXEL22_2
+ break;
+ }
+ case 20:
+ case 21:
+ case 52:
+ case 53:
+ {
+ PIXEL00_2
+ PIXEL01_1
+ PIXEL02_1U
+ PIXEL10_1
+ PIXEL11
+ PIXEL12_C
+ PIXEL20_2
+ PIXEL21_1
+ PIXEL22_1M
+ break;
+ }
+ case 144:
+ case 145:
+ case 176:
+ case 177:
+ {
+ PIXEL00_2
+ PIXEL01_1
+ PIXEL02_1M
+ PIXEL10_1
+ PIXEL11
+ PIXEL12_C
+ PIXEL20_2
+ PIXEL21_1
+ PIXEL22_1D
+ break;
+ }
+ case 192:
+ case 193:
+ case 196:
+ case 197:
+ {
+ PIXEL00_2
+ PIXEL01_1
+ PIXEL02_2
+ PIXEL10_1
+ PIXEL11
+ PIXEL12_1
+ PIXEL20_1M
+ PIXEL21_C
+ PIXEL22_1R
+ break;
+ }
+ case 96:
+ case 97:
+ case 100:
+ case 101:
+ {
+ PIXEL00_2
+ PIXEL01_1
+ PIXEL02_2
+ PIXEL10_1
+ PIXEL11
+ PIXEL12_1
+ PIXEL20_1L
+ PIXEL21_C
+ PIXEL22_1M
+ break;
+ }
+ case 40:
+ case 44:
+ case 168:
+ case 172:
+ {
+ PIXEL00_1M
+ PIXEL01_1
+ PIXEL02_2
+ PIXEL10_C
+ PIXEL11
+ PIXEL12_1
+ PIXEL20_1D
+ PIXEL21_1
+ PIXEL22_2
+ break;
+ }
+ case 9:
+ case 13:
+ case 137:
+ case 141:
+ {
+ PIXEL00_1U
+ PIXEL01_1
+ PIXEL02_2
+ PIXEL10_C
+ PIXEL11
+ PIXEL12_1
+ PIXEL20_1M
+ PIXEL21_1
+ PIXEL22_2
+ break;
+ }
+ case 18:
+ case 50:
+ {
+ PIXEL00_1M
+ if (Diff(YUV1, YUV2, RGBtoYUV, trY, trU, trV, Ymask, Umask, Vmask, w[2], w[6]))
+ {
+ PIXEL01_C
+ PIXEL02_1M
+ PIXEL12_C
+ }
+ else
+ {
+ PIXEL01_3
+ PIXEL02_4
+ PIXEL12_3
+ }
+ PIXEL10_1
+ PIXEL11
+ PIXEL20_2
+ PIXEL21_1
+ PIXEL22_1M
+ break;
+ }
+ case 80:
+ case 81:
+ {
+ PIXEL00_2
+ PIXEL01_1
+ PIXEL02_1M
+ PIXEL10_1
+ PIXEL11
+ PIXEL20_1M
+ if (Diff(YUV1, YUV2, RGBtoYUV, trY, trU, trV, Ymask, Umask, Vmask, w[6], w[8]))
+ {
+ PIXEL12_C
+ PIXEL21_C
+ PIXEL22_1M
+ }
+ else
+ {
+ PIXEL12_3
+ PIXEL21_3
+ PIXEL22_4
+ }
+ break;
+ }
+ case 72:
+ case 76:
+ {
+ PIXEL00_1M
+ PIXEL01_1
+ PIXEL02_2
+ PIXEL11
+ PIXEL12_1
+ if (Diff(YUV1, YUV2, RGBtoYUV, trY, trU, trV, Ymask, Umask, Vmask, w[8], w[4]))
+ {
+ PIXEL10_C
+ PIXEL20_1M
+ PIXEL21_C
+ }
+ else
+ {
+ PIXEL10_3
+ PIXEL20_4
+ PIXEL21_3
+ }
+ PIXEL22_1M
+ break;
+ }
+ case 10:
+ case 138:
+ {
+ if (Diff(YUV1, YUV2, RGBtoYUV, trY, trU, trV, Ymask, Umask, Vmask, w[4], w[2]))
+ {
+ PIXEL00_1M
+ PIXEL01_C
+ PIXEL10_C
+ }
+ else
+ {
+ PIXEL00_4
+ PIXEL01_3
+ PIXEL10_3
+ }
+ PIXEL02_1M
+ PIXEL11
+ PIXEL12_1
+ PIXEL20_1M
+ PIXEL21_1
+ PIXEL22_2
+ break;
+ }
+ case 66:
+ {
+ PIXEL00_1M
+ PIXEL01_C
+ PIXEL02_1M
+ PIXEL10_1
+ PIXEL11
+ PIXEL12_1
+ PIXEL20_1M
+ PIXEL21_C
+ PIXEL22_1M
+ break;
+ }
+ case 24:
+ {
+ PIXEL00_1M
+ PIXEL01_1
+ PIXEL02_1M
+ PIXEL10_C
+ PIXEL11
+ PIXEL12_C
+ PIXEL20_1M
+ PIXEL21_1
+ PIXEL22_1M
+ break;
+ }
+ case 7:
+ case 39:
+ case 135:
+ {
+ PIXEL00_1L
+ PIXEL01_C
+ PIXEL02_1R
+ PIXEL10_1
+ PIXEL11
+ PIXEL12_1
+ PIXEL20_2
+ PIXEL21_1
+ PIXEL22_2
+ break;
+ }
+ case 148:
+ case 149:
+ case 180:
+ {
+ PIXEL00_2
+ PIXEL01_1
+ PIXEL02_1U
+ PIXEL10_1
+ PIXEL11
+ PIXEL12_C
+ PIXEL20_2
+ PIXEL21_1
+ PIXEL22_1D
+ break;
+ }
+ case 224:
+ case 228:
+ case 225:
+ {
+ PIXEL00_2
+ PIXEL01_1
+ PIXEL02_2
+ PIXEL10_1
+ PIXEL11
+ PIXEL12_1
+ PIXEL20_1L
+ PIXEL21_C
+ PIXEL22_1R
+ break;
+ }
+ case 41:
+ case 169:
+ case 45:
+ {
+ PIXEL00_1U
+ PIXEL01_1
+ PIXEL02_2
+ PIXEL10_C
+ PIXEL11
+ PIXEL12_1
+ PIXEL20_1D
+ PIXEL21_1
+ PIXEL22_2
+ break;
+ }
+ case 22:
+ case 54:
+ {
+ PIXEL00_1M
+ if (Diff(YUV1, YUV2, RGBtoYUV, trY, trU, trV, Ymask, Umask, Vmask, w[2], w[6]))
+ {
+ PIXEL01_C
+ PIXEL02_C
+ PIXEL12_C
+ }
+ else
+ {
+ PIXEL01_3
+ PIXEL02_4
+ PIXEL12_3
+ }
+ PIXEL10_1
+ PIXEL11
+ PIXEL20_2
+ PIXEL21_1
+ PIXEL22_1M
+ break;
+ }
+ case 208:
+ case 209:
+ {
+ PIXEL00_2
+ PIXEL01_1
+ PIXEL02_1M
+ PIXEL10_1
+ PIXEL11
+ PIXEL20_1M
+ if (Diff(YUV1, YUV2, RGBtoYUV, trY, trU, trV, Ymask, Umask, Vmask, w[6], w[8]))
+ {
+ PIXEL12_C
+ PIXEL21_C
+ PIXEL22_C
+ }
+ else
+ {
+ PIXEL12_3
+ PIXEL21_3
+ PIXEL22_4
+ }
+ break;
+ }
+ case 104:
+ case 108:
+ {
+ PIXEL00_1M
+ PIXEL01_1
+ PIXEL02_2
+ PIXEL11
+ PIXEL12_1
+ if (Diff(YUV1, YUV2, RGBtoYUV, trY, trU, trV, Ymask, Umask, Vmask, w[8], w[4]))
+ {
+ PIXEL10_C
+ PIXEL20_C
+ PIXEL21_C
+ }
+ else
+ {
+ PIXEL10_3
+ PIXEL20_4
+ PIXEL21_3
+ }
+ PIXEL22_1M
+ break;
+ }
+ case 11:
+ case 139:
+ {
+ if (Diff(YUV1, YUV2, RGBtoYUV, trY, trU, trV, Ymask, Umask, Vmask, w[4], w[2]))
+ {
+ PIXEL00_C
+ PIXEL01_C
+ PIXEL10_C
+ }
+ else
+ {
+ PIXEL00_4
+ PIXEL01_3
+ PIXEL10_3
+ }
+ PIXEL02_1M
+ PIXEL11
+ PIXEL12_1
+ PIXEL20_1M
+ PIXEL21_1
+ PIXEL22_2
+ break;
+ }
+ case 19:
+ case 51:
+ {
+ if (Diff(YUV1, YUV2, RGBtoYUV, trY, trU, trV, Ymask, Umask, Vmask, w[2], w[6]))
+ {
+ PIXEL00_1L
+ PIXEL01_C
+ PIXEL02_1M
+ PIXEL12_C
+ }
+ else
+ {
+ PIXEL00_2
+ PIXEL01_6
+ PIXEL02_5
+ PIXEL12_1
+ }
+ PIXEL10_1
+ PIXEL11
+ PIXEL20_2
+ PIXEL21_1
+ PIXEL22_1M
+ break;
+ }
+ case 146:
+ case 178:
+ {
+ if (Diff(YUV1, YUV2, RGBtoYUV, trY, trU, trV, Ymask, Umask, Vmask, w[2], w[6]))
+ {
+ PIXEL01_C
+ PIXEL02_1M
+ PIXEL12_C
+ PIXEL22_1D
+ }
+ else
+ {
+ PIXEL01_1
+ PIXEL02_5
+ PIXEL12_6
+ PIXEL22_2
+ }
+ PIXEL00_1M
+ PIXEL10_1
+ PIXEL11
+ PIXEL20_2
+ PIXEL21_1
+ break;
+ }
+ case 84:
+ case 85:
+ {
+ if (Diff(YUV1, YUV2, RGBtoYUV, trY, trU, trV, Ymask, Umask, Vmask, w[6], w[8]))
+ {
+ PIXEL02_1U
+ PIXEL12_C
+ PIXEL21_C
+ PIXEL22_1M
+ }
+ else
+ {
+ PIXEL02_2
+ PIXEL12_6
+ PIXEL21_1
+ PIXEL22_5
+ }
+ PIXEL00_2
+ PIXEL01_1
+ PIXEL10_1
+ PIXEL11
+ PIXEL20_1M
+ break;
+ }
+ case 112:
+ case 113:
+ {
+ if (Diff(YUV1, YUV2, RGBtoYUV, trY, trU, trV, Ymask, Umask, Vmask, w[6], w[8]))
+ {
+ PIXEL12_C
+ PIXEL20_1L
+ PIXEL21_C
+ PIXEL22_1M
+ }
+ else
+ {
+ PIXEL12_1
+ PIXEL20_2
+ PIXEL21_6
+ PIXEL22_5
+ }
+ PIXEL00_2
+ PIXEL01_1
+ PIXEL02_1M
+ PIXEL10_1
+ PIXEL11
+ break;
+ }
+ case 200:
+ case 204:
+ {
+ if (Diff(YUV1, YUV2, RGBtoYUV, trY, trU, trV, Ymask, Umask, Vmask, w[8], w[4]))
+ {
+ PIXEL10_C
+ PIXEL20_1M
+ PIXEL21_C
+ PIXEL22_1R
+ }
+ else
+ {
+ PIXEL10_1
+ PIXEL20_5
+ PIXEL21_6
+ PIXEL22_2
+ }
+ PIXEL00_1M
+ PIXEL01_1
+ PIXEL02_2
+ PIXEL11
+ PIXEL12_1
+ break;
+ }
+ case 73:
+ case 77:
+ {
+ if (Diff(YUV1, YUV2, RGBtoYUV, trY, trU, trV, Ymask, Umask, Vmask, w[8], w[4]))
+ {
+ PIXEL00_1U
+ PIXEL10_C
+ PIXEL20_1M
+ PIXEL21_C
+ }
+ else
+ {
+ PIXEL00_2
+ PIXEL10_6
+ PIXEL20_5
+ PIXEL21_1
+ }
+ PIXEL01_1
+ PIXEL02_2
+ PIXEL11
+ PIXEL12_1
+ PIXEL22_1M
+ break;
+ }
+ case 42:
+ case 170:
+ {
+ if (Diff(YUV1, YUV2, RGBtoYUV, trY, trU, trV, Ymask, Umask, Vmask, w[4], w[2]))
+ {
+ PIXEL00_1M
+ PIXEL01_C
+ PIXEL10_C
+ PIXEL20_1D
+ }
+ else
+ {
+ PIXEL00_5
+ PIXEL01_1
+ PIXEL10_6
+ PIXEL20_2
+ }
+ PIXEL02_1M
+ PIXEL11
+ PIXEL12_1
+ PIXEL21_1
+ PIXEL22_2
+ break;
+ }
+ case 14:
+ case 142:
+ {
+ if (Diff(YUV1, YUV2, RGBtoYUV, trY, trU, trV, Ymask, Umask, Vmask, w[4], w[2]))
+ {
+ PIXEL00_1M
+ PIXEL01_C
+ PIXEL02_1R
+ PIXEL10_C
+ }
+ else
+ {
+ PIXEL00_5
+ PIXEL01_6
+ PIXEL02_2
+ PIXEL10_1
+ }
+ PIXEL11
+ PIXEL12_1
+ PIXEL20_1M
+ PIXEL21_1
+ PIXEL22_2
+ break;
+ }
+ case 67:
+ {
+ PIXEL00_1L
+ PIXEL01_C
+ PIXEL02_1M
+ PIXEL10_1
+ PIXEL11
+ PIXEL12_1
+ PIXEL20_1M
+ PIXEL21_C
+ PIXEL22_1M
+ break;
+ }
+ case 70:
+ {
+ PIXEL00_1M
+ PIXEL01_C
+ PIXEL02_1R
+ PIXEL10_1
+ PIXEL11
+ PIXEL12_1
+ PIXEL20_1M
+ PIXEL21_C
+ PIXEL22_1M
+ break;
+ }
+ case 28:
+ {
+ PIXEL00_1M
+ PIXEL01_1
+ PIXEL02_1U
+ PIXEL10_C
+ PIXEL11
+ PIXEL12_C
+ PIXEL20_1M
+ PIXEL21_1
+ PIXEL22_1M
+ break;
+ }
+ case 152:
+ {
+ PIXEL00_1M
+ PIXEL01_1
+ PIXEL02_1M
+ PIXEL10_C
+ PIXEL11
+ PIXEL12_C
+ PIXEL20_1M
+ PIXEL21_1
+ PIXEL22_1D
+ break;
+ }
+ case 194:
+ {
+ PIXEL00_1M
+ PIXEL01_C
+ PIXEL02_1M
+ PIXEL10_1
+ PIXEL11
+ PIXEL12_1
+ PIXEL20_1M
+ PIXEL21_C
+ PIXEL22_1R
+ break;
+ }
+ case 98:
+ {
+ PIXEL00_1M
+ PIXEL01_C
+ PIXEL02_1M
+ PIXEL10_1
+ PIXEL11
+ PIXEL12_1
+ PIXEL20_1L
+ PIXEL21_C
+ PIXEL22_1M
+ break;
+ }
+ case 56:
+ {
+ PIXEL00_1M
+ PIXEL01_1
+ PIXEL02_1M
+ PIXEL10_C
+ PIXEL11
+ PIXEL12_C
+ PIXEL20_1D
+ PIXEL21_1
+ PIXEL22_1M
+ break;
+ }
+ case 25:
+ {
+ PIXEL00_1U
+ PIXEL01_1
+ PIXEL02_1M
+ PIXEL10_C
+ PIXEL11
+ PIXEL12_C
+ PIXEL20_1M
+ PIXEL21_1
+ PIXEL22_1M
+ break;
+ }
+ case 26:
+ case 31:
+ {
+ if (Diff(YUV1, YUV2, RGBtoYUV, trY, trU, trV, Ymask, Umask, Vmask, w[4], w[2]))
+ {
+ PIXEL00_C
+ PIXEL10_C
+ }
+ else
+ {
+ PIXEL00_4
+ PIXEL10_3
+ }
+ PIXEL01_C
+ if (Diff(YUV1, YUV2, RGBtoYUV, trY, trU, trV, Ymask, Umask, Vmask, w[2], w[6]))
+ {
+ PIXEL02_C
+ PIXEL12_C
+ }
+ else
+ {
+ PIXEL02_4
+ PIXEL12_3
+ }
+ PIXEL11
+ PIXEL20_1M
+ PIXEL21_1
+ PIXEL22_1M
+ break;
+ }
+ case 82:
+ case 214:
+ {
+ PIXEL00_1M
+ if (Diff(YUV1, YUV2, RGBtoYUV, trY, trU, trV, Ymask, Umask, Vmask, w[2], w[6]))
+ {
+ PIXEL01_C
+ PIXEL02_C
+ }
+ else
+ {
+ PIXEL01_3
+ PIXEL02_4
+ }
+ PIXEL10_1
+ PIXEL11
+ PIXEL12_C
+ PIXEL20_1M
+ if (Diff(YUV1, YUV2, RGBtoYUV, trY, trU, trV, Ymask, Umask, Vmask, w[6], w[8]))
+ {
+ PIXEL21_C
+ PIXEL22_C
+ }
+ else
+ {
+ PIXEL21_3
+ PIXEL22_4
+ }
+ break;
+ }
+ case 88:
+ case 248:
+ {
+ PIXEL00_1M
+ PIXEL01_1
+ PIXEL02_1M
+ PIXEL11
+ if (Diff(YUV1, YUV2, RGBtoYUV, trY, trU, trV, Ymask, Umask, Vmask, w[8], w[4]))
+ {
+ PIXEL10_C
+ PIXEL20_C
+ }
+ else
+ {
+ PIXEL10_3
+ PIXEL20_4
+ }
+ PIXEL21_C
+ if (Diff(YUV1, YUV2, RGBtoYUV, trY, trU, trV, Ymask, Umask, Vmask, w[6], w[8]))
+ {
+ PIXEL12_C
+ PIXEL22_C
+ }
+ else
+ {
+ PIXEL12_3
+ PIXEL22_4
+ }
+ break;
+ }
+ case 74:
+ case 107:
+ {
+ if (Diff(YUV1, YUV2, RGBtoYUV, trY, trU, trV, Ymask, Umask, Vmask, w[4], w[2]))
+ {
+ PIXEL00_C
+ PIXEL01_C
+ }
+ else
+ {
+ PIXEL00_4
+ PIXEL01_3
+ }
+ PIXEL02_1M
+ PIXEL10_C
+ PIXEL11
+ PIXEL12_1
+ if (Diff(YUV1, YUV2, RGBtoYUV, trY, trU, trV, Ymask, Umask, Vmask, w[8], w[4]))
+ {
+ PIXEL20_C
+ PIXEL21_C
+ }
+ else
+ {
+ PIXEL20_4
+ PIXEL21_3
+ }
+ PIXEL22_1M
+ break;
+ }
+ case 27:
+ {
+ if (Diff(YUV1, YUV2, RGBtoYUV, trY, trU, trV, Ymask, Umask, Vmask, w[4], w[2]))
+ {
+ PIXEL00_C
+ PIXEL01_C
+ PIXEL10_C
+ }
+ else
+ {
+ PIXEL00_4
+ PIXEL01_3
+ PIXEL10_3
+ }
+ PIXEL02_1M
+ PIXEL11
+ PIXEL12_C
+ PIXEL20_1M
+ PIXEL21_1
+ PIXEL22_1M
+ break;
+ }
+ case 86:
+ {
+ PIXEL00_1M
+ if (Diff(YUV1, YUV2, RGBtoYUV, trY, trU, trV, Ymask, Umask, Vmask, w[2], w[6]))
+ {
+ PIXEL01_C
+ PIXEL02_C
+ PIXEL12_C
+ }
+ else
+ {
+ PIXEL01_3
+ PIXEL02_4
+ PIXEL12_3
+ }
+ PIXEL10_1
+ PIXEL11
+ PIXEL20_1M
+ PIXEL21_C
+ PIXEL22_1M
+ break;
+ }
+ case 216:
+ {
+ PIXEL00_1M
+ PIXEL01_1
+ PIXEL02_1M
+ PIXEL10_C
+ PIXEL11
+ PIXEL20_1M
+ if (Diff(YUV1, YUV2, RGBtoYUV, trY, trU, trV, Ymask, Umask, Vmask, w[6], w[8]))
+ {
+ PIXEL12_C
+ PIXEL21_C
+ PIXEL22_C
+ }
+ else
+ {
+ PIXEL12_3
+ PIXEL21_3
+ PIXEL22_4
+ }
+ break;
+ }
+ case 106:
+ {
+ PIXEL00_1M
+ PIXEL01_C
+ PIXEL02_1M
+ PIXEL11
+ PIXEL12_1
+ if (Diff(YUV1, YUV2, RGBtoYUV, trY, trU, trV, Ymask, Umask, Vmask, w[8], w[4]))
+ {
+ PIXEL10_C
+ PIXEL20_C
+ PIXEL21_C
+ }
+ else
+ {
+ PIXEL10_3
+ PIXEL20_4
+ PIXEL21_3
+ }
+ PIXEL22_1M
+ break;
+ }
+ case 30:
+ {
+ PIXEL00_1M
+ if (Diff(YUV1, YUV2, RGBtoYUV, trY, trU, trV, Ymask, Umask, Vmask, w[2], w[6]))
+ {
+ PIXEL01_C
+ PIXEL02_C
+ PIXEL12_C
+ }
+ else
+ {
+ PIXEL01_3
+ PIXEL02_4
+ PIXEL12_3
+ }
+ PIXEL10_C
+ PIXEL11
+ PIXEL20_1M
+ PIXEL21_1
+ PIXEL22_1M
+ break;
+ }
+ case 210:
+ {
+ PIXEL00_1M
+ PIXEL01_C
+ PIXEL02_1M
+ PIXEL10_1
+ PIXEL11
+ PIXEL20_1M
+ if (Diff(YUV1, YUV2, RGBtoYUV, trY, trU, trV, Ymask, Umask, Vmask, w[6], w[8]))
+ {
+ PIXEL12_C
+ PIXEL21_C
+ PIXEL22_C
+ }
+ else
+ {
+ PIXEL12_3
+ PIXEL21_3
+ PIXEL22_4
+ }
+ break;
+ }
+ case 120:
+ {
+ PIXEL00_1M
+ PIXEL01_1
+ PIXEL02_1M
+ PIXEL11
+ PIXEL12_C
+ if (Diff(YUV1, YUV2, RGBtoYUV, trY, trU, trV, Ymask, Umask, Vmask, w[8], w[4]))
+ {
+ PIXEL10_C
+ PIXEL20_C
+ PIXEL21_C
+ }
+ else
+ {
+ PIXEL10_3
+ PIXEL20_4
+ PIXEL21_3
+ }
+ PIXEL22_1M
+ break;
+ }
+ case 75:
+ {
+ if (Diff(YUV1, YUV2, RGBtoYUV, trY, trU, trV, Ymask, Umask, Vmask, w[4], w[2]))
+ {
+ PIXEL00_C
+ PIXEL01_C
+ PIXEL10_C
+ }
+ else
+ {
+ PIXEL00_4
+ PIXEL01_3
+ PIXEL10_3
+ }
+ PIXEL02_1M
+ PIXEL11
+ PIXEL12_1
+ PIXEL20_1M
+ PIXEL21_C
+ PIXEL22_1M
+ break;
+ }
+ case 29:
+ {
+ PIXEL00_1U
+ PIXEL01_1
+ PIXEL02_1U
+ PIXEL10_C
+ PIXEL11
+ PIXEL12_C
+ PIXEL20_1M
+ PIXEL21_1
+ PIXEL22_1M
+ break;
+ }
+ case 198:
+ {
+ PIXEL00_1M
+ PIXEL01_C
+ PIXEL02_1R
+ PIXEL10_1
+ PIXEL11
+ PIXEL12_1
+ PIXEL20_1M
+ PIXEL21_C
+ PIXEL22_1R
+ break;
+ }
+ case 184:
+ {
+ PIXEL00_1M
+ PIXEL01_1
+ PIXEL02_1M
+ PIXEL10_C
+ PIXEL11
+ PIXEL12_C
+ PIXEL20_1D
+ PIXEL21_1
+ PIXEL22_1D
+ break;
+ }
+ case 99:
+ {
+ PIXEL00_1L
+ PIXEL01_C
+ PIXEL02_1M
+ PIXEL10_1
+ PIXEL11
+ PIXEL12_1
+ PIXEL20_1L
+ PIXEL21_C
+ PIXEL22_1M
+ break;
+ }
+ case 57:
+ {
+ PIXEL00_1U
+ PIXEL01_1
+ PIXEL02_1M
+ PIXEL10_C
+ PIXEL11
+ PIXEL12_C
+ PIXEL20_1D
+ PIXEL21_1
+ PIXEL22_1M
+ break;
+ }
+ case 71:
+ {
+ PIXEL00_1L
+ PIXEL01_C
+ PIXEL02_1R
+ PIXEL10_1
+ PIXEL11
+ PIXEL12_1
+ PIXEL20_1M
+ PIXEL21_C
+ PIXEL22_1M
+ break;
+ }
+ case 156:
+ {
+ PIXEL00_1M
+ PIXEL01_1
+ PIXEL02_1U
+ PIXEL10_C
+ PIXEL11
+ PIXEL12_C
+ PIXEL20_1M
+ PIXEL21_1
+ PIXEL22_1D
+ break;
+ }
+ case 226:
+ {
+ PIXEL00_1M
+ PIXEL01_C
+ PIXEL02_1M
+ PIXEL10_1
+ PIXEL11
+ PIXEL12_1
+ PIXEL20_1L
+ PIXEL21_C
+ PIXEL22_1R
+ break;
+ }
+ case 60:
+ {
+ PIXEL00_1M
+ PIXEL01_1
+ PIXEL02_1U
+ PIXEL10_C
+ PIXEL11
+ PIXEL12_C
+ PIXEL20_1D
+ PIXEL21_1
+ PIXEL22_1M
+ break;
+ }
+ case 195:
+ {
+ PIXEL00_1L
+ PIXEL01_C
+ PIXEL02_1M
+ PIXEL10_1
+ PIXEL11
+ PIXEL12_1
+ PIXEL20_1M
+ PIXEL21_C
+ PIXEL22_1R
+ break;
+ }
+ case 102:
+ {
+ PIXEL00_1M
+ PIXEL01_C
+ PIXEL02_1R
+ PIXEL10_1
+ PIXEL11
+ PIXEL12_1
+ PIXEL20_1L
+ PIXEL21_C
+ PIXEL22_1M
+ break;
+ }
+ case 153:
+ {
+ PIXEL00_1U
+ PIXEL01_1
+ PIXEL02_1M
+ PIXEL10_C
+ PIXEL11
+ PIXEL12_C
+ PIXEL20_1M
+ PIXEL21_1
+ PIXEL22_1D
+ break;
+ }
+ case 58:
+ {
+ if (Diff(YUV1, YUV2, RGBtoYUV, trY, trU, trV, Ymask, Umask, Vmask, w[4], w[2]))
+ {
+ PIXEL00_1M
+ }
+ else
+ {
+ PIXEL00_2
+ }
+ PIXEL01_C
+ if (Diff(YUV1, YUV2, RGBtoYUV, trY, trU, trV, Ymask, Umask, Vmask, w[2], w[6]))
+ {
+ PIXEL02_1M
+ }
+ else
+ {
+ PIXEL02_2
+ }
+ PIXEL10_C
+ PIXEL11
+ PIXEL12_C
+ PIXEL20_1D
+ PIXEL21_1
+ PIXEL22_1M
+ break;
+ }
+ case 83:
+ {
+ PIXEL00_1L
+ PIXEL01_C
+ if (Diff(YUV1, YUV2, RGBtoYUV, trY, trU, trV, Ymask, Umask, Vmask, w[2], w[6]))
+ {
+ PIXEL02_1M
+ }
+ else
+ {
+ PIXEL02_2
+ }
+ PIXEL10_1
+ PIXEL11
+ PIXEL12_C
+ PIXEL20_1M
+ PIXEL21_C
+ if (Diff(YUV1, YUV2, RGBtoYUV, trY, trU, trV, Ymask, Umask, Vmask, w[6], w[8]))
+ {
+ PIXEL22_1M
+ }
+ else
+ {
+ PIXEL22_2
+ }
+ break;
+ }
+ case 92:
+ {
+ PIXEL00_1M
+ PIXEL01_1
+ PIXEL02_1U
+ PIXEL10_C
+ PIXEL11
+ PIXEL12_C
+ if (Diff(YUV1, YUV2, RGBtoYUV, trY, trU, trV, Ymask, Umask, Vmask, w[8], w[4]))
+ {
+ PIXEL20_1M
+ }
+ else
+ {
+ PIXEL20_2
+ }
+ PIXEL21_C
+ if (Diff(YUV1, YUV2, RGBtoYUV, trY, trU, trV, Ymask, Umask, Vmask, w[6], w[8]))
+ {
+ PIXEL22_1M
+ }
+ else
+ {
+ PIXEL22_2
+ }
+ break;
+ }
+ case 202:
+ {
+ if (Diff(YUV1, YUV2, RGBtoYUV, trY, trU, trV, Ymask, Umask, Vmask, w[4], w[2]))
+ {
+ PIXEL00_1M
+ }
+ else
+ {
+ PIXEL00_2
+ }
+ PIXEL01_C
+ PIXEL02_1M
+ PIXEL10_C
+ PIXEL11
+ PIXEL12_1
+ if (Diff(YUV1, YUV2, RGBtoYUV, trY, trU, trV, Ymask, Umask, Vmask, w[8], w[4]))
+ {
+ PIXEL20_1M
+ }
+ else
+ {
+ PIXEL20_2
+ }
+ PIXEL21_C
+ PIXEL22_1R
+ break;
+ }
+ case 78:
+ {
+ if (Diff(YUV1, YUV2, RGBtoYUV, trY, trU, trV, Ymask, Umask, Vmask, w[4], w[2]))
+ {
+ PIXEL00_1M
+ }
+ else
+ {
+ PIXEL00_2
+ }
+ PIXEL01_C
+ PIXEL02_1R
+ PIXEL10_C
+ PIXEL11
+ PIXEL12_1
+ if (Diff(YUV1, YUV2, RGBtoYUV, trY, trU, trV, Ymask, Umask, Vmask, w[8], w[4]))
+ {
+ PIXEL20_1M
+ }
+ else
+ {
+ PIXEL20_2
+ }
+ PIXEL21_C
+ PIXEL22_1M
+ break;
+ }
+ case 154:
+ {
+ if (Diff(YUV1, YUV2, RGBtoYUV, trY, trU, trV, Ymask, Umask, Vmask, w[4], w[2]))
+ {
+ PIXEL00_1M
+ }
+ else
+ {
+ PIXEL00_2
+ }
+ PIXEL01_C
+ if (Diff(YUV1, YUV2, RGBtoYUV, trY, trU, trV, Ymask, Umask, Vmask, w[2], w[6]))
+ {
+ PIXEL02_1M
+ }
+ else
+ {
+ PIXEL02_2
+ }
+ PIXEL10_C
+ PIXEL11
+ PIXEL12_C
+ PIXEL20_1M
+ PIXEL21_1
+ PIXEL22_1D
+ break;
+ }
+ case 114:
+ {
+ PIXEL00_1M
+ PIXEL01_C
+ if (Diff(YUV1, YUV2, RGBtoYUV, trY, trU, trV, Ymask, Umask, Vmask, w[2], w[6]))
+ {
+ PIXEL02_1M
+ }
+ else
+ {
+ PIXEL02_2
+ }
+ PIXEL10_1
+ PIXEL11
+ PIXEL12_C
+ PIXEL20_1L
+ PIXEL21_C
+ if (Diff(YUV1, YUV2, RGBtoYUV, trY, trU, trV, Ymask, Umask, Vmask, w[6], w[8]))
+ {
+ PIXEL22_1M
+ }
+ else
+ {
+ PIXEL22_2
+ }
+ break;
+ }
+ case 89:
+ {
+ PIXEL00_1U
+ PIXEL01_1
+ PIXEL02_1M
+ PIXEL10_C
+ PIXEL11
+ PIXEL12_C
+ if (Diff(YUV1, YUV2, RGBtoYUV, trY, trU, trV, Ymask, Umask, Vmask, w[8], w[4]))
+ {
+ PIXEL20_1M
+ }
+ else
+ {
+ PIXEL20_2
+ }
+ PIXEL21_C
+ if (Diff(YUV1, YUV2, RGBtoYUV, trY, trU, trV, Ymask, Umask, Vmask, w[6], w[8]))
+ {
+ PIXEL22_1M
+ }
+ else
+ {
+ PIXEL22_2
+ }
+ break;
+ }
+ case 90:
+ {
+ if (Diff(YUV1, YUV2, RGBtoYUV, trY, trU, trV, Ymask, Umask, Vmask, w[4], w[2]))
+ {
+ PIXEL00_1M
+ }
+ else
+ {
+ PIXEL00_2
+ }
+ PIXEL01_C
+ if (Diff(YUV1, YUV2, RGBtoYUV, trY, trU, trV, Ymask, Umask, Vmask, w[2], w[6]))
+ {
+ PIXEL02_1M
+ }
+ else
+ {
+ PIXEL02_2
+ }
+ PIXEL10_C
+ PIXEL11
+ PIXEL12_C
+ if (Diff(YUV1, YUV2, RGBtoYUV, trY, trU, trV, Ymask, Umask, Vmask, w[8], w[4]))
+ {
+ PIXEL20_1M
+ }
+ else
+ {
+ PIXEL20_2
+ }
+ PIXEL21_C
+ if (Diff(YUV1, YUV2, RGBtoYUV, trY, trU, trV, Ymask, Umask, Vmask, w[6], w[8]))
+ {
+ PIXEL22_1M
+ }
+ else
+ {
+ PIXEL22_2
+ }
+ break;
+ }
+ case 55:
+ case 23:
+ {
+ if (Diff(YUV1, YUV2, RGBtoYUV, trY, trU, trV, Ymask, Umask, Vmask, w[2], w[6]))
+ {
+ PIXEL00_1L
+ PIXEL01_C
+ PIXEL02_C
+ PIXEL12_C
+ }
+ else
+ {
+ PIXEL00_2
+ PIXEL01_6
+ PIXEL02_5
+ PIXEL12_1
+ }
+ PIXEL10_1
+ PIXEL11
+ PIXEL20_2
+ PIXEL21_1
+ PIXEL22_1M
+ break;
+ }
+ case 182:
+ case 150:
+ {
+ if (Diff(YUV1, YUV2, RGBtoYUV, trY, trU, trV, Ymask, Umask, Vmask, w[2], w[6]))
+ {
+ PIXEL01_C
+ PIXEL02_C
+ PIXEL12_C
+ PIXEL22_1D
+ }
+ else
+ {
+ PIXEL01_1
+ PIXEL02_5
+ PIXEL12_6
+ PIXEL22_2
+ }
+ PIXEL00_1M
+ PIXEL10_1
+ PIXEL11
+ PIXEL20_2
+ PIXEL21_1
+ break;
+ }
+ case 213:
+ case 212:
+ {
+ if (Diff(YUV1, YUV2, RGBtoYUV, trY, trU, trV, Ymask, Umask, Vmask, w[6], w[8]))
+ {
+ PIXEL02_1U
+ PIXEL12_C
+ PIXEL21_C
+ PIXEL22_C
+ }
+ else
+ {
+ PIXEL02_2
+ PIXEL12_6
+ PIXEL21_1
+ PIXEL22_5
+ }
+ PIXEL00_2
+ PIXEL01_1
+ PIXEL10_1
+ PIXEL11
+ PIXEL20_1M
+ break;
+ }
+ case 241:
+ case 240:
+ {
+ if (Diff(YUV1, YUV2, RGBtoYUV, trY, trU, trV, Ymask, Umask, Vmask, w[6], w[8]))
+ {
+ PIXEL12_C
+ PIXEL20_1L
+ PIXEL21_C
+ PIXEL22_C
+ }
+ else
+ {
+ PIXEL12_1
+ PIXEL20_2
+ PIXEL21_6
+ PIXEL22_5
+ }
+ PIXEL00_2
+ PIXEL01_1
+ PIXEL02_1M
+ PIXEL10_1
+ PIXEL11
+ break;
+ }
+ case 236:
+ case 232:
+ {
+ if (Diff(YUV1, YUV2, RGBtoYUV, trY, trU, trV, Ymask, Umask, Vmask, w[8], w[4]))
+ {
+ PIXEL10_C
+ PIXEL20_C
+ PIXEL21_C
+ PIXEL22_1R
+ }
+ else
+ {
+ PIXEL10_1
+ PIXEL20_5
+ PIXEL21_6
+ PIXEL22_2
+ }
+ PIXEL00_1M
+ PIXEL01_1
+ PIXEL02_2
+ PIXEL11
+ PIXEL12_1
+ break;
+ }
+ case 109:
+ case 105:
+ {
+ if (Diff(YUV1, YUV2, RGBtoYUV, trY, trU, trV, Ymask, Umask, Vmask, w[8], w[4]))
+ {
+ PIXEL00_1U
+ PIXEL10_C
+ PIXEL20_C
+ PIXEL21_C
+ }
+ else
+ {
+ PIXEL00_2
+ PIXEL10_6
+ PIXEL20_5
+ PIXEL21_1
+ }
+ PIXEL01_1
+ PIXEL02_2
+ PIXEL11
+ PIXEL12_1
+ PIXEL22_1M
+ break;
+ }
+ case 171:
+ case 43:
+ {
+ if (Diff(YUV1, YUV2, RGBtoYUV, trY, trU, trV, Ymask, Umask, Vmask, w[4], w[2]))
+ {
+ PIXEL00_C
+ PIXEL01_C
+ PIXEL10_C
+ PIXEL20_1D
+ }
+ else
+ {
+ PIXEL00_5
+ PIXEL01_1
+ PIXEL10_6
+ PIXEL20_2
+ }
+ PIXEL02_1M
+ PIXEL11
+ PIXEL12_1
+ PIXEL21_1
+ PIXEL22_2
+ break;
+ }
+ case 143:
+ case 15:
+ {
+ if (Diff(YUV1, YUV2, RGBtoYUV, trY, trU, trV, Ymask, Umask, Vmask, w[4], w[2]))
+ {
+ PIXEL00_C
+ PIXEL01_C
+ PIXEL02_1R
+ PIXEL10_C
+ }
+ else
+ {
+ PIXEL00_5
+ PIXEL01_6
+ PIXEL02_2
+ PIXEL10_1
+ }
+ PIXEL11
+ PIXEL12_1
+ PIXEL20_1M
+ PIXEL21_1
+ PIXEL22_2
+ break;
+ }
+ case 124:
+ {
+ PIXEL00_1M
+ PIXEL01_1
+ PIXEL02_1U
+ PIXEL11
+ PIXEL12_C
+ if (Diff(YUV1, YUV2, RGBtoYUV, trY, trU, trV, Ymask, Umask, Vmask, w[8], w[4]))
+ {
+ PIXEL10_C
+ PIXEL20_C
+ PIXEL21_C
+ }
+ else
+ {
+ PIXEL10_3
+ PIXEL20_4
+ PIXEL21_3
+ }
+ PIXEL22_1M
+ break;
+ }
+ case 203:
+ {
+ if (Diff(YUV1, YUV2, RGBtoYUV, trY, trU, trV, Ymask, Umask, Vmask, w[4], w[2]))
+ {
+ PIXEL00_C
+ PIXEL01_C
+ PIXEL10_C
+ }
+ else
+ {
+ PIXEL00_4
+ PIXEL01_3
+ PIXEL10_3
+ }
+ PIXEL02_1M
+ PIXEL11
+ PIXEL12_1
+ PIXEL20_1M
+ PIXEL21_C
+ PIXEL22_1R
+ break;
+ }
+ case 62:
+ {
+ PIXEL00_1M
+ if (Diff(YUV1, YUV2, RGBtoYUV, trY, trU, trV, Ymask, Umask, Vmask, w[2], w[6]))
+ {
+ PIXEL01_C
+ PIXEL02_C
+ PIXEL12_C
+ }
+ else
+ {
+ PIXEL01_3
+ PIXEL02_4
+ PIXEL12_3
+ }
+ PIXEL10_C
+ PIXEL11
+ PIXEL20_1D
+ PIXEL21_1
+ PIXEL22_1M
+ break;
+ }
+ case 211:
+ {
+ PIXEL00_1L
+ PIXEL01_C
+ PIXEL02_1M
+ PIXEL10_1
+ PIXEL11
+ PIXEL20_1M
+ if (Diff(YUV1, YUV2, RGBtoYUV, trY, trU, trV, Ymask, Umask, Vmask, w[6], w[8]))
+ {
+ PIXEL12_C
+ PIXEL21_C
+ PIXEL22_C
+ }
+ else
+ {
+ PIXEL12_3
+ PIXEL21_3
+ PIXEL22_4
+ }
+ break;
+ }
+ case 118:
+ {
+ PIXEL00_1M
+ if (Diff(YUV1, YUV2, RGBtoYUV, trY, trU, trV, Ymask, Umask, Vmask, w[2], w[6]))
+ {
+ PIXEL01_C
+ PIXEL02_C
+ PIXEL12_C
+ }
+ else
+ {
+ PIXEL01_3
+ PIXEL02_4
+ PIXEL12_3
+ }
+ PIXEL10_1
+ PIXEL11
+ PIXEL20_1L
+ PIXEL21_C
+ PIXEL22_1M
+ break;
+ }
+ case 217:
+ {
+ PIXEL00_1U
+ PIXEL01_1
+ PIXEL02_1M
+ PIXEL10_C
+ PIXEL11
+ PIXEL20_1M
+ if (Diff(YUV1, YUV2, RGBtoYUV, trY, trU, trV, Ymask, Umask, Vmask, w[6], w[8]))
+ {
+ PIXEL12_C
+ PIXEL21_C
+ PIXEL22_C
+ }
+ else
+ {
+ PIXEL12_3
+ PIXEL21_3
+ PIXEL22_4
+ }
+ break;
+ }
+ case 110:
+ {
+ PIXEL00_1M
+ PIXEL01_C
+ PIXEL02_1R
+ PIXEL11
+ PIXEL12_1
+ if (Diff(YUV1, YUV2, RGBtoYUV, trY, trU, trV, Ymask, Umask, Vmask, w[8], w[4]))
+ {
+ PIXEL10_C
+ PIXEL20_C
+ PIXEL21_C
+ }
+ else
+ {
+ PIXEL10_3
+ PIXEL20_4
+ PIXEL21_3
+ }
+ PIXEL22_1M
+ break;
+ }
+ case 155:
+ {
+ if (Diff(YUV1, YUV2, RGBtoYUV, trY, trU, trV, Ymask, Umask, Vmask, w[4], w[2]))
+ {
+ PIXEL00_C
+ PIXEL01_C
+ PIXEL10_C
+ }
+ else
+ {
+ PIXEL00_4
+ PIXEL01_3
+ PIXEL10_3
+ }
+ PIXEL02_1M
+ PIXEL11
+ PIXEL12_C
+ PIXEL20_1M
+ PIXEL21_1
+ PIXEL22_1D
+ break;
+ }
+ case 188:
+ {
+ PIXEL00_1M
+ PIXEL01_1
+ PIXEL02_1U
+ PIXEL10_C
+ PIXEL11
+ PIXEL12_C
+ PIXEL20_1D
+ PIXEL21_1
+ PIXEL22_1D
+ break;
+ }
+ case 185:
+ {
+ PIXEL00_1U
+ PIXEL01_1
+ PIXEL02_1M
+ PIXEL10_C
+ PIXEL11
+ PIXEL12_C
+ PIXEL20_1D
+ PIXEL21_1
+ PIXEL22_1D
+ break;
+ }
+ case 61:
+ {
+ PIXEL00_1U
+ PIXEL01_1
+ PIXEL02_1U
+ PIXEL10_C
+ PIXEL11
+ PIXEL12_C
+ PIXEL20_1D
+ PIXEL21_1
+ PIXEL22_1M
+ break;
+ }
+ case 157:
+ {
+ PIXEL00_1U
+ PIXEL01_1
+ PIXEL02_1U
+ PIXEL10_C
+ PIXEL11
+ PIXEL12_C
+ PIXEL20_1M
+ PIXEL21_1
+ PIXEL22_1D
+ break;
+ }
+ case 103:
+ {
+ PIXEL00_1L
+ PIXEL01_C
+ PIXEL02_1R
+ PIXEL10_1
+ PIXEL11
+ PIXEL12_1
+ PIXEL20_1L
+ PIXEL21_C
+ PIXEL22_1M
+ break;
+ }
+ case 227:
+ {
+ PIXEL00_1L
+ PIXEL01_C
+ PIXEL02_1M
+ PIXEL10_1
+ PIXEL11
+ PIXEL12_1
+ PIXEL20_1L
+ PIXEL21_C
+ PIXEL22_1R
+ break;
+ }
+ case 230:
+ {
+ PIXEL00_1M
+ PIXEL01_C
+ PIXEL02_1R
+ PIXEL10_1
+ PIXEL11
+ PIXEL12_1
+ PIXEL20_1L
+ PIXEL21_C
+ PIXEL22_1R
+ break;
+ }
+ case 199:
+ {
+ PIXEL00_1L
+ PIXEL01_C
+ PIXEL02_1R
+ PIXEL10_1
+ PIXEL11
+ PIXEL12_1
+ PIXEL20_1M
+ PIXEL21_C
+ PIXEL22_1R
+ break;
+ }
+ case 220:
+ {
+ PIXEL00_1M
+ PIXEL01_1
+ PIXEL02_1U
+ PIXEL10_C
+ PIXEL11
+ if (Diff(YUV1, YUV2, RGBtoYUV, trY, trU, trV, Ymask, Umask, Vmask, w[8], w[4]))
+ {
+ PIXEL20_1M
+ }
+ else
+ {
+ PIXEL20_2
+ }
+ if (Diff(YUV1, YUV2, RGBtoYUV, trY, trU, trV, Ymask, Umask, Vmask, w[6], w[8]))
+ {
+ PIXEL12_C
+ PIXEL21_C
+ PIXEL22_C
+ }
+ else
+ {
+ PIXEL12_3
+ PIXEL21_3
+ PIXEL22_4
+ }
+ break;
+ }
+ case 158:
+ {
+ if (Diff(YUV1, YUV2, RGBtoYUV, trY, trU, trV, Ymask, Umask, Vmask, w[4], w[2]))
+ {
+ PIXEL00_1M
+ }
+ else
+ {
+ PIXEL00_2
+ }
+ if (Diff(YUV1, YUV2, RGBtoYUV, trY, trU, trV, Ymask, Umask, Vmask, w[2], w[6]))
+ {
+ PIXEL01_C
+ PIXEL02_C
+ PIXEL12_C
+ }
+ else
+ {
+ PIXEL01_3
+ PIXEL02_4
+ PIXEL12_3
+ }
+ PIXEL10_C
+ PIXEL11
+ PIXEL20_1M
+ PIXEL21_1
+ PIXEL22_1D
+ break;
+ }
+ case 234:
+ {
+ if (Diff(YUV1, YUV2, RGBtoYUV, trY, trU, trV, Ymask, Umask, Vmask, w[4], w[2]))
+ {
+ PIXEL00_1M
+ }
+ else
+ {
+ PIXEL00_2
+ }
+ PIXEL01_C
+ PIXEL02_1M
+ PIXEL11
+ PIXEL12_1
+ if (Diff(YUV1, YUV2, RGBtoYUV, trY, trU, trV, Ymask, Umask, Vmask, w[8], w[4]))
+ {
+ PIXEL10_C
+ PIXEL20_C
+ PIXEL21_C
+ }
+ else
+ {
+ PIXEL10_3
+ PIXEL20_4
+ PIXEL21_3
+ }
+ PIXEL22_1R
+ break;
+ }
+ case 242:
+ {
+ PIXEL00_1M
+ PIXEL01_C
+ if (Diff(YUV1, YUV2, RGBtoYUV, trY, trU, trV, Ymask, Umask, Vmask, w[2], w[6]))
+ {
+ PIXEL02_1M
+ }
+ else
+ {
+ PIXEL02_2
+ }
+ PIXEL10_1
+ PIXEL11
+ PIXEL20_1L
+ if (Diff(YUV1, YUV2, RGBtoYUV, trY, trU, trV, Ymask, Umask, Vmask, w[6], w[8]))
+ {
+ PIXEL12_C
+ PIXEL21_C
+ PIXEL22_C
+ }
+ else
+ {
+ PIXEL12_3
+ PIXEL21_3
+ PIXEL22_4
+ }
+ break;
+ }
+ case 59:
+ {
+ if (Diff(YUV1, YUV2, RGBtoYUV, trY, trU, trV, Ymask, Umask, Vmask, w[4], w[2]))
+ {
+ PIXEL00_C
+ PIXEL01_C
+ PIXEL10_C
+ }
+ else
+ {
+ PIXEL00_4
+ PIXEL01_3
+ PIXEL10_3
+ }
+ if (Diff(YUV1, YUV2, RGBtoYUV, trY, trU, trV, Ymask, Umask, Vmask, w[2], w[6]))
+ {
+ PIXEL02_1M
+ }
+ else
+ {
+ PIXEL02_2
+ }
+ PIXEL11
+ PIXEL12_C
+ PIXEL20_1D
+ PIXEL21_1
+ PIXEL22_1M
+ break;
+ }
+ case 121:
+ {
+ PIXEL00_1U
+ PIXEL01_1
+ PIXEL02_1M
+ PIXEL11
+ PIXEL12_C
+ if (Diff(YUV1, YUV2, RGBtoYUV, trY, trU, trV, Ymask, Umask, Vmask, w[8], w[4]))
+ {
+ PIXEL10_C
+ PIXEL20_C
+ PIXEL21_C
+ }
+ else
+ {
+ PIXEL10_3
+ PIXEL20_4
+ PIXEL21_3
+ }
+ if (Diff(YUV1, YUV2, RGBtoYUV, trY, trU, trV, Ymask, Umask, Vmask, w[6], w[8]))
+ {
+ PIXEL22_1M
+ }
+ else
+ {
+ PIXEL22_2
+ }
+ break;
+ }
+ case 87:
+ {
+ PIXEL00_1L
+ if (Diff(YUV1, YUV2, RGBtoYUV, trY, trU, trV, Ymask, Umask, Vmask, w[2], w[6]))
+ {
+ PIXEL01_C
+ PIXEL02_C
+ PIXEL12_C
+ }
+ else
+ {
+ PIXEL01_3
+ PIXEL02_4
+ PIXEL12_3
+ }
+ PIXEL10_1
+ PIXEL11
+ PIXEL20_1M
+ PIXEL21_C
+ if (Diff(YUV1, YUV2, RGBtoYUV, trY, trU, trV, Ymask, Umask, Vmask, w[6], w[8]))
+ {
+ PIXEL22_1M
+ }
+ else
+ {
+ PIXEL22_2
+ }
+ break;
+ }
+ case 79:
+ {
+ if (Diff(YUV1, YUV2, RGBtoYUV, trY, trU, trV, Ymask, Umask, Vmask, w[4], w[2]))
+ {
+ PIXEL00_C
+ PIXEL01_C
+ PIXEL10_C
+ }
+ else
+ {
+ PIXEL00_4
+ PIXEL01_3
+ PIXEL10_3
+ }
+ PIXEL02_1R
+ PIXEL11
+ PIXEL12_1
+ if (Diff(YUV1, YUV2, RGBtoYUV, trY, trU, trV, Ymask, Umask, Vmask, w[8], w[4]))
+ {
+ PIXEL20_1M
+ }
+ else
+ {
+ PIXEL20_2
+ }
+ PIXEL21_C
+ PIXEL22_1M
+ break;
+ }
+ case 122:
+ {
+ if (Diff(YUV1, YUV2, RGBtoYUV, trY, trU, trV, Ymask, Umask, Vmask, w[4], w[2]))
+ {
+ PIXEL00_1M
+ }
+ else
+ {
+ PIXEL00_2
+ }
+ PIXEL01_C
+ if (Diff(YUV1, YUV2, RGBtoYUV, trY, trU, trV, Ymask, Umask, Vmask, w[2], w[6]))
+ {
+ PIXEL02_1M
+ }
+ else
+ {
+ PIXEL02_2
+ }
+ PIXEL11
+ PIXEL12_C
+ if (Diff(YUV1, YUV2, RGBtoYUV, trY, trU, trV, Ymask, Umask, Vmask, w[8], w[4]))
+ {
+ PIXEL10_C
+ PIXEL20_C
+ PIXEL21_C
+ }
+ else
+ {
+ PIXEL10_3
+ PIXEL20_4
+ PIXEL21_3
+ }
+ if (Diff(YUV1, YUV2, RGBtoYUV, trY, trU, trV, Ymask, Umask, Vmask, w[6], w[8]))
+ {
+ PIXEL22_1M
+ }
+ else
+ {
+ PIXEL22_2
+ }
+ break;
+ }
+ case 94:
+ {
+ if (Diff(YUV1, YUV2, RGBtoYUV, trY, trU, trV, Ymask, Umask, Vmask, w[4], w[2]))
+ {
+ PIXEL00_1M
+ }
+ else
+ {
+ PIXEL00_2
+ }
+ if (Diff(YUV1, YUV2, RGBtoYUV, trY, trU, trV, Ymask, Umask, Vmask, w[2], w[6]))
+ {
+ PIXEL01_C
+ PIXEL02_C
+ PIXEL12_C
+ }
+ else
+ {
+ PIXEL01_3
+ PIXEL02_4
+ PIXEL12_3
+ }
+ PIXEL10_C
+ PIXEL11
+ if (Diff(YUV1, YUV2, RGBtoYUV, trY, trU, trV, Ymask, Umask, Vmask, w[8], w[4]))
+ {
+ PIXEL20_1M
+ }
+ else
+ {
+ PIXEL20_2
+ }
+ PIXEL21_C
+ if (Diff(YUV1, YUV2, RGBtoYUV, trY, trU, trV, Ymask, Umask, Vmask, w[6], w[8]))
+ {
+ PIXEL22_1M
+ }
+ else
+ {
+ PIXEL22_2
+ }
+ break;
+ }
+ case 218:
+ {
+ if (Diff(YUV1, YUV2, RGBtoYUV, trY, trU, trV, Ymask, Umask, Vmask, w[4], w[2]))
+ {
+ PIXEL00_1M
+ }
+ else
+ {
+ PIXEL00_2
+ }
+ PIXEL01_C
+ if (Diff(YUV1, YUV2, RGBtoYUV, trY, trU, trV, Ymask, Umask, Vmask, w[2], w[6]))
+ {
+ PIXEL02_1M
+ }
+ else
+ {
+ PIXEL02_2
+ }
+ PIXEL10_C
+ PIXEL11
+ if (Diff(YUV1, YUV2, RGBtoYUV, trY, trU, trV, Ymask, Umask, Vmask, w[8], w[4]))
+ {
+ PIXEL20_1M
+ }
+ else
+ {
+ PIXEL20_2
+ }
+ if (Diff(YUV1, YUV2, RGBtoYUV, trY, trU, trV, Ymask, Umask, Vmask, w[6], w[8]))
+ {
+ PIXEL12_C
+ PIXEL21_C
+ PIXEL22_C
+ }
+ else
+ {
+ PIXEL12_3
+ PIXEL21_3
+ PIXEL22_4
+ }
+ break;
+ }
+ case 91:
+ {
+ if (Diff(YUV1, YUV2, RGBtoYUV, trY, trU, trV, Ymask, Umask, Vmask, w[4], w[2]))
+ {
+ PIXEL00_C
+ PIXEL01_C
+ PIXEL10_C
+ }
+ else
+ {
+ PIXEL00_4
+ PIXEL01_3
+ PIXEL10_3
+ }
+ if (Diff(YUV1, YUV2, RGBtoYUV, trY, trU, trV, Ymask, Umask, Vmask, w[2], w[6]))
+ {
+ PIXEL02_1M
+ }
+ else
+ {
+ PIXEL02_2
+ }
+ PIXEL11
+ PIXEL12_C
+ if (Diff(YUV1, YUV2, RGBtoYUV, trY, trU, trV, Ymask, Umask, Vmask, w[8], w[4]))
+ {
+ PIXEL20_1M
+ }
+ else
+ {
+ PIXEL20_2
+ }
+ PIXEL21_C
+ if (Diff(YUV1, YUV2, RGBtoYUV, trY, trU, trV, Ymask, Umask, Vmask, w[6], w[8]))
+ {
+ PIXEL22_1M
+ }
+ else
+ {
+ PIXEL22_2
+ }
+ break;
+ }
+ case 229:
+ {
+ PIXEL00_2
+ PIXEL01_1
+ PIXEL02_2
+ PIXEL10_1
+ PIXEL11
+ PIXEL12_1
+ PIXEL20_1L
+ PIXEL21_C
+ PIXEL22_1R
+ break;
+ }
+ case 167:
+ {
+ PIXEL00_1L
+ PIXEL01_C
+ PIXEL02_1R
+ PIXEL10_1
+ PIXEL11
+ PIXEL12_1
+ PIXEL20_2
+ PIXEL21_1
+ PIXEL22_2
+ break;
+ }
+ case 173:
+ {
+ PIXEL00_1U
+ PIXEL01_1
+ PIXEL02_2
+ PIXEL10_C
+ PIXEL11
+ PIXEL12_1
+ PIXEL20_1D
+ PIXEL21_1
+ PIXEL22_2
+ break;
+ }
+ case 181:
+ {
+ PIXEL00_2
+ PIXEL01_1
+ PIXEL02_1U
+ PIXEL10_1
+ PIXEL11
+ PIXEL12_C
+ PIXEL20_2
+ PIXEL21_1
+ PIXEL22_1D
+ break;
+ }
+ case 186:
+ {
+ if (Diff(YUV1, YUV2, RGBtoYUV, trY, trU, trV, Ymask, Umask, Vmask, w[4], w[2]))
+ {
+ PIXEL00_1M
+ }
+ else
+ {
+ PIXEL00_2
+ }
+ PIXEL01_C
+ if (Diff(YUV1, YUV2, RGBtoYUV, trY, trU, trV, Ymask, Umask, Vmask, w[2], w[6]))
+ {
+ PIXEL02_1M
+ }
+ else
+ {
+ PIXEL02_2
+ }
+ PIXEL10_C
+ PIXEL11
+ PIXEL12_C
+ PIXEL20_1D
+ PIXEL21_1
+ PIXEL22_1D
+ break;
+ }
+ case 115:
+ {
+ PIXEL00_1L
+ PIXEL01_C
+ if (Diff(YUV1, YUV2, RGBtoYUV, trY, trU, trV, Ymask, Umask, Vmask, w[2], w[6]))
+ {
+ PIXEL02_1M
+ }
+ else
+ {
+ PIXEL02_2
+ }
+ PIXEL10_1
+ PIXEL11
+ PIXEL12_C
+ PIXEL20_1L
+ PIXEL21_C
+ if (Diff(YUV1, YUV2, RGBtoYUV, trY, trU, trV, Ymask, Umask, Vmask, w[6], w[8]))
+ {
+ PIXEL22_1M
+ }
+ else
+ {
+ PIXEL22_2
+ }
+ break;
+ }
+ case 93:
+ {
+ PIXEL00_1U
+ PIXEL01_1
+ PIXEL02_1U
+ PIXEL10_C
+ PIXEL11
+ PIXEL12_C
+ if (Diff(YUV1, YUV2, RGBtoYUV, trY, trU, trV, Ymask, Umask, Vmask, w[8], w[4]))
+ {
+ PIXEL20_1M
+ }
+ else
+ {
+ PIXEL20_2
+ }
+ PIXEL21_C
+ if (Diff(YUV1, YUV2, RGBtoYUV, trY, trU, trV, Ymask, Umask, Vmask, w[6], w[8]))
+ {
+ PIXEL22_1M
+ }
+ else
+ {
+ PIXEL22_2
+ }
+ break;
+ }
+ case 206:
+ {
+ if (Diff(YUV1, YUV2, RGBtoYUV, trY, trU, trV, Ymask, Umask, Vmask, w[4], w[2]))
+ {
+ PIXEL00_1M
+ }
+ else
+ {
+ PIXEL00_2
+ }
+ PIXEL01_C
+ PIXEL02_1R
+ PIXEL10_C
+ PIXEL11
+ PIXEL12_1
+ if (Diff(YUV1, YUV2, RGBtoYUV, trY, trU, trV, Ymask, Umask, Vmask, w[8], w[4]))
+ {
+ PIXEL20_1M
+ }
+ else
+ {
+ PIXEL20_2
+ }
+ PIXEL21_C
+ PIXEL22_1R
+ break;
+ }
+ case 205:
+ case 201:
+ {
+ PIXEL00_1U
+ PIXEL01_1
+ PIXEL02_2
+ PIXEL10_C
+ PIXEL11
+ PIXEL12_1
+ if (Diff(YUV1, YUV2, RGBtoYUV, trY, trU, trV, Ymask, Umask, Vmask, w[8], w[4]))
+ {
+ PIXEL20_1M
+ }
+ else
+ {
+ PIXEL20_2
+ }
+ PIXEL21_C
+ PIXEL22_1R
+ break;
+ }
+ case 174:
+ case 46:
+ {
+ if (Diff(YUV1, YUV2, RGBtoYUV, trY, trU, trV, Ymask, Umask, Vmask, w[4], w[2]))
+ {
+ PIXEL00_1M
+ }
+ else
+ {
+ PIXEL00_2
+ }
+ PIXEL01_C
+ PIXEL02_1R
+ PIXEL10_C
+ PIXEL11
+ PIXEL12_1
+ PIXEL20_1D
+ PIXEL21_1
+ PIXEL22_2
+ break;
+ }
+ case 179:
+ case 147:
+ {
+ PIXEL00_1L
+ PIXEL01_C
+ if (Diff(YUV1, YUV2, RGBtoYUV, trY, trU, trV, Ymask, Umask, Vmask, w[2], w[6]))
+ {
+ PIXEL02_1M
+ }
+ else
+ {
+ PIXEL02_2
+ }
+ PIXEL10_1
+ PIXEL11
+ PIXEL12_C
+ PIXEL20_2
+ PIXEL21_1
+ PIXEL22_1D
+ break;
+ }
+ case 117:
+ case 116:
+ {
+ PIXEL00_2
+ PIXEL01_1
+ PIXEL02_1U
+ PIXEL10_1
+ PIXEL11
+ PIXEL12_C
+ PIXEL20_1L
+ PIXEL21_C
+ if (Diff(YUV1, YUV2, RGBtoYUV, trY, trU, trV, Ymask, Umask, Vmask, w[6], w[8]))
+ {
+ PIXEL22_1M
+ }
+ else
+ {
+ PIXEL22_2
+ }
+ break;
+ }
+ case 189:
+ {
+ PIXEL00_1U
+ PIXEL01_1
+ PIXEL02_1U
+ PIXEL10_C
+ PIXEL11
+ PIXEL12_C
+ PIXEL20_1D
+ PIXEL21_1
+ PIXEL22_1D
+ break;
+ }
+ case 231:
+ {
+ PIXEL00_1L
+ PIXEL01_C
+ PIXEL02_1R
+ PIXEL10_1
+ PIXEL11
+ PIXEL12_1
+ PIXEL20_1L
+ PIXEL21_C
+ PIXEL22_1R
+ break;
+ }
+ case 126:
+ {
+ PIXEL00_1M
+ if (Diff(YUV1, YUV2, RGBtoYUV, trY, trU, trV, Ymask, Umask, Vmask, w[2], w[6]))
+ {
+ PIXEL01_C
+ PIXEL02_C
+ PIXEL12_C
+ }
+ else
+ {
+ PIXEL01_3
+ PIXEL02_4
+ PIXEL12_3
+ }
+ PIXEL11
+ if (Diff(YUV1, YUV2, RGBtoYUV, trY, trU, trV, Ymask, Umask, Vmask, w[8], w[4]))
+ {
+ PIXEL10_C
+ PIXEL20_C
+ PIXEL21_C
+ }
+ else
+ {
+ PIXEL10_3
+ PIXEL20_4
+ PIXEL21_3
+ }
+ PIXEL22_1M
+ break;
+ }
+ case 219:
+ {
+ if (Diff(YUV1, YUV2, RGBtoYUV, trY, trU, trV, Ymask, Umask, Vmask, w[4], w[2]))
+ {
+ PIXEL00_C
+ PIXEL01_C
+ PIXEL10_C
+ }
+ else
+ {
+ PIXEL00_4
+ PIXEL01_3
+ PIXEL10_3
+ }
+ PIXEL02_1M
+ PIXEL11
+ PIXEL20_1M
+ if (Diff(YUV1, YUV2, RGBtoYUV, trY, trU, trV, Ymask, Umask, Vmask, w[6], w[8]))
+ {
+ PIXEL12_C
+ PIXEL21_C
+ PIXEL22_C
+ }
+ else
+ {
+ PIXEL12_3
+ PIXEL21_3
+ PIXEL22_4
+ }
+ break;
+ }
+ case 125:
+ {
+ if (Diff(YUV1, YUV2, RGBtoYUV, trY, trU, trV, Ymask, Umask, Vmask, w[8], w[4]))
+ {
+ PIXEL00_1U
+ PIXEL10_C
+ PIXEL20_C
+ PIXEL21_C
+ }
+ else
+ {
+ PIXEL00_2
+ PIXEL10_6
+ PIXEL20_5
+ PIXEL21_1
+ }
+ PIXEL01_1
+ PIXEL02_1U
+ PIXEL11
+ PIXEL12_C
+ PIXEL22_1M
+ break;
+ }
+ case 221:
+ {
+ if (Diff(YUV1, YUV2, RGBtoYUV, trY, trU, trV, Ymask, Umask, Vmask, w[6], w[8]))
+ {
+ PIXEL02_1U
+ PIXEL12_C
+ PIXEL21_C
+ PIXEL22_C
+ }
+ else
+ {
+ PIXEL02_2
+ PIXEL12_6
+ PIXEL21_1
+ PIXEL22_5
+ }
+ PIXEL00_1U
+ PIXEL01_1
+ PIXEL10_C
+ PIXEL11
+ PIXEL20_1M
+ break;
+ }
+ case 207:
+ {
+ if (Diff(YUV1, YUV2, RGBtoYUV, trY, trU, trV, Ymask, Umask, Vmask, w[4], w[2]))
+ {
+ PIXEL00_C
+ PIXEL01_C
+ PIXEL02_1R
+ PIXEL10_C
+ }
+ else
+ {
+ PIXEL00_5
+ PIXEL01_6
+ PIXEL02_2
+ PIXEL10_1
+ }
+ PIXEL11
+ PIXEL12_1
+ PIXEL20_1M
+ PIXEL21_C
+ PIXEL22_1R
+ break;
+ }
+ case 238:
+ {
+ if (Diff(YUV1, YUV2, RGBtoYUV, trY, trU, trV, Ymask, Umask, Vmask, w[8], w[4]))
+ {
+ PIXEL10_C
+ PIXEL20_C
+ PIXEL21_C
+ PIXEL22_1R
+ }
+ else
+ {
+ PIXEL10_1
+ PIXEL20_5
+ PIXEL21_6
+ PIXEL22_2
+ }
+ PIXEL00_1M
+ PIXEL01_C
+ PIXEL02_1R
+ PIXEL11
+ PIXEL12_1
+ break;
+ }
+ case 190:
+ {
+ if (Diff(YUV1, YUV2, RGBtoYUV, trY, trU, trV, Ymask, Umask, Vmask, w[2], w[6]))
+ {
+ PIXEL01_C
+ PIXEL02_C
+ PIXEL12_C
+ PIXEL22_1D
+ }
+ else
+ {
+ PIXEL01_1
+ PIXEL02_5
+ PIXEL12_6
+ PIXEL22_2
+ }
+ PIXEL00_1M
+ PIXEL10_C
+ PIXEL11
+ PIXEL20_1D
+ PIXEL21_1
+ break;
+ }
+ case 187:
+ {
+ if (Diff(YUV1, YUV2, RGBtoYUV, trY, trU, trV, Ymask, Umask, Vmask, w[4], w[2]))
+ {
+ PIXEL00_C
+ PIXEL01_C
+ PIXEL10_C
+ PIXEL20_1D
+ }
+ else
+ {
+ PIXEL00_5
+ PIXEL01_1
+ PIXEL10_6
+ PIXEL20_2
+ }
+ PIXEL02_1M
+ PIXEL11
+ PIXEL12_C
+ PIXEL21_1
+ PIXEL22_1D
+ break;
+ }
+ case 243:
+ {
+ if (Diff(YUV1, YUV2, RGBtoYUV, trY, trU, trV, Ymask, Umask, Vmask, w[6], w[8]))
+ {
+ PIXEL12_C
+ PIXEL20_1L
+ PIXEL21_C
+ PIXEL22_C
+ }
+ else
+ {
+ PIXEL12_1
+ PIXEL20_2
+ PIXEL21_6
+ PIXEL22_5
+ }
+ PIXEL00_1L
+ PIXEL01_C
+ PIXEL02_1M
+ PIXEL10_1
+ PIXEL11
+ break;
+ }
+ case 119:
+ {
+ if (Diff(YUV1, YUV2, RGBtoYUV, trY, trU, trV, Ymask, Umask, Vmask, w[2], w[6]))
+ {
+ PIXEL00_1L
+ PIXEL01_C
+ PIXEL02_C
+ PIXEL12_C
+ }
+ else
+ {
+ PIXEL00_2
+ PIXEL01_6
+ PIXEL02_5
+ PIXEL12_1
+ }
+ PIXEL10_1
+ PIXEL11
+ PIXEL20_1L
+ PIXEL21_C
+ PIXEL22_1M
+ break;
+ }
+ case 237:
+ case 233:
+ {
+ PIXEL00_1U
+ PIXEL01_1
+ PIXEL02_2
+ PIXEL10_C
+ PIXEL11
+ PIXEL12_1
+ if (Diff(YUV1, YUV2, RGBtoYUV, trY, trU, trV, Ymask, Umask, Vmask, w[8], w[4]))
+ {
+ PIXEL20_C
+ }
+ else
+ {
+ PIXEL20_2
+ }
+ PIXEL21_C
+ PIXEL22_1R
+ break;
+ }
+ case 175:
+ case 47:
+ {
+ if (Diff(YUV1, YUV2, RGBtoYUV, trY, trU, trV, Ymask, Umask, Vmask, w[4], w[2]))
+ {
+ PIXEL00_C
+ }
+ else
+ {
+ PIXEL00_2
+ }
+ PIXEL01_C
+ PIXEL02_1R
+ PIXEL10_C
+ PIXEL11
+ PIXEL12_1
+ PIXEL20_1D
+ PIXEL21_1
+ PIXEL22_2
+ break;
+ }
+ case 183:
+ case 151:
+ {
+ PIXEL00_1L
+ PIXEL01_C
+ if (Diff(YUV1, YUV2, RGBtoYUV, trY, trU, trV, Ymask, Umask, Vmask, w[2], w[6]))
+ {
+ PIXEL02_C
+ }
+ else
+ {
+ PIXEL02_2
+ }
+ PIXEL10_1
+ PIXEL11
+ PIXEL12_C
+ PIXEL20_2
+ PIXEL21_1
+ PIXEL22_1D
+ break;
+ }
+ case 245:
+ case 244:
+ {
+ PIXEL00_2
+ PIXEL01_1
+ PIXEL02_1U
+ PIXEL10_1
+ PIXEL11
+ PIXEL12_C
+ PIXEL20_1L
+ PIXEL21_C
+ if (Diff(YUV1, YUV2, RGBtoYUV, trY, trU, trV, Ymask, Umask, Vmask, w[6], w[8]))
+ {
+ PIXEL22_C
+ }
+ else
+ {
+ PIXEL22_2
+ }
+ break;
+ }
+ case 250:
+ {
+ PIXEL00_1M
+ PIXEL01_C
+ PIXEL02_1M
+ PIXEL11
+ if (Diff(YUV1, YUV2, RGBtoYUV, trY, trU, trV, Ymask, Umask, Vmask, w[8], w[4]))
+ {
+ PIXEL10_C
+ PIXEL20_C
+ }
+ else
+ {
+ PIXEL10_3
+ PIXEL20_4
+ }
+ PIXEL21_C
+ if (Diff(YUV1, YUV2, RGBtoYUV, trY, trU, trV, Ymask, Umask, Vmask, w[6], w[8]))
+ {
+ PIXEL12_C
+ PIXEL22_C
+ }
+ else
+ {
+ PIXEL12_3
+ PIXEL22_4
+ }
+ break;
+ }
+ case 123:
+ {
+ if (Diff(YUV1, YUV2, RGBtoYUV, trY, trU, trV, Ymask, Umask, Vmask, w[4], w[2]))
+ {
+ PIXEL00_C
+ PIXEL01_C
+ }
+ else
+ {
+ PIXEL00_4
+ PIXEL01_3
+ }
+ PIXEL02_1M
+ PIXEL10_C
+ PIXEL11
+ PIXEL12_C
+ if (Diff(YUV1, YUV2, RGBtoYUV, trY, trU, trV, Ymask, Umask, Vmask, w[8], w[4]))
+ {
+ PIXEL20_C
+ PIXEL21_C
+ }
+ else
+ {
+ PIXEL20_4
+ PIXEL21_3
+ }
+ PIXEL22_1M
+ break;
+ }
+ case 95:
+ {
+ if (Diff(YUV1, YUV2, RGBtoYUV, trY, trU, trV, Ymask, Umask, Vmask, w[4], w[2]))
+ {
+ PIXEL00_C
+ PIXEL10_C
+ }
+ else
+ {
+ PIXEL00_4
+ PIXEL10_3
+ }
+ PIXEL01_C
+ if (Diff(YUV1, YUV2, RGBtoYUV, trY, trU, trV, Ymask, Umask, Vmask, w[2], w[6]))
+ {
+ PIXEL02_C
+ PIXEL12_C
+ }
+ else
+ {
+ PIXEL02_4
+ PIXEL12_3
+ }
+ PIXEL11
+ PIXEL20_1M
+ PIXEL21_C
+ PIXEL22_1M
+ break;
+ }
+ case 222:
+ {
+ PIXEL00_1M
+ if (Diff(YUV1, YUV2, RGBtoYUV, trY, trU, trV, Ymask, Umask, Vmask, w[2], w[6]))
+ {
+ PIXEL01_C
+ PIXEL02_C
+ }
+ else
+ {
+ PIXEL01_3
+ PIXEL02_4
+ }
+ PIXEL10_C
+ PIXEL11
+ PIXEL12_C
+ PIXEL20_1M
+ if (Diff(YUV1, YUV2, RGBtoYUV, trY, trU, trV, Ymask, Umask, Vmask, w[6], w[8]))
+ {
+ PIXEL21_C
+ PIXEL22_C
+ }
+ else
+ {
+ PIXEL21_3
+ PIXEL22_4
+ }
+ break;
+ }
+ case 252:
+ {
+ PIXEL00_1M
+ PIXEL01_1
+ PIXEL02_1U
+ PIXEL11
+ PIXEL12_C
+ if (Diff(YUV1, YUV2, RGBtoYUV, trY, trU, trV, Ymask, Umask, Vmask, w[8], w[4]))
+ {
+ PIXEL10_C
+ PIXEL20_C
+ }
+ else
+ {
+ PIXEL10_3
+ PIXEL20_4
+ }
+ PIXEL21_C
+ if (Diff(YUV1, YUV2, RGBtoYUV, trY, trU, trV, Ymask, Umask, Vmask, w[6], w[8]))
+ {
+ PIXEL22_C
+ }
+ else
+ {
+ PIXEL22_2
+ }
+ break;
+ }
+ case 249:
+ {
+ PIXEL00_1U
+ PIXEL01_1
+ PIXEL02_1M
+ PIXEL10_C
+ PIXEL11
+ if (Diff(YUV1, YUV2, RGBtoYUV, trY, trU, trV, Ymask, Umask, Vmask, w[8], w[4]))
+ {
+ PIXEL20_C
+ }
+ else
+ {
+ PIXEL20_2
+ }
+ PIXEL21_C
+ if (Diff(YUV1, YUV2, RGBtoYUV, trY, trU, trV, Ymask, Umask, Vmask, w[6], w[8]))
+ {
+ PIXEL12_C
+ PIXEL22_C
+ }
+ else
+ {
+ PIXEL12_3
+ PIXEL22_4
+ }
+ break;
+ }
+ case 235:
+ {
+ if (Diff(YUV1, YUV2, RGBtoYUV, trY, trU, trV, Ymask, Umask, Vmask, w[4], w[2]))
+ {
+ PIXEL00_C
+ PIXEL01_C
+ }
+ else
+ {
+ PIXEL00_4
+ PIXEL01_3
+ }
+ PIXEL02_1M
+ PIXEL10_C
+ PIXEL11
+ PIXEL12_1
+ if (Diff(YUV1, YUV2, RGBtoYUV, trY, trU, trV, Ymask, Umask, Vmask, w[8], w[4]))
+ {
+ PIXEL20_C
+ }
+ else
+ {
+ PIXEL20_2
+ }
+ PIXEL21_C
+ PIXEL22_1R
+ break;
+ }
+ case 111:
+ {
+ if (Diff(YUV1, YUV2, RGBtoYUV, trY, trU, trV, Ymask, Umask, Vmask, w[4], w[2]))
+ {
+ PIXEL00_C
+ }
+ else
+ {
+ PIXEL00_2
+ }
+ PIXEL01_C
+ PIXEL02_1R
+ PIXEL10_C
+ PIXEL11
+ PIXEL12_1
+ if (Diff(YUV1, YUV2, RGBtoYUV, trY, trU, trV, Ymask, Umask, Vmask, w[8], w[4]))
+ {
+ PIXEL20_C
+ PIXEL21_C
+ }
+ else
+ {
+ PIXEL20_4
+ PIXEL21_3
+ }
+ PIXEL22_1M
+ break;
+ }
+ case 63:
+ {
+ if (Diff(YUV1, YUV2, RGBtoYUV, trY, trU, trV, Ymask, Umask, Vmask, w[4], w[2]))
+ {
+ PIXEL00_C
+ }
+ else
+ {
+ PIXEL00_2
+ }
+ PIXEL01_C
+ if (Diff(YUV1, YUV2, RGBtoYUV, trY, trU, trV, Ymask, Umask, Vmask, w[2], w[6]))
+ {
+ PIXEL02_C
+ PIXEL12_C
+ }
+ else
+ {
+ PIXEL02_4
+ PIXEL12_3
+ }
+ PIXEL10_C
+ PIXEL11
+ PIXEL20_1D
+ PIXEL21_1
+ PIXEL22_1M
+ break;
+ }
+ case 159:
+ {
+ if (Diff(YUV1, YUV2, RGBtoYUV, trY, trU, trV, Ymask, Umask, Vmask, w[4], w[2]))
+ {
+ PIXEL00_C
+ PIXEL10_C
+ }
+ else
+ {
+ PIXEL00_4
+ PIXEL10_3
+ }
+ PIXEL01_C
+ if (Diff(YUV1, YUV2, RGBtoYUV, trY, trU, trV, Ymask, Umask, Vmask, w[2], w[6]))
+ {
+ PIXEL02_C
+ }
+ else
+ {
+ PIXEL02_2
+ }
+ PIXEL11
+ PIXEL12_C
+ PIXEL20_1M
+ PIXEL21_1
+ PIXEL22_1D
+ break;
+ }
+ case 215:
+ {
+ PIXEL00_1L
+ PIXEL01_C
+ if (Diff(YUV1, YUV2, RGBtoYUV, trY, trU, trV, Ymask, Umask, Vmask, w[2], w[6]))
+ {
+ PIXEL02_C
+ }
+ else
+ {
+ PIXEL02_2
+ }
+ PIXEL10_1
+ PIXEL11
+ PIXEL12_C
+ PIXEL20_1M
+ if (Diff(YUV1, YUV2, RGBtoYUV, trY, trU, trV, Ymask, Umask, Vmask, w[6], w[8]))
+ {
+ PIXEL21_C
+ PIXEL22_C
+ }
+ else
+ {
+ PIXEL21_3
+ PIXEL22_4
+ }
+ break;
+ }
+ case 246:
+ {
+ PIXEL00_1M
+ if (Diff(YUV1, YUV2, RGBtoYUV, trY, trU, trV, Ymask, Umask, Vmask, w[2], w[6]))
+ {
+ PIXEL01_C
+ PIXEL02_C
+ }
+ else
+ {
+ PIXEL01_3
+ PIXEL02_4
+ }
+ PIXEL10_1
+ PIXEL11
+ PIXEL12_C
+ PIXEL20_1L
+ PIXEL21_C
+ if (Diff(YUV1, YUV2, RGBtoYUV, trY, trU, trV, Ymask, Umask, Vmask, w[6], w[8]))
+ {
+ PIXEL22_C
+ }
+ else
+ {
+ PIXEL22_2
+ }
+ break;
+ }
+ case 254:
+ {
+ PIXEL00_1M
+ if (Diff(YUV1, YUV2, RGBtoYUV, trY, trU, trV, Ymask, Umask, Vmask, w[2], w[6]))
+ {
+ PIXEL01_C
+ PIXEL02_C
+ }
+ else
+ {
+ PIXEL01_3
+ PIXEL02_4
+ }
+ PIXEL11
+ if (Diff(YUV1, YUV2, RGBtoYUV, trY, trU, trV, Ymask, Umask, Vmask, w[8], w[4]))
+ {
+ PIXEL10_C
+ PIXEL20_C
+ }
+ else
+ {
+ PIXEL10_3
+ PIXEL20_4
+ }
+ if (Diff(YUV1, YUV2, RGBtoYUV, trY, trU, trV, Ymask, Umask, Vmask, w[6], w[8]))
+ {
+ PIXEL12_C
+ PIXEL21_C
+ PIXEL22_C
+ }
+ else
+ {
+ PIXEL12_3
+ PIXEL21_3
+ PIXEL22_2
+ }
+ break;
+ }
+ case 253:
+ {
+ PIXEL00_1U
+ PIXEL01_1
+ PIXEL02_1U
+ PIXEL10_C
+ PIXEL11
+ PIXEL12_C
+ if (Diff(YUV1, YUV2, RGBtoYUV, trY, trU, trV, Ymask, Umask, Vmask, w[8], w[4]))
+ {
+ PIXEL20_C
+ }
+ else
+ {
+ PIXEL20_2
+ }
+ PIXEL21_C
+ if (Diff(YUV1, YUV2, RGBtoYUV, trY, trU, trV, Ymask, Umask, Vmask, w[6], w[8]))
+ {
+ PIXEL22_C
+ }
+ else
+ {
+ PIXEL22_2
+ }
+ break;
+ }
+ case 251:
+ {
+ if (Diff(YUV1, YUV2, RGBtoYUV, trY, trU, trV, Ymask, Umask, Vmask, w[4], w[2]))
+ {
+ PIXEL00_C
+ PIXEL01_C
+ }
+ else
+ {
+ PIXEL00_4
+ PIXEL01_3
+ }
+ PIXEL02_1M
+ PIXEL11
+ if (Diff(YUV1, YUV2, RGBtoYUV, trY, trU, trV, Ymask, Umask, Vmask, w[8], w[4]))
+ {
+ PIXEL10_C
+ PIXEL20_C
+ PIXEL21_C
+ }
+ else
+ {
+ PIXEL10_3
+ PIXEL20_2
+ PIXEL21_3
+ }
+ if (Diff(YUV1, YUV2, RGBtoYUV, trY, trU, trV, Ymask, Umask, Vmask, w[6], w[8]))
+ {
+ PIXEL12_C
+ PIXEL22_C
+ }
+ else
+ {
+ PIXEL12_3
+ PIXEL22_4
+ }
+ break;
+ }
+ case 239:
+ {
+ if (Diff(YUV1, YUV2, RGBtoYUV, trY, trU, trV, Ymask, Umask, Vmask, w[4], w[2]))
+ {
+ PIXEL00_C
+ }
+ else
+ {
+ PIXEL00_2
+ }
+ PIXEL01_C
+ PIXEL02_1R
+ PIXEL10_C
+ PIXEL11
+ PIXEL12_1
+ if (Diff(YUV1, YUV2, RGBtoYUV, trY, trU, trV, Ymask, Umask, Vmask, w[8], w[4]))
+ {
+ PIXEL20_C
+ }
+ else
+ {
+ PIXEL20_2
+ }
+ PIXEL21_C
+ PIXEL22_1R
+ break;
+ }
+ case 127:
+ {
+ if (Diff(YUV1, YUV2, RGBtoYUV, trY, trU, trV, Ymask, Umask, Vmask, w[4], w[2]))
+ {
+ PIXEL00_C
+ PIXEL01_C
+ PIXEL10_C
+ }
+ else
+ {
+ PIXEL00_2
+ PIXEL01_3
+ PIXEL10_3
+ }
+ if (Diff(YUV1, YUV2, RGBtoYUV, trY, trU, trV, Ymask, Umask, Vmask, w[2], w[6]))
+ {
+ PIXEL02_C
+ PIXEL12_C
+ }
+ else
+ {
+ PIXEL02_4
+ PIXEL12_3
+ }
+ PIXEL11
+ if (Diff(YUV1, YUV2, RGBtoYUV, trY, trU, trV, Ymask, Umask, Vmask, w[8], w[4]))
+ {
+ PIXEL20_C
+ PIXEL21_C
+ }
+ else
+ {
+ PIXEL20_4
+ PIXEL21_3
+ }
+ PIXEL22_1M
+ break;
+ }
+ case 191:
+ {
+ if (Diff(YUV1, YUV2, RGBtoYUV, trY, trU, trV, Ymask, Umask, Vmask, w[4], w[2]))
+ {
+ PIXEL00_C
+ }
+ else
+ {
+ PIXEL00_2
+ }
+ PIXEL01_C
+ if (Diff(YUV1, YUV2, RGBtoYUV, trY, trU, trV, Ymask, Umask, Vmask, w[2], w[6]))
+ {
+ PIXEL02_C
+ }
+ else
+ {
+ PIXEL02_2
+ }
+ PIXEL10_C
+ PIXEL11
+ PIXEL12_C
+ PIXEL20_1D
+ PIXEL21_1
+ PIXEL22_1D
+ break;
+ }
+ case 223:
+ {
+ if (Diff(YUV1, YUV2, RGBtoYUV, trY, trU, trV, Ymask, Umask, Vmask, w[4], w[2]))
+ {
+ PIXEL00_C
+ PIXEL10_C
+ }
+ else
+ {
+ PIXEL00_4
+ PIXEL10_3
+ }
+ if (Diff(YUV1, YUV2, RGBtoYUV, trY, trU, trV, Ymask, Umask, Vmask, w[2], w[6]))
+ {
+ PIXEL01_C
+ PIXEL02_C
+ PIXEL12_C
+ }
+ else
+ {
+ PIXEL01_3
+ PIXEL02_2
+ PIXEL12_3
+ }
+ PIXEL11
+ PIXEL20_1M
+ if (Diff(YUV1, YUV2, RGBtoYUV, trY, trU, trV, Ymask, Umask, Vmask, w[6], w[8]))
+ {
+ PIXEL21_C
+ PIXEL22_C
+ }
+ else
+ {
+ PIXEL21_3
+ PIXEL22_4
+ }
+ break;
+ }
+ case 247:
+ {
+ PIXEL00_1L
+ PIXEL01_C
+ if (Diff(YUV1, YUV2, RGBtoYUV, trY, trU, trV, Ymask, Umask, Vmask, w[2], w[6]))
+ {
+ PIXEL02_C
+ }
+ else
+ {
+ PIXEL02_2
+ }
+ PIXEL10_1
+ PIXEL11
+ PIXEL12_C
+ PIXEL20_1L
+ PIXEL21_C
+ if (Diff(YUV1, YUV2, RGBtoYUV, trY, trU, trV, Ymask, Umask, Vmask, w[6], w[8]))
+ {
+ PIXEL22_C
+ }
+ else
+ {
+ PIXEL22_2
+ }
+ break;
+ }
+ case 255:
+ {
+ if (Diff(YUV1, YUV2, RGBtoYUV, trY, trU, trV, Ymask, Umask, Vmask, w[4], w[2]))
+ {
+ PIXEL00_C
+ }
+ else
+ {
+ PIXEL00_2
+ }
+ PIXEL01_C
+ if (Diff(YUV1, YUV2, RGBtoYUV, trY, trU, trV, Ymask, Umask, Vmask, w[2], w[6]))
+ {
+ PIXEL02_C
+ }
+ else
+ {
+ PIXEL02_2
+ }
+ PIXEL10_C
+ PIXEL11
+ PIXEL12_C
+ if (Diff(YUV1, YUV2, RGBtoYUV, trY, trU, trV, Ymask, Umask, Vmask, w[8], w[4]))
+ {
+ PIXEL20_C
+ }
+ else
+ {
+ PIXEL20_2
+ }
+ PIXEL21_C
+ if (Diff(YUV1, YUV2, RGBtoYUV, trY, trU, trV, Ymask, Umask, Vmask, w[6], w[8]))
+ {
+ PIXEL22_C
+ }
+ else
+ {
+ PIXEL22_2
+ }
+ break;
+ }
+ }
+ }
+ }
+
+ trace::exiting("upsampling::impl::hq3x_");
+ return output;
+ }
+
+ } // end of namespace mln::upsampling::impl
+
+
+ template <typename I>
+ inline
+ mln_concrete(I)
+ hq3x(const Image<I>& input)
+ {
+ trace::entering("upsampling::hq3x");
+ mln_precondition(exact(input).is_valid());
+
+ mln_concrete(I) output;
+
+ output = impl::hq3x_(exact(input));
+
+ trace::exiting("upsampling::hq3x");
+ return output;
+ }
+
+# endif // ! MLN_INCLUDE_ONLY
+
+ } // end of namespace mln::upsampling
+
+} // end of namespace mln
+
+
+#endif // ! MLN_UPSAMPLING_HQ3X_HH
Index: trunk/milena/sandbox/fabien/mln/core/image/magick_tiled2d.hh
===================================================================
--- trunk/milena/sandbox/fabien/mln/core/image/magick_tiled2d.hh (revision 4420)
+++ trunk/milena/sandbox/fabien/mln/core/image/magick_tiled2d.hh (revision 4421)
@@ -27,7 +27,7 @@
# define MLN_CORE_IMAGE_TILED2D_HH
/// \file
-/// Definition of the basic mln::tiled2d class.
+/// Definition of the basic mln::magick_tiled2d class.
# include <Magick++.h>
@@ -47,17 +47,16 @@
{
// Forward declaration.
- template <typename T> struct tiled2d;
+ template <typename T> struct magick_tiled2d;
namespace internal
{
- /// Data structure for \c mln::tiled2d<T>.
+ /// Data structure for \c mln::magick_tiled2d<T>.
template <typename T>
- struct data< tiled2d<T> >
+ struct data< magick_tiled2d<T> >
{
-// data(const box2d& b, unsigned bdr);
data(const std::string& filename);
~data();
@@ -72,7 +71,7 @@
void update_vb_();
void allocate_();
void deallocate_();
- void swap_(data< tiled2d<T> >& other_);
+ void swap_(data< magick_tiled2d<T> >& other_);
void reallocate_(unsigned new_border);
};
@@ -83,7 +82,7 @@
{
template <typename T>
- struct image_< tiled2d<T> > : default_image_< T, tiled2d<T> >
+ struct image_< magick_tiled2d<T> > : default_image_< T, magick_tiled2d<T> >
{
// misc
typedef trait::image::category::primary category;
@@ -123,9 +122,9 @@
/// \ingroup modimageconcrete
//
template <typename T>
- class tiled2d : public internal::image_primary< T, mln::box2d, tiled2d<T> >
+ class magick_tiled2d : public internal::image_primary< T, mln::box2d, magick_tiled2d<T> >
{
- typedef internal::image_primary< T, mln::box2d, tiled2d<T> > super_;
+ typedef internal::image_primary< T, mln::box2d, magick_tiled2d<T> > super_;
public:
/// Value associated type.
@@ -135,30 +134,19 @@
typedef const T& rvalue;
/// Return type of read-write access.
- typedef mln::value::proxy< tiled2d<T> > lvalue;
+ typedef mln::value::proxy< magick_tiled2d<T> > lvalue;
/// Skeleton.
- typedef tiled2d< tag::value_<T> > skeleton;
+ typedef magick_tiled2d< tag::value_<T> > skeleton;
/// Constructor without argument.
- tiled2d();
-
- /// Constructor with the numbers of rows and columns and the
- /// border thickness.
- //tiled2d(int nrows, int ncols, unsigned bdr = border::thickness);
-
- /// Constructor with a box and the border thickness (default is
- /// 3).
- // tiled2d(const box2d& b, unsigned bdr = border::thickness);
+ magick_tiled2d();
/// Constructor with a filename.
- tiled2d(const std::string& filename);
-
+ magick_tiled2d(const std::string& filename);
- /// Initialize an empty image.
- //void init_(const box2d& b, unsigned bdr = border::thickness);
/// Initialize an empty image.
void init_(const std::string& filename);
@@ -177,7 +165,7 @@
const T& operator()(const point2d& p) const;
/// Read-write access to the image value located at point \p p.
- mln::value::proxy< tiled2d<T> > operator()(const point2d& p);
+ mln::value::proxy< magick_tiled2d<T> > operator()(const point2d& p);
// Read access to the image value located at point \p p.
const T& read_(const point2d& p) const;
@@ -252,10 +240,10 @@
// Forward declaration
template <typename T>
- void init_(tag::border_t, unsigned& bdr, const tiled2d<T>& model);
+ void init_(tag::border_t, unsigned& bdr, const magick_tiled2d<T>& model);
template <typename T, typename J>
- void init_(tag::image_t, mln::tiled2d<T>& target, const J& model);
+ void init_(tag::image_t, mln::magick_tiled2d<T>& target, const J& model);
@@ -265,14 +253,14 @@
template <typename T>
inline
- void init_(tag::border_t, unsigned& bdr, const tiled2d<T>& model)
+ void init_(tag::border_t, unsigned& bdr, const magick_tiled2d<T>& model)
{
bdr = model.border();
}
template <typename T, typename J>
inline
- void init_(tag::image_t, tiled2d<T>& target, const J& model)
+ void init_(tag::image_t, magick_tiled2d<T>& target, const J& model)
{
box2d b;
init_(tag::bbox, b, model);
@@ -282,36 +270,22 @@
}
- // internal::data< tiled2d<T> >
+ // internal::data< magick_tiled2d<T> >
namespace internal
{
-/* template <typename T>
- inline
- data< tiled2d<T> >::data(const box2d& b, unsigned bdr)
- : buffer_(0),
- b_ (b),
- bdr_ (bdr)
- {
- allocate_();
- }*/
template <typename T>
inline
- data< tiled2d<T> >::data(const std::string& filename)
+ data< magick_tiled2d<T> >::data(const std::string& filename)
{
buffer_.read(filename);
- // DELETEME
- std::cout << "columns: " << buffer_.columns() << std::endl;
- std::cout << "rows: " << buffer_.rows() << std::endl;
- // ! DELETEME
b_ = make::box2d(buffer_.rows(), buffer_.columns());
- std::cout << "bbox: " << b_ << std::endl; // DELETEME
}
template <typename T>
inline
- data< tiled2d<T> >::~data()
+ data< magick_tiled2d<T> >::~data()
{
deallocate_();
}
@@ -319,7 +293,7 @@
template <typename T>
inline
void
- data< tiled2d<T> >::update_vb_()
+ data< magick_tiled2d<T> >::update_vb_()
{
vb_.pmin() = b_.pmin() - dpoint2d(all_to(bdr_));
vb_.pmax() = b_.pmax() + dpoint2d(all_to(bdr_));
@@ -328,21 +302,9 @@
template <typename T>
inline
void
- data< tiled2d<T> >::allocate_()
+ data< magick_tiled2d<T> >::allocate_()
{
update_vb_();
-// unsigned
-// nr = vb_.len(0),
-// nc = vb_.len(1);
-// buffer_ = new T[nr * nc];
-// array_ = new T*[nr];
-// T* buf = buffer_ - vb_.pmin().col();
-// for (unsigned i = 0; i < nr; ++i)
-// {
-// array_[i] = buf;
-// buf += nc;
-// }
-// array_ -= vb_.pmin().row();
mln_postcondition(vb_.len(0) == b_.len(0) + 2 * bdr_);
mln_postcondition(vb_.len(1) == b_.len(1) + 2 * bdr_);
}
@@ -350,27 +312,16 @@
template <typename T>
inline
void
- data< tiled2d<T> >::deallocate_()
+ data< magick_tiled2d<T> >::deallocate_()
{
-// if (buffer_)
-// {
-// delete[] buffer_;
-// buffer_ = 0;
-// }
-// if (array_)
-// {
-// array_ += vb_.pmin().row();
-// delete[] array_;
-// array_ = 0;
-// }
}
template <typename T>
inline
void
- data< tiled2d<T> >::swap_(data< tiled2d<T> >& other_)
+ data< magick_tiled2d<T> >::swap_(data< magick_tiled2d<T> >& other_)
{
- data< tiled2d<T> > self_ = *this;
+ data< magick_tiled2d<T> > self_ = *this;
*this = other_;
other_ = self_;
}
@@ -378,9 +329,9 @@
template <typename T>
inline
void
- data< tiled2d<T> >::reallocate_(unsigned new_border)
+ data< magick_tiled2d<T> >::reallocate_(unsigned new_border)
{
- data< tiled2d<T> >& tmp = *(new data< tiled2d<T> >(this->b_, new_border));
+ data< magick_tiled2d<T> >& tmp = *(new data< magick_tiled2d<T> >(this->b_, new_border));
this->swap_(tmp);
}
@@ -388,17 +339,17 @@
} // end of namespace mln::internal
- // tiled2d<T>
+ // magick_tiled2d<T>
template <typename T>
inline
- tiled2d<T>::tiled2d()
+ magick_tiled2d<T>::magick_tiled2d()
{
}
template <typename T>
inline
- tiled2d<T>::tiled2d(const std::string& filename)
+ magick_tiled2d<T>::magick_tiled2d(const std::string& filename)
{
init_(filename);
}
@@ -406,16 +357,16 @@
template <typename T>
inline
void
- tiled2d<T>::init_(const std::string& filename)
+ magick_tiled2d<T>::init_(const std::string& filename)
{
mln_precondition(! this->is_valid());
- this->data_ = new internal::data< tiled2d<T> >(filename);
+ this->data_ = new internal::data< magick_tiled2d<T> >(filename);
}
template <typename T>
inline
const box2d&
- tiled2d<T>::domain() const
+ magick_tiled2d<T>::domain() const
{
mln_precondition(this->is_valid());
return this->data_->b_;
@@ -424,7 +375,7 @@
template <typename T>
inline
const box2d&
- tiled2d<T>::bbox() const
+ magick_tiled2d<T>::bbox() const
{
mln_precondition(this->is_valid());
return this->data_->b_;
@@ -433,7 +384,7 @@
template <typename T>
inline
bool
- tiled2d<T>::has(const point2d& p) const
+ magick_tiled2d<T>::has(const point2d& p) const
{
mln_precondition(this->is_valid());
return this->data_->vb_.has(p);
@@ -442,26 +393,26 @@
template <typename T>
inline
const T&
- tiled2d<T>::operator()(const point2d& p) const
+ magick_tiled2d<T>::operator()(const point2d& p) const
{
return read_(p);
}
template <typename T>
inline
- mln::value::proxy< tiled2d<T> >
- tiled2d<T>::operator()(const point2d& p)
+ mln::value::proxy< magick_tiled2d<T> >
+ magick_tiled2d<T>::operator()(const point2d& p)
{
- mln::value::proxy<tiled2d> prx(*this, p);
+ mln::value::proxy<magick_tiled2d> prx(*this, p);
return prx;
}
template <typename T>
inline
const T&
- tiled2d<T>::read_(const point2d& p) const
+ magick_tiled2d<T>::read_(const point2d& p) const
{
- mln::tiled2d<T>* this_ = const_cast<mln::tiled2d<T>* >(this); // Trust me, I have to do this(_).
+ mln::magick_tiled2d<T>* this_ = const_cast<mln::magick_tiled2d<T>* >(this); // Trust me, I have to do this(_).
this_->data_->pixel_cache = this_->data_->buffer_.getPixels(p.col(), p.row(), p.col(), p.row());
this->data_->value_.red() = this->data_->pixel_cache->red % 256;
this->data_->value_.green() = this->data_->pixel_cache->green % 256;
@@ -472,7 +423,7 @@
template <typename T>
inline
void
- tiled2d<T>::write_(const point2d& p, const T& value)
+ magick_tiled2d<T>::write_(const point2d& p, const T& value)
{
std::cout << "setting value " << value << " at point " << p << std::endl; // DELETEME
/*this->data_->pixel_cache = this->data_->buffer_.getPixels(p.col(), p.row(), p.col(), p.row());
@@ -487,7 +438,7 @@
template <typename T>
inline
const T&
- tiled2d<T>::at_(unsigned row, unsigned col) const
+ magick_tiled2d<T>::at_(unsigned row, unsigned col) const
{
mln_precondition(this->has(point2d(row, col)));
//FIXME: use the cache Luke.
@@ -501,7 +452,7 @@
template <typename T>
inline
T&
- tiled2d<T>::at_(unsigned row, unsigned col)
+ magick_tiled2d<T>::at_(unsigned row, unsigned col)
{
mln_precondition(this->has(point2d(row, col)));
//FIXME: use the cache Luke.
@@ -515,7 +466,7 @@
template <typename T>
inline
unsigned
- tiled2d<T>::nrows() const
+ magick_tiled2d<T>::nrows() const
{
mln_precondition(this->is_valid());
return this->data_->b_.len(0);
@@ -524,7 +475,7 @@
template <typename T>
inline
unsigned
- tiled2d<T>::ncols() const
+ magick_tiled2d<T>::ncols() const
{
mln_precondition(this->is_valid());
return this->data_->b_.len(1);
@@ -536,7 +487,7 @@
template <typename T>
inline
const Magick::Image
- tiled2d<T>::buffer() const
+ magick_tiled2d<T>::buffer() const
{
mln_precondition(this->is_valid());
return this->data_->buffer_;
@@ -545,7 +496,7 @@
template <typename T>
inline
Magick::Image
- tiled2d<T>::buffer()
+ magick_tiled2d<T>::buffer()
{
mln_precondition(this->is_valid());
return this->data_->buffer_;
@@ -573,79 +524,79 @@
// pixter
template <typename T>
- struct fwd_pixter< tiled2d<T> >
+ struct fwd_pixter< magick_tiled2d<T> >
{
- typedef fwd_pixter2d< tiled2d<T> > ret;
+ typedef fwd_pixter2d< magick_tiled2d<T> > ret;
};
template <typename T>
- struct fwd_pixter< const tiled2d<T> >
+ struct fwd_pixter< const magick_tiled2d<T> >
{
- typedef fwd_pixter2d< const tiled2d<T> > ret;
+ typedef fwd_pixter2d< const magick_tiled2d<T> > ret;
};
template <typename T>
- struct bkd_pixter< tiled2d<T> >
+ struct bkd_pixter< magick_tiled2d<T> >
{
- typedef bkd_pixter2d< tiled2d<T> > ret;
+ typedef bkd_pixter2d< magick_tiled2d<T> > ret;
};
template <typename T>
- struct bkd_pixter< const tiled2d<T> >
+ struct bkd_pixter< const magick_tiled2d<T> >
{
- typedef bkd_pixter2d< const tiled2d<T> > ret;
+ typedef bkd_pixter2d< const magick_tiled2d<T> > ret;
};
// qixter
template <typename T, typename W>
- struct fwd_qixter< tiled2d<T>, W >
+ struct fwd_qixter< magick_tiled2d<T>, W >
{
- typedef dpoints_fwd_pixter< tiled2d<T> > ret;
+ typedef dpoints_fwd_pixter< magick_tiled2d<T> > ret;
};
template <typename T, typename W>
- struct fwd_qixter< const tiled2d<T>, W >
+ struct fwd_qixter< const magick_tiled2d<T>, W >
{
- typedef dpoints_fwd_pixter< const tiled2d<T> > ret;
+ typedef dpoints_fwd_pixter< const magick_tiled2d<T> > ret;
};
template <typename T, typename W>
- struct bkd_qixter< tiled2d<T>, W >
+ struct bkd_qixter< magick_tiled2d<T>, W >
{
- typedef dpoints_bkd_pixter< tiled2d<T> > ret;
+ typedef dpoints_bkd_pixter< magick_tiled2d<T> > ret;
};
template <typename T, typename W>
- struct bkd_qixter< const tiled2d<T>, W >
+ struct bkd_qixter< const magick_tiled2d<T>, W >
{
- typedef dpoints_bkd_pixter< const tiled2d<T> > ret;
+ typedef dpoints_bkd_pixter< const magick_tiled2d<T> > ret;
};
// nixter
template <typename T, typename N>
- struct fwd_nixter< tiled2d<T>, N >
+ struct fwd_nixter< magick_tiled2d<T>, N >
{
- typedef dpoints_fwd_pixter< tiled2d<T> > ret;
+ typedef dpoints_fwd_pixter< magick_tiled2d<T> > ret;
};
template <typename T, typename N>
- struct fwd_nixter< const tiled2d<T>, N >
+ struct fwd_nixter< const magick_tiled2d<T>, N >
{
- typedef dpoints_fwd_pixter< const tiled2d<T> > ret;
+ typedef dpoints_fwd_pixter< const magick_tiled2d<T> > ret;
};
template <typename T, typename N>
- struct bkd_nixter< tiled2d<T>, N >
+ struct bkd_nixter< magick_tiled2d<T>, N >
{
- typedef dpoints_bkd_pixter< tiled2d<T> > ret;
+ typedef dpoints_bkd_pixter< magick_tiled2d<T> > ret;
};
template <typename T, typename N>
- struct bkd_nixter< const tiled2d<T>, N >
+ struct bkd_nixter< const magick_tiled2d<T>, N >
{
- typedef dpoints_bkd_pixter< const tiled2d<T> > ret;
+ typedef dpoints_bkd_pixter< const magick_tiled2d<T> > ret;
};
} // end of namespace mln::trait
Index: trunk/milena/sandbox/fabien/mln/core/image/tiled2d.hh
===================================================================
--- trunk/milena/sandbox/fabien/mln/core/image/tiled2d.hh (revision 4420)
+++ trunk/milena/sandbox/fabien/mln/core/image/tiled2d.hh (revision 4421)
@@ -55,7 +55,6 @@
template <typename T>
struct data< tiled2d<T> >
{
-// data(const box2d& b, unsigned bdr);
data(const box2d& b, unsigned bdr);
~data();
@@ -145,17 +144,10 @@
/// Constructor without argument.
tiled2d();
- /// Constructor with the numbers of rows and columns and the
- /// border thickness.
- //tiled2d(int nrows, int ncols, unsigned bdr = border::thickness);
-
/// Constructor with a box and the border thickness (default is
/// 3).
tiled2d(const box2d& b, unsigned bdr = border::thickness);
- /// Constructor with a filename.
- //tiled2d(const std::string& filename);
-
/// Initialize an empty image.
void init_(const box2d& b, unsigned bdr = border::thickness);
@@ -234,12 +226,6 @@
// Hooks
- /// Give a hook to the value buffer.
- //const std::fstream* buffer() const;
-
- /// Give a hook to the value buffer.
- //std::fstream* buffer();
-
/// Give a hook to the offset for accessing data.
const std::streampos& pos_() const;
@@ -305,14 +291,6 @@
allocate_();
}
- /*template <typename T>
- inline
- data< tiled2d<T> >::data(const std::string& filename)
- {
- // FIXME
- //b_ = make::box2d(buffer_.rows(), buffer_.columns());
- }*/
-
template <typename T>
inline
data< tiled2d<T> >::~data()
@@ -335,18 +313,6 @@
data< tiled2d<T> >::allocate_()
{
update_vb_();
-// unsigned
-// nr = vb_.len(0),
-// nc = vb_.len(1);
-// buffer_ = new T[nr * nc];
-// array_ = new T*[nr];
-// T* buf = buffer_ - vb_.pmin().col();
-// for (unsigned i = 0; i < nr; ++i)
-// {
-// array_[i] = buf;
-// buf += nc;
-// }
-// array_ -= vb_.pmin().row();
mln_postcondition(vb_.len(0) == b_.len(0) + 2 * bdr_);
mln_postcondition(vb_.len(1) == b_.len(1) + 2 * bdr_);
}
@@ -408,22 +374,6 @@
this->data_->loaded_ = false;
}
- /*template <typename T>
- inline
- tiled2d<T>::tiled2d(const std::string& filename)
- {
- init_(filename);
- }
-
- template <typename T>
- inline
- void
- tiled2d<T>::init_(const std::string& filename)
- {
- mln_precondition(! this->is_valid());
- this->data_ = new internal::data< tiled2d<T> >(filename);
- }*/
-
template <typename T>
inline
const box2d&
@@ -513,10 +463,6 @@
{
mln_precondition(this->has(point2d(row, col)));
//FIXME: use the cache Luke.
- this->data_->pixel_cache = this->data_->buffer_.getPixels(col, row, col, row);
- this->data_->value_.red() = this->data_->pixel_cache->red % 256;
- this->data_->value_.green() = this->data_->pixel_cache->green % 256;
- this->data_->value_.blue() = this->data_->pixel_cache->blue % 256;
return this->data_->value_;
}
@@ -527,10 +473,6 @@
{
mln_precondition(this->has(point2d(row, col)));
//FIXME: use the cache Luke.
- this->data_->pixel_cache = this->data_->buffer_.getPixels(col, row, col, row);
- this->data_->value_.red() = this->data_->pixel_cache->red % 256;
- this->data_->value_.green() = this->data_->pixel_cache->green % 256;
- this->data_->value_.blue() = this->data_->pixel_cache->blue % 256;
return this->data_->value_;
}
@@ -555,24 +497,6 @@
// Hooks.
- /*template <typename T>
- inline
- const std::fstream*
- tiled2d<T>::buffer() const
- {
- mln_precondition(this->is_valid());
- return this->data_->f_;
- }
-
- template <typename T>
- inline
- std::fstream*
- tiled2d<T>::buffer()
- {
- mln_precondition(this->is_valid());
- return this->data_->f_;
- }*/
-
template <typename T>
inline
const std::streampos&
1
0
---
milena/ChangeLog | 4 ++++
milena/mln/win/multiple.hh | 13 +++++++++++++
2 files changed, 17 insertions(+), 0 deletions(-)
diff --git a/milena/ChangeLog b/milena/ChangeLog
index f40e949..60f3ad7 100644
--- a/milena/ChangeLog
+++ b/milena/ChangeLog
@@ -1,3 +1,7 @@
+2009-08-24 Guillaume Lazzara <lazzara(a)lrde.epita.fr>
+
+ * mln/win/multiple.hh: Add a missing init_ member.
+
2009-08-28 Guillaume Lazzara <lazzara(a)lrde.epita.fr>
Small fixes.
diff --git a/milena/mln/win/multiple.hh b/milena/mln/win/multiple.hh
index f39a55e..a3632f5 100644
--- a/milena/mln/win/multiple.hh
+++ b/milena/mln/win/multiple.hh
@@ -145,6 +145,10 @@ namespace mln
void change_target(const multiple<W,F>& w); // Overridden to initialize size_.
+ /// Delegated initialization.
+ template <typename P>
+ void init_(const multiple<W,F>& w, const P& c);
+
/// Test the iterator validity.
bool is_valid_() const;
@@ -316,6 +320,15 @@ namespace mln
inline
multiple_qiter<W,F>::multiple_qiter(const multiple<W,F>& w, const P& c)
{
+ this->init_(w, c);
+ }
+
+ template <typename W, typename F>
+ template <typename P>
+ inline
+ void
+ multiple_qiter<W,F>::init_(const multiple<W,F>& w, const P& c)
+ {
this->center_at(c);
// We have to first change the center so that 'invalidate' can
// work when changing the target.
--
1.5.6.5
1
0
Re: [Olena-patches] 4396: Introduce mixed windows and neighborhood for graph images.
by Guillaume Lazzara 01 Sep '09
by Guillaume Lazzara 01 Sep '09
01 Sep '09
Roland Levillain wrote:
>
> Le 25 août 09 à 19:13, Guillaume Lazzara a écrit :
>
>> * mln/core/box_runstart_piter.hh,
>> * mln/core/dpsites_piter.hh,
>> * mln/core/image/complex_window_piter.hh: Add new init_() member.
>
> Is this new `init_()' member mandatory or is it just a shortcut?
>
Yes, it is now mandatory. I needed a shared member for all piter classes
to be able to call specific initialization routines.
>> + /// Delayed initialization.
>> + template <typename Pref>
>> + void init_(const Window<W>& win, const Pref& p_ref);
>> +
>
> Didn't you want to mean "Delegated initialization" instead of "Delayed
> initialization"?
Yes, that's probably a better description.
1
0
01 Sep '09
* mln/core/box_runstart_piter.hh,
* mln/core/dpsites_piter.hh,
* mln/core/image/complex_window_piter.hh: Add new init_() member.
* mln/core/image/graph_elt_mixed_neighborhood.hh,
* mln/core/image/graph_elt_mixed_window.hh,
* mln/core/mixed_neighb.hh: New.
* mln/core/image/graph_elt_neighborhood.hh,
* mln/core/image/graph_elt_window.hh: Get rid of a template
parameter.
* mln/core/image/graph_window_piter.hh: Add a selector for
do_start_() implementation.
* mln/core/image/vertex_image.hh: Add a new include.
* mln/core/internal/neighb_base.hh: New neighborhood base class.
* mln/core/internal/neighb_niter_base.hh: New neiborhood iterator
base class.
* mln/core/internal/neighb_niter_impl.hh: Add a new specialization
for graph_elt_mixed_window.
* mln/core/neighb.hh: Make inherit from neighb_base.
* mln/core/window.hh: Update header.
* tests/core/image/vertex_and_edge_image.cc: Use a
graph_elt_mixed_window.
---
milena/ChangeLog | 36 +++
milena/mln/core/box_runstart_piter.hh | 12 +
milena/mln/core/dpsites_piter.hh | 17 ++-
milena/mln/core/image/complex_window_piter.hh | 30 +++
...hborhood.hh => graph_elt_mixed_neighborhood.hh} | 20 +-
...aph_elt_window.hh => graph_elt_mixed_window.hh} | 55 ++---
milena/mln/core/image/graph_elt_neighborhood.hh | 11 +-
milena/mln/core/image/graph_elt_window.hh | 58 ++---
milena/mln/core/image/graph_window_piter.hh | 123 +++++++++--
milena/mln/core/image/vertex_image.hh | 1 +
milena/mln/core/internal/neighb_base.hh | 128 +++++++++++
milena/mln/core/internal/neighb_niter_base.hh | 148 ++++++++++++
milena/mln/core/internal/neighb_niter_impl.hh | 24 ++-
milena/mln/core/mixed_neighb.hh | 240 ++++++++++++++++++++
milena/mln/core/neighb.hh | 218 +++---------------
milena/mln/core/window.hh | 3 +-
milena/tests/core/image/vertex_and_edge_image.cc | 3 +-
17 files changed, 824 insertions(+), 303 deletions(-)
copy milena/mln/core/image/{graph_elt_neighborhood.hh => graph_elt_mixed_neighborhood.hh} (76%)
copy milena/mln/core/image/{graph_elt_window.hh => graph_elt_mixed_window.hh} (73%)
create mode 100644 milena/mln/core/internal/neighb_base.hh
create mode 100644 milena/mln/core/internal/neighb_niter_base.hh
create mode 100644 milena/mln/core/mixed_neighb.hh
diff --git a/milena/ChangeLog b/milena/ChangeLog
index c996afc..d9a3461 100644
--- a/milena/ChangeLog
+++ b/milena/ChangeLog
@@ -1,5 +1,41 @@
2009-08-24 Guillaume Lazzara <lazzara(a)lrde.epita.fr>
+ Introduce mixed windows and neighborhood for graph images.
+
+ * mln/core/box_runstart_piter.hh,
+ * mln/core/dpsites_piter.hh,
+ * mln/core/image/complex_window_piter.hh: Add new init_() member.
+
+ * mln/core/image/graph_elt_mixed_neighborhood.hh,
+ * mln/core/image/graph_elt_mixed_window.hh,
+ * mln/core/mixed_neighb.hh: New.
+
+ * mln/core/image/graph_elt_neighborhood.hh,
+ * mln/core/image/graph_elt_window.hh: Get rid of a template
+ parameter.
+
+ * mln/core/image/graph_window_piter.hh: Add a selector for
+ do_start_() implementation.
+
+ * mln/core/image/vertex_image.hh: Add a new include.
+
+ * mln/core/internal/neighb_base.hh: New neighborhood base class.
+
+ * mln/core/internal/neighb_niter_base.hh: New neiborhood iterator
+ base class.
+
+ * mln/core/internal/neighb_niter_impl.hh: Add a new specialization
+ for graph_elt_mixed_window.
+
+ * mln/core/neighb.hh: Make inherit from neighb_base.
+
+ * mln/core/window.hh: Update header.
+
+ * tests/core/image/vertex_and_edge_image.cc: Use a
+ graph_elt_mixed_window.
+
+2009-08-24 Guillaume Lazzara <lazzara(a)lrde.epita.fr>
+
Small fixes in Milena.
* mln/canvas/labeling/blobs.hh,
diff --git a/milena/mln/core/box_runstart_piter.hh b/milena/mln/core/box_runstart_piter.hh
index d58bc89..a777d1e 100644
--- a/milena/mln/core/box_runstart_piter.hh
+++ b/milena/mln/core/box_runstart_piter.hh
@@ -63,6 +63,9 @@ namespace mln
*/
box_runstart_piter(const box<P>& b);
+ /// Delayed initialization.
+ void init_(const box<P>& b);
+
box_runstart_piter();
/// Test the iterator validity.
@@ -101,9 +104,18 @@ namespace mln
inline
box_runstart_piter<P>::box_runstart_piter(const box<P>& b)
{
+ init_(b);
+ }
+
+ template <typename P>
+ inline
+ void
+ box_runstart_piter<P>::init_(const box<P>& b)
+ {
this->change_target(b);
}
+
template <typename P>
inline
bool
diff --git a/milena/mln/core/dpsites_piter.hh b/milena/mln/core/dpsites_piter.hh
index 0af9d9a..970fe0e 100644
--- a/milena/mln/core/dpsites_piter.hh
+++ b/milena/mln/core/dpsites_piter.hh
@@ -1,4 +1,5 @@
-// Copyright (C) 2007, 2008, 2009 EPITA Research and Development Laboratory (LRDE)
+// Copyright (C) 2007, 2008, 2009 EPITA Research and Development
+// Laboratory (LRDE)
//
// This file is part of Olena.
//
@@ -56,6 +57,10 @@ namespace mln
template <typename P>
dpsites_fwd_piter(const V& v, const P& c);
+ /// Delayed initialization.
+ template <typename P>
+ void init_(const V& v, const P& c);
+
/// Constructor without argument.
dpsites_fwd_piter();
@@ -139,10 +144,20 @@ namespace mln
inline
dpsites_fwd_piter<V>::dpsites_fwd_piter(const V& v, const P& c)
{
+ init_(v, c);
+ }
+
+ template <typename V>
+ template <typename P>
+ inline
+ void
+ dpsites_fwd_piter<V>::init_(const V& v, const P& c)
+ {
this->change_target(v);
this->center_at(c);
}
+
template <typename V>
inline
bool
diff --git a/milena/mln/core/image/complex_window_piter.hh b/milena/mln/core/image/complex_window_piter.hh
index 309f083..b723ec6 100644
--- a/milena/mln/core/image/complex_window_piter.hh
+++ b/milena/mln/core/image/complex_window_piter.hh
@@ -72,6 +72,10 @@ namespace mln
complex_window_fwd_piter(const Window<W>& win, const Pref& p_ref);
/// \}
+ /// Delayed initialization.
+ template <typename Pref>
+ void init_(const Window<W>& win, const Pref& p_ref);
+
/// Manipulation.
/// \{
/// Test if the iterator is valid.
@@ -138,6 +142,10 @@ namespace mln
complex_window_bkd_piter(const Window<W>& win, const Pref& p_ref);
/// \}
+ /// Delayed initialization.
+ template <typename Pref>
+ void init_(const Window<W>& win, const Pref& p_ref);
+
/// Manipulation.
/// \{
/// Test if the iterator is valid.
@@ -196,11 +204,22 @@ namespace mln
complex_window_fwd_piter<I, G, W>::complex_window_fwd_piter(const Window<W>& win,
const Pref& p_ref)
{
+ init_(win, p_ref);
+ }
+
+ template <typename I, typename G, typename W>
+ template <typename Pref>
+ inline
+ void
+ complex_window_fwd_piter<I, G, W>::init_(const Window<W>& win,
+ const Pref& p_ref)
+ {
this->change_target(exact(win));
center_at(p_ref);
mln_postcondition(!this->is_valid());
}
+
template <typename I, typename G, typename W>
inline
bool
@@ -293,11 +312,22 @@ namespace mln
complex_window_bkd_piter<I, G, W>::complex_window_bkd_piter(const Window<W>& win,
const Pref& p_ref)
{
+ init_(win, p_ref);
+ }
+
+ template <typename I, typename G, typename W>
+ template <typename Pref>
+ inline
+ void
+ complex_window_bkd_piter<I, G, W>::init_(const Window<W>& win,
+ const Pref& p_ref)
+ {
this->change_target(exact(win));
center_at(p_ref);
mln_postcondition(!this->is_valid());
}
+
template <typename I, typename G, typename W>
inline
bool
diff --git a/milena/mln/core/image/graph_elt_neighborhood.hh b/milena/mln/core/image/graph_elt_mixed_neighborhood.hh
similarity index 76%
copy from milena/mln/core/image/graph_elt_neighborhood.hh
copy to milena/mln/core/image/graph_elt_mixed_neighborhood.hh
index a1a739f..40245ce 100644
--- a/milena/mln/core/image/graph_elt_neighborhood.hh
+++ b/milena/mln/core/image/graph_elt_mixed_neighborhood.hh
@@ -24,15 +24,15 @@
// exception does not however invalidate any other reasons why the
// executable file might be covered by the GNU General Public License.
-#ifndef MLN_CORE_IMAGE_GRAPH_ELT_NEIGHBORHOOD_HH
-# define MLN_CORE_IMAGE_GRAPH_ELT_NEIGHBORHOOD_HH
+#ifndef MLN_CORE_IMAGE_GRAPH_ELT_MIXED_NEIGHBORHOOD_HH
+# define MLN_CORE_IMAGE_GRAPH_ELT_MIXED_NEIGHBORHOOD_HH
/// \file
///
/// Definition of the elementary ``neighborhood'' on a graph.
# include <mln/core/neighb.hh>
-# include <mln/core/image/graph_elt_window.hh>
+# include <mln/core/image/graph_elt_mixed_window.hh>
namespace mln
@@ -44,13 +44,13 @@ namespace mln
/// \tparam S is a site set type.
/// \tparam S2 is the site set type of the neighbors.
//
- template <typename G, typename S, typename S2 = S>
- struct graph_elt_neighborhood
- : public neighb< graph_elt_window<G,S,S2> >
+ template <typename G, typename S, typename S2>
+ struct graph_elt_mixed_neighborhood
+ : public neighb< graph_elt_mixed_window<G,S,S2> >
{
- typedef neighb< graph_elt_window<G,S,S2> > super_;
+ typedef neighb< graph_elt_mixed_window<G,S,S2> > super_;
- graph_elt_neighborhood();
+ graph_elt_mixed_neighborhood();
};
@@ -60,7 +60,7 @@ namespace mln
template <typename G, typename S, typename S2>
inline
- graph_elt_neighborhood<G,S,S2>::graph_elt_neighborhood()
+ graph_elt_mixed_neighborhood<G,S,S2>::graph_elt_mixed_neighborhood()
{
}
@@ -69,4 +69,4 @@ namespace mln
}
-#endif // ! MLN_CORE_IMAGE_GRAPH_ELT_NEIGHBORHOOD_HH
+#endif // ! MLN_CORE_IMAGE_GRAPH_ELT_MIXED_NEIGHBORHOOD_HH
diff --git a/milena/mln/core/image/graph_elt_window.hh b/milena/mln/core/image/graph_elt_mixed_window.hh
similarity index 73%
copy from milena/mln/core/image/graph_elt_window.hh
copy to milena/mln/core/image/graph_elt_mixed_window.hh
index 867a7bd..6ece878 100644
--- a/milena/mln/core/image/graph_elt_window.hh
+++ b/milena/mln/core/image/graph_elt_mixed_window.hh
@@ -1,5 +1,4 @@
-// Copyright (C) 2007, 2008, 2009 EPITA Research and Development
-// Laboratory (LRDE)
+// Copyright (C) 2009 EPITA Research and Development Laboratory (LRDE)
//
// This file is part of Olena.
//
@@ -24,12 +23,13 @@
// exception does not however invalidate any other reasons why the
// executable file might be covered by the GNU General Public License.
-#ifndef MLN_CORE_IMAGE_GRAPH_ELT_WINDOW_HH
-# define MLN_CORE_IMAGE_GRAPH_ELT_WINDOW_HH
+#ifndef MLN_CORE_IMAGE_GRAPH_ELT_MIXED_WINDOW_HH
+# define MLN_CORE_IMAGE_GRAPH_ELT_MIXED_WINDOW_HH
/// \file
///
-/// Definition of the elementary ``window'' on a graph.
+/// Definition of the elementary ``window'' on a graph where elements
+/// are in a different site set from the center's.
# include <mln/core/concept/window.hh>
# include <mln/core/internal/neighborhood_base.hh>
@@ -41,7 +41,7 @@ namespace mln
{
/// Forward declaration
- template <typename G, typename S, typename S2> class graph_elt_window;
+ template <typename G, typename S, typename S2> class graph_elt_mixed_window;
template <typename G, typename F> struct p_edges;
template <typename G, typename F> struct p_vertices;
namespace util
@@ -55,8 +55,8 @@ namespace mln
{
template <typename G, typename S, typename S2, typename E>
- struct neighborhood_impl<graph_elt_window<G,S,S2>,E>
- : public neighborhood_extra_impl<graph_elt_window<G,S,S2>,E>
+ struct neighborhood_impl<graph_elt_mixed_window<G,S,S2>,E>
+ : public neighborhood_extra_impl<graph_elt_mixed_window<G,S,S2>,E>
{
};
@@ -70,29 +70,10 @@ namespace mln
/// extracted.
//
template <typename G, typename S, typename S2>
- struct graph_window_iter_dispatch;
-
- template <typename G, typename F>
- struct graph_window_iter_dispatch<G, p_edges<G,F>, p_edges<G,F> >
- {
- typedef mln_edge_nbh_edge_fwd_iter(G) nbh_fwd_iter_;
- typedef mln_edge_nbh_edge_bkd_iter(G) nbh_bkd_iter_;
-
- typedef p_edges<G,F> target;
- };
-
- template <typename G, typename F>
- struct graph_window_iter_dispatch<G, p_vertices<G,F>, p_vertices<G,F> >
- {
- typedef mln_vertex_nbh_vertex_fwd_iter(G) nbh_fwd_iter_;
- typedef mln_vertex_nbh_vertex_bkd_iter(G) nbh_bkd_iter_;
-
- typedef p_vertices<G,F> target;
- };
-
+ struct graph_mixed_window_iter_dispatch;
template <typename G, typename F, typename F2>
- struct graph_window_iter_dispatch<G, p_vertices<G,F>, p_edges<G,F2> >
+ struct graph_mixed_window_iter_dispatch<G, p_vertices<G,F>, p_edges<G,F2> >
{
typedef mln_vertex_nbh_edge_fwd_iter(G) nbh_fwd_iter_;
typedef mln_vertex_nbh_edge_bkd_iter(G) nbh_bkd_iter_;
@@ -108,7 +89,7 @@ namespace mln
{
template <typename G, typename S, typename S2>
- struct window_< mln::graph_elt_window<G,S,S2> >
+ struct window_< mln::graph_elt_mixed_window<G,S,S2> >
{
typedef trait::window::size::unknown size;
typedef trait::window::support::irregular support;
@@ -124,14 +105,14 @@ namespace mln
/// \p S2 is an image site set from where the neighbors are
/// extracted.
//
- template <typename G, typename S, typename S2 = S>
- class graph_elt_window
+ template <typename G, typename S, typename S2>
+ class graph_elt_mixed_window
: public graph_window_base<mln_result(S2::fun_t),
- graph_elt_window<G,S,S2> >,
- public internal::graph_window_iter_dispatch<G,S,S2>
+ graph_elt_mixed_window<G,S,S2> >,
+ public internal::graph_mixed_window_iter_dispatch<G,S,S2>
{
- typedef graph_elt_window<G,S,S2> self_;
- typedef internal::graph_window_iter_dispatch<G,S,S2> super_;
+ typedef graph_elt_mixed_window<G,S,S2> self_;
+ typedef internal::graph_mixed_window_iter_dispatch<G,S,S2> super_;
typedef typename super_::nbh_fwd_iter_ nbh_fwd_iter_;
typedef typename super_::nbh_bkd_iter_ nbh_bkd_iter_;
@@ -166,4 +147,4 @@ namespace mln
} // end of namespace mln
-#endif // ! MLN_CORE_IMAGE_GRAPH_ELT_WINDOW_HH
+#endif // ! MLN_CORE_IMAGE_GRAPH_ELT_MIXED_WINDOW_HH
diff --git a/milena/mln/core/image/graph_elt_neighborhood.hh b/milena/mln/core/image/graph_elt_neighborhood.hh
index a1a739f..b946067 100644
--- a/milena/mln/core/image/graph_elt_neighborhood.hh
+++ b/milena/mln/core/image/graph_elt_neighborhood.hh
@@ -42,13 +42,12 @@ namespace mln
///
/// \tparam G is a graph type.
/// \tparam S is a site set type.
- /// \tparam S2 is the site set type of the neighbors.
//
- template <typename G, typename S, typename S2 = S>
+ template <typename G, typename S>
struct graph_elt_neighborhood
- : public neighb< graph_elt_window<G,S,S2> >
+ : public neighb< graph_elt_window<G,S> >
{
- typedef neighb< graph_elt_window<G,S,S2> > super_;
+ typedef neighb< graph_elt_window<G,S> > super_;
graph_elt_neighborhood();
};
@@ -58,9 +57,9 @@ namespace mln
# ifndef MLN_INCLUDE_ONLY
- template <typename G, typename S, typename S2>
+ template <typename G, typename S>
inline
- graph_elt_neighborhood<G,S,S2>::graph_elt_neighborhood()
+ graph_elt_neighborhood<G,S>::graph_elt_neighborhood()
{
}
diff --git a/milena/mln/core/image/graph_elt_window.hh b/milena/mln/core/image/graph_elt_window.hh
index 867a7bd..b39c44e 100644
--- a/milena/mln/core/image/graph_elt_window.hh
+++ b/milena/mln/core/image/graph_elt_window.hh
@@ -41,7 +41,7 @@ namespace mln
{
/// Forward declaration
- template <typename G, typename S, typename S2> class graph_elt_window;
+ template <typename G, typename S> class graph_elt_window;
template <typename G, typename F> struct p_edges;
template <typename G, typename F> struct p_vertices;
namespace util
@@ -54,9 +54,9 @@ namespace mln
namespace internal
{
- template <typename G, typename S, typename S2, typename E>
- struct neighborhood_impl<graph_elt_window<G,S,S2>,E>
- : public neighborhood_extra_impl<graph_elt_window<G,S,S2>,E>
+ template <typename G, typename S, typename E>
+ struct neighborhood_impl<graph_elt_window<G,S>,E>
+ : public neighborhood_extra_impl<graph_elt_window<G,S>,E>
{
};
@@ -66,49 +66,32 @@ namespace mln
///
/// \p G is the graph type.
/// \p S is an image site set from where the center is extracted.
- /// \p S2 is an image site set from where the neighbors are
- /// extracted.
//
- template <typename G, typename S, typename S2>
+ template <typename G, typename S>
struct graph_window_iter_dispatch;
template <typename G, typename F>
- struct graph_window_iter_dispatch<G, p_edges<G,F>, p_edges<G,F> >
+ struct graph_window_iter_dispatch<G, p_edges<G,F> >
{
typedef mln_edge_nbh_edge_fwd_iter(G) nbh_fwd_iter_;
typedef mln_edge_nbh_edge_bkd_iter(G) nbh_bkd_iter_;
-
- typedef p_edges<G,F> target;
};
template <typename G, typename F>
- struct graph_window_iter_dispatch<G, p_vertices<G,F>, p_vertices<G,F> >
+ struct graph_window_iter_dispatch<G, p_vertices<G,F> >
{
typedef mln_vertex_nbh_vertex_fwd_iter(G) nbh_fwd_iter_;
typedef mln_vertex_nbh_vertex_bkd_iter(G) nbh_bkd_iter_;
-
- typedef p_vertices<G,F> target;
};
-
- template <typename G, typename F, typename F2>
- struct graph_window_iter_dispatch<G, p_vertices<G,F>, p_edges<G,F2> >
- {
- typedef mln_vertex_nbh_edge_fwd_iter(G) nbh_fwd_iter_;
- typedef mln_vertex_nbh_edge_bkd_iter(G) nbh_bkd_iter_;
-
- typedef p_edges<G,F2> target;
- };
-
-
} // end of namespace mln::internal
namespace trait
{
- template <typename G, typename S, typename S2>
- struct window_< mln::graph_elt_window<G,S,S2> >
+ template <typename G, typename S>
+ struct window_< mln::graph_elt_window<G,S> >
{
typedef trait::window::size::unknown size;
typedef trait::window::support::irregular support;
@@ -124,14 +107,14 @@ namespace mln
/// \p S2 is an image site set from where the neighbors are
/// extracted.
//
- template <typename G, typename S, typename S2 = S>
+ template <typename G, typename S>
class graph_elt_window
- : public graph_window_base<mln_result(S2::fun_t),
- graph_elt_window<G,S,S2> >,
- public internal::graph_window_iter_dispatch<G,S,S2>
+ : public graph_window_base<mln_result(S::fun_t),
+ graph_elt_window<G,S> >,
+ public internal::graph_window_iter_dispatch<G,S>
{
- typedef graph_elt_window<G,S,S2> self_;
- typedef internal::graph_window_iter_dispatch<G,S,S2> super_;
+ typedef graph_elt_window<G,S> self_;
+ typedef internal::graph_window_iter_dispatch<G,S> super_;
typedef typename super_::nbh_fwd_iter_ nbh_fwd_iter_;
typedef typename super_::nbh_bkd_iter_ nbh_bkd_iter_;
@@ -139,23 +122,24 @@ namespace mln
public:
/// Associated types.
/// \{
- typedef typename super_::target target;
+ typedef S target;
+
/// The type of psite corresponding to the window.
- typedef mln_psite(target) psite;
+ typedef mln_psite(S) psite;
/// Type of the window center element.
typedef mln_psite(S) center_t;
/// Type of the graph element pointed by this iterator.
- typedef mln_graph_element(target) graph_element;
+ typedef mln_graph_element(S) graph_element;
/// Site_Iterator type to browse the psites of the window
/// w.r.t. the ordering of vertices.
- typedef graph_window_piter<target,self_,nbh_fwd_iter_> fwd_qiter;
+ typedef graph_window_piter<S,self_,nbh_fwd_iter_> fwd_qiter;
/// Site_Iterator type to browse the psites of the window
/// w.r.t. the reverse ordering of vertices.
- typedef graph_window_piter<target,self_,nbh_bkd_iter_> bkd_qiter;
+ typedef graph_window_piter<S,self_,nbh_bkd_iter_> bkd_qiter;
/// The default qiter type.
typedef fwd_qiter qiter;
diff --git a/milena/mln/core/image/graph_window_piter.hh b/milena/mln/core/image/graph_window_piter.hh
index 7812767..8ea77db 100644
--- a/milena/mln/core/image/graph_window_piter.hh
+++ b/milena/mln/core/image/graph_window_piter.hh
@@ -30,6 +30,9 @@
/// \file
///
/// Definition of a graph element iterator on a graph window.
+///
+/// \fixme Split into graph_window_piter, graph_mixed_window_piter and
+/// graph_window_piter_base.
# include <mln/core/concept/site_set.hh>
# include <mln/core/concept/window.hh>
@@ -42,6 +45,59 @@ namespace mln
// Forward declaration.
template <typename S, typename I> class p_graph_piter;
+
+ namespace internal
+ {
+
+ /// The window center and the window elements are part of
+ /// different site sets.
+ template <typename C, typename P, typename E>
+ struct impl_selector
+ {
+ E& exact()
+ {
+ return internal::force_exact<E>(*this);
+ }
+
+ void do_start_()
+ {
+ exact().iter_.start();
+ // Nothing else to do. A pointer to the window element's site
+ // set has been already stored in the constructor.
+ }
+
+ };
+
+ /// The window center and the window elements are part of the same
+ /// site set.
+ template <typename C, typename E>
+ struct impl_selector<C,C,E>
+ {
+ E& exact()
+ {
+ return internal::force_exact<E>(*this);
+ }
+
+ void do_start_()
+ {
+ exact().iter_.start();
+
+ // We need to store a pointer on the site set of the window
+ // center.
+ // We cannot do this in the constructor since the center may
+ // not be initialized.
+ // Here we suppose that if we start this iterator, the
+ // potential iterator used as center has been started just
+ // before calling this method.
+ //
+ exact().change_target_site_set(exact().center().site_set());
+ }
+
+ };
+
+ } // end of namespace mln::internal
+
+
/// Forward iterator on line graph window.
///
/// \tparam S is the site set type.
@@ -52,11 +108,17 @@ namespace mln
class graph_window_piter
: public internal::site_relative_iterator_base< W,
graph_window_piter<S,W,I>,
- typename W::center_t >
+ typename W::center_t >,
+ public internal::impl_selector<typename W::center_t, mln_psite(W),
+ graph_window_piter<S,W,I> >
{
typedef graph_window_piter<S,W,I> self_;
typedef
internal::site_relative_iterator_base<W,self_,mln_psite(S)> super_;
+ typedef
+ internal::impl_selector<typename W::center_t, mln_psite(W),
+ graph_window_piter<S,W,I> > super_impl_;
+
public:
/// Associated types
@@ -103,6 +165,17 @@ namespace mln
const Pref& p_ref);
/// \}
+ /// Delayed initialization.
+ /// \{
+ template <typename Pref>
+ void init_(const Window<W>& win, const Pref& p_ref);
+
+ template <typename Pref>
+ void init_(const Window<W>& win,
+ const Site_Set<S>& target_site_set,
+ const Pref& p_ref);
+ /// \}
+
/// Manipulation.
/// \{
/// Test if the iterator is valid.
@@ -110,8 +183,6 @@ namespace mln
/// Invalidate the iterator.
void invalidate_();
- /// Start an iteration.
- void do_start_();
/// Go to the next point.
void do_next_();
@@ -139,6 +210,11 @@ namespace mln
void change_target_site_set(const S& s);
const S& target_site_set() const;
+ using super_impl_::do_start_;
+
+ friend class internal::impl_selector<typename W::center_t, mln_psite(W),
+ graph_window_piter<S,W,I> > ;
+
private:
I iter_;
const S* s_;
@@ -166,12 +242,7 @@ namespace mln
// Center and neighbor sites have the same type and belong to
// the same site set.
mlc_is(center_t, mln_psite(W))::check();
-
- this->center_at(p_ref);
- this->change_target(exact(win));
- change_target_site_set(this->center().site_set());
-
- mln_postcondition(!this->is_valid());
+ init_(win, p_ref);
}
@@ -186,14 +257,36 @@ namespace mln
// Center and neighbors sites do not have the same type and do
// not belong to the same site set.
mlc_is_not(center_t, mln_psite(W))::check();
+ init_(win, target_site_set, p_ref);
+ }
+ template <typename S, typename W, typename I>
+ template <typename Pref>
+ inline
+ void
+ graph_window_piter<S,W,I>::init_(const Window<W>& win,
+ const Pref& p_ref)
+ {
this->center_at(p_ref);
this->change_target(exact(win));
- change_target_site_set(exact(target_site_set));
mln_postcondition(!this->is_valid());
}
+ template <typename S, typename W, typename I>
+ template <typename Pref>
+ inline
+ void
+ graph_window_piter<S,W,I>::init_(const Window<W>& win,
+ const Site_Set<S>& target_site_set,
+ const Pref& p_ref)
+ {
+ this->center_at(p_ref);
+ this->change_target(exact(win));
+ change_target_site_set(exact(target_site_set));
+ mln_postcondition(!this->is_valid());
+ }
+
template <typename S, typename W, typename I>
inline
@@ -214,14 +307,6 @@ namespace mln
template <typename S, typename W, typename I>
inline
void
- graph_window_piter<S,W,I>::do_start_()
- {
- iter_.start();
- }
-
- template <typename S, typename W, typename I>
- inline
- void
graph_window_piter<S,W,I>::do_next_()
{
iter_.next();
@@ -234,7 +319,6 @@ namespace mln
graph_window_piter<S, W, I>::center_at_(const Pref& c)
{
iter_.center_at(c.p_hook_());
- //FIXME: should we update target site set?
}
template <typename S, typename W, typename I>
@@ -244,7 +328,6 @@ namespace mln
graph_window_piter<S, W, I>::center_at_(const p_graph_piter<S2, I2>& c)
{
iter_.center_at(c.hook_elt_());
- //FIXME: should we update target site set?
}
template <typename S, typename W, typename I>
diff --git a/milena/mln/core/image/vertex_image.hh b/milena/mln/core/image/vertex_image.hh
index fd7d2eb..3ce7ed5 100644
--- a/milena/mln/core/image/vertex_image.hh
+++ b/milena/mln/core/image/vertex_image.hh
@@ -33,6 +33,7 @@
# include <mln/core/concept/graph.hh>
# include <mln/core/image/graph_elt_window.hh>
# include <mln/core/image/graph_elt_neighborhood.hh>
+# include <mln/core/image/graph_elt_mixed_neighborhood.hh>
# include <mln/core/site_set/p_vertices.hh>
# include <mln/pw/internal/image_base.hh>
# include <mln/fun/i2v/array.hh>
diff --git a/milena/mln/core/internal/neighb_base.hh b/milena/mln/core/internal/neighb_base.hh
new file mode 100644
index 0000000..bfb499a
--- /dev/null
+++ b/milena/mln/core/internal/neighb_base.hh
@@ -0,0 +1,128 @@
+// Copyright (C) 2009 EPITA Research and Development Laboratory (LRDE)
+//
+// This file is part of Olena.
+//
+// Olena is free software: you can redistribute it and/or modify it under
+// the terms of the GNU General Public License as published by the Free
+// Software Foundation, version 2 of the License.
+//
+// Olena is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with Olena. If not, see <http://www.gnu.org/licenses/>.
+//
+// As a special exception, you may use this file as part of a free
+// software project without restriction. Specifically, if other files
+// instantiate templates or use macros or inline functions from this
+// file, or you compile this file and link it with other files to produce
+// an executable, this file does not by itself cause the resulting
+// executable to be covered by the GNU General Public License. This
+// exception does not however invalidate any other reasons why the
+// executable file might be covered by the GNU General Public License.
+
+#ifndef MLN_CORE_INTERNAL_NEIGHB_BASE_HH
+# define MLN_CORE_INTERNAL_NEIGHB_BASE_HH
+
+/// \file
+///
+/// Base implementation for neighborhood classes.
+
+# include <mln/core/internal/neighborhood_base.hh>
+# include <mln/core/internal/site_relative_iterator_base.hh>
+# include <mln/core/internal/neighb_niter_impl.hh>
+
+
+namespace mln
+{
+
+ namespace internal
+ {
+
+
+ /// Adapter class from window to neighborhood.
+ ///
+ /// \tparam W The underlying window type.
+ /// \tparam E The exact neighborhood type.
+ //
+ template <typename W, typename E>
+ class neighb_base
+ : public internal::neighborhood_base< W, E >,
+ private mlc_is_a(W, Window)::check_t
+ {
+ public:
+
+ /// Constructor without argument.
+ neighb_base();
+
+ /// Constructor from a window \p win.
+ neighb_base(const W& win);
+
+ /// Get the corresponding window.
+ const W& win() const;
+
+ /// Change the corresponding window.
+ void change_window(const W& new_win);
+
+
+ /// \internal Hook to the window.
+ W& hook_win_();
+
+ private:
+
+ W win_;
+ };
+
+
+# ifndef MLN_INCLUDE_ONLY
+
+ // neighb<W,E>
+
+ template <typename W, typename E>
+ inline
+ neighb_base<W,E>::neighb_base()
+ {
+ }
+
+ template <typename W, typename E>
+ inline
+ neighb_base<W,E>::neighb_base(const W& win)
+ {
+ change_window(win);
+ }
+
+ template <typename W, typename E>
+ inline
+ const W&
+ neighb_base<W,E>::win() const
+ {
+ return win_;
+ }
+
+ template <typename W, typename E>
+ inline
+ void
+ neighb_base<W,E>::change_window(const W& new_win)
+ {
+ mln_precondition(new_win.is_neighbable_());
+ win_ = new_win;
+ }
+
+ template <typename W, typename E>
+ inline
+ W&
+ neighb_base<W,E>::hook_win_()
+ {
+ return win_;
+ }
+
+# endif // ! MLN_INCLUDE_ONLY
+
+ } // end of namespace mln::internal
+
+} // end of namespace mln
+
+
+#endif // ! MLN_CORE_INTERNAL_NEIGHB_BASE_HH
diff --git a/milena/mln/core/internal/neighb_niter_base.hh b/milena/mln/core/internal/neighb_niter_base.hh
new file mode 100644
index 0000000..6aba054
--- /dev/null
+++ b/milena/mln/core/internal/neighb_niter_base.hh
@@ -0,0 +1,148 @@
+// Copyright (C) 2009 EPITA Research and Development Laboratory (LRDE)
+//
+// This file is part of Olena.
+//
+// Olena is free software: you can redistribute it and/or modify it under
+// the terms of the GNU General Public License as published by the Free
+// Software Foundation, version 2 of the License.
+//
+// Olena is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with Olena. If not, see <http://www.gnu.org/licenses/>.
+//
+// As a special exception, you may use this file as part of a free
+// software project without restriction. Specifically, if other files
+// instantiate templates or use macros or inline functions from this
+// file, or you compile this file and link it with other files to produce
+// an executable, this file does not by itself cause the resulting
+// executable to be covered by the GNU General Public License. This
+// exception does not however invalidate any other reasons why the
+// executable file might be covered by the GNU General Public License.
+
+#ifndef MLN_CORE_INTERNAL_NEIGHB_NITER_BASE_HH
+# define MLN_CORE_INTERNAL_NEIGHB_NITER_BASE_HH
+
+/// \file
+///
+/// Base implementation for neighborhood iterators.
+
+namespace mln
+{
+
+ namespace internal
+ {
+
+ // neighb_niter_base<W,I,E>
+
+ template <typename W, typename N, typename I, typename E>
+ class neighb_niter_base
+ : public internal::site_relative_iterator_base< N,
+ E,
+ mln_psite(N) >,
+ public internal::neighb_niter_impl<W,E>
+ {
+ public:
+
+ /// Constructor without argument.
+ neighb_niter_base();
+
+ template <typename P>
+ neighb_niter_base(const N& nbh, const P& c);
+
+ /// Test the iterator validity.
+ bool is_valid_() const;
+
+ /// Invalidate the iterator.
+ void invalidate_();
+
+ /// Start an iteration.
+ void do_start_();
+
+ /// Go to the next point.
+ void do_next_();
+
+ /// Compute the current psite.
+ mln_psite(W) compute_p_() const;
+
+ protected:
+
+ I i_;
+ };
+
+
+
+# ifndef MLN_INCLUDE_ONLY
+
+
+ // neighb_niter_base<W,N,I,E>
+
+ template <typename W, typename N, typename I, typename E>
+ inline
+ neighb_niter_base<W,N,I,E>::neighb_niter_base()
+ {
+ }
+
+ template <typename W, typename N, typename I, typename E>
+ template <typename P>
+ inline
+ neighb_niter_base<W,N,I,E>::neighb_niter_base(const N& nbh, const P& c)
+ {
+ this->change_target(nbh);
+ this->center_at(c);
+
+ }
+
+ template <typename W, typename N, typename I, typename E>
+ inline
+ bool
+ neighb_niter_base<W,N,I,E>::is_valid_() const
+ {
+ return i_.is_valid();
+ }
+
+ template <typename W, typename N, typename I, typename E>
+ inline
+ void
+ neighb_niter_base<W,N,I,E>::invalidate_()
+ {
+ i_.invalidate();
+ }
+
+ template <typename W, typename N, typename I, typename E>
+ inline
+ void
+ neighb_niter_base<W,N,I,E>::do_start_()
+ {
+ i_.start();
+ }
+
+ template <typename W, typename N, typename I, typename E>
+ inline
+ void
+ neighb_niter_base<W,N,I,E>::do_next_()
+ {
+ i_.next();
+ }
+
+ template <typename W, typename N, typename I, typename E>
+ inline
+ mln_psite(W)
+ neighb_niter_base<W,N,I,E>::compute_p_() const
+ {
+ return i_.compute_p_();
+ }
+
+
+# endif // ! MLN_INCLUDE_ONLY
+
+
+ } // end of namespace mln::internal
+
+} // end of namespace mln
+
+
+#endif // ! MLN_CORE_INTERNAL_NEIGHB_NITER_BASE_HH
diff --git a/milena/mln/core/internal/neighb_niter_impl.hh b/milena/mln/core/internal/neighb_niter_impl.hh
index ea44822..f2c8ee0 100644
--- a/milena/mln/core/internal/neighb_niter_impl.hh
+++ b/milena/mln/core/internal/neighb_niter_impl.hh
@@ -1,4 +1,5 @@
-// Copyright (C) 2008, 2009 EPITA Research and Development Laboratory (LRDE)
+// Copyright (C) 2008, 2009 EPITA Research and Development Laboratory
+// (LRDE)
//
// This file is part of Olena.
//
@@ -39,7 +40,8 @@ namespace mln
// Forward declaration.
template <typename P, typename W> class graph_window_base;
- template <typename G, typename F, typename Q> class graph_elt_window;
+ template <typename G, typename S> class graph_elt_window;
+ template <typename G, typename S, typename S2> class graph_elt_mixed_window;
template <typename G, typename F, typename I> class graph_elt_window_if;
template <typename G, typename F> class line_graph_elt_window;
namespace util
@@ -124,10 +126,10 @@ namespace mln
/// Add more implementation for neighborhoods made from a
/// graph_window_piter.
- template <typename G, typename S, typename Q, typename E>
- struct neighb_niter_impl<graph_elt_window<G,S,Q>, E>
+ template <typename G, typename S, typename E>
+ struct neighb_niter_impl<graph_elt_window<G,S>, E>
: public neighb_niter_impl< graph_window_base< mln_result(S::fun_t),
- graph_elt_window<G,S,Q> >,
+ graph_elt_window<G,S> >,
E >
{
@@ -157,6 +159,18 @@ namespace mln
};
+ /// Add more implementation for neighborhoods made from a
+ /// graph_window_piter.
+ template <typename G, typename S, typename S2, typename E>
+ struct neighb_niter_impl<graph_elt_mixed_window<G,S,S2>, E>
+ : public neighb_niter_impl< graph_window_base< mln_result(S2::fun_t),
+ graph_elt_mixed_window<G,S,S2> >,
+ E >
+ {
+
+ };
+
+
} // end of namespace mln::internal
} // end of namespace mln
diff --git a/milena/mln/core/mixed_neighb.hh b/milena/mln/core/mixed_neighb.hh
new file mode 100644
index 0000000..377bab1
--- /dev/null
+++ b/milena/mln/core/mixed_neighb.hh
@@ -0,0 +1,240 @@
+// Copyright (C) 2009 EPITA Research and Development Laboratory (LRDE)
+//
+// This file is part of Olena.
+//
+// Olena is free software: you can redistribute it and/or modify it under
+// the terms of the GNU General Public License as published by the Free
+// Software Foundation, version 2 of the License.
+//
+// Olena is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with Olena. If not, see <http://www.gnu.org/licenses/>.
+//
+// As a special exception, you may use this file as part of a free
+// software project without restriction. Specifically, if other files
+// instantiate templates or use macros or inline functions from this
+// file, or you compile this file and link it with other files to produce
+// an executable, this file does not by itself cause the resulting
+// executable to be covered by the GNU General Public License. This
+// exception does not however invalidate any other reasons why the
+// executable file might be covered by the GNU General Public License.
+
+#ifndef MLN_CORE_MIXED_NEIGHB_HH
+# define MLN_CORE_MIXED_NEIGHB_HH
+
+/// \file
+///
+/// Definition of a window-to-neighborhood adapter.
+///
+/// Works for windows and neighborhoods having the elements' site set
+/// different from the center's site set.
+///
+///
+/// \todo See if the impl of from_to is fine. What about removing the
+/// origin? etc.
+
+# include <mln/core/internal/neighb_base.hh>
+# include <mln/core/internal/neighb_niter_base.hh>
+# include <mln/core/internal/site_relative_iterator_base.hh>
+# include <mln/core/internal/neighb_niter_impl.hh>
+
+
+namespace mln
+{
+
+ // Forward declarations.
+ template <typename W> class mixed_neighb_fwd_niter;
+ template <typename W> class mixed_neighb_bkd_niter;
+ template <typename W> class mixed_neighb;
+
+
+ namespace convert
+ {
+
+ namespace over_load
+ {
+
+ template <typename W>
+ void
+ from_to_(const mln::mixed_neighb<W>& from, W& to);
+
+ template <typename W>
+ void
+ from_to_(const W& from, mln::mixed_neighb<W>& to);
+
+ } // end of namespace mln::convert::over_load
+
+ } // end of namespace mln::convert
+
+
+
+ /// Adapter class from window to neighborhood.
+
+ template <typename W>
+ class mixed_neighb
+ : public internal::neighb_base<W,mixed_neighb<W> >,
+ private mlc_is_a(W, Window)::check_t
+ {
+ typedef internal::neighb_base<W,mixed_neighb<W> > super_;
+
+ public:
+
+ /// Forward site iterator associated type.
+ typedef mixed_neighb_fwd_niter<W> fwd_niter;
+
+ /// Backward site iterator associated type.
+ typedef mixed_neighb_bkd_niter<W> bkd_niter;
+
+ /// Site iterator associated type.
+ typedef fwd_niter niter;
+
+
+ /// Constructor without argument.
+ mixed_neighb();
+
+ /// Constructor from a window \p win.
+ mixed_neighb(const W& win);
+
+ };
+
+
+ // mixed_neighb_fwd_niter<W>
+
+ template <typename W>
+ class mixed_neighb_fwd_niter
+ : public internal::neighb_niter_base<W,mixed_neighb<W>,
+ mln_fwd_qiter(W),neighb_fwd_niter<W> >
+ {
+ typedef
+ internal::neighb_niter_base<W,mixed_neighb<W>,
+ mln_fwd_qiter(W),neighb_fwd_niter<W> > super_;
+
+ public:
+ mixed_neighb_fwd_niter();
+
+ template <typename P>
+ mixed_neighb_fwd_niter(const mixed_neighb<W>& nbh, const P& c);
+
+ };
+
+
+
+ // mixed_neighb_bkd_niter<W,E>
+
+ template <typename W>
+ class mixed_neighb_bkd_niter
+ : public internal::neighb_niter_base<W,mixed_neighb<W>,
+ mln_bkd_qiter(W),neighb_bkd_niter<W> >
+ {
+ typedef
+ internal::neighb_niter_base<W,mixed_neighb<W>,
+ mln_bkd_qiter(W),neighb_bkd_niter<W> > super_;
+
+ public:
+ mixed_neighb_bkd_niter();
+
+ template <typename P>
+ mixed_neighb_bkd_niter(const mixed_neighb<W>& nbh, const P& c);
+
+ };
+
+
+
+# ifndef MLN_INCLUDE_ONLY
+
+ // mixed_neighb<W>
+
+ template <typename W>
+ inline
+ mixed_neighb<W>::mixed_neighb()
+ {
+ }
+
+ template <typename W>
+ inline
+ mixed_neighb<W>::mixed_neighb(const W& win)
+ : super_(win)
+ {
+ }
+
+
+ // mln::convert::from_to
+
+ namespace convert
+ {
+
+ namespace over_load
+ {
+
+ template <typename W>
+ void
+ from_to_(const mln::mixed_neighb<W>& from, W& to)
+ {
+ to = from.win();
+ }
+
+ template <typename W>
+ void
+ from_to_(const W& from, mln::mixed_neighb<W>& to)
+ {
+ to.change_window(from);
+ }
+
+ } // end of namespace mln::convert::over_load
+
+ } // end of namespace mln::convert
+
+
+
+
+ // mixed_neighb_fwd_niter<W>
+
+ template <typename W>
+ inline
+ mixed_neighb_fwd_niter<W>::mixed_neighb_fwd_niter()
+ {
+ }
+
+ template <typename W>
+ template <typename P>
+ inline
+ mixed_neighb_fwd_niter<W>::mixed_neighb_fwd_niter(const mixed_neighb<W>& nbh,
+ const mln_target(W)& nbh_site_set,
+ const P& c)
+ : super_(nbh, c)
+ {
+ this->i_.init_(nbh.win(), nbh_site_set, c);
+ }
+
+
+
+ // mixed_neighb_bkd_niter<W>
+
+ template <typename W>
+ inline
+ mixed_neighb_bkd_niter<W>::mixed_neighb_bkd_niter()
+ {
+ }
+
+ template <typename W>
+ template <typename P>
+ inline
+ mixed_neighb_bkd_niter<W>::mixed_neighb_bkd_niter(const mixed_neighb<W>& nbh,
+ const mln_target(W)& nbh_site_set,
+ const P& c)
+ : super_(nbh, c)
+ {
+ this->i_.init_(nbh.win(), nbh_site_set, c);
+ }
+
+
+# endif // ! MLN_INCLUDE_ONLY
+
+} // end of namespace mln
+
+
+#endif // ! MLN_CORE_MIXED_NEIGHB_HH
diff --git a/milena/mln/core/neighb.hh b/milena/mln/core/neighb.hh
index 8ce148e..db31bea 100644
--- a/milena/mln/core/neighb.hh
+++ b/milena/mln/core/neighb.hh
@@ -35,7 +35,8 @@
/// \todo See if the impl of from_to is fine. What about removing the
/// origin? etc.
-# include <mln/core/internal/neighborhood_base.hh>
+# include <mln/core/internal/neighb_base.hh>
+# include <mln/core/internal/neighb_niter_base.hh>
# include <mln/core/internal/site_relative_iterator_base.hh>
# include <mln/core/internal/neighb_niter_impl.hh>
@@ -72,9 +73,11 @@ namespace mln
/// Adapter class from window to neighborhood.
template <typename W>
- class neighb : public internal::neighborhood_base< W, neighb<W> >,
- private mlc_is_a(W, Window)::check_t
+ class neighb
+ : public internal::neighb_base<W,neighb<W> >
{
+ typedef internal::neighb_base<W,neighb<W> > super_;
+
public:
/// Forward site iterator associated type.
@@ -93,98 +96,48 @@ namespace mln
/// Constructor from a window \p win.
neighb(const W& win);
- /// Get the corresponding window.
- const W& win() const;
-
- /// Change the corresponding window.
- void change_window(const W& new_win);
-
-
- /// \internal Hook to the window.
- W& hook_win_();
-
- private:
-
- W win_;
};
-
// neighb_fwd_niter<W>
template <typename W>
class neighb_fwd_niter
- : public internal::site_relative_iterator_base< neighb<W>,
- neighb_fwd_niter<W>,
- mln_psite(neighb<W>) >,
- public internal::neighb_niter_impl<W, neighb_fwd_niter<W> >
+ : public internal::neighb_niter_base<W,neighb<W>,
+ mln_fwd_qiter(W),neighb_fwd_niter<W> >
{
- public:
+ typedef
+ internal::neighb_niter_base<W,neighb<W>,
+ mln_fwd_qiter(W),neighb_fwd_niter<W> > super_;
- /// Constructor without argument.
+ public:
neighb_fwd_niter();
template <typename P>
neighb_fwd_niter(const neighb<W>& nbh, const P& c);
- /// Test the iterator validity.
- bool is_valid_() const;
-
- /// Invalidate the iterator.
- void invalidate_();
-
- /// Start an iteration.
- void do_start_();
-
- /// Go to the next point.
- void do_next_();
-
- /// Compute the current psite.
- mln_psite(W) compute_p_() const;
-
- protected:
-
- mln_fwd_qiter(W) i_;
};
-// neighb_bkd_niter<W>
-
-template <typename W>
-class neighb_bkd_niter
- : public internal::site_relative_iterator_base< neighb<W>,
- neighb_bkd_niter<W>,
- mln_psite(neighb<W>)>,
- public internal::neighb_niter_impl<W, neighb_fwd_niter<W> >
-{
-public:
-
- /// Constructor without argument.
- neighb_bkd_niter();
-
- template <typename P>
- neighb_bkd_niter(const neighb<W>& nbh, const P& c);
-
- /// Test the iterator validity.
- bool is_valid_() const;
-
- /// Invalidate the iterator.
- void invalidate_();
-
- /// Start an iteration.
- void do_start_();
+ // neighb_bkd_niter<W,E>
- /// Go to the next point.
- void do_next_();
+ template <typename W>
+ class neighb_bkd_niter
+ : public internal::neighb_niter_base<W,neighb<W>,
+ mln_bkd_qiter(W),neighb_bkd_niter<W> >
+ {
+ typedef
+ internal::neighb_niter_base<W,neighb<W>,
+ mln_bkd_qiter(W),neighb_bkd_niter<W> > super_;
- /// Compute the current psite.
- mln_psite(W) compute_p_() const;
+ public:
+ neighb_bkd_niter();
-protected:
+ template <typename P>
+ neighb_bkd_niter(const neighb<W>& nbh, const P& c);
- mln_bkd_qiter(W) i_;
-};
+ };
@@ -201,33 +154,8 @@ protected:
template <typename W>
inline
neighb<W>::neighb(const W& win)
+ : super_(win)
{
- change_window(win);
- }
-
- template <typename W>
- inline
- const W&
- neighb<W>::win() const
- {
- return win_;
- }
-
- template <typename W>
- inline
- void
- neighb<W>::change_window(const W& new_win)
- {
- mln_precondition(new_win.is_neighbable_());
- win_ = new_win;
- }
-
- template <typename W>
- inline
- W&
- neighb<W>::hook_win_()
- {
- return win_;
}
@@ -258,6 +186,8 @@ protected:
} // end of namespace mln::convert
+
+
// neighb_fwd_niter<W>
template <typename W>
@@ -270,52 +200,11 @@ protected:
template <typename P>
inline
neighb_fwd_niter<W>::neighb_fwd_niter(const neighb<W>& nbh, const P& c)
+ : super_(nbh, c)
{
- this->change_target(nbh);
- this->center_at(c);
- i_.center_at(c); // Always before change_target for this kind of iter.
- i_.change_target(nbh.win());
- }
-
- template <typename W>
- inline
- bool
- neighb_fwd_niter<W>::is_valid_() const
- {
- return i_.is_valid();
- }
-
- template <typename W>
- inline
- void
- neighb_fwd_niter<W>::invalidate_()
- {
- i_.invalidate();
- }
-
- template <typename W>
- inline
- void
- neighb_fwd_niter<W>::do_start_()
- {
- i_.start();
- }
-
- template <typename W>
- inline
- void
- neighb_fwd_niter<W>::do_next_()
- {
- i_.next();
+ this->i_.init_(nbh.win(), c);
}
- template <typename W>
- inline
- mln_psite(W)
- neighb_fwd_niter<W>::compute_p_() const
- {
- return i_.compute_p_();
- }
// neighb_bkd_niter<W>
@@ -330,52 +219,11 @@ protected:
template <typename P>
inline
neighb_bkd_niter<W>::neighb_bkd_niter(const neighb<W>& nbh, const P& c)
+ : super_(nbh, c)
{
- this->change_target(nbh);
- this->center_at(c);
- i_.center_at(c); // Always before change_target for this kind of iter.
- i_.change_target(nbh.win());
+ this->i_.init_(nbh.win(), c);
}
- template <typename W>
- inline
- bool
- neighb_bkd_niter<W>::is_valid_() const
- {
- return i_.is_valid();
- }
-
- template <typename W>
- inline
- void
- neighb_bkd_niter<W>::invalidate_()
- {
- i_.invalidate();
- }
-
- template <typename W>
- inline
- void
- neighb_bkd_niter<W>::do_start_()
- {
- i_.start();
- }
-
- template <typename W>
- inline
- void
- neighb_bkd_niter<W>::do_next_()
- {
- i_.next();
- }
-
- template <typename W>
- inline
- mln_psite(W)
- neighb_bkd_niter<W>::compute_p_() const
- {
- return i_.compute_p_();
- }
# endif // ! MLN_INCLUDE_ONLY
diff --git a/milena/mln/core/window.hh b/milena/mln/core/window.hh
index af8d079..87f1940 100644
--- a/milena/mln/core/window.hh
+++ b/milena/mln/core/window.hh
@@ -1,4 +1,5 @@
-// Copyright (C) 2007, 2008, 2009 EPITA Research and Development Laboratory (LRDE)
+// Copyright (C) 2007, 2008, 2009 EPITA Research and Development
+// Laboratory (LRDE)
//
// This file is part of Olena.
//
diff --git a/milena/tests/core/image/vertex_and_edge_image.cc b/milena/tests/core/image/vertex_and_edge_image.cc
index 60a4609..05aa059 100644
--- a/milena/tests/core/image/vertex_and_edge_image.cc
+++ b/milena/tests/core/image/vertex_and_edge_image.cc
@@ -25,6 +25,7 @@
#include <vector>
+#include <mln/core/image/graph_elt_mixed_window.hh>
#include <mln/core/image/vertex_image.hh>
#include <mln/core/image/edge_image.hh>
#include <mln/fun/i2v/array.hh>
@@ -123,7 +124,7 @@ int main()
mln_piter_(v_ima_t) v(v_ima.domain());
- typedef graph_elt_window<util::graph,
+ typedef graph_elt_mixed_window<util::graph,
v_ima_t::domain_t,
e_ima_t::domain_t> edge_win_t;
edge_win_t win;
--
1.5.6.5
2
1