00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #include "pent_include.h"
00021
00022 #ifdef USE_HQ2X_SCALER
00023
00024 #include "hq2xScaler.h"
00025 #include "Manips.h"
00026 #include "Texture.h"
00027
00028 namespace Pentagram {
00029
00030 static bool InitedLUT = false;
00031 static uint32 RGBtoYUV[65536];
00032 static uint32 YUV1;
00033 static uint32 YUV2;
00034 static const uint32 Ymask = 0x00FF0000;
00035 static const uint32 Umask = 0x0000FF00;
00036 static const uint32 Vmask = 0x000000FF;
00037 static const uint32 trY = 0x00300000;
00038 static const uint32 trU = 0x00000700;
00039 static const uint32 trV = 0x00000006;
00040 static const uint32 tableMaskR = 0;
00041 static const uint32 tableMaskG = 0;
00042 static const uint32 tableMaskB = 0;
00043
00044 template<class uintX, class Manip, class uintS=uintX> class hq2xScalerInternal {
00045
00046 static inline void Interp1(uint8 * pc, uintS c1, uintS c2)
00047 {
00048
00049 uint8 rgba1[4];
00050 uint8 rgba2[4];
00051 uint8 res[4];
00052
00053 Manip::split(c1,rgba1[0], rgba1[1], rgba1[2], rgba1[3]);
00054 Manip::split(c2,rgba2[0], rgba2[1], rgba2[2], rgba2[3]);
00055
00056 for (int i=0; i<4; i++) res[i]=(rgba1[i]*3+rgba2[i])>>2;
00057
00058 *reinterpret_cast<uintX*>(pc) = Manip::merge(res[0],res[1],res[2],res[3]);
00059 }
00060
00061 static inline void Interp2(uint8 * pc, uintS c1, uintS c2, uintS c3)
00062 {
00063
00064 uint8 rgba1[4];
00065 uint8 rgba2[4];
00066 uint8 rgba3[4];
00067 uint8 res[4];
00068
00069 Manip::split(c1,rgba1[0], rgba1[1], rgba1[2], rgba1[3]);
00070 Manip::split(c2,rgba2[0], rgba2[1], rgba2[2], rgba2[3]);
00071 Manip::split(c3,rgba3[0], rgba3[1], rgba3[2], rgba3[3]);
00072
00073 for (int i=0; i<4; i++) res[i]=(rgba1[i]*2+rgba2[i]+rgba3[i])>>2;
00074
00075 *reinterpret_cast<uintX*>(pc) = Manip::merge(res[0],res[1],res[2],res[3]);
00076
00077 }
00078
00079 static inline void Interp5(uint8 * pc, uintS c1, uintS c2)
00080 {
00081
00082 uint8 rgba1[4];
00083 uint8 rgba2[4];
00084 uint8 res[4];
00085
00086 Manip::split(c1,rgba1[0], rgba1[1], rgba1[2], rgba1[3]);
00087 Manip::split(c2,rgba2[0], rgba2[1], rgba2[2], rgba2[3]);
00088
00089 for (int i=0; i<4; i++) res[i]=(rgba1[i]+rgba2[i])>>1;
00090
00091 *reinterpret_cast<uintX*>(pc) = Manip::merge(res[0],res[1],res[2],res[3]);
00092
00093 }
00094
00095 static inline void Interp6(uint8 * pc, uintS c1, uintS c2, uintS c3)
00096 {
00097
00098
00099
00100
00101 uint8 rgba1[4];
00102 uint8 rgba2[4];
00103 uint8 rgba3[4];
00104 uint8 res[4];
00105
00106 Manip::split(c1,rgba1[0], rgba1[1], rgba1[2], rgba1[3]);
00107 Manip::split(c2,rgba2[0], rgba2[1], rgba2[2], rgba2[3]);
00108 Manip::split(c3,rgba3[0], rgba3[1], rgba3[2], rgba3[3]);
00109
00110 for (int i=0; i<4; i++) res[i]=(rgba1[i]*5+rgba2[i]*2+rgba3[i])>>3;
00111
00112 *reinterpret_cast<uintX*>(pc) = Manip::merge(res[0],res[1],res[2],res[3]);
00113 }
00114
00115 static inline void Interp7(uint8 * pc, uintS c1, uintS c2, uintS c3)
00116 {
00117
00118
00119
00120
00121 uint8 rgba1[4];
00122 uint8 rgba2[4];
00123 uint8 rgba3[4];
00124 uint8 res[4];
00125
00126 Manip::split(c1,rgba1[0], rgba1[1], rgba1[2], rgba1[3]);
00127 Manip::split(c2,rgba2[0], rgba2[1], rgba2[2], rgba2[3]);
00128 Manip::split(c3,rgba3[0], rgba3[1], rgba3[2], rgba3[3]);
00129
00130 for (int i=0; i<4; i++) res[i]=(rgba1[i]*6+rgba2[i]+rgba3[i])>>3;
00131
00132 *reinterpret_cast<uintX*>(pc) = Manip::merge(res[0],res[1],res[2],res[3]);
00133
00134 }
00135
00136 static inline void Interp9(uint8 * pc, uintS c1, uintS c2, uintS c3)
00137 {
00138
00139
00140
00141
00142 uint8 rgba1[4];
00143 uint8 rgba2[4];
00144 uint8 rgba3[4];
00145 uint8 res[4];
00146
00147 Manip::split(c1,rgba1[0], rgba1[1], rgba1[2], rgba1[3]);
00148 Manip::split(c2,rgba2[0], rgba2[1], rgba2[2], rgba2[3]);
00149 Manip::split(c3,rgba3[0], rgba3[1], rgba3[2], rgba3[3]);
00150
00151 for (int i=0; i<4; i++) res[i]=(rgba1[i]*2+(rgba2[i]+rgba3[i])*3)>>3;
00152
00153 *reinterpret_cast<uintX*>(pc) = Manip::merge(res[0],res[1],res[2],res[3]);
00154 }
00155
00156 static inline void Interp10(uint8 * pc, uintS c1, uintS c2, uintS c3)
00157 {
00158
00159
00160
00161
00162 uint8 rgba1[4];
00163 uint8 rgba2[4];
00164 uint8 rgba3[4];
00165 uint32 res[4];
00166
00167 Manip::split(c1,rgba1[0], rgba1[1], rgba1[2], rgba1[3]);
00168 Manip::split(c2,rgba2[0], rgba2[1], rgba2[2], rgba2[3]);
00169 Manip::split(c3,rgba3[0], rgba3[1], rgba3[2], rgba3[3]);
00170
00171 for (int i=0; i<4; i++) res[i]=(rgba1[i]*14+rgba2[i]+rgba3[i])>>4;
00172
00173 *reinterpret_cast<uintX*>(pc) = Manip::merge(res[0],res[1],res[2],res[3]);
00174 }
00175
00176
00177 #define PIXEL00_0 *(reinterpret_cast<uintX*>(pOut)) = Manip::copy(c32[5]);
00178 #define PIXEL00_10 Interp1(pOut, c32[5], c32[1]);
00179 #define PIXEL00_11 Interp1(pOut, c32[5], c32[4]);
00180 #define PIXEL00_12 Interp1(pOut, c32[5], c32[2]);
00181 #define PIXEL00_20 Interp2(pOut, c32[5], c32[4], c32[2]);
00182 #define PIXEL00_21 Interp2(pOut, c32[5], c32[1], c32[2]);
00183 #define PIXEL00_22 Interp2(pOut, c32[5], c32[1], c32[4]);
00184 #define PIXEL00_60 Interp6(pOut, c32[5], c32[2], c32[4]);
00185 #define PIXEL00_61 Interp6(pOut, c32[5], c32[4], c32[2]);
00186 #define PIXEL00_70 Interp7(pOut, c32[5], c32[4], c32[2]);
00187 #define PIXEL00_90 Interp9(pOut, c32[5], c32[4], c32[2]);
00188 #define PIXEL00_100 Interp10(pOut, c32[5], c32[4], c32[2]);
00189 #define PIXEL01_0 *(reinterpret_cast<uintX*>(pOut+sizeof(uintX))) = Manip::copy(c32[5]);
00190 #define PIXEL01_10 Interp1(pOut+sizeof(uintX), c32[5], c32[3]);
00191 #define PIXEL01_11 Interp1(pOut+sizeof(uintX), c32[5], c32[2]);
00192 #define PIXEL01_12 Interp1(pOut+sizeof(uintX), c32[5], c32[6]);
00193 #define PIXEL01_20 Interp2(pOut+sizeof(uintX), c32[5], c32[2], c32[6]);
00194 #define PIXEL01_21 Interp2(pOut+sizeof(uintX), c32[5], c32[3], c32[6]);
00195 #define PIXEL01_22 Interp2(pOut+sizeof(uintX), c32[5], c32[3], c32[2]);
00196 #define PIXEL01_60 Interp6(pOut+sizeof(uintX), c32[5], c32[6], c32[2]);
00197 #define PIXEL01_61 Interp6(pOut+sizeof(uintX), c32[5], c32[2], c32[6]);
00198 #define PIXEL01_70 Interp7(pOut+sizeof(uintX), c32[5], c32[2], c32[6]);
00199 #define PIXEL01_90 Interp9(pOut+sizeof(uintX), c32[5], c32[2], c32[6]);
00200 #define PIXEL01_100 Interp10(pOut+sizeof(uintX), c32[5], c32[2], c32[6]);
00201 #define PIXEL10_0 *(reinterpret_cast<uintX*>(pOut+BpL)) = Manip::copy(c32[5]);
00202 #define PIXEL10_10 Interp1(pOut+BpL, c32[5], c32[7]);
00203 #define PIXEL10_11 Interp1(pOut+BpL, c32[5], c32[8]);
00204 #define PIXEL10_12 Interp1(pOut+BpL, c32[5], c32[4]);
00205 #define PIXEL10_20 Interp2(pOut+BpL, c32[5], c32[8], c32[4]);
00206 #define PIXEL10_21 Interp2(pOut+BpL, c32[5], c32[7], c32[4]);
00207 #define PIXEL10_22 Interp2(pOut+BpL, c32[5], c32[7], c32[8]);
00208 #define PIXEL10_60 Interp6(pOut+BpL, c32[5], c32[4], c32[8]);
00209 #define PIXEL10_61 Interp6(pOut+BpL, c32[5], c32[8], c32[4]);
00210 #define PIXEL10_70 Interp7(pOut+BpL, c32[5], c32[8], c32[4]);
00211 #define PIXEL10_90 Interp9(pOut+BpL, c32[5], c32[8], c32[4]);
00212 #define PIXEL10_100 Interp10(pOut+BpL, c32[5], c32[8], c32[4]);
00213 #define PIXEL11_0 *(reinterpret_cast<uintX*>(pOut+BpL+sizeof(uintX))) = Manip::copy(c32[5]);
00214 #define PIXEL11_10 Interp1(pOut+BpL+sizeof(uintX), c32[5], c32[9]);
00215 #define PIXEL11_11 Interp1(pOut+BpL+sizeof(uintX), c32[5], c32[6]);
00216 #define PIXEL11_12 Interp1(pOut+BpL+sizeof(uintX), c32[5], c32[8]);
00217 #define PIXEL11_20 Interp2(pOut+BpL+sizeof(uintX), c32[5], c32[6], c32[8]);
00218 #define PIXEL11_21 Interp2(pOut+BpL+sizeof(uintX), c32[5], c32[9], c32[8]);
00219 #define PIXEL11_22 Interp2(pOut+BpL+sizeof(uintX), c32[5], c32[9], c32[6]);
00220 #define PIXEL11_60 Interp6(pOut+BpL+sizeof(uintX), c32[5], c32[8], c32[6]);
00221 #define PIXEL11_61 Interp6(pOut+BpL+sizeof(uintX), c32[5], c32[6], c32[8]);
00222 #define PIXEL11_70 Interp7(pOut+BpL+sizeof(uintX), c32[5], c32[6], c32[8]);
00223 #define PIXEL11_90 Interp9(pOut+BpL+sizeof(uintX), c32[5], c32[6], c32[8]);
00224 #define PIXEL11_100 Interp10(pOut+BpL+sizeof(uintX), c32[5], c32[6], c32[8]);
00225
00226 static inline bool Diff(unsigned int w1, unsigned int w2)
00227 {
00228 YUV1 = RGBtoYUV[w1];
00229 YUV2 = RGBtoYUV[w2];
00230 return ( ( abs((YUV1 & Ymask) - (YUV2 & Ymask)) > trY ) ||
00231 ( abs((YUV1 & Umask) - (YUV2 & Umask)) > trU ) ||
00232 ( abs((YUV1 & Vmask) - (YUV2 & Vmask)) > trV ) );
00233 }
00234
00235 public:
00236
00237 static void InitLUTs(void)
00238 {
00239 if (InitedLUT) return;
00240 InitedLUT = true;
00241
00242 int i, j, k, r, g, b, Y, u, v;
00243
00244 for (i=0; i<32; i++)
00245 for (j=0; j<64; j++)
00246 for (k=0; k<32; k++)
00247 {
00248 r = i << 3;
00249 g = j << 2;
00250 b = k << 3;
00251 Y = (r + g + b) >> 2;
00252 u = 128 + ((r - b) >> 2);
00253 v = 128 + ((-r + 2*g -b)>>3);
00254 RGBtoYUV[ (i << 11) + (j << 5) + k ] = (Y<<16) + (u<<8) + v;
00255 }
00256 }
00257
00258 static bool hq2x_32(Texture *tex, sint32 sx, sint32 sy, sint32 Xres, sint32 Yres,
00259 uint8* pOut, sint32 dw, sint32 dh, sint32 BpL, bool clamp_src)
00260 {
00261 if (Xres*2!=dw || Yres*2!=dh) return false;
00262
00263 InitLUTs();
00264
00265 int i, j, k;
00266 int prevline, nextline;
00267 uint32 w16[10];
00268 uintS c32[10];
00269
00270
00271 int tpitch = tex->width*sizeof(uintS);
00272 uint8 *pIn = reinterpret_cast<uint8*>(tex->buffer) + sy*tpitch + sx*sizeof(uintS);
00273 int tex_diff = tpitch - Xres*sizeof(uintX);
00274
00275 int pix_diff = BpL*2-Xres*2*sizeof(uintX);
00276
00277 bool clipX = true;
00278 bool clipY_Begin = true;
00279 bool clipY_End = true;
00280
00281 if (!clamp_src && sy!=0) clipY_Begin = false;
00282 if (!clamp_src && (Yres+sy)<tex->height) clipY_End = false;
00283
00284
00285
00286
00287
00288
00289
00290
00291
00292
00293
00294
00295 for (j=0; j<Yres; j++)
00296 {
00297 if (j==0 || !clipY_Begin) prevline = -tpitch; else prevline = 0;
00298 if (j<Yres-1 || !clipY_End) nextline = tpitch; else nextline = 0;
00299
00300
00301 c32[2] = c32[3] = *reinterpret_cast<uintS*>(pIn + prevline);
00302 c32[5] = c32[6] = *reinterpret_cast<uintS*>(pIn);
00303 c32[8] = c32[9] = *reinterpret_cast<uintS*>(pIn + nextline);
00304
00305 w16[2] = w16[3] = Manip::to16bit(c32[2]);
00306 w16[5] = w16[6] = Manip::to16bit(c32[5]);
00307 w16[8] = w16[9] = Manip::to16bit(c32[6]);
00308
00309 for (i=0; i<Xres; i++)
00310 {
00311
00312 c32[1] = c32[2];
00313 c32[4] = c32[5];
00314 c32[7] = c32[8];
00315 w16[1] = w16[2];
00316 w16[4] = w16[5];
00317 w16[7] = w16[8];
00318
00319
00320 c32[2] = c32[3];
00321 c32[5] = c32[6];
00322 c32[8] = c32[9];
00323 w16[2] = w16[3];
00324 w16[5] = w16[6];
00325 w16[8] = w16[9];
00326
00327
00328 if (i<Xres-1 || !clipX)
00329 {
00330 c32[3] = *reinterpret_cast<uintS*>(pIn + sizeof(uintS) + prevline);
00331 c32[6] = *reinterpret_cast<uintS*>(pIn + sizeof(uintS));
00332 c32[9] = *reinterpret_cast<uintS*>(pIn + sizeof(uintS) + nextline);
00333 w16[3] = Manip::to16bit(c32[3]);
00334 w16[6] = Manip::to16bit(c32[6]);
00335 w16[9] = Manip::to16bit(c32[9]);
00336 }
00337
00338 int pattern = 0;
00339 int flag = 1;
00340
00341 YUV1 = RGBtoYUV[w16[5]];
00342
00343 for (k=1; k<=9; k++)
00344 {
00345 if (k==5) continue;
00346
00347 if ( w16[k] != w16[5] )
00348 {
00349 YUV2 = RGBtoYUV[w16[k]];
00350 if ( ( abs((YUV1 & Ymask) - (YUV2 & Ymask)) > trY ) ||
00351 ( abs((YUV1 & Umask) - (YUV2 & Umask)) > trU ) ||
00352 ( abs((YUV1 & Vmask) - (YUV2 & Vmask)) > trV ) )
00353 pattern |= flag;
00354 }
00355 flag <<= 1;
00356 }
00357
00358 switch (pattern)
00359 {
00360 case 0:
00361 case 1:
00362 case 4:
00363 case 32:
00364 case 128:
00365 case 5:
00366 case 132:
00367 case 160:
00368 case 33:
00369 case 129:
00370 case 36:
00371 case 133:
00372 case 164:
00373 case 161:
00374 case 37:
00375 case 165:
00376 {
00377 PIXEL00_20
00378 PIXEL01_20
00379 PIXEL10_20
00380 PIXEL11_20
00381 break;
00382 }
00383 case 2:
00384 case 34:
00385 case 130:
00386 case 162:
00387 {
00388 PIXEL00_22
00389 PIXEL01_21
00390 PIXEL10_20
00391 PIXEL11_20
00392 break;
00393 }
00394 case 16:
00395 case 17:
00396 case 48:
00397 case 49:
00398 {
00399 PIXEL00_20
00400 PIXEL01_22
00401 PIXEL10_20
00402 PIXEL11_21
00403 break;
00404 }
00405 case 64:
00406 case 65:
00407 case 68:
00408 case 69:
00409 {
00410 PIXEL00_20
00411 PIXEL01_20
00412 PIXEL10_21
00413 PIXEL11_22
00414 break;
00415 }
00416 case 8:
00417 case 12:
00418 case 136:
00419 case 140:
00420 {
00421 PIXEL00_21
00422 PIXEL01_20
00423 PIXEL10_22
00424 PIXEL11_20
00425 break;
00426 }
00427 case 3:
00428 case 35:
00429 case 131:
00430 case 163:
00431 {
00432 PIXEL00_11
00433 PIXEL01_21
00434 PIXEL10_20
00435 PIXEL11_20
00436 break;
00437 }
00438 case 6:
00439 case 38:
00440 case 134:
00441 case 166:
00442 {
00443 PIXEL00_22
00444 PIXEL01_12
00445 PIXEL10_20
00446 PIXEL11_20
00447 break;
00448 }
00449 case 20:
00450 case 21:
00451 case 52:
00452 case 53:
00453 {
00454 PIXEL00_20
00455 PIXEL01_11
00456 PIXEL10_20
00457 PIXEL11_21
00458 break;
00459 }
00460 case 144:
00461 case 145:
00462 case 176:
00463 case 177:
00464 {
00465 PIXEL00_20
00466 PIXEL01_22
00467 PIXEL10_20
00468 PIXEL11_12
00469 break;
00470 }
00471 case 192:
00472 case 193:
00473 case 196:
00474 case 197:
00475 {
00476 PIXEL00_20
00477 PIXEL01_20
00478 PIXEL10_21
00479 PIXEL11_11
00480 break;
00481 }
00482 case 96:
00483 case 97:
00484 case 100:
00485 case 101:
00486 {
00487 PIXEL00_20
00488 PIXEL01_20
00489 PIXEL10_12
00490 PIXEL11_22
00491 break;
00492 }
00493 case 40:
00494 case 44:
00495 case 168:
00496 case 172:
00497 {
00498 PIXEL00_21
00499 PIXEL01_20
00500 PIXEL10_11
00501 PIXEL11_20
00502 break;
00503 }
00504 case 9:
00505 case 13:
00506 case 137:
00507 case 141:
00508 {
00509 PIXEL00_12
00510 PIXEL01_20
00511 PIXEL10_22
00512 PIXEL11_20
00513 break;
00514 }
00515 case 18:
00516 case 50:
00517 {
00518 PIXEL00_22
00519 if (Diff(w16[2], w16[6]))
00520 {
00521 PIXEL01_10
00522 }
00523 else
00524 {
00525 PIXEL01_20
00526 }
00527 PIXEL10_20
00528 PIXEL11_21
00529 break;
00530 }
00531 case 80:
00532 case 81:
00533 {
00534 PIXEL00_20
00535 PIXEL01_22
00536 PIXEL10_21
00537 if (Diff(w16[6], w16[8]))
00538 {
00539 PIXEL11_10
00540 }
00541 else
00542 {
00543 PIXEL11_20
00544 }
00545 break;
00546 }
00547 case 72:
00548 case 76:
00549 {
00550 PIXEL00_21
00551 PIXEL01_20
00552 if (Diff(w16[8], w16[4]))
00553 {
00554 PIXEL10_10
00555 }
00556 else
00557 {
00558 PIXEL10_20
00559 }
00560 PIXEL11_22
00561 break;
00562 }
00563 case 10:
00564 case 138:
00565 {
00566 if (Diff(w16[4], w16[2]))
00567 {
00568 PIXEL00_10
00569 }
00570 else
00571 {
00572 PIXEL00_20
00573 }
00574 PIXEL01_21
00575 PIXEL10_22
00576 PIXEL11_20
00577 break;
00578 }
00579 case 66:
00580 {
00581 PIXEL00_22
00582 PIXEL01_21
00583 PIXEL10_21
00584 PIXEL11_22
00585 break;
00586 }
00587 case 24:
00588 {
00589 PIXEL00_21
00590 PIXEL01_22
00591 PIXEL10_22
00592 PIXEL11_21
00593 break;
00594 }
00595 case 7:
00596 case 39:
00597 case 135:
00598 {
00599 PIXEL00_11
00600 PIXEL01_12
00601 PIXEL10_20
00602 PIXEL11_20
00603 break;
00604 }
00605 case 148:
00606 case 149:
00607 case 180:
00608 {
00609 PIXEL00_20
00610 PIXEL01_11
00611 PIXEL10_20
00612 PIXEL11_12
00613 break;
00614 }
00615 case 224:
00616 case 228:
00617 case 225:
00618 {
00619 PIXEL00_20
00620 PIXEL01_20
00621 PIXEL10_12
00622 PIXEL11_11
00623 break;
00624 }
00625 case 41:
00626 case 169:
00627 case 45:
00628 {
00629 PIXEL00_12
00630 PIXEL01_20
00631 PIXEL10_11
00632 PIXEL11_20
00633 break;
00634 }
00635 case 22:
00636 case 54:
00637 {
00638 PIXEL00_22
00639 if (Diff(w16[2], w16[6]))
00640 {
00641 PIXEL01_0
00642 }
00643 else
00644 {
00645 PIXEL01_20
00646 }
00647 PIXEL10_20
00648 PIXEL11_21
00649 break;
00650 }
00651 case 208:
00652 case 209:
00653 {
00654 PIXEL00_20
00655 PIXEL01_22
00656 PIXEL10_21
00657 if (Diff(w16[6], w16[8]))
00658 {
00659 PIXEL11_0
00660 }
00661 else
00662 {
00663 PIXEL11_20
00664 }
00665 break;
00666 }
00667 case 104:
00668 case 108:
00669 {
00670 PIXEL00_21
00671 PIXEL01_20
00672 if (Diff(w16[8], w16[4]))
00673 {
00674 PIXEL10_0
00675 }
00676 else
00677 {
00678 PIXEL10_20
00679 }
00680 PIXEL11_22
00681 break;
00682 }
00683 case 11:
00684 case 139:
00685 {
00686 if (Diff(w16[4], w16[2]))
00687 {
00688 PIXEL00_0
00689 }
00690 else
00691 {
00692 PIXEL00_20
00693 }
00694 PIXEL01_21
00695 PIXEL10_22
00696 PIXEL11_20
00697 break;
00698 }
00699 case 19:
00700 case 51:
00701 {
00702 if (Diff(w16[2], w16[6]))
00703 {
00704 PIXEL00_11
00705 PIXEL01_10
00706 }
00707 else
00708 {
00709 PIXEL00_60
00710 PIXEL01_90
00711 }
00712 PIXEL10_20
00713 PIXEL11_21
00714 break;
00715 }
00716 case 146:
00717 case 178:
00718 {
00719 PIXEL00_22
00720 if (Diff(w16[2], w16[6]))
00721 {
00722 PIXEL01_10
00723 PIXEL11_12
00724 }
00725 else
00726 {
00727 PIXEL01_90
00728 PIXEL11_61
00729 }
00730 PIXEL10_20
00731 break;
00732 }
00733 case 84:
00734 case 85:
00735 {
00736 PIXEL00_20
00737 if (Diff(w16[6], w16[8]))
00738 {
00739 PIXEL01_11
00740 PIXEL11_10
00741 }
00742 else
00743 {
00744 PIXEL01_60
00745 PIXEL11_90
00746 }
00747 PIXEL10_21
00748 break;
00749 }
00750 case 112:
00751 case 113:
00752 {
00753 PIXEL00_20
00754 PIXEL01_22
00755 if (Diff(w16[6], w16[8]))
00756 {
00757 PIXEL10_12
00758 PIXEL11_10
00759 }
00760 else
00761 {
00762 PIXEL10_61
00763 PIXEL11_90
00764 }
00765 break;
00766 }
00767 case 200:
00768 case 204:
00769 {
00770 PIXEL00_21
00771 PIXEL01_20
00772 if (Diff(w16[8], w16[4]))
00773 {
00774 PIXEL10_10
00775 PIXEL11_11
00776 }
00777 else
00778 {
00779 PIXEL10_90
00780 PIXEL11_60
00781 }
00782 break;
00783 }
00784 case 73:
00785 case 77:
00786 {
00787 if (Diff(w16[8], w16[4]))
00788 {
00789 PIXEL00_12
00790 PIXEL10_10
00791 }
00792 else
00793 {
00794 PIXEL00_61
00795 PIXEL10_90
00796 }
00797 PIXEL01_20
00798 PIXEL11_22
00799 break;
00800 }
00801 case 42:
00802 case 170:
00803 {
00804 if (Diff(w16[4], w16[2]))
00805 {
00806 PIXEL00_10
00807 PIXEL10_11
00808 }
00809 else
00810 {
00811 PIXEL00_90
00812 PIXEL10_60
00813 }
00814 PIXEL01_21
00815 PIXEL11_20
00816 break;
00817 }
00818 case 14:
00819 case 142:
00820 {
00821 if (Diff(w16[4], w16[2]))
00822 {
00823 PIXEL00_10
00824 PIXEL01_12
00825 }
00826 else
00827 {
00828 PIXEL00_90
00829 PIXEL01_61
00830 }
00831 PIXEL10_22
00832 PIXEL11_20
00833 break;
00834 }
00835 case 67:
00836 {
00837 PIXEL00_11
00838 PIXEL01_21
00839 PIXEL10_21
00840 PIXEL11_22
00841 break;
00842 }
00843 case 70:
00844 {
00845 PIXEL00_22
00846 PIXEL01_12
00847 PIXEL10_21
00848 PIXEL11_22
00849 break;
00850 }
00851 case 28:
00852 {
00853 PIXEL00_21
00854 PIXEL01_11
00855 PIXEL10_22
00856 PIXEL11_21
00857 break;
00858 }
00859 case 152:
00860 {
00861 PIXEL00_21
00862 PIXEL01_22
00863 PIXEL10_22
00864 PIXEL11_12
00865 break;
00866 }
00867 case 194:
00868 {
00869 PIXEL00_22
00870 PIXEL01_21
00871 PIXEL10_21
00872 PIXEL11_11
00873 break;
00874 }
00875 case 98:
00876 {
00877 PIXEL00_22
00878 PIXEL01_21
00879 PIXEL10_12
00880 PIXEL11_22
00881 break;
00882 }
00883 case 56:
00884 {
00885 PIXEL00_21
00886 PIXEL01_22
00887 PIXEL10_11
00888 PIXEL11_21
00889 break;
00890 }
00891 case 25:
00892 {
00893 PIXEL00_12
00894 PIXEL01_22
00895 PIXEL10_22
00896 PIXEL11_21
00897 break;
00898 }
00899 case 26:
00900 case 31:
00901 {
00902 if (Diff(w16[4], w16[2]))
00903 {
00904 PIXEL00_0
00905 }
00906 else
00907 {
00908 PIXEL00_20
00909 }
00910 if (Diff(w16[2], w16[6]))
00911 {
00912 PIXEL01_0
00913 }
00914 else
00915 {
00916 PIXEL01_20
00917 }
00918 PIXEL10_22
00919 PIXEL11_21
00920 break;
00921 }
00922 case 82:
00923 case 214:
00924 {
00925 PIXEL00_22
00926 if (Diff(w16[2], w16[6]))
00927 {
00928 PIXEL01_0
00929 }
00930 else
00931 {
00932 PIXEL01_20
00933 }
00934 PIXEL10_21
00935 if (Diff(w16[6], w16[8]))
00936 {
00937 PIXEL11_0
00938 }
00939 else
00940 {
00941 PIXEL11_20
00942 }
00943 break;
00944 }
00945 case 88:
00946 case 248:
00947 {
00948 PIXEL00_21
00949 PIXEL01_22
00950 if (Diff(w16[8], w16[4]))
00951 {
00952 PIXEL10_0
00953 }
00954 else
00955 {
00956 PIXEL10_20
00957 }
00958 if (Diff(w16[6], w16[8]))
00959 {
00960 PIXEL11_0
00961 }
00962 else
00963 {
00964 PIXEL11_20
00965 }
00966 break;
00967 }
00968 case 74:
00969 case 107:
00970 {
00971 if (Diff(w16[4], w16[2]))
00972 {
00973 PIXEL00_0
00974 }
00975 else
00976 {
00977 PIXEL00_20
00978 }
00979 PIXEL01_21
00980 if (Diff(w16[8], w16[4]))
00981 {
00982 PIXEL10_0
00983 }
00984 else
00985 {
00986 PIXEL10_20
00987 }
00988 PIXEL11_22
00989 break;
00990 }
00991 case 27:
00992 {
00993 if (Diff(w16[4], w16[2]))
00994 {
00995 PIXEL00_0
00996 }
00997 else
00998 {
00999 PIXEL00_20
01000 }
01001 PIXEL01_10
01002 PIXEL10_22
01003 PIXEL11_21
01004 break;
01005 }
01006 case 86:
01007 {
01008 PIXEL00_22
01009 if (Diff(w16[2], w16[6]))
01010 {
01011 PIXEL01_0
01012 }
01013 else
01014 {
01015 PIXEL01_20
01016 }
01017 PIXEL10_21
01018 PIXEL11_10
01019 break;
01020 }
01021 case 216:
01022 {
01023 PIXEL00_21
01024 PIXEL01_22
01025 PIXEL10_10
01026 if (Diff(w16[6], w16[8]))
01027 {
01028 PIXEL11_0
01029 }
01030 else
01031 {
01032 PIXEL11_20
01033 }
01034 break;
01035 }
01036 case 106:
01037 {
01038 PIXEL00_10
01039 PIXEL01_21
01040 if (Diff(w16[8], w16[4]))
01041 {
01042 PIXEL10_0
01043 }
01044 else
01045 {
01046 PIXEL10_20
01047 }
01048 PIXEL11_22
01049 break;
01050 }
01051 case 30:
01052 {
01053 PIXEL00_10
01054 if (Diff(w16[2], w16[6]))
01055 {
01056 PIXEL01_0
01057 }
01058 else
01059 {
01060 PIXEL01_20
01061 }
01062 PIXEL10_22
01063 PIXEL11_21
01064 break;
01065 }
01066 case 210:
01067 {
01068 PIXEL00_22
01069 PIXEL01_10
01070 PIXEL10_21
01071 if (Diff(w16[6], w16[8]))
01072 {
01073 PIXEL11_0
01074 }
01075 else
01076 {
01077 PIXEL11_20
01078 }
01079 break;
01080 }
01081 case 120:
01082 {
01083 PIXEL00_21
01084 PIXEL01_22
01085 if (Diff(w16[8], w16[4]))
01086 {
01087 PIXEL10_0
01088 }
01089 else
01090 {
01091 PIXEL10_20
01092 }
01093 PIXEL11_10
01094 break;
01095 }
01096 case 75:
01097 {
01098 if (Diff(w16[4], w16[2]))
01099 {
01100 PIXEL00_0
01101 }
01102 else
01103 {
01104 PIXEL00_20
01105 }
01106 PIXEL01_21
01107 PIXEL10_10
01108 PIXEL11_22
01109 break;
01110 }
01111 case 29:
01112 {
01113 PIXEL00_12
01114 PIXEL01_11
01115 PIXEL10_22
01116 PIXEL11_21
01117 break;
01118 }
01119 case 198:
01120 {
01121 PIXEL00_22
01122 PIXEL01_12
01123 PIXEL10_21
01124 PIXEL11_11
01125 break;
01126 }
01127 case 184:
01128 {
01129 PIXEL00_21
01130 PIXEL01_22
01131 PIXEL10_11
01132 PIXEL11_12
01133 break;
01134 }
01135 case 99:
01136 {
01137 PIXEL00_11
01138 PIXEL01_21
01139 PIXEL10_12
01140 PIXEL11_22
01141 break;
01142 }
01143 case 57:
01144 {
01145 PIXEL00_12
01146 PIXEL01_22
01147 PIXEL10_11
01148 PIXEL11_21
01149 break;
01150 }
01151 case 71:
01152 {
01153 PIXEL00_11
01154 PIXEL01_12
01155 PIXEL10_21
01156 PIXEL11_22
01157 break;
01158 }
01159 case 156:
01160 {
01161 PIXEL00_21
01162 PIXEL01_11
01163 PIXEL10_22
01164 PIXEL11_12
01165 break;
01166 }
01167 case 226:
01168 {
01169 PIXEL00_22
01170 PIXEL01_21
01171 PIXEL10_12
01172 PIXEL11_11
01173 break;
01174 }
01175 case 60:
01176 {
01177 PIXEL00_21
01178 PIXEL01_11
01179 PIXEL10_11
01180 PIXEL11_21
01181 break;
01182 }
01183 case 195:
01184 {
01185 PIXEL00_11
01186 PIXEL01_21
01187 PIXEL10_21
01188 PIXEL11_11