当前位置: 澳门新濠3559 > 编程 > 正文

哈哈算法集,偶然看到hqx算法【澳门新濠3559】

时间:2019-10-06 08:25来源:编程
从今天开始我要训练算法了,用博客记录一下对应代码的github链接:等等(还会不断再加入别的)代码暂时只准备写Java实现的,以后有时间也许可能会写C 或python版,哈哈算法集: 写代

从今天开始我要训练算法了,用博客记录一下对应代码的github链接: 等等(还会不断再加入别的)代码暂时只准备写Java实现的,以后有时间也许可能会写C 或python版,哈哈算法集:

写代码和写文章非常相似,都利用电脑工作,都码字。判断一段代码好不好,能考评的也就是代码的格式,风格还有算法了,下面从这些方面来看看写代码和写文章是多么的相似。

pixel art之 hqx 算法,pixelarthqx算法

在去年的时候,偶然看到hqx算法。

一个高质量的插值放大算法。

与双线性插值等插值算法相比,这个算法放大后对人眼保护相对比较好。

没有双线性插值看起来模糊,固然,也抽空把算法简单优化了一下。

官网及代码:

维基百科:

不够这个算法写得贼恶心,并不适用于学习。

贴上维基百科上的demo效果对比图。

澳门新濠3559 1    澳门新濠3559 2       博主只是简单地把其中的放大两倍的算法,优化了一下,极大地提升算法的速度。 废话不多说,贴上代码:

/*
//(c1*3 c2) >> 2;
#define Interp1(c1, c2) Interpolate_2(c1, c2, 3, 1, 2);
//(c1*2 c2 c3) >> 2; 
#define Interp2(c1, c2, c3) Interpolate_3(c1, c2, c3, 2, 1, 1, 2);
//(c1*7 c2)/8;
#define Interp3(c1, c2) Interpolate_2(c1, c2, 7, 1, 3);
//(c1*2 (c2 c3)*7)/16;
#define Interp4(c1, c2, c3) Interpolate_3(c1, c2, c3, 2, 7, 7, 4);
//(c1 c2) >> 1;
#define Interp5(c1, c2) Interpolate_2(c1, c2, 1, 1, 1);
//(c1*5 c2*2 c3)/8;
#define Interp6(c1, c2, c3) Interpolate_3(c1, c2, c3, 5, 2, 1, 3);
//(c1*6 c2 c3)/8;
#define Interp7(c1, c2, c3) Interpolate_3(c1, c2, c3, 6, 1, 1, 3);
//(c1*5 c2*3)/8;
#define Interp8(c1, c2) Interpolate_2(c1, c2, 5, 3, 3);
//(c1*2 (c2 c3)*3)/8;
#define Interp9(c1, c2, c3) Interpolate_3(c1, c2, c3, 2, 3, 3, 3);
//(c1*14 c2 c3)/16;
#define Interp10(c1, c2, c3) Interpolate_3(c1, c2, c3, 14, 1, 1, 4);
*/

#define MASK_2     0x0000FF00
#define MASK_13    0x00FF00FF 
#define MASK_ALPHA 0xFF000000


#define    rgb_to_y( c)   ((19595 * RED((c))   38470 * GREEN((c))   7471 * BLUE((c))) >> 16)


/* Interpolate functions */
 unsigned int Interpolate_2(unsigned int &c1, unsigned int &c2, int w1, int w2, int shift)
{
    if (c1 == c2) {
        return c1;
    }
    return
        (((((c1 & MASK_ALPHA) >> 24) * w1   ((c2 & MASK_ALPHA) >> 24) * w2) << (24 - shift)) & MASK_ALPHA)  
        ((((c1 & MASK_2) * w1   (c2 & MASK_2) * w2) >> shift) & MASK_2)  
        ((((c1 & MASK_13) * w1   (c2 & MASK_13) * w2) >> shift) & MASK_13);
}
 unsigned int Interpolate_3(unsigned int &c1, unsigned int &c2, unsigned int &c3, int w1, int w2, int w3, int shift)
{
    return
        (((((c1 & MASK_ALPHA) >> 24) * w1   ((c2 & MASK_ALPHA) >> 24) * w2   ((c3 & MASK_ALPHA) >> 24) * w3) << (24 - shift)) & MASK_ALPHA)  
        ((((c1 & MASK_2) * w1   (c2 & MASK_2) * w2   (c3 & MASK_2) * w3) >> shift) & MASK_2)  
        ((((c1 & MASK_13) * w1   (c2 & MASK_13) * w2   (c3 & MASK_13) * w3) >> shift) & MASK_13);
}


void   hq2x_32(unsigned int *input, unsigned int *output, int Width, int Height, int Stride)
{
    int Channels = Stride / Width;
    if (Channels != 4) return;  
    unsigned int pixel[10]; 
    unsigned int gray[10]; 
    int step = 2;
    unsigned int dstStride = (Width * step)*Channels;
    int    dstWidth = (unsigned int)((Width * step)); 
    for (int y = 0; y < Height;   y)
    {
        int    prevline = 0;
        int    nextline = 0;
        if (y > 0)
            prevline = -Width;
        if (y < Height - 1)
            nextline = Width;
        unsigned int* srcRowPtr = input   y*Width;
        unsigned int* dstRowPtr = output   (y<<1)*dstWidth;
        for (int x = 0; x < Width;   x)
        {
            unsigned int&    pixel5 = pixel[5];
            unsigned int&    pixel2 = pixel[2];
            unsigned int&    pixel8 = pixel[8];
            unsigned int&    pixel1 = pixel[1];
            unsigned int&    pixel4 = pixel[4];
            unsigned int&    pixel7 = pixel[7];
            unsigned int&    pixel3 = pixel[3];
            unsigned int&    pixel6 = pixel[6];
            unsigned int&    pixel9 = pixel[9];
            unsigned int&    gray5 = gray[5];
            unsigned int&    gray2 = gray[2];
            unsigned int&    gray8 = gray[8];
            unsigned int&    gray1 = gray[1];
            unsigned int&    gray4 = gray[4];
            unsigned int&    gray7 = gray[7];
            unsigned int&    gray3 = gray[3];
            unsigned int&    gray6 = gray[6];
            unsigned int&    gray9 = gray[9];
            pixel2 = srcRowPtr[prevline];
            pixel5 = srcRowPtr[0];
            pixel8 = srcRowPtr[nextline];
            if (x <= 0)
            {
                pixel1 = pixel2;
                pixel4 = pixel5;
                pixel7 = pixel8;
            }
            else
            {
                pixel1 = srcRowPtr[prevline - 1];
                pixel4 = srcRowPtr[-1];
                pixel7 = srcRowPtr[nextline - 1];
            }
            if (x >= Width - 1)
            {
                pixel3 = pixel2;
                pixel6 = pixel5;
                pixel9 = pixel8;
            }
            else
            {
                pixel3 = srcRowPtr[prevline   1];
                pixel6 = srcRowPtr[1];
                pixel9 = srcRowPtr[nextline   1];
            }
            int    pattern = 0;
            int flag = 1;
            for (int k = 1; k <= 9;   k)
            {
                gray[k] = (7471 * ((pixel[k] >> 16) & 0xFF)   38470 * ((pixel[k] >> 8) & 0xFF)   19595 * (pixel[k] & 0xFF)) >> 16; 
            }
            for (int i = 1; i <= 9;   i)
            {
                if (i != 5)
                {
                    if (pixel[i] != pixel5)
                        pattern |= flag;
                    flag *= 2;
                }
            }
            unsigned int *    dstCurLine = &dstRowPtr[dstWidth];
            unsigned int *    dstCurLineNextPixel = &dstRowPtr[dstWidth   1];

            switch (pattern)
            {
            case 0:
            case 1:
            case 4:
            case 5:
            case 32:
            case 33:
            case 36:
            case 37:
            case 128:
            case 129:
            case 132:
            case 133:
            case 160:
            case 161:
            case 164:
            case 165:
                dstRowPtr[0] = Interpolate_3(pixel5, pixel4, pixel2, 2, 1, 1, 2);
                dstRowPtr[1] = Interpolate_3(pixel5, pixel2, pixel6, 2, 1, 1, 2);
                dstCurLine[0] = Interpolate_3(pixel5, pixel8, pixel4, 2, 1, 1, 2);
                dstCurLineNextPixel [0] = Interpolate_3(pixel5, pixel6, pixel8, 2, 1, 1, 2);
                break;
            case 2:
            case 34:
            case 130:
            case 162:
                dstRowPtr[0] = Interpolate_3(pixel5, pixel1, pixel4, 2, 1, 1, 2);
                dstRowPtr[1] = Interpolate_3(pixel5, pixel3, pixel6, 2, 1, 1, 2);
                dstCurLine[0] = Interpolate_3(pixel5, pixel8, pixel4, 2, 1, 1, 2);
                dstCurLineNextPixel [0] = Interpolate_3(pixel5, pixel6, pixel8, 2, 1, 1, 2);
                break;
            case 16:
            case 17:
            case 48:
            case 49:
                dstRowPtr[0] = Interpolate_3(pixel5, pixel4, pixel2, 2, 1, 1, 2);
                dstRowPtr[1] = Interpolate_3(pixel5, pixel3, pixel2, 2, 1, 1, 2);
                dstCurLine[0] = Interpolate_3(pixel5, pixel8, pixel4, 2, 1, 1, 2);
                dstCurLineNextPixel [0] = Interpolate_3(pixel5, pixel9, pixel8, 2, 1, 1, 2);
                break;
            case 64:
            case 65:
            case 68:
            case 69:
                dstRowPtr[0] = Interpolate_3(pixel5, pixel4, pixel2, 2, 1, 1, 2);
                dstRowPtr[1] = Interpolate_3(pixel5, pixel2, pixel6, 2, 1, 1, 2);
                dstCurLine[0] = Interpolate_3(pixel5, pixel7, pixel4, 2, 1, 1, 2);
                dstCurLineNextPixel [0] = Interpolate_3(pixel5, pixel9, pixel6, 2, 1, 1, 2);
                break;
            case 8:
            case 12:
            case 136:
            case 140:
                dstRowPtr[0] = Interpolate_3(pixel5, pixel1, pixel2, 2, 1, 1, 2);
                dstRowPtr[1] = Interpolate_3(pixel5, pixel2, pixel6, 2, 1, 1, 2);
                dstCurLine[0] = Interpolate_3(pixel5, pixel7, pixel8, 2, 1, 1, 2);
                dstCurLineNextPixel [0] = Interpolate_3(pixel5, pixel6, pixel8, 2, 1, 1, 2);
                break;
            case 3:
            case 35:
            case 131:
            case 163:
                dstRowPtr[0] = Interpolate_2(pixel5, pixel4, 3, 1, 2);
                dstRowPtr[1] = Interpolate_3(pixel5, pixel3, pixel6, 2, 1, 1, 2);
                dstCurLine[0] = Interpolate_3(pixel5, pixel8, pixel4, 2, 1, 1, 2);
                dstCurLineNextPixel [0] = Interpolate_3(pixel5, pixel6, pixel8, 2, 1, 1, 2);
                break;
            case 6:
            case 38:
            case 134:
            case 166:
                dstRowPtr[0] = Interpolate_3(pixel5, pixel1, pixel4, 2, 1, 1, 2);
                dstRowPtr[1] = Interpolate_2(pixel5, pixel6, 3, 1, 2);
                dstCurLine[0] = Interpolate_3(pixel5, pixel8, pixel4, 2, 1, 1, 2);
                dstCurLineNextPixel [0] = Interpolate_3(pixel5, pixel6, pixel8, 2, 1, 1, 2);
                break;
            case 20:
            case 21:
            case 52:
            case 53:
                dstRowPtr[0] = Interpolate_3(pixel5, pixel4, pixel2, 2, 1, 1, 2);
                dstRowPtr[1] = Interpolate_2(pixel5, pixel2, 3, 1, 2);
                dstCurLine[0] = Interpolate_3(pixel5, pixel8, pixel4, 2, 1, 1, 2);
                dstCurLineNextPixel [0] = Interpolate_3(pixel5, pixel9, pixel8, 2, 1, 1, 2);
                break;
            case 144:
            case 145:
            case 176:
            case 177:
                dstRowPtr[0] = Interpolate_3(pixel5, pixel4, pixel2, 2, 1, 1, 2);
                dstRowPtr[1] = Interpolate_3(pixel5, pixel3, pixel2, 2, 1, 1, 2);
                dstCurLine[0] = Interpolate_3(pixel5, pixel8, pixel4, 2, 1, 1, 2);
                dstCurLineNextPixel [0] = Interpolate_2(pixel5, pixel8, 3, 1, 2);
                break;
            case 192:
            case 193:
            case 196:
            case 197:
                dstRowPtr[0] = Interpolate_3(pixel5, pixel4, pixel2, 2, 1, 1, 2);
                dstRowPtr[1] = Interpolate_3(pixel5, pixel2, pixel6, 2, 1, 1, 2);
                dstCurLine[0] = Interpolate_3(pixel5, pixel7, pixel4, 2, 1, 1, 2);
                dstCurLineNextPixel [0] = Interpolate_2(pixel5, pixel6, 3, 1, 2);
                break;
            case 96:
            case 97:
            case 100:
            case 101:
                dstRowPtr[0] = Interpolate_3(pixel5, pixel4, pixel2, 2, 1, 1, 2);
                dstRowPtr[1] = Interpolate_3(pixel5, pixel2, pixel6, 2, 1, 1, 2);
                dstCurLine[0] = Interpolate_2(pixel5, pixel4, 3, 1, 2);
                dstCurLineNextPixel [0] = Interpolate_3(pixel5, pixel9, pixel6, 2, 1, 1, 2);
                break;
            case 40:
            case 44:
            case 168:
            case 172:
                dstRowPtr[0] = Interpolate_3(pixel5, pixel1, pixel2, 2, 1, 1, 2);
                dstRowPtr[1] = Interpolate_3(pixel5, pixel2, pixel6, 2, 1, 1, 2);
                dstCurLine[0] = Interpolate_2(pixel5, pixel8, 3, 1, 2);
                dstCurLineNextPixel [0] = Interpolate_3(pixel5, pixel6, pixel8, 2, 1, 1, 2);
                break;
            case 9:
            case 13:
            case 137:
            case 141:
                dstRowPtr[0] = Interpolate_2(pixel5, pixel2, 3, 1, 2);
                dstRowPtr[1] = Interpolate_3(pixel5, pixel2, pixel6, 2, 1, 1, 2);
                dstCurLine[0] = Interpolate_3(pixel5, pixel7, pixel8, 2, 1, 1, 2);
                dstCurLineNextPixel [0] = Interpolate_3(pixel5, pixel6, pixel8, 2, 1, 1, 2);
                break;
            case 18:
            case 50:
                dstRowPtr[0] = Interpolate_3(pixel5, pixel1, pixel4, 2, 1, 1, 2);
                if (gray2 == gray6)
                    dstRowPtr[1] = Interpolate_3(pixel5, pixel2, pixel6, 2, 1, 1, 2);
                else
                    dstRowPtr[1] = Interpolate_2(pixel5, pixel3, 3, 1, 2);
                dstCurLine[0] = Interpolate_3(pixel5, pixel8, pixel4, 2, 1, 1, 2);
                dstCurLineNextPixel [0] = Interpolate_3(pixel5, pixel9, pixel8, 2, 1, 1, 2);
                break;
            case 80:
            case 81:
                dstRowPtr[0] = Interpolate_3(pixel5, pixel4, pixel2, 2, 1, 1, 2);
                dstRowPtr[1] = Interpolate_3(pixel5, pixel3, pixel2, 2, 1, 1, 2);
                dstCurLine[0] = Interpolate_3(pixel5, pixel7, pixel4, 2, 1, 1, 2);
                if (gray6 == gray8)
                    dstCurLineNextPixel [0] = Interpolate_3(pixel5, pixel6, pixel8, 2, 1, 1, 2);
                else
                    dstCurLineNextPixel [0] = Interpolate_2(pixel5, pixel9, 3, 1, 2);
                break;
            case 72:
            case 76:
                dstRowPtr[0] = Interpolate_3(pixel5, pixel1, pixel2, 2, 1, 1, 2);
                dstRowPtr[1] = Interpolate_3(pixel5, pixel2, pixel6, 2, 1, 1, 2);
                if (gray8 == gray4)
                    dstCurLine[0] = Interpolate_3(pixel5, pixel8, pixel4, 2, 1, 1, 2);
                else
                    dstCurLine[0] = Interpolate_2(pixel5, pixel7, 3, 1, 2);
                dstCurLineNextPixel [0] = Interpolate_3(pixel5, pixel9, pixel6, 2, 1, 1, 2);
                break;
            case 10:
            case 138:
                if (gray4 == gray2)
                    dstRowPtr[0] = Interpolate_3(pixel5, pixel4, pixel2, 2, 1, 1, 2);
                else
                    dstRowPtr[0] = Interpolate_2(pixel5, pixel1, 3, 1, 2);
                dstRowPtr[1] = Interpolate_3(pixel5, pixel3, pixel6, 2, 1, 1, 2);
                dstCurLine[0] = Interpolate_3(pixel5, pixel7, pixel8, 2, 1, 1, 2);
                dstCurLineNextPixel [0] = Interpolate_3(pixel5, pixel6, pixel8, 2, 1, 1, 2);
                break;
            case 66:
                dstRowPtr[0] = Interpolate_3(pixel5, pixel1, pixel4, 2, 1, 1, 2);
                dstRowPtr[1] = Interpolate_3(pixel5, pixel3, pixel6, 2, 1, 1, 2);
                dstCurLine[0] = Interpolate_3(pixel5, pixel7, pixel4, 2, 1, 1, 2);
                dstCurLineNextPixel [0] = Interpolate_3(pixel5, pixel9, pixel6, 2, 1, 1, 2);
                break;
            case 24:
                dstRowPtr[0] = Interpolate_3(pixel5, pixel1, pixel2, 2, 1, 1, 2);
                dstRowPtr[1] = Interpolate_3(pixel5, pixel3, pixel2, 2, 1, 1, 2);
                dstCurLine[0] = Interpolate_3(pixel5, pixel7, pixel8, 2, 1, 1, 2);
                dstCurLineNextPixel [0] = Interpolate_3(pixel5, pixel9, pixel8, 2, 1, 1, 2);
                break;
            case 7:
            case 39:
            case 135:
                dstRowPtr[0] = Interpolate_2(pixel5, pixel4, 3, 1, 2);
                dstRowPtr[1] = Interpolate_2(pixel5, pixel6, 3, 1, 2);
                dstCurLine[0] = Interpolate_3(pixel5, pixel8, pixel4, 2, 1, 1, 2);
                dstCurLineNextPixel [0] = Interpolate_3(pixel5, pixel6, pixel8, 2, 1, 1, 2);
                break;
            case 148:
            case 149:
            case 180:
                dstRowPtr[0] = Interpolate_3(pixel5, pixel4, pixel2, 2, 1, 1, 2);
                dstRowPtr[1] = Interpolate_2(pixel5, pixel2, 3, 1, 2);
                dstCurLine[0] = Interpolate_3(pixel5, pixel8, pixel4, 2, 1, 1, 2);
                dstCurLineNextPixel [0] = Interpolate_2(pixel5, pixel8, 3, 1, 2);
                break;
            case 224:
            case 225:
            case 228:
                dstRowPtr[0] = Interpolate_3(pixel5, pixel4, pixel2, 2, 1, 1, 2);
                dstRowPtr[1] = Interpolate_3(pixel5, pixel2, pixel6, 2, 1, 1, 2);
                dstCurLine[0] = Interpolate_2(pixel5, pixel4, 3, 1, 2);
                dstCurLineNextPixel [0] = Interpolate_2(pixel5, pixel6, 3, 1, 2);
                break;
            case 41:
            case 45:
            case 169:
                dstRowPtr[0] = Interpolate_2(pixel5, pixel2, 3, 1, 2);
                dstRowPtr[1] = Interpolate_3(pixel5, pixel2, pixel6, 2, 1, 1, 2);
                dstCurLine[0] = Interpolate_2(pixel5, pixel8, 3, 1, 2);
                dstCurLineNextPixel [0] = Interpolate_3(pixel5, pixel6, pixel8, 2, 1, 1, 2);
                break;
            case 22:
            case 54:
                dstRowPtr[0] = Interpolate_3(pixel5, pixel1, pixel4, 2, 1, 1, 2);
                if (gray2 == gray6)
                    dstRowPtr[1] = Interpolate_3(pixel5, pixel2, pixel6, 2, 1, 1, 2);
                else
                    dstRowPtr[1] = pixel5;
                dstCurLine[0] = Interpolate_3(pixel5, pixel8, pixel4, 2, 1, 1, 2);
                dstCurLineNextPixel [0] = Interpolate_3(pixel5, pixel9, pixel8, 2, 1, 1, 2);
                break;
            case 208:
            case 209:
                dstRowPtr[0] = Interpolate_3(pixel5, pixel4, pixel2, 2, 1, 1, 2);
                dstRowPtr[1] = Interpolate_3(pixel5, pixel3, pixel2, 2, 1, 1, 2);
                dstCurLine[0] = Interpolate_3(pixel5, pixel7, pixel4, 2, 1, 1, 2);
                if (gray6 == gray8)
                    dstCurLineNextPixel [0] = Interpolate_3(pixel5, pixel6, pixel8, 2, 1, 1, 2);
                else
                    dstCurLineNextPixel [0] = pixel5;
                break;
            case 104:
            case 108:
                dstRowPtr[0] = Interpolate_3(pixel5, pixel1, pixel2, 2, 1, 1, 2);
                dstRowPtr[1] = Interpolate_3(pixel5, pixel2, pixel6, 2, 1, 1, 2);
                if (gray8 == gray4)
                    dstCurLine[0] = Interpolate_3(pixel5, pixel8, pixel4, 2, 1, 1, 2);
                else
                    dstCurLine[0] = pixel5;
                dstCurLineNextPixel [0] = Interpolate_3(pixel5, pixel9, pixel6, 2, 1, 1, 2);
                break;
            case 11:
            case 139:
                if (gray4 == gray2)
                    dstRowPtr[0] = Interpolate_3(pixel5, pixel4, pixel2, 2, 1, 1, 2);
                else
                    dstRowPtr[0] = pixel5;
                dstRowPtr[1] = Interpolate_3(pixel5, pixel3, pixel6, 2, 1, 1, 2);
                dstCurLine[0] = Interpolate_3(pixel5, pixel7, pixel8, 2, 1, 1, 2);
                dstCurLineNextPixel [0] = Interpolate_3(pixel5, pixel6, pixel8, 2, 1, 1, 2);
                break;
            case 19:
            case 51:
                if (gray2 == gray6)
                {
                    dstRowPtr[0] = Interpolate_3(pixel5, pixel2, pixel4, 5, 2, 1, 3);
                    dstRowPtr[1] = Interpolate_3(pixel5, pixel2, pixel6, 2, 3, 3, 3);
                }
                else
                {
                    dstRowPtr[0] = Interpolate_2(pixel5, pixel4, 3, 1, 2);
                    dstRowPtr[1] = Interpolate_2(pixel5, pixel3, 3, 1, 2);
                }
                dstCurLine[0] = Interpolate_3(pixel5, pixel8, pixel4, 2, 1, 1, 2);
                dstCurLineNextPixel [0] = Interpolate_3(pixel5, pixel9, pixel8, 2, 1, 1, 2);
                break;
            case 146:
            case 178:
                dstRowPtr[0] = Interpolate_3(pixel5, pixel1, pixel4, 2, 1, 1, 2);
                if (gray2 == gray6)
                {
                    dstRowPtr[1] = Interpolate_3(pixel5, pixel2, pixel6, 2, 3, 3, 3);
                    dstCurLineNextPixel [0] = Interpolate_3(pixel5, pixel6, pixel8, 5, 2, 1, 3);
                }
                else
                {
                    dstRowPtr[1] = Interpolate_2(pixel5, pixel3, 3, 1, 2);
                    dstCurLineNextPixel [0] = Interpolate_2(pixel5, pixel8, 3, 1, 2);
                }
                dstCurLine[0] = Interpolate_3(pixel5, pixel8, pixel4, 2, 1, 1, 2);
                break;
            case 84:
            case 85:
                dstRowPtr[0] = Interpolate_3(pixel5, pixel4, pixel2, 2, 1, 1, 2);
                if (gray6 == gray8)
                {
                    dstRowPtr[1] = Interpolate_3(pixel5, pixel6, pixel2, 5, 2, 1, 3);
                    dstCurLineNextPixel [0] = Interpolate_3(pixel5, pixel6, pixel8, 2, 3, 3, 3);
                }
                else
                {
                    dstRowPtr[1] = Interpolate_2(pixel5, pixel2, 3, 1, 2);
                    dstCurLineNextPixel [0] = Interpolate_2(pixel5, pixel9, 3, 1, 2);
                }
                dstCurLine[0] = Interpolate_3(pixel5, pixel7, pixel4, 2, 1, 1, 2);
                break;
            case 112:
            case 113:
                dstRowPtr[0] = Interpolate_3(pixel5, pixel4, pixel2, 2, 1, 1, 2);
                dstRowPtr[1] = Interpolate_3(pixel5, pixel3, pixel2, 2, 1, 1, 2);
                if (gray6 == gray8)
                {
                    dstCurLine[0] = Interpolate_3(pixel5, pixel8, pixel4, 5, 2, 1, 3);
                    dstCurLineNextPixel [0] = Interpolate_3(pixel5, pixel6, pixel8, 2, 3, 3, 3);
                }
                else
                {
                    dstCurLine[0] = Interpolate_2(pixel5, pixel4, 3, 1, 2);
                    dstCurLineNextPixel [0] = Interpolate_2(pixel5, pixel9, 3, 1, 2);
                }
                break;
            case 200:
            case 204:
                dstRowPtr[0] = Interpolate_3(pixel5, pixel1, pixel2, 2, 1, 1, 2);
                dstRowPtr[1] = Interpolate_3(pixel5, pixel2, pixel6, 2, 1, 1, 2);
                if (gray8 == gray4)
                {
                    dstCurLine[0] = Interpolate_3(pixel5, pixel8, pixel4, 2, 3, 3, 3);
                    dstCurLineNextPixel [0] = Interpolate_3(pixel5, pixel8, pixel6, 5, 2, 1, 3);
                }
                else
                {
                    dstCurLine[0] = Interpolate_2(pixel5, pixel7, 3, 1, 2);
                    dstCurLineNextPixel [0] = Interpolate_2(pixel5, pixel6, 3, 1, 2);
                }
                break;
            case 73:
            case 77:
                if (gray8 == gray4)
                {
                    dstRowPtr[0] = Interpolate_3(pixel5, pixel4, pixel2, 5, 2, 1, 3);
                    dstCurLine[0] = Interpolate_3(pixel5, pixel8, pixel4, 2, 3, 3, 3);
                }
                else
                {
                    dstRowPtr[0] = Interpolate_2(pixel5, pixel2, 3, 1, 2);
                    dstCurLine[0] = Interpolate_2(pixel5, pixel7, 3, 1, 2);
                }
                dstRowPtr[1] = Interpolate_3(pixel5, pixel2, pixel6, 2, 1, 1, 2);
                dstCurLineNextPixel [0] = Interpolate_3(pixel5, pixel9, pixel6, 2, 1, 1, 2);
                break;
            case 42:
            case 170:
                if (gray4 == gray2)
                {
                    dstRowPtr[0] = Interpolate_3(pixel5, pixel4, pixel2, 2, 3, 3, 3);
                    dstCurLine[0] = Interpolate_3(pixel5, pixel4, pixel8, 5, 2, 1, 3);
                }
                else
                {
                    dstRowPtr[0] = Interpolate_2(pixel5, pixel1, 3, 1, 2);
                    dstCurLine[0] = Interpolate_2(pixel5, pixel8, 3, 1, 2);
                }
                dstRowPtr[1] = Interpolate_3(pixel5, pixel3, pixel6, 2, 1, 1, 2);
                dstCurLineNextPixel [0] = Interpolate_3(pixel5, pixel6, pixel8, 2, 1, 1, 2);
                break;
            case 14:
            case 142:
                if (gray4 == gray2)
                {
                    dstRowPtr[0] = Interpolate_3(pixel5, pixel4, pixel2, 2, 3, 3, 3);
                    dstRowPtr[1] = Interpolate_3(pixel5, pixel2, pixel6, 5, 2, 1, 3);
                }
                else
                {
                    dstRowPtr[0] = Interpolate_2(pixel5, pixel1, 3, 1, 2);
                    dstRowPtr[1] = Interpolate_2(pixel5, pixel6, 3, 1, 2);
                }
                dstCurLine[0] = Interpolate_3(pixel5, pixel7, pixel8, 2, 1, 1, 2);
                dstCurLineNextPixel [0] = Interpolate_3(pixel5, pixel6, pixel8, 2, 1, 1, 2);
                break;
            case 67:
                dstRowPtr[0] = Interpolate_2(pixel5, pixel4, 3, 1, 2);
                dstRowPtr[1] = Interpolate_3(pixel5, pixel3, pixel6, 2, 1, 1, 2);
                dstCurLine[0] = Interpolate_3(pixel5, pixel7, pixel4, 2, 1, 1, 2);
                dstCurLineNextPixel [0] = Interpolate_3(pixel5, pixel9, pixel6, 2, 1, 1, 2);
                break;
            case 70:
                dstRowPtr[0] = Interpolate_3(pixel5, pixel1, pixel4, 2, 1, 1, 2);
                dstRowPtr[1] = Interpolate_2(pixel5, pixel6, 3, 1, 2);
                dstCurLine[0] = Interpolate_3(pixel5, pixel7, pixel4, 2, 1, 1, 2);
                dstCurLineNextPixel [0] = Interpolate_3(pixel5, pixel9, pixel6, 2, 1, 1, 2);
                break;
            case 28:
                dstRowPtr[0] = Interpolate_3(pixel5, pixel1, pixel2, 2, 1, 1, 2);
                dstRowPtr[1] = Interpolate_2(pixel5, pixel2, 3, 1, 2);
                dstCurLine[0] = Interpolate_3(pixel5, pixel7, pixel8, 2, 1, 1, 2);
                dstCurLineNextPixel [0] = Interpolate_3(pixel5, pixel9, pixel8, 2, 1, 1, 2);
                break;
            case 152:
                dstRowPtr[0] = Interpolate_3(pixel5, pixel1, pixel2, 2, 1, 1, 2);
                dstRowPtr[1] = Interpolate_3(pixel5, pixel3, pixel2, 2, 1, 1, 2);
                dstCurLine[0] = Interpolate_3(pixel5, pixel7, pixel8, 2, 1, 1, 2);
                dstCurLineNextPixel [0] = Interpolate_2(pixel5, pixel8, 3, 1, 2);
                break;
            case 194:
                dstRowPtr[0] = Interpolate_3(pixel5, pixel1, pixel4, 2, 1, 1, 2);
                dstRowPtr[1] = Interpolate_3(pixel5, pixel3, pixel6, 2, 1, 1, 2);
                dstCurLine[0] = Interpolate_3(pixel5, pixel7, pixel4, 2, 1, 1, 2);
                dstCurLineNextPixel [0] = Interpolate_2(pixel5, pixel6, 3, 1, 2);
                break;
            case 98:
                dstRowPtr[0] = Interpolate_3(pixel5, pixel1, pixel4, 2, 1, 1, 2);
                dstRowPtr[1] = Interpolate_3(pixel5, pixel3, pixel6, 2, 1, 1, 2);
                dstCurLine[0] = Interpolate_2(pixel5, pixel4, 3, 1, 2);
                dstCurLineNextPixel [0] = Interpolate_3(pixel5, pixel9, pixel6, 2, 1, 1, 2);
                break;
            case 56:
                dstRowPtr[0] = Interpolate_3(pixel5, pixel1, pixel2, 2, 1, 1, 2);
                dstRowPtr[1] = Interpolate_3(pixel5, pixel3, pixel2, 2, 1, 1, 2);
                dstCurLine[0] = Interpolate_2(pixel5, pixel8, 3, 1, 2);
                dstCurLineNextPixel [0] = Interpolate_3(pixel5, pixel9, pixel8, 2, 1, 1, 2);
                break;
            case 25:
                dstRowPtr[0] = Interpolate_2(pixel5, pixel2, 3, 1, 2);
                dstRowPtr[1] = Interpolate_3(pixel5, pixel3, pixel2, 2, 1, 1, 2);
                dstCurLine[0] = Interpolate_3(pixel5, pixel7, pixel8, 2, 1, 1, 2);
                dstCurLineNextPixel [0] = Interpolate_3(pixel5, pixel9, pixel8, 2, 1, 1, 2);
                break;
            case 26:
            case 31:
                if (gray4 == gray2)
                    dstRowPtr[0] = Interpolate_3(pixel5, pixel4, pixel2, 2, 1, 1, 2);
                else
                    dstRowPtr[0] = pixel5;
                if (gray2 == gray6)
                    dstRowPtr[1] = Interpolate_3(pixel5, pixel2, pixel6, 2, 1, 1, 2);
                else
                    dstRowPtr[1] = pixel5;
                dstCurLine[0] = Interpolate_3(pixel5, pixel7, pixel8, 2, 1, 1, 2);
                dstCurLineNextPixel [0] = Interpolate_3(pixel5, pixel9, pixel8, 2, 1, 1, 2);
                break;
            case 82:
            case 214:
                dstRowPtr[0] = Interpolate_3(pixel5, pixel1, pixel4, 2, 1, 1, 2);
                if (gray2 == gray6)
                    dstRowPtr[1] = Interpolate_3(pixel5, pixel2, pixel6, 2, 1, 1, 2);
                else
                    dstRowPtr[1] = pixel5;
                dstCurLine[0] = Interpolate_3(pixel5, pixel7, pixel4, 2, 1, 1, 2);
                if (gray6 == gray8)
                    dstCurLineNextPixel [0] = Interpolate_3(pixel5, pixel6, pixel8, 2, 1, 1, 2);
                else
                    dstCurLineNextPixel [0] = pixel5;
                break;
            case 88:
            case 248:
                dstRowPtr[0] = Interpolate_3(pixel5, pixel1, pixel2, 2, 1, 1, 2);
                dstRowPtr[1] = Interpolate_3(pixel5, pixel3, pixel2, 2, 1, 1, 2);
                if (gray8 == gray4)
                    dstCurLine[0] = Interpolate_3(pixel5, pixel8, pixel4, 2, 1, 1, 2);
                else
                    dstCurLine[0] = pixel5;
                if (gray6 == gray8)
                    dstCurLineNextPixel [0] = Interpolate_3(pixel5, pixel6, pixel8, 2, 1, 1, 2);
                else
                    dstCurLineNextPixel [0] = pixel5;
                break;
            case 74:
            case 107:
                if (gray4 == gray2)
                    dstRowPtr[0] = Interpolate_3(pixel5, pixel4, pixel2, 2, 1, 1, 2);
                else
                    dstRowPtr[0] = pixel5;
                dstRowPtr[1] = Interpolate_3(pixel5, pixel3, pixel6, 2, 1, 1, 2);
                if (gray8 == gray4)
                    dstCurLine[0] = Interpolate_3(pixel5, pixel8, pixel4, 2, 1, 1, 2);
                else
                    dstCurLine[0] = pixel5;
                dstCurLineNextPixel [0] = Interpolate_3(pixel5, pixel9, pixel6, 2, 1, 1, 2);
                break;
            case 27:
                if (gray4 == gray2)
                    dstRowPtr[0] = Interpolate_3(pixel5, pixel4, pixel2, 2, 1, 1, 2);
                else
                    dstRowPtr[0] = pixel5;
                dstRowPtr[1] = Interpolate_2(pixel5, pixel3, 3, 1, 2);
                dstCurLine[0] = Interpolate_3(pixel5, pixel7, pixel8, 2, 1, 1, 2);
                dstCurLineNextPixel [0] = Interpolate_3(pixel5, pixel9, pixel8, 2, 1, 1, 2);
                break;
            case 86:
                dstRowPtr[0] = Interpolate_3(pixel5, pixel1, pixel4, 2, 1, 1, 2);
                if (gray2 == gray6)
                    dstRowPtr[1] = Interpolate_3(pixel5, pixel2, pixel6, 2, 1, 1, 2);
                else
                    dstRowPtr[1] = pixel5;
                dstCurLine[0] = Interpolate_3(pixel5, pixel7, pixel4, 2, 1, 1, 2);
                dstCurLineNextPixel [0] = Interpolate_2(pixel5, pixel9, 3, 1, 2);
                break;
            case 216:
                dstRowPtr[0] = Interpolate_3(pixel5, pixel1, pixel2, 2, 1, 1, 2);
                dstRowPtr[1] = Interpolate_3(pixel5, pixel3, pixel2, 2, 1, 1, 2);
                dstCurLine[0] = Interpolate_2(pixel5, pixel7, 3, 1, 2);
                if (gray6 == gray8)
                    dstCurLineNextPixel [0] = Interpolate_3(pixel5, pixel6, pixel8, 2, 1, 1, 2);
                else
                    dstCurLineNextPixel [0] = pixel5;
                break;
            case 106:
                dstRowPtr[0] = Interpolate_2(pixel5, pixel1, 3, 1, 2);
                dstRowPtr[1] = Interpolate_3(pixel5, pixel3, pixel6, 2, 1, 1, 2);
                if (gray8 == gray4)
                    dstCurLine[0] = Interpolate_3(pixel5, pixel8, pixel4, 2, 1, 1, 2);
                else
                    dstCurLine[0] = pixel5;
                dstCurLineNextPixel [0] = Interpolate_3(pixel5, pixel9, pixel6, 2, 1, 1, 2);
                break;
            case 30:
                dstRowPtr[0] = Interpolate_2(pixel5, pixel1, 3, 1, 2);
                if (gray2 == gray6)
                    dstRowPtr[1] = Interpolate_3(pixel5, pixel2, pixel6, 2, 1, 1, 2);
                else
                    dstRowPtr[1] = pixel5;
                dstCurLine[0] = Interpolate_3(pixel5, pixel7, pixel8, 2, 1, 1, 2);
                dstCurLineNextPixel [0] = Interpolate_3(pixel5, pixel9, pixel8, 2, 1, 1, 2);
                break;
            case 210:
                dstRowPtr[0] = Interpolate_3(pixel5, pixel1, pixel4, 2, 1, 1, 2);
                dstRowPtr[1] = Interpolate_2(pixel5, pixel3, 3, 1, 2);
                dstCurLine[0] = Interpolate_3(pixel5, pixel7, pixel4, 2, 1, 1, 2);
                if (gray6 == gray8)
                    dstCurLineNextPixel [0] = Interpolate_3(pixel5, pixel6, pixel8, 2, 1, 1, 2);
                else
                    dstCurLineNextPixel [0] = pixel5;
                break;
            case 120:
                dstRowPtr[0] = Interpolate_3(pixel5, pixel1, pixel2, 2, 1, 1, 2);
                dstRowPtr[1] = Interpolate_3(pixel5, pixel3, pixel2, 2, 1, 1, 2);
                if (gray8 == gray4)
                    dstCurLine[0] = Interpolate_3(pixel5, pixel8, pixel4, 2, 1, 1, 2);
                else
                    dstCurLine[0] = pixel5;
                dstCurLineNextPixel [0] = Interpolate_2(pixel5, pixel9, 3, 1, 2);
                break;
            case 75:
                if (gray4 == gray2)
                    dstRowPtr[0] = Interpolate_3(pixel5, pixel4, pixel2, 2, 1, 1, 2);
                else
                    dstRowPtr[0] = pixel5;
                dstRowPtr[1] = Interpolate_3(pixel5, pixel3, pixel6, 2, 1, 1, 2);
                dstCurLine[0] = Interpolate_2(pixel5, pixel7, 3, 1, 2);
                dstCurLineNextPixel [0] = Interpolate_3(pixel5, pixel9, pixel6, 2, 1, 1, 2);
                break;
            case 29:
                dstRowPtr[0] = Interpolate_2(pixel5, pixel2, 3, 1, 2);
                dstRowPtr[1] = Interpolate_2(pixel5, pixel2, 3, 1, 2);
                dstCurLine[0] = Interpolate_3(pixel5, pixel7, pixel8, 2, 1, 1, 2);
                dstCurLineNextPixel [0] = Interpolate_3(pixel5, pixel9, pixel8, 2, 1, 1, 2);
                break;
            case 198:
                dstRowPtr[0] = Interpolate_3(pixel5, pixel1, pixel4, 2, 1, 1, 2);
                dstRowPtr[1] = Interpolate_2(pixel5, pixel6, 3, 1, 2);
                dstCurLine[0] = Interpolate_3(pixel5, pixel7, pixel4, 2, 1, 1, 2);
                dstCurLineNextPixel [0] = Interpolate_2(pixel5, pixel6, 3, 1, 2);
                break;
            case 184:
                dstRowPtr[0] = Interpolate_3(pixel5, pixel1, pixel2, 2, 1, 1, 2);
                dstRowPtr[1] = Interpolate_3(pixel5, pixel3, pixel2, 2, 1, 1, 2);
                dstCurLine[0] = Interpolate_2(pixel5, pixel8, 3, 1, 2);
                dstCurLineNextPixel [0] = Interpolate_2(pixel5, pixel8, 3, 1, 2);
                break;
            case 99:
                dstRowPtr[0] = Interpolate_2(pixel5, pixel4, 3, 1, 2);
                dstRowPtr[1] = Interpolate_3(pixel5, pixel3, pixel6, 2, 1, 1, 2);
                dstCurLine[0] = Interpolate_2(pixel5, pixel4, 3, 1, 2);
                dstCurLineNextPixel [0] = Interpolate_3(pixel5, pixel9, pixel6, 2, 1, 1, 2);
                break;
            case 57:
                dstRowPtr[0] = Interpolate_2(pixel5, pixel2, 3, 1, 2);
                dstRowPtr[1] = Interpolate_3(pixel5, pixel3, pixel2, 2, 1, 1, 2);
                dstCurLine[0] = Interpolate_2(pixel5, pixel8, 3, 1, 2);
                dstCurLineNextPixel [0] = Interpolate_3(pixel5, pixel9, pixel8, 2, 1, 1, 2);
                break;
            case 71:
                dstRowPtr[0] = Interpolate_2(pixel5, pixel4, 3, 1, 2);
                dstRowPtr[1] = Interpolate_2(pixel5, pixel6, 3, 1, 2);
                dstCurLine[0] = Interpolate_3(pixel5, pixel7, pixel4, 2, 1, 1, 2);
                dstCurLineNextPixel [0] = Interpolate_3(pixel5, pixel9, pixel6, 2, 1, 1, 2);
                break;
            case 156:
                dstRowPtr[0] = Interpolate_3(pixel5, pixel1, pixel2, 2, 1, 1, 2);
                dstRowPtr[1] = Interpolate_2(pixel5, pixel2, 3, 1, 2);
                dstCurLine[0] = Interpolate_3(pixel5, pixel7, pixel8, 2, 1, 1, 2);
                dstCurLineNextPixel [0] = Interpolate_2(pixel5, pixel8, 3, 1, 2);
                break;
            case 226:
                dstRowPtr[0] = Interpolate_3(pixel5, pixel1, pixel4, 2, 1, 1, 2);
                dstRowPtr[1] = Interpolate_3(pixel5, pixel3, pixel6, 2, 1, 1, 2);
                dstCurLine[0] = Interpolate_2(pixel5, pixel4, 3, 1, 2);
                dstCurLineNextPixel [0] = Interpolate_2(pixel5, pixel6, 3, 1, 2);
                break;
            case 60:
                dstRowPtr[0] = Interpolate_3(pixel5, pixel1, pixel2, 2, 1, 1, 2);
                dstRowPtr[1] = Interpolate_2(pixel5, pixel2, 3, 1, 2);
                dstCurLine[0] = Interpolate_2(pixel5, pixel8, 3, 1, 2);
                dstCurLineNextPixel [0] = Interpolate_3(pixel5, pixel9, pixel8, 2, 1, 1, 2);
                break;
            case 195:
                dstRowPtr[0] = Interpolate_2(pixel5, pixel4, 3, 1, 2);
                dstRowPtr[1] = Interpolate_3(pixel5, pixel3, pixel6, 2, 1, 1, 2);
                dstCurLine[0] = Interpolate_3(pixel5, pixel7, pixel4, 2, 1, 1, 2);
                dstCurLineNextPixel [0] = Interpolate_2(pixel5, pixel6, 3, 1, 2);
                break;
            case 102:
                dstRowPtr[0] = Interpolate_3(pixel5, pixel1, pixel4, 2, 1, 1, 2);
                dstRowPtr[1] = Interpolate_2(pixel5, pixel6, 3, 1, 2);
                dstCurLine[0] = Interpolate_2(pixel5, pixel4, 3, 1, 2);
                dstCurLineNextPixel [0] = Interpolate_3(pixel5, pixel9, pixel6, 2, 1, 1, 2);
                break;
            case 153:
                dstRowPtr[0] = Interpolate_2(pixel5, pixel2, 3, 1, 2);
                dstRowPtr[1] = Interpolate_3(pixel5, pixel3, pixel2, 2, 1, 1, 2);
                dstCurLine[0] = Interpolate_3(pixel5, pixel7, pixel8, 2, 1, 1, 2);
                dstCurLineNextPixel [0] = Interpolate_2(pixel5, pixel8, 3, 1, 2);
                break;
            case 58:
                if (gray4 == gray2)
                    dstRowPtr[0] = Interpolate_3(pixel5, pixel4, pixel2, 6, 1, 1, 3);
                else
                    dstRowPtr[0] = Interpolate_2(pixel5, pixel1, 3, 1, 2);
                if (gray2 == gray6)
                    dstRowPtr[1] = Interpolate_3(pixel5, pixel2, pixel6, 6, 1, 1, 3);
                else
                    dstRowPtr[1] = Interpolate_2(pixel5, pixel3, 3, 1, 2);
                dstCurLine[0] = Interpolate_2(pixel5, pixel8, 3, 1, 2);
                dstCurLineNextPixel [0] = Interpolate_3(pixel5, pixel9, pixel8, 2, 1, 1, 2);
                break;
            case 83:
                dstRowPtr[0] = Interpolate_2(pixel5, pixel4, 3, 1, 2);
                if (gray2 == gray6)
                    dstRowPtr[1] = Interpolate_3(pixel5, pixel2, pixel6, 6, 1, 1, 3);
                else
                    dstRowPtr[1] = Interpolate_2(pixel5, pixel3, 3, 1, 2);
                dstCurLine[0] = Interpolate_3(pixel5, pixel7, pixel4, 2, 1, 1, 2);
                if (gray6 == gray8)
                    dstCurLineNextPixel [0] = Interpolate_3(pixel5, pixel6, pixel8, 6, 1, 1, 3);
                else
                    dstCurLineNextPixel [0] = Interpolate_2(pixel5, pixel9, 3, 1, 2);
                break;
            case 92:
                dstRowPtr[0] = Interpolate_3(pixel5, pixel1, pixel2, 2, 1, 1, 2);
                dstRowPtr[1] = Interpolate_2(pixel5, pixel2, 3, 1, 2);
                if (gray8 == gray4)
                    dstCurLine[0] = Interpolate_3(pixel5, pixel8, pixel4, 6, 1, 1, 3);
                else
                    dstCurLine[0] = Interpolate_2(pixel5, pixel7, 3, 1, 2);
                if (gray6 == gray8)
                    dstCurLineNextPixel [0] = Interpolate_3(pixel5, pixel6, pixel8, 6, 1, 1, 3);
                else
                    dstCurLineNextPixel [0] = Interpolate_2(pixel5, pixel9, 3, 1, 2);
                break;
            case 202:
                if (gray4 == gray2)
                    dstRowPtr[0] = Interpolate_3(pixel5, pixel4, pixel2, 6, 1, 1, 3);
                else
                    dstRowPtr[0] = Interpolate_2(pixel5, pixel1, 3, 1, 2);
                dstRowPtr[1] = Interpolate_3(pixel5, pixel3, pixel6, 2, 1, 1, 2);
                if (gray8 == gray4)
                    dstCurLine[0] = Interpolate_3(pixel5, pixel8, pixel4, 6, 1, 1, 3);
                else
                    dstCurLine[0] = Interpolate_2(pixel5, pixel7, 3, 1, 2);
                dstCurLineNextPixel [0] = Interpolate_2(pixel5, pixel6, 3, 1, 2);
                break;
            case 78:
                if (gray4 == gray2)
                    dstRowPtr[0] = Interpolate_3(pixel5, pixel4, pixel2, 6, 1, 1, 3);
                else
                    dstRowPtr[0] = Interpolate_2(pixel5, pixel1, 3, 1, 2);
                dstRowPtr[1] = Interpolate_2(pixel5, pixel6, 3, 1, 2);
                if (gray8 == gray4)
                    dstCurLine[0] = Interpolate_3(pixel5, pixel8, pixel4, 6, 1, 1, 3);
                else
                    dstCurLine[0] = Interpolate_2(pixel5, pixel7, 3, 1, 2);
                dstCurLineNextPixel [0] = Interpolate_3(pixel5, pixel9, pixel6, 2, 1, 1, 2);
                break;
            case 154:
                if (gray4 == gray2)
                    dstRowPtr[0] = Interpolate_3(pixel5, pixel4, pixel2, 6, 1, 1, 3);
                else
                    dstRowPtr[0] = Interpolate_2(pixel5, pixel1, 3, 1, 2);
                if (gray2 == gray6)
                    dstRowPtr[1] = Interpolate_3(pixel5, pixel2, pixel6, 6, 1, 1, 3);
                else
                    dstRowPtr[1] = Interpolate_2(pixel5, pixel3, 3, 1, 2);
                dstCurLine[0] = Interpolate_3(pixel5, pixel7, pixel8, 2, 1, 1, 2);
                dstCurLineNextPixel [0] = Interpolate_2(pixel5, pixel8, 3, 1, 2);
                break;
            case 114:
                dstRowPtr[0] = Interpolate_3(pixel5, pixel1, pixel4, 2, 1, 1, 2);
                if (gray2 == gray6)
                    dstRowPtr[1] = Interpolate_3(pixel5, pixel2, pixel6, 6, 1, 1, 3);
                else
                    dstRowPtr[1] = Interpolate_2(pixel5, pixel3, 3, 1, 2);
                dstCurLine[0] = Interpolate_2(pixel5, pixel4, 3, 1, 2);
                if (gray6 == gray8)
                    dstCurLineNextPixel [0] = Interpolate_3(pixel5, pixel6, pixel8, 6, 1, 1, 3);
                else
                    dstCurLineNextPixel [0] = Interpolate_2(pixel5, pixel9, 3, 1, 2);
                break;
            case 89:
                dstRowPtr[0] = Interpolate_2(pixel5, pixel2, 3, 1, 2);
                dstRowPtr[1] = Interpolate_3(pixel5, pixel3, pixel2, 2, 1, 1, 2);
                if (gray8 == gray4)
                    dstCurLine[0] = Interpolate_3(pixel5, pixel8, pixel4, 6, 1, 1, 3);
                else
                    dstCurLine[0] = Interpolate_2(pixel5, pixel7, 3, 1, 2);
                if (gray6 == gray8)
                    dstCurLineNextPixel [0] = Interpolate_3(pixel5, pixel6, pixel8, 6, 1, 1, 3);
                else
                    dstCurLineNextPixel [0] = Interpolate_2(pixel5, pixel9, 3, 1, 2);
                break;
            case 90:
                if (gray4 == gray2)
                    dstRowPtr[0] = Interpolate_3(pixel5, pixel4, pixel2, 6, 1, 1, 3);
                else
                    dstRowPtr[0] = Interpolate_2(pixel5, pixel1, 3, 1, 2);
                if (gray2 == gray6)
                    dstRowPtr[1] = Interpolate_3(pixel5, pixel2, pixel6, 6, 1, 1, 3);
                else
                    dstRowPtr[1] = Interpolate_2(pixel5, pixel3, 3, 1, 2);
                if (gray8 == gray4)
                    dstCurLine[0] = Interpolate_3(pixel5, pixel8, pixel4, 6, 1, 1, 3);
                else
                    dstCurLine[0] = Interpolate_2(pixel5, pixel7, 3, 1, 2);
                if (gray6 == gray8)
                    dstCurLineNextPixel [0] = Interpolate_3(pixel5, pixel6, pixel8, 6, 1, 1, 3);
                else
                    dstCurLineNextPixel [0] = Interpolate_2(pixel5, pixel9, 3, 1, 2);
                break;
            case 23:
            case 55:
                if (gray2 == gray6)
                {
                    dstRowPtr[0] = Interpolate_3(pixel5, pixel2, pixel4, 5, 2, 1, 3);
                    dstRowPtr[1] = Interpolate_3(pixel5, pixel2, pixel6, 2, 3, 3, 3);
                }
                else
                {
                    dstRowPtr[0] = Interpolate_2(pixel5, pixel4, 3, 1, 2);
                    dstRowPtr[1] = pixel5;
                }
                dstCurLine[0] = Interpolate_3(pixel5, pixel8, pixel4, 2, 1, 1, 2);
                dstCurLineNextPixel [0] = Interpolate_3(pixel5, pixel9, pixel8, 2, 1, 1, 2);
                break;
            case 150:
            case 182:
                dstRowPtr[0] = Interpolate_3(pixel5, pixel1, pixel4, 2, 1, 1, 2);
                if (gray2 == gray6)
                {
                    dstRowPtr[1] = Interpolate_3(pixel5, pixel2, pixel6, 2, 3, 3, 3);
                    dstCurLineNextPixel [0] = Interpolate_3(pixel5, pixel6, pixel8, 5, 2, 1, 3);
                }
                else
                {
                    dstRowPtr[1] = pixel5;
                    dstCurLineNextPixel [0] = Interpolate_2(pixel5, pixel8, 3, 1, 2);
                }
                dstCurLine[0] = Interpolate_3(pixel5, pixel8, pixel4, 2, 1, 1, 2);
                break;
            case 212:
            case 213:
                dstRowPtr[0] = Interpolate_3(pixel5, pixel4, pixel2, 2, 1, 1, 2);
                if (gray6 == gray8)
                {
                    dstRowPtr[1] = Interpolate_3(pixel5, pixel6, pixel2, 5, 2, 1, 3);
                    dstCurLineNextPixel [0] = Interpolate_3(pixel5, pixel6, pixel8, 2, 3, 3, 3);
                }
                else
                {
                    dstRowPtr[1] = Interpolate_2(pixel5, pixel2, 3, 1, 2);
                    dstCurLineNextPixel [0] = pixel5;
                }
                dstCurLine[0] = Interpolate_3(pixel5, pixel7, pixel4, 2, 1, 1, 2);
                break;
            case 240:
            case 241:
                dstRowPtr[0] = Interpolate_3(pixel5, pixel4, pixel2, 2, 1, 1, 2);
                dstRowPtr[1] = Interpolate_3(pixel5, pixel3, pixel2, 2, 1, 1, 2);
                if (gray6 == gray8)
                {
                    dstCurLine[0] = Interpolate_3(pixel5, pixel8, pixel4, 5, 2, 1, 3);
                    dstCurLineNextPixel [0] = Interpolate_3(pixel5, pixel6, pixel8, 2, 3, 3, 3);
                }
                else
                {
                    dstCurLine[0] = Interpolate_2(pixel5, pixel4, 3, 1, 2);
                    dstCurLineNextPixel [0] = pixel5;
                }
                break;
            case 232:
            case 236:
                dstRowPtr[0] = Interpolate_3(pixel5, pixel1, pixel2, 2, 1, 1, 2);
                dstRowPtr[1] = Interpolate_3(pixel5, pixel2, pixel6, 2, 1, 1, 2);
                if (gray8 == gray4)
                {
                    dstCurLine[0] = Interpolate_3(pixel5, pixel8, pixel4, 2, 3, 3, 3);
                    dstCurLineNextPixel [0] = Interpolate_3(pixel5, pixel8, pixel6, 5, 2, 1, 3);
                }
                else
                {
                    dstCurLine[0] = pixel5;
                    dstCurLineNextPixel [0] = Interpolate_2(pixel5, pixel6, 3, 1, 2);
                }
                break;
            case 105:
            case 109:
                if (gray8 == gray4)
                {
                    dstRowPtr[0] = Interpolate_3(pixel5, pixel4, pixel2, 5, 2, 1, 3);
                    dstCurLine[0] = Interpolate_3(pixel5, pixel8, pixel4, 2, 3, 3, 3);
                }
                else
                {
                    dstRowPtr[0] = Interpolate_2(pixel5, pixel2, 3, 1, 2);
                    dstCurLine[0] = pixel5;
                }
                dstRowPtr[1] = Interpolate_3(pixel5, pixel2, pixel6, 2, 1, 1, 2);
                dstCurLineNextPixel [0] = Interpolate_3(pixel5, pixel9, pixel6, 2, 1, 1, 2);
                break;
            case 43:
            case 171:
                if (gray4 == gray2)
                {
                    dstRowPtr[0] = Interpolate_3(pixel5, pixel4, pixel2, 2, 3, 3, 3);
                    dstCurLine[0] = Interpolate_3(pixel5, pixel4, pixel8, 5, 2, 1, 3);
                }
                else
                {
                    dstRowPtr[0] = pixel5;
                    dstCurLine[0] = Interpolate_2(pixel5, pixel8, 3, 1, 2);
                }
                dstRowPtr[1] = Interpolate_3(pixel5, pixel3, pixel6, 2, 1, 1, 2);
                dstCurLineNextPixel [0] = Interpolate_3(pixel5, pixel6, pixel8, 2, 1, 1, 2);
                break;
            case 15:
            case 143:
                if (gray4 == gray2)
                {
                    dstRowPtr[0] = Interpolate_3(pixel5, pixel4, pixel2, 2, 3, 3, 3);
                    dstRowPtr[1] = Interpolate_3(pixel5, pixel2, pixel6, 5, 2, 1, 3);
                }
                else
                {
                    dstRowPtr[0] = pixel5;
                    dstRowPtr[1] = Interpolate_2(pixel5, pixel6, 3, 1, 2);
                }
                dstCurLine[0] = Interpolate_3(pixel5, pixel7, pixel8, 2, 1, 1, 2);
                dstCurLineNextPixel [0] = Interpolate_3(pixel5, pixel6, pixel8, 2, 1, 1, 2);
                break;
            case 124:
                dstRowPtr[0] = Interpolate_3(pixel5, pixel1, pixel2, 2, 1, 1, 2);
                dstRowPtr[1] = Interpolate_2(pixel5, pixel2, 3, 1, 2);
                if (gray8 == gray4)
                    dstCurLine[0] = Interpolate_3(pixel5, pixel8, pixel4, 2, 1, 1, 2);
                else
                    dstCurLine[0] = pixel5;
                dstCurLineNextPixel [0] = Interpolate_2(pixel5, pixel9, 3, 1, 2);
                break;
            case 203:
                if (gray4 == gray2)
                    dstRowPtr[0] = Interpolate_3(pixel5, pixel4, pixel2, 2, 1, 1, 2);
                else
                    dstRowPtr[0] = pixel5;
                dstRowPtr[1] = Interpolate_3(pixel5, pixel3, pixel6, 2, 1, 1, 2);
                dstCurLine[0] = Interpolate_2(pixel5, pixel7, 3, 1, 2);
                dstCurLineNextPixel [0] = Interpolate_2(pixel5, pixel6, 3, 1, 2);
                break;
            case 62:
                dstRowPtr[0] = Interpolate_2(pixel5, pixel1, 3, 1, 2);
                if (gray2 == gray6)
                    dstRowPtr[1] = Interpolate_3(pixel5, pixel2, pixel6, 2, 1, 1, 2);
                else
                    dstRowPtr[1] = pixel5;
                dstCurLine[0] = Interpolate_2(pixel5, pixel8, 3, 1, 2);
                dstCurLineNextPixel [0] = Interpolate_3(pixel5, pixel9, pixel8, 2, 1, 1, 2);
                break;
            case 211:
                dstRowPtr[0] = Interpolate_2(pixel5, pixel4, 3, 1, 2);
                dstRowPtr[1] = Interpolate_2(pixel5, pixel3, 3, 1, 2);
                dstCurLine[0] = Interpolate_3(pixel5, pixel7, pixel4, 2, 1, 1, 2);
                if (gray6 == gray8)
                    dstCurLineNextPixel [0] = Interpolate_3(pixel5, pixel6, pixel8, 2, 1, 1, 2);
                else
                    dstCurLineNextPixel [0] = pixel5;
                break;
            case 118:
                dstRowPtr[0] = Interpolate_3(pixel5, pixel1, pixel4, 2, 1, 1, 2);
                if (gray2 == gray6)
                    dstRowPtr[1] = Interpolate_3(pixel5, pixel2, pixel6, 2, 1, 1, 2);
                else
                    dstRowPtr[1] = pixel5;
                dstCurLine[0] = Interpolate_2(pixel5, pixel4, 3, 1, 2);
                dstCurLineNextPixel [0] = Interpolate_2(pixel5, pixel9, 3, 1, 2);
                break;
            case 217:
                dstRowPtr[0] = Interpolate_2(pixel5, pixel2, 3, 1, 2);
                dstRowPtr[1] = Interpolate_3(pixel5, pixel3, pixel2, 2, 1, 1, 2);
                dstCurLine[0] = Interpolate_2(pixel5, pixel7, 3, 1, 2);
                if (gray6 == gray8)
                    dstCurLineNextPixel [0] = Interpolate_3(pixel5, pixel6, pixel8, 2, 1, 1, 2);
                else
                    dstCurLineNextPixel [0] = pixel5;
                break;
            case 110:
                dstRowPtr[0] = Interpolate_2(pixel5, pixel1, 3, 1, 2);
                dstRowPtr[1] = Interpolate_2(pixel5, pixel6, 3, 1, 2);
                if (gray8 == gray4)
                    dstCurLine[0] = Interpolate_3(pixel5, pixel8, pixel4, 2, 1, 1, 2);
                else
                    dstCurLine[0] = pixel5;
                dstCurLineNextPixel [0] = Interpolate_3(pixel5, pixel9, pixel6, 2, 1, 1, 2);
                break;
            case 155:
                if (gray4 == gray2)
                    dstRowPtr[0] = Interpolate_3(pixel5, pixel4, pixel2, 2, 1, 1, 2);
                else
                    dstRowPtr[0] = pixel5;
                dstRowPtr[1] = Interpolate_2(pixel5, pixel3, 3, 1, 2);
                dstCurLine[0] = Interpolate_3(pixel5, pixel7, pixel8, 2, 1, 1, 2);
                dstCurLineNextPixel [0] = Interpolate_2(pixel5, pixel8, 3, 1, 2);
                break;
            case 188:
                dstRowPtr[0] = Interpolate_3(pixel5, pixel1, pixel2, 2, 1, 1, 2);
                dstRowPtr[1] = Interpolate_2(pixel5, pixel2, 3, 1, 2);
                dstCurLine[0] = Interpolate_2(pixel5, pixel8, 3, 1, 2);
                dstCurLineNextPixel [0] = Interpolate_2(pixel5, pixel8, 3, 1, 2);
                break;
            case 185:
                dstRowPtr[0] = Interpolate_2(pixel5, pixel2, 3, 1, 2);
                dstRowPtr[1] = Interpolate_3(pixel5, pixel3, pixel2, 2, 1, 1, 2);
                dstCurLine[0] = Interpolate_2(pixel5, pixel8, 3, 1, 2);
                dstCurLineNextPixel [0] = Interpolate_2(pixel5, pixel8, 3, 1, 2);
                break;
            case 61:
                dstRowPtr[0] = Interpolate_2(pixel5, pixel2, 3, 1, 2);
                dstRowPtr[1] = Interpolate_2(pixel5, pixel2, 3, 1, 2);
                dstCurLine[0] = Interpolate_2(pixel5, pixel8, 3, 1, 2);
                dstCurLineNextPixel [0] = Interpolate_3(pixel5, pixel9, pixel8, 2, 1, 1, 2);
                break;
            case 157:
                dstRowPtr[0] = Interpolate_2(pixel5, pixel2, 3, 1, 2);
                dstRowPtr[1] = Interpolate_2(pixel5, pixel2, 3, 1, 2);
                dstCurLine[0] = Interpolate_3(pixel5, pixel7, pixel8, 2, 1, 1, 2);
                dstCurLineNextPixel [0] = Interpolate_2(pixel5, pixel8, 3, 1, 2);
                break;
            case 103:
                dstRowPtr[0] = Interpolate_2(pixel5, pixel4, 3, 1, 2);
                dstRowPtr[1] = Interpolate_2(pixel5, pixel6, 3, 1, 2);
                dstCurLine[0] = Interpolate_2(pixel5, pixel4, 3, 1, 2);
                dstCurLineNextPixel [0] = Interpolate_3(pixel5, pixel9, pixel6, 2, 1, 1, 2);
                break;
            case 227:
                dstRowPtr[0] = Interpolate_2(pixel5, pixel4, 3, 1, 2);
                dstRowPtr[1] = Interpolate_3(pixel5, pixel3, pixel6, 2, 1, 1, 2);
                dstCurLine[0] = Interpolate_2(pixel5, pixel4, 3, 1, 2);
                dstCurLineNextPixel [0] = Interpolate_2(pixel5, pixel6, 3, 1, 2);
                break;
            case 230:
                dstRowPtr[0] = Interpolate_3(pixel5, pixel1, pixel4, 2, 1, 1, 2);
                dstRowPtr[1] = Interpolate_2(pixel5, pixel6, 3, 1, 2);
                dstCurLine[0] = Interpolate_2(pixel5, pixel4, 3, 1, 2);
                dstCurLineNextPixel [0] = Interpolate_2(pixel5, pixel6, 3, 1, 2);
                break;
            case 199:
                dstRowPtr[0] = Interpolate_2(pixel5, pixel4, 3, 1, 2);
                dstRowPtr[1] = Interpolate_2(pixel5, pixel6, 3, 1, 2);
                dstCurLine[0] = Interpolate_3(pixel5, pixel7, pixel4, 2, 1, 1, 2);
                dstCurLineNextPixel [0] = Interpolate_2(pixel5, pixel6, 3, 1, 2);
                break;
            case 220:
                dstRowPtr[0] = Interpolate_3(pixel5, pixel1, pixel2, 2, 1, 1, 2);
                dstRowPtr[1] = Interpolate_2(pixel5, pixel2, 3, 1, 2);
                if (gray8 == gray4)
                    dstCurLine[0] = Interpolate_3(pixel5, pixel8, pixel4, 6, 1, 1, 3);
                else
                    dstCurLine[0] = Interpolate_2(pixel5, pixel7, 3, 1, 2);
                if (gray6 == gray8)
                    dstCurLineNextPixel [0] = Interpolate_3(pixel5, pixel6, pixel8, 2, 1, 1, 2);
                else
                    dstCurLineNextPixel [0] = pixel5;
                break;
            case 158:
                if (gray4 == gray2)
                    dstRowPtr[0] = Interpolate_3(pixel5, pixel4, pixel2, 6, 1, 1, 3);
                else
                    dstRowPtr[0] = Interpolate_2(pixel5, pixel1, 3, 1, 2);
                if (gray2 == gray6)
                    dstRowPtr[1] = Interpolate_3(pixel5, pixel2, pixel6, 2, 1, 1, 2);
                else
                    dstRowPtr[1] = pixel5;
                dstCurLine[0] = Interpolate_3(pixel5, pixel7, pixel8, 2, 1, 1, 2);
                dstCurLineNextPixel [0] = Interpolate_2(pixel5, pixel8, 3, 1, 2);
                break;
            case 234:
                if (gray4 == gray2)
                    dstRowPtr[0] = Interpolate_3(pixel5, pixel4, pixel2, 6, 1, 1, 3);
                else
                    dstRowPtr[0] = Interpolate_2(pixel5, pixel1, 3, 1, 2);
                dstRowPtr[1] = Interpolate_3(pixel5, pixel3, pixel6, 2, 1, 1, 2);
                if (gray8 == gray4)
                    dstCurLine[0] = Interpolate_3(pixel5, pixel8, pixel4, 2, 1, 1, 2);
                else
                    dstCurLine[0] = pixel5;
                dstCurLineNextPixel [0] = Interpolate_2(pixel5, pixel6, 3, 1, 2);
                break;
            case 242:
                dstRowPtr[0] = Interpolate_3(pixel5, pixel1, pixel4, 2, 1, 1, 2);
                if (gray2 == gray6)
                    dstRowPtr[1] = Interpolate_3(pixel5, pixel2, pixel6, 6, 1, 1, 3);
                else
                    dstRowPtr[1] = Interpolate_2(pixel5, pixel3, 3, 1, 2);
                dstCurLine[0] = Interpolate_2(pixel5, pixel4, 3, 1, 2);
                if (gray6 == gray8)
                    dstCurLineNextPixel [0] = Interpolate_3(pixel5, pixel6, pixel8, 2, 1, 1, 2);
                else
                    dstCurLineNextPixel [0] = pixel5;
                break;
            case 59:
                if (gray4 == gray2)
                    dstRowPtr[0] = Interpolate_3(pixel5, pixel4, pixel2, 2, 1, 1, 2);
                else
                    dstRowPtr[0] = pixel5;
                if (gray2 == gray6)
                    dstRowPtr[1] = Interpolate_3(pixel5, pixel2, pixel6, 6, 1, 1, 3);
                else
                    dstRowPtr[1] = Interpolate_2(pixel5, pixel3, 3, 1, 2);
                dstCurLine[0] = Interpolate_2(pixel5, pixel8, 3, 1, 2);
                dstCurLineNextPixel [0] = Interpolate_3(pixel5, pixel9, pixel8, 2, 1, 1, 2);
                break;
            case 121:
                dstRowPtr[0] = Interpolate_2(pixel5, pixel2, 3, 1, 2);
                dstRowPtr[1] = Interpolate_3(pixel5, pixel3, pixel2, 2, 1, 1, 2);
                if (gray8 == gray4)
                    dstCurLine[0] = Interpolate_3(pixel5, pixel8, pixel4, 2, 1, 1, 2);
                else
                    dstCurLine[0] = pixel5;
                if (gray6 == gray8)
                    dstCurLineNextPixel [0] = Interpolate_3(pixel5, pixel6, pixel8, 6, 1, 1, 3);
                else
                    dstCurLineNextPixel [0] = Interpolate_2(pixel5, pixel9, 3, 1, 2);
                break;
            case 87:
                dstRowPtr[0] = Interpolate_2(pixel5, pixel4, 3, 1, 2);
                if (gray2 == gray6)
                    dstRowPtr[1] = Interpolate_3(pixel5, pixel2, pixel6, 2, 1, 1, 2);
                else
                    dstRowPtr[1] = pixel5;
                dstCurLine[0] = Interpolate_3(pixel5, pixel7, pixel4, 2, 1, 1, 2);
                if (gray6 == gray8)
                    dstCurLineNextPixel [0] = Interpolate_3(pixel5, pixel6, pixel8, 6, 1, 1, 3);
                else
                    dstCurLineNextPixel [0] = Interpolate_2(pixel5, pixel9, 3, 1, 2);
                break;
            case 79:
                if (gray4 == gray2)
                    dstRowPtr[0] = Interpolate_3(pixel5, pixel4, pixel2, 2, 1, 1, 2);
                else
                    dstRowPtr[0] = pixel5;
                dstRowPtr[1] = Interpolate_2(pixel5, pixel6, 3, 1, 2);
                if (gray8 == gray4)
                    dstCurLine[0] = Interpolate_3(pixel5, pixel8, pixel4, 6, 1, 1, 3);
                else
                    dstCurLine[0] = Interpolate_2(pixel5, pixel7, 3, 1, 2);
                dstCurLineNextPixel [0] = Interpolate_3(pixel5, pixel9, pixel6, 2, 1, 1, 2);
                break;
            case 122:
                if (gray4 == gray2)
                    dstRowPtr[0] = Interpolate_3(pixel5, pixel4, pixel2, 6, 1, 1, 3);
                else
                    dstRowPtr[0] = Interpolate_2(pixel5, pixel1, 3, 1, 2);
                if (gray2 == gray6)
                    dstRowPtr[1] = Interpolate_3(pixel5, pixel2, pixel6, 6, 1, 1, 3);
                else
                    dstRowPtr[1] = Interpolate_2(pixel5, pixel3, 3, 1, 2);
                if (gray8 == gray4)
                    dstCurLine[0] = Interpolate_3(pixel5, pixel8, pixel4, 2, 1, 1, 2);
                else
                    dstCurLine[0] = pixel5;
                if (gray6 == gray8)
                    dstCurLineNextPixel [0] = Interpolate_3(pixel5, pixel6, pixel8, 6, 1, 1, 3);
                else
                    dstCurLineNextPixel [0] = Interpolate_2(pixel5, pixel9, 3, 1, 2);
                break;
            case 94:
                if (gray4 == gray2)
                    dstRowPtr[0] = Interpolate_3(pixel5, pixel4, pixel2, 6, 1, 1, 3);
                else
                    dstRowPtr[0] = Interpolate_2(pixel5, pixel1, 3, 1, 2);
                if (gray2 == gray6)
                    dstRowPtr[1] = Interpolate_3(pixel5, pixel2, pixel6, 2, 1, 1, 2);
                else
                    dstRowPtr[1] = pixel5;
                if (gray8 == gray4)
                    dstCurLine[0] = Interpolate_3(pixel5, pixel8, pixel4, 6, 1, 1, 3);
                else
                    dstCurLine[0] = Interpolate_2(pixel5, pixel7, 3, 1, 2);
                if (gray6 == gray8)
                    dstCurLineNextPixel [0] = Interpolate_3(pixel5, pixel6, pixel8, 6, 1, 1, 3);
                else
                    dstCurLineNextPixel [0] = Interpolate_2(pixel5, pixel9, 3, 1, 2);
                break;
            case 218:
                if (gray4 == gray2)
                    dstRowPtr[0] = Interpolate_3(pixel5, pixel4, pixel2, 6, 1, 1, 3);
                else
                    dstRowPtr[0] = Interpolate_2(pixel5, pixel1, 3, 1, 2);
                if (gray2 == gray6)
                    dstRowPtr[1] = Interpolate_3(pixel5, pixel2, pixel6, 6, 1, 1, 3);
                else
                    dstRowPtr[1] = Interpolate_2(pixel5, pixel3, 3, 1, 2);
                if (gray8 == gray4)
                    dstCurLine[0] = Interpolate_3(pixel5, pixel8, pixel4, 6, 1, 1, 3);
                else
                    dstCurLine[0] = Interpolate_2(pixel5, pixel7, 3, 1, 2);
                if (gray6 == gray8)
                    dstCurLineNextPixel [0] = Interpolate_3(pixel5, pixel6, pixel8, 2, 1, 1, 2);
                else
                    dstCurLineNextPixel [0] = pixel5;
                break;
            case 91:
                if (gray4 == gray2)
                    dstRowPtr[0] = Interpolate_3(pixel5, pixel4, pixel2, 2, 1, 1, 2);
                else
                    dstRowPtr[0] = pixel5;
                if (gray2 == gray6)
                    dstRowPtr[1] = Interpolate_3(pixel5, pixel2, pixel6, 6, 1, 1, 3);
                else
                    dstRowPtr[1] = Interpolate_2(pixel5, pixel3, 3, 1, 2);
                if (gray8 == gray4)
                    dstCurLine[0] = Interpolate_3(pixel5, pixel8, pixel4, 6, 1, 1, 3);
                else
                    dstCurLine[0] = Interpolate_2(pixel5, pixel7, 3, 1, 2);
                if (gray6 == gray8)
                    dstCurLineNextPixel [0] = Interpolate_3(pixel5, pixel6, pixel8, 6, 1, 1, 3);
                else
                    dstCurLineNextPixel [0] = Interpolate_2(pixel5, pixel9, 3, 1, 2);
                break;
            case 229:
                dstRowPtr[0] = Interpolate_3(pixel5, pixel4, pixel2, 2, 1, 1, 2);
                dstRowPtr[1] = Interpolate_3(pixel5, pixel2, pixel6, 2, 1, 1, 2);
                dstCurLine[0] = Interpolate_2(pixel5, pixel4, 3, 1, 2);
                dstCurLineNextPixel [0] = Interpolate_2(pixel5, pixel6, 3, 1, 2);
                break;
            case 167:
                dstRowPtr[0] = Interpolate_2(pixel5, pixel4, 3, 1, 2);
                dstRowPtr[1] = Interpolate_2(pixel5, pixel6, 3, 1, 2);
                dstCurLine[0] = Interpolate_3(pixel5, pixel8, pixel4, 2, 1, 1, 2);
                dstCurLineNextPixel [0] = Interpolate_3(pixel5, pixel6, pixel8, 2, 1, 1, 2);
                break;
            case 173:
                dstRowPtr[0] = Interpolate_2(pixel5, pixel2, 3, 1, 2);
                dstRowPtr[1] = Interpolate_3(pixel5, pixel2, pixel6, 2, 1, 1, 2);
                dstCurLine[0] = Interpolate_2(pixel5, pixel8, 3, 1, 2);
                dstCurLineNextPixel [0] = Interpolate_3(pixel5, pixel6, pixel8, 2, 1, 1, 2);
                break;
            case 181:
                dstRowPtr[0] = Interpolate_3(pixel5, pixel4, pixel2, 2, 1, 1, 2);
                dstRowPtr[1] = Interpolate_2(pixel5, pixel2, 3, 1, 2);
                dstCurLine[0] = Interpolate_3(pixel5, pixel8, pixel4, 2, 1, 1, 2);
                dstCurLineNextPixel [0] = Interpolate_2(pixel5, pixel8, 3, 1, 2);
                break;
            case 186:
                if (gray4 == gray2)
                    dstRowPtr[0] = Interpolate_3(pixel5, pixel4, pixel2, 6, 1, 1, 3);
                else
                    dstRowPtr[0] = Interpolate_2(pixel5, pixel1, 3, 1, 2);
                if (gray2 == gray6)
                    dstRowPtr[1] = Interpolate_3(pixel5, pixel2, pixel6, 6, 1, 1, 3);
                else
                    dstRowPtr[1] = Interpolate_2(pixel5, pixel3, 3, 1, 2);
                dstCurLine[0] = Interpolate_2(pixel5, pixel8, 3, 1, 2);
                dstCurLineNextPixel [0] = Interpolate_2(pixel5, pixel8, 3, 1, 2);
                break;
            case 115:
                dstRowPtr[0] = Interpolate_2(pixel5, pixel4, 3, 1, 2);
                if (gray2 == gray6)
                    dstRowPtr[1] = Interpolate_3(pixel5, pixel2, pixel6, 6, 1, 1, 3);
                else
                    dstRowPtr[1] = Interpolate_2(pixel5, pixel3, 3, 1, 2);
                dstCurLine[0] = Interpolate_2(pixel5, pixel4, 3, 1, 2);
                if (gray6 == gray8)
                    dstCurLineNextPixel [0] = Interpolate_3(pixel5, pixel6, pixel8, 6, 1, 1, 3);
                else
                    dstCurLineNextPixel [0] = Interpolate_2(pixel5, pixel9, 3, 1, 2);
                break;
            case 93:
                dstRowPtr[0] = Interpolate_2(pixel5, pixel2, 3, 1, 2);
                dstRowPtr[1] = Interpolate_2(pixel5, pixel2, 3, 1, 2);
                if (gray8 == gray4)
                    dstCurLine[0] = Interpolate_3(pixel5, pixel8, pixel4, 6, 1, 1, 3);
                else
                    dstCurLine[0] = Interpolate_2(pixel5, pixel7, 3, 1, 2);
                if (gray6 == gray8)
                    dstCurLineNextPixel [0] = Interpolate_3(pixel5, pixel6, pixel8, 6, 1, 1, 3);
                else
                    dstCurLineNextPixel [0] = Interpolate_2(pixel5, pixel9, 3, 1, 2);
                break;
            case 206:
                if (gray4 == gray2)
                    dstRowPtr[0] = Interpolate_3(pixel5, pixel4, pixel2, 6, 1, 1, 3);
                else
                    dstRowPtr[0] = Interpolate_2(pixel5, pixel1, 3, 1, 2);
                dstRowPtr[1] = Interpolate_2(pixel5, pixel6, 3, 1, 2);
                if (gray8 == gray4)
                    dstCurLine[0] = Interpolate_3(pixel5, pixel8, pixel4, 6, 1, 1, 3);
                else
                    dstCurLine[0] = Interpolate_2(pixel5, pixel7, 3, 1, 2);
                dstCurLineNextPixel [0] = Interpolate_2(pixel5, pixel6, 3, 1, 2);
                break;
            case 201:
            case 205:
                dstRowPtr[0] = Interpolate_2(pixel5, pixel2, 3, 1, 2);
                dstRowPtr[1] = Interpolate_3(pixel5, pixel2, pixel6, 2, 1, 1, 2);
                if (gray8 == gray4)
                    dstCurLine[0] = Interpolate_3(pixel5, pixel8, pixel4, 6, 1, 1, 3);
                else
                    dstCurLine[0] = Interpolate_2(pixel5, pixel7, 3, 1, 2);
                dstCurLineNextPixel [0] = Interpolate_2(pixel5, pixel6, 3, 1, 2);
                break;
            case 46:
            case 174:
                if (gray4 == gray2)
                    dstRowPtr[0] = Interpolate_3(pixel5, pixel4, pixel2, 6, 1, 1, 3);
                else
                    dstRowPtr[0] = Interpolate_2(pixel5, pixel1, 3, 1, 2);
                dstRowPtr[1] = Interpolate_2(pixel5, pixel6, 3, 1, 2);
                dstCurLine[0] = Interpolate_2(pixel5, pixel8, 3, 1, 2);
                dstCurLineNextPixel [0] = Interpolate_3(pixel5, pixel6, pixel8, 2, 1, 1, 2);
                break;
            case 147:
            case 179:
                dstRowPtr[0] = Interpolate_2(pixel5, pixel4, 3, 1, 2);
                if (gray2 == gray6)
                    dstRowPtr[1] = Interpolate_3(pixel5, pixel2, pixel6, 6, 1, 1, 3);
                else
                    dstRowPtr[1] = Interpolate_2(pixel5, pixel3, 3, 1, 2);
                dstCurLine[0] = Interpolate_3(pixel5, pixel8, pixel4, 2, 1, 1, 2);
                dstCurLineNextPixel [0] = Interpolate_2(pixel5, pixel8, 3, 1, 2);
                break;
            case 116:
            case 117:
                dstRowPtr[0] = Interpolate_3(pixel5, pixel4, pixel2, 2, 1, 1, 2);
                dstRowPtr[1] = Interpolate_2(pixel5, pixel2, 3, 1, 2);
                dstCurLine[0] = Interpolate_2(pixel5, pixel4, 3, 1, 2);
                if (gray6 == gray8)
                    dstCurLineNextPixel [0] = Interpolate_3(pixel5, pixel6, pixel8, 6, 1, 1, 3);
                else
                    dstCurLineNextPixel [0] = Interpolate_2(pixel5, pixel9, 3, 1, 2);
                break;
            case 189:
                dstRowPtr[0] = Interpolate_2(pixel5, pixel2, 3, 1, 2);
                dstRowPtr[1] = Interpolate_2(pixel5, pixel2, 3, 1, 2);
                dstCurLine[0] = Interpolate_2(pixel5, pixel8, 3, 1, 2);
                dstCurLineNextPixel [0] = Interpolate_2(pixel5, pixel8, 3, 1, 2);
                break;
            case 231:
                dstRowPtr[0] = Interpolate_2(pixel5, pixel4, 3, 1, 2);
                dstRowPtr[1] = Interpolate_2(pixel5, pixel6, 3, 1, 2);
                dstCurLine[0] = Interpolate_2(pixel5, pixel4, 3, 1, 2);
                dstCurLineNextPixel [0] = Interpolate_2(pixel5, pixel6, 3, 1, 2);
                break;
            case 126:
                dstRowPtr[0] = Interpolate_2(pixel5, pixel1, 3, 1, 2);
                if (gray2 == gray6)
                    dstRowPtr[1] = Interpolate_3(pixel5, pixel2, pixel6, 2, 1, 1, 2);
                else
                    dstRowPtr[1] = pixel5;
                if (gray8 == gray4)
                    dstCurLine[0] = Interpolate_3(pixel5, pixel8, pixel4, 2, 1, 1, 2);
                else
                    dstCurLine[0] = pixel5;
                dstCurLineNextPixel [0] = Interpolate_2(pixel5, pixel9, 3, 1, 2);
                break;
            case 219:
                if (gray4 == gray2)
                    dstRowPtr[0] = Interpolate_3(pixel5, pixel4, pixel2, 2, 1, 1, 2);
                else
                    dstRowPtr[0] = pixel5;
                dstRowPtr[1] = Interpolate_2(pixel5, pixel3, 3, 1, 2);
                dstCurLine[0] = Interpolate_2(pixel5, pixel7, 3, 1, 2);
                if (gray6 == gray8)
                    dstCurLineNextPixel [0] = Interpolate_3(pixel5, pixel6, pixel8, 2, 1, 1, 2);
                else
                    dstCurLineNextPixel [0] = pixel5;
                break;
            case 125:
                if (gray8 == gray4)
                {
                    dstRowPtr[0] = Interpolate_3(pixel5, pixel4, pixel2, 5, 2, 1, 3);
                    dstCurLine[0] = Interpolate_3(pixel5, pixel8, pixel4, 2, 3, 3, 3);
                }
                else
                {
                    dstRowPtr[0] = Interpolate_2(pixel5, pixel2, 3, 1, 2);
                    dstCurLine[0] = pixel5;
                }
                dstRowPtr[1] = Interpolate_2(pixel5, pixel2, 3, 1, 2);
                dstCurLineNextPixel [0] = Interpolate_2(pixel5, pixel9, 3, 1, 2);
                break;
            case 221:
                dstRowPtr[0] = Interpolate_2(pixel5, pixel2, 3, 1, 2);
                if (gray6 == gray8)
                {
                    dstRowPtr[1] = Interpolate_3(pixel5, pixel6, pixel2, 5, 2, 1, 3);
                    dstCurLineNextPixel [0] = Interpolate_3(pixel5, pixel6, pixel8, 2, 3, 3, 3);
                }
                else
                {
                    dstRowPtr[1] = Interpolate_2(pixel5, pixel2, 3, 1, 2);
                    dstCurLineNextPixel [0] = pixel5;
                }
                dstCurLine[0] = Interpolate_2(pixel5, pixel7, 3, 1, 2);
                break;
            case 207:
                if (gray4 == gray2)
                {
                    dstRowPtr[0] = Interpolate_3(pixel5, pixel4, pixel2, 2, 3, 3, 3);
                    dstRowPtr[1] = Interpolate_3(pixel5, pixel2, pixel6, 5, 2, 1, 3);
                }
                else
                {
                    dstRowPtr[0] = pixel5;
                    dstRowPtr[1] = Interpolate_2(pixel5, pixel6, 3, 1, 2);
                }
                dstCurLine[0] = Interpolate_2(pixel5, pixel7, 3, 1, 2);
                dstCurLineNextPixel [0] = Interpolate_2(pixel5, pixel6, 3, 1, 2);
                break;
            case 238:
                dstRowPtr[0] = Interpolate_2(pixel5, pixel1, 3, 1, 2);
                dstRowPtr[1] = Interpolate_2(pixel5, pixel6, 3, 1, 2);
                if (gray8 == gray4)
                {
                    dstCurLine[0] = Interpolate_3(pixel5, pixel8, pixel4, 2, 3, 3, 3);
                    dstCurLineNextPixel [0] = Interpolate_3(pixel5, pixel8, pixel6, 5, 2, 1, 3);
                }
                else
                {
                    dstCurLine[0] = pixel5;
                    dstCurLineNextPixel [0] = Interpolate_2(pixel5, pixel6, 3, 1, 2);
                }
                break;
            case 190:
                dstRowPtr[0] = Interpolate_2(pixel5, pixel1, 3, 1, 2);
                if (gray2 == gray6)
                {
                    dstRowPtr[1] = Interpolate_3(pixel5, pixel2, pixel6, 2, 3, 3, 3);
                    dstCurLineNextPixel [0] = Interpolate_3(pixel5, pixel6, pixel8, 5, 2, 1, 3);
                }
                else
                {
                    dstRowPtr[1] = pixel5;
                    dstCurLineNextPixel [0] = Interpolate_2(pixel5, pixel8, 3, 1, 2);
                }
                dstCurLine[0] = Interpolate_2(pixel5, pixel8, 3, 1, 2);
                break;
            case 187:
                if (gray4 == gray2)
                {
                    dstRowPtr[0] = Interpolate_3(pixel5, pixel4, pixel2, 2, 3, 3, 3);
                    dstCurLine[0] = Interpolate_3(pixel5, pixel4, pixel8, 5, 2, 1, 3);
                }
                else
                {
                    dstRowPtr[0] = pixel5;
                    dstCurLine[0] = Interpolate_2(pixel5, pixel8, 3, 1, 2);
                }
                dstRowPtr[1] = Interpolate_2(pixel5, pixel3, 3, 1, 2);
                dstCurLineNextPixel [0] = Interpolate_2(pixel5, pixel8, 3, 1, 2);
                break;
            case 243:
                dstRowPtr[0] = Interpolate_2(pixel5, pixel4, 3, 1, 2);
                dstRowPtr[1] = Interpolate_2(pixel5, pixel3, 3, 1, 2);
                if (gray6 == gray8)
                {
                    dstCurLine[0] = Interpolate_3(pixel5, pixel8, pixel4, 5, 2, 1, 3);
                    dstCurLineNextPixel [0] = Interpolate_3(pixel5, pixel6, pixel8, 2, 3, 3, 3);
                }
                else
                {
                    dstCurLine[0] = Interpolate_2(pixel5, pixel4, 3, 1, 2);
                    dstCurLineNextPixel [0] = pixel5;
                }
                break;
            case 119:
                if (gray2 == gray6)
                {
                    dstRowPtr[0] = Interpolate_3(pixel5, pixel2, pixel4, 5, 2, 1, 3);
                    dstRowPtr[1] = Interpolate_3(pixel5, pixel2, pixel6, 2, 3, 3, 3);
                }
                else
                {
                    dstRowPtr[0] = Interpolate_2(pixel5, pixel4, 3, 1, 2);
                    dstRowPtr[1] = pixel5;
                }
                dstCurLine[0] = Interpolate_2(pixel5, pixel4, 3, 1, 2);
                dstCurLineNextPixel [0] = Interpolate_2(pixel5, pixel9, 3, 1, 2);
                break;
            case 233:
            case 237:
                dstRowPtr[0] = Interpolate_2(pixel5, pixel2, 3, 1, 2);
                dstRowPtr[1] = Interpolate_3(pixel5, pixel2, pixel6, 2, 1, 1, 2);
                if (gray8 == gray4)
                    dstCurLine[0] = Interpolate_3(pixel5, pixel8, pixel4, 14, 1, 1, 4);
                else
                    dstCurLine[0] = pixel5;
                dstCurLineNextPixel [0] = Interpolate_2(pixel5, pixel6, 3, 1, 2);
                break;
            case 47:
            case 175:
                if (gray4 == gray2)
                    dstRowPtr[0] = Interpolate_3(pixel5, pixel4, pixel2, 14, 1, 1, 4);
                else
                    dstRowPtr[0] = pixel5;
                dstRowPtr[1] = Interpolate_2(pixel5, pixel6, 3, 1, 2);
                dstCurLine[0] = Interpolate_2(pixel5, pixel8, 3, 1, 2);
                dstCurLineNextPixel [0] = Interpolate_3(pixel5, pixel6, pixel8, 2, 1, 1, 2);
                break;
            case 151:
            case 183:
                dstRowPtr[0] = Interpolate_2(pixel5, pixel4, 3, 1, 2);
                if (gray2 == gray6)
                    dstRowPtr[1] = Interpolate_3(pixel5, pixel2, pixel6, 14, 1, 1, 4);
                else
                    dstRowPtr[1] = pixel5;
                dstCurLine[0] = Interpolate_3(pixel5, pixel8, pixel4, 2, 1, 1, 2);
                dstCurLineNextPixel [0] = Interpolate_2(pixel5, pixel8, 3, 1, 2);
                break;
            case 244:
            case 245:
                dstRowPtr[0] = Interpolate_3(pixel5, pixel4, pixel2, 2, 1, 1, 2);
                dstRowPtr[1] = Interpolate_2(pixel5, pixel2, 3, 1, 2);
                dstCurLine[0] = Interpolate_2(pixel5, pixel4, 3, 1, 2);
                if (gray6 == gray8)
                    dstCurLineNextPixel [0] = Interpolate_3(pixel5, pixel6, pixel8, 14, 1, 1, 4);
                else
                    dstCurLineNextPixel [0] = pixel5;
                break;
            case 250:
                dstRowPtr[0] = Interpolate_2(pixel5, pixel1, 3, 1, 2);
                dstRowPtr[1] = Interpolate_2(pixel5, pixel3, 3, 1, 2);
                if (gray8 == gray4)
                    dstCurLine[0] = Interpolate_3(pixel5, pixel8, pixel4, 2, 1, 1, 2);
                else
                    dstCurLine[0] = pixel5;
                if (gray6 == gray8)
                    dstCurLineNextPixel [0] = Interpolate_3(pixel5, pixel6, pixel8, 2, 1, 1, 2);
                else
                    dstCurLineNextPixel [0] = pixel5;
                break;
            case 123:
                if (gray4 == gray2)
                    dstRowPtr[0] = Interpolate_3(pixel5, pixel4, pixel2, 2, 1, 1, 2);
                else
                    dstRowPtr[0] = pixel5;
                dstRowPtr[1] = Interpolate_2(pixel5, pixel3, 3, 1, 2);
                if (gray8 == gray4)
                    dstCurLine[0] = Interpolate_3(pixel5, pixel8, pixel4, 2, 1, 1, 2);
                else
                    dstCurLine[0] = pixel5;
                dstCurLineNextPixel [0] = Interpolate_2(pixel5, pixel9, 3, 1, 2);
                break;
            case 95:
                if (gray4 == gray2)
                    dstRowPtr[0] = Interpolate_3(pixel5, pixel4, pixel2, 2, 1, 1, 2);
                else
                    dstRowPtr[0] = pixel5;
                if (gray2 == gray6)
                    dstRowPtr[1] = Interpolate_3(pixel5, pixel2, pixel6, 2, 1, 1, 2);
                else
                    dstRowPtr[1] = pixel5;
                dstCurLine[0] = Interpolate_2(pixel5, pixel7, 3, 1, 2);
                dstCurLineNextPixel [0] = Interpolate_2(pixel5, pixel9, 3, 1, 2);
                break;
            case 222:
                dstRowPtr[0] = Interpolate_2(pixel5, pixel1, 3, 1, 2);
                if (gray2 == gray6)
                    dstRowPtr[1] = Interpolate_3(pixel5, pixel2, pixel6, 2, 1, 1, 2);
                else
                    dstRowPtr[1] = pixel5;
                dstCurLine[0] = Interpolate_2(pixel5, pixel7, 3, 1, 2);
                if (gray6 == gray8)
                    dstCurLineNextPixel [0] = Interpolate_3(pixel5, pixel6, pixel8, 2, 1, 1, 2);
                else
                    dstCurLineNextPixel [0] = pixel5;
                break;
            case 252:
                dstRowPtr[0] = Interpolate_3(pixel5, pixel1, pixel2, 2, 1, 1, 2);
                dstRowPtr[1] = Interpolate_2(pixel5, pixel2, 3, 1, 2);
                if (gray8 == gray4)
                    dstCurLine[0] = Interpolate_3(pixel5, pixel8, pixel4, 2, 1, 1, 2);
                else
                    dstCurLine[0] = pixel5;
                if (gray6 == gray8)
                    dstCurLineNextPixel [0] = Interpolate_3(pixel5, pixel6, pixel8, 14, 1, 1, 4);
                else
                    dstCurLineNextPixel [0] = pixel5;
                break;
            case 249:
                dstRowPtr[0] = Interpolate_2(pixel5, pixel2, 3, 1, 2);
                dstRowPtr[1] = Interpolate_3(pixel5, pixel3, pixel2, 2, 1, 1, 2);
                if (gray8 == gray4)
                    dstCurLine[0] = Interpolate_3(pixel5, pixel8, pixel4, 14, 1, 1, 4);
                else
                    dstCurLine[0] = pixel5;
                if (gray6 == gray8)
                    dstCurLineNextPixel [0] = Interpolate_3(pixel5, pixel6, pixel8, 2, 1, 1, 2);
                else
                    dstCurLineNextPixel [0] = pixel5;
                break;
            case 235:
                if (gray4 == gray2)
                    dstRowPtr[0] = Interpolate_3(pixel5, pixel4, pixel2, 2, 1, 1, 2);
                else
                    dstRowPtr[0] = pixel5;
                dstRowPtr[1] = Interpolate_3(pixel5, pixel3, pixel6, 2, 1, 1, 2);
                if (gray8 == gray4)
                    dstCurLine[0] = Interpolate_3(pixel5, pixel8, pixel4, 14, 1, 1, 4);
                else
                    dstCurLine[0] = pixel5;
                dstCurLineNextPixel [0] = Interpolate_2(pixel5, pixel6, 3, 1, 2);
                break;
            case 111:
                if (gray4 == gray2)
                    dstRowPtr[0] = Interpolate_3(pixel5, pixel4, pixel2, 14, 1, 1, 4);
                else
                    dstRowPtr[0] = pixel5;
                dstRowPtr[1] = Interpolate_2(pixel5, pixel6, 3, 1, 2);
                if (gray8 == gray4)
                    dstCurLine[0] = Interpolate_3(pixel5, pixel8, pixel4, 2, 1, 1, 2);
                else
                    dstCurLine[0] = pixel5;
                dstCurLineNextPixel [0] = Interpolate_3(pixel5, pixel9, pixel6, 2, 1, 1, 2);
                break;
            case 63:
                if (gray4 == gray2)
                    dstRowPtr[0] = Interpolate_3(pixel5, pixel4, pixel2, 14, 1, 1, 4);
                else
                    dstRowPtr[0] = pixel5;
                if (gray2 == gray6)
                    dstRowPtr[1] = Interpolate_3(pixel5, pixel2, pixel6, 2, 1, 1, 2);
                else
                    dstRowPtr[1] = pixel5;
                dstCurLine[0] = Interpolate_2(pixel5, pixel8, 3, 1, 2);
                dstCurLineNextPixel [0] = Interpolate_3(pixel5, pixel9, pixel8, 2, 1, 1, 2);
                break;
            case 159:
                if (gray4 == gray2)
                    dstRowPtr[0] = Interpolate_3(pixel5, pixel4, pixel2, 2, 1, 1, 2);
                else
                    dstRowPtr[0] = pixel5;
                if (gray2 == gray6)
                    dstRowPtr[1] = Interpolate_3(pixel5, pixel2, pixel6, 14, 1, 1, 4);
                else
                    dstRowPtr[1] = pixel5;
                dstCurLine[0] = Interpolate_3(pixel5, pixel7, pixel8, 2, 1, 1, 2);
                dstCurLineNextPixel [0] = Interpolate_2(pixel5, pixel8, 3, 1, 2);
                break;
            case 215:
                dstRowPtr[0] = Interpolate_2(pixel5, pixel4, 3, 1, 2);
                if (gray2 == gray6)
                    dstRowPtr[1] = Interpolate_3(pixel5, pixel2, pixel6, 14, 1, 1, 4);
                else
                    dstRowPtr[1] = pixel5;
                dstCurLine[0] = Interpolate_3(pixel5, pixel7, pixel4, 2, 1, 1, 2);
                if (gray6 == gray8)
                    dstCurLineNextPixel [0] = Interpolate_3(pixel5, pixel6, pixel8, 2, 1, 1, 2);
                else
                    dstCurLineNextPixel [0] = pixel5;
                break;
            case 246:
                dstRowPtr[0] = Interpolate_3(pixel5, pixel1, pixel4, 2, 1, 1, 2);
                if (gray2 == gray6)
                    dstRowPtr[1] = Interpolate_3(pixel5, pixel2, pixel6, 2, 1, 1, 2);
                else
                    dstRowPtr[1] = pixel5;
                dstCurLine[0] = Interpolate_2(pixel5, pixel4, 3, 1, 2);
                if (gray6 == gray8)
                    dstCurLineNextPixel [0] = Interpolate_3(pixel5, pixel6, pixel8, 14, 1, 1, 4);
                else
                    dstCurLineNextPixel [0] = pixel5;
                break;
            case 254:
                dstRowPtr[0] = Interpolate_2(pixel5, pixel1, 3, 1, 2);
                if (gray2 == gray6)
                    dstRowPtr[1] = Interpolate_3(pixel5, pixel2, pixel6, 2, 1, 1, 2);
                else
                    dstRowPtr[1] = pixel5;
                if (gray8 == gray4)
                    dstCurLine[0] = Interpolate_3(pixel5, pixel8, pixel4, 2, 1, 1, 2);
                else
                    dstCurLine[0] = pixel5;
                if (gray6 == gray8)
                    dstCurLineNextPixel [0] = Interpolate_3(pixel5, pixel6, pixel8, 14, 1, 1, 4);
                else
                    dstCurLineNextPixel [0] = pixel5;
                break;
            case 253:
                dstRowPtr[0] = Interpolate_2(pixel5, pixel2, 3, 1, 2);
                dstRowPtr[1] = Interpolate_2(pixel5, pixel2, 3, 1, 2);
                if (gray8 == gray4)
                    dstCurLine[0] = Interpolate_3(pixel5, pixel8, pixel4, 14, 1, 1, 4);
                else
                    dstCurLine[0] = pixel5;
                if (gray6 == gray8)
                    dstCurLineNextPixel [0] = Interpolate_3(pixel5, pixel6, pixel8, 14, 1, 1, 4);
                else
                    dstCurLineNextPixel [0] = pixel5;
                break;
            case 251:
                if (gray4 == gray2)
                    dstRowPtr[0] = Interpolate_3(pixel5, pixel4, pixel2, 2, 1, 1, 2);
                else
                    dstRowPtr[0] = pixel5;
                dstRowPtr[1] = Interpolate_2(pixel5, pixel3, 3, 1, 2);
                if (gray8 == gray4)
                    dstCurLine[0] = Interpolate_3(pixel5, pixel8, pixel4, 14, 1, 1, 4);
                else
                    dstCurLine[0] = pixel5;
                if (gray6 == gray8)
                    dstCurLineNextPixel [0] = Interpolate_3(pixel5, pixel6, pixel8, 2, 1, 1, 2);
                else
                    dstCurLineNextPixel [0] = pixel5;
                break;
            case 239:
                if (gray4 == gray2)
                    dstRowPtr[0] = Interpolate_3(pixel5, pixel4, pixel2, 14, 1, 1, 4);
                else
                    dstRowPtr[0] = pixel5;
                dstRowPtr[1] = Interpolate_2(pixel5, pixel6, 3, 1, 2);
                if (gray8 == gray4)
                    dstCurLine[0] = Interpolate_3(pixel5, pixel8, pixel4, 14, 1, 1, 4);
                else
                    dstCurLine[0] = pixel5;
                dstCurLineNextPixel [0] = Interpolate_2(pixel5, pixel6, 3, 1, 2);
                break;
            case 127:
                if (gray4 == gray2)
                    dstRowPtr[0] = Interpolate_3(pixel5, pixel4, pixel2, 14, 1, 1, 4);
                else
                    dstRowPtr[0] = pixel5;
                if (gray2 == gray6)
                    dstRowPtr[1] = Interpolate_3(pixel5, pixel2, pixel6, 2, 1, 1, 2);
                else
                    dstRowPtr[1] = pixel5;
                if (gray8 == gray4)
                    dstCurLine[0] = Interpolate_3(pixel5, pixel8, pixel4, 2, 1, 1, 2);
                else
                    dstCurLine[0] = pixel5;
                dstCurLineNextPixel [0] = Interpolate_2(pixel5, pixel9, 3, 1, 2);
                break;
            case 191:
                if (gray4 == gray2)
                    dstRowPtr[0] = Interpolate_3(pixel5, pixel4, pixel2, 14, 1, 1, 4);
                else
                    dstRowPtr[0] = pixel5;
                if (gray2 == gray6)
                    dstRowPtr[1] = Interpolate_3(pixel5, pixel2, pixel6, 14, 1, 1, 4);
                else
                    dstRowPtr[1] = pixel5;
                dstCurLine[0] = Interpolate_2(pixel5, pixel8, 3, 1, 2);
                dstCurLineNextPixel [0] = Interpolate_2(pixel5, pixel8, 3, 1, 2);
                break;
            case 223:
                if (gray4 == gray2)
                    dstRowPtr[0] = Interpolate_3(pixel5, pixel4, pixel2, 2, 1, 1, 2);
                else
                    dstRowPtr[0] = pixel5;
                if (gray2 == gray6)
                    dstRowPtr[1] = Interpolate_3(pixel5, pixel2, pixel6, 14, 1, 1, 4);
                else
                    dstRowPtr[1] = pixel5;
                dstCurLine[0] = Interpolate_2(pixel5, pixel7, 3, 1, 2);
                if (gray6 == gray8)
                    dstCurLineNextPixel [0] = Interpolate_3(pixel5, pixel6, pixel8, 2, 1, 1, 2);
                else
                    dstCurLineNextPixel [0] = pixel5;
                break;
            case 247:
                dstRowPtr[0] = Interpolate_2(pixel5, pixel4, 3, 1, 2);
                if (gray2 == gray6)
                    dstRowPtr[1] = Interpolate_3(pixel5, pixel2, pixel6, 14, 1, 1, 4);
                else
                    dstRowPtr[1] = pixel5;
                dstCurLine[0] = Interpolate_2(pixel5, pixel4, 3, 1, 2);
                if (gray6 == gray8)
                    dstCurLineNextPixel [0] = Interpolate_3(pixel5, pixel6, pixel8, 14, 1, 1, 4);
                else
                    dstCurLineNextPixel [0] = pixel5;
                break;
            case 255:
                if (gray4 == gray2)
                    dstRowPtr[0] = Interpolate_3(pixel5, pixel4, pixel2, 14, 1, 1, 4);
                else
                    dstRowPtr[0] = pixel5;
                if (gray2 == gray6)
                    dstRowPtr[1] = Interpolate_3(pixel5, pixel2, pixel6, 14, 1, 1, 4);
                else
                    dstRowPtr[1] = pixel5;
                if (gray8 == gray4)
                    dstCurLine[0] = Interpolate_3(pixel5, pixel8, pixel4, 14, 1, 1, 4);
                else
                    dstCurLine[0] = pixel5;
                if (gray6 == gray8)
                    dstCurLineNextPixel [0] = Interpolate_3(pixel5, pixel6, pixel8, 14, 1, 1, 4);
                else
                    dstCurLineNextPixel [0] = pixel5;
                break;
            default:
                break;
            }
            srcRowPtr  ;
            dstRowPtr  = step;
        } 
    }
}

  本代码仅支持4通道32位,若1通道以及3通道,可参考改动之。

也不是很麻烦,代码也是挺简单的,虽然有点长,懒得写注释了,感兴趣的可以看看官方的代码。

俺这代码主要是做了一些算法上的简单优化。

好久没发博文里,上来冒个泡。不喜请喷。

俺的联系方式如下:

邮箱: [email protected]

QQ:200759103

联系我时请说明来意,不然一律忽略,谢谢。

art之 hqx 算法,pixelarthqx算法 在去年的时候,偶然看到hqx算法。 一个高质量的插值放大算法。 与双线性插值等插值算法相比,这个算法...

算法是解决问题的手段和步骤。

加油吧,少年!!!

格式

在写代码里主要指缩进,空格,空行,对齐等文本排版形式,这个是最最容易到达的一个代码好的指标,好多的IDE环境都是一键自动格式化。好的代码格式就像好的文章一样排版精美,段落清晰。代码的格式美观是形式美,是外在美。

/** 差的格式举例 **/
function swap(a, b)           {
var           c=a;
  a=b;
          b=c;
      }

/** 好的格式举例 **/

function swap(a, b){
    var c = a;
    a = b;
    b=c;
}

针对一个算法,需要知道两件事情:

澳门新濠3559 3算法.png

风格

作家写作有文风,编码也有码风,代码风格就包含更多的东西了,比如命名风格,比如实现方式。

码风其实和文风是很像的,比如鲁迅散文诗集<野草>中的第一篇,名为<秋夜>。第一段原文如下:“在我的后园,可以看见墙外有两株树,一株是枣树,还有一株也是枣树。”那换一种文风来描述也可以是:“我家后院墙外种着两颗枣树。”

排除需要表达的深层含义,这两种文字都表达了我家后院有两棵枣树,达到的目的是一样的。无法是采用的词汇语句不一样而已,即使得文风不同。在编码的时候,码风也是这样形成的,相同的功能需求,不同的人来编写,代码基本也都不是完全一样的,因为每个人都有自己的码风,这个码风就体现在了变量的命名,循环语句的偏好(for还是while)等等等等。

举个不同码风的例子:

/** 数组求和 **/

function sum_for(arr){
    var sum = 0;
    for(var i = 0; i < arr.length; i  ){
        sum  = arr[i];
    }
    return sum;
}

function sum_while(arr){
    var sum = 0, i = arr.length;
    while(i--){
        sum  = arr[i];
    }
    return sum;
}

1.它能否解决特定的问题?
2.它能否有效地使用资源?

算法

写文章会有一个提纲一个骨架。写代码也是一样的,不过我们称之为算法,算法决定了整个代码的行文走向,是悲剧还是喜剧。如果你想写篇文章,因为你有个很好的想法需要表达给你的读者,但是由于你词句匮乏,成语还错用,写出来的文章就会总是文不达意。相同的写代码有时候也会文不达意,因为for语句的语法规则没弄清楚,处理流程便会出现了预期结果不一致的结果,这个时候我们称之为BUG了。算法是一段代码的灵魂思想,正如一篇文章,尽管文风平实,但思想深邃,构思巧妙,发人深省,影响深远。好的算法也有这种魅力,码风平实,但用途广泛,小如快速排序,泛如动态规划,好的算法甚至可以流芳百世,如好的小说被翻译成各国语言,好的算法也会被各种编程语言实现。编程语言说到底是一种表达工具,是为了表达我们心中的算法的工具。如果写代码只追求格式与风格(码风),毫不理会算法设计,那么就会像写文章只追求排版与辞藻却毫无思想,读完也会空洞无力。所以算法就像代码的灵魂,是一种内在的美。

如果你写代码不能解决某个问题,或者它能解决问题,但是对资源的利用并不是高效的(比如执行所花的时间太长或者消耗了太多的内存)。那么写的代码并没有真正起到帮助的作用。

现实的世界

现实的世界与理想的世界不同,不过写代码又一次神似写文章了,我们好多的程序员也是复制粘贴,引用第三方类库,自己组织的部分也仅仅是小部分,底层研发的程序员在业界也总是占小部分。从事编辑工作的大部分工作也是编辑转载,原创的编辑也是少之又少。

这就是为什么我们需要去学习算法。我们想要知道我们的代码是基于可以解决问题并且对资源的使用是高效的点子上。并且我们想要知道我们的解决方案针对所有可能的场景是正确和高效的。或者至少我们知道我们的算法在哪种比较少见的情况下会失败。

最后

虽然上面几段我把算法是夸了又夸,推崇至极,但是如果你和我一样都是创造不了伟大算法的那种平凡人,也就是我们只能在代码格式和代码风格上多做努力的朋友们。咱们晦涩难懂的码风还是少写一些,做程序员要厚道!以上纯属娱乐~~欢迎大家提供更多有趣的相似点

即使你可能更倾向于调用API中的函数而不是自己设计算法,你应该知道在实现这些API中所使用的算法和数据结构。针对每一个场景,没有哪一个数据结构是最好的选择。因此我们需要知道每种数据结构的优势和弱点。

编程本来就是跟数据结构和算法有关的事情。数据结构是用来保存数据,算法是用来使用这些数据解决问题的。如果你写程序了,你本身就在使用这两个东西。

你为什么要学习它们呢?因为你要使用它们更好并且有效率。没有学习过算法,当试图解决手头上的问题时,你将面临麻烦。你必须用你自己的方式去解决,这样可能会不是非常高效。没有学习数据结构,你面临的问题是不知道如何去选择哪一种数据结构。是应该去选择链表还是不可变的数组呢?

如果你已经知道数据结构和算法,在你写一行代码之前你就会明白这个问题。难道你不想让自己的代码高效吗?

最后,针对这个问题曾听说过这样的比喻,就好像“有一个这样的应用程序,依靠今天的天气状况将正确地预测明天的天气状况,唯一的问题是,应用程序需要两天的时间进行计算。”

编辑:编程 本文来源:哈哈算法集,偶然看到hqx算法【澳门新濠3559】

关键词: 澳门新濠3559