r4421: Add implementation of HQ3x algorithm

URL: https://svn.lrde.epita.fr/svn/oln/trunk/milena/sandbox ChangeLog: 2009-09-04 Fabien Freling <fabien.freling@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&
participants (1)
-
Fabien Freling