1 //hq2x filter demo program
2 //----------------------------------------------------------
3 //Copyright (C) 2003 MaxSt ( maxst@hiend3d.com )
4
5 //This program is free software; you can redistribute it and/or
6 //modify it under the terms of the GNU Lesser General Public
7 //License as published by the Free Software Foundation; either
8 //version 2.1 of the License, or (at your option) any later version.
9 //
10 //This program is distributed in the hope that it will be useful,
11 //but WITHOUT ANY WARRANTY; without even the implied warranty of
12 //MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 //Lesser General Public License for more details.
14 //
15 //You should have received a copy of the GNU Lesser General Public
16 //License along with this program; if not, write to the Free Software
17 //Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18
19 /* Modified for usage in Mednafen */
20
21 #include "main.h"
22
23 #define HQXX_INTERNAL
24 #include "hqxx-common.h"
25
Interp1(unsigned char * pc,int c1,int c2)26 static inline void Interp1(unsigned char * pc, int c1, int c2)
27 {
28 *((int*)pc) = (c1*3+c2) >> 2;
29 }
30
Interp2(unsigned char * pc,int c1,int c2,int c3)31 static inline void Interp2(unsigned char * pc, int c1, int c2, int c3)
32 {
33 *((int*)pc) = (c1*2+c2+c3) >> 2;
34 }
35
Interp5(unsigned char * pc,int c1,int c2)36 static inline void Interp5(unsigned char * pc, int c1, int c2)
37 {
38 *((int*)pc) = (c1+c2) >> 1;
39 }
40
Interp6(unsigned char * pc,int c1,int c2,int c3)41 static inline void Interp6(unsigned char * pc, int c1, int c2, int c3)
42 {
43 *((int*)pc) = ((((c1 & 0x00FF00)*5 + (c2 & 0x00FF00)*2 + (c3 & 0x00FF00) ) & 0x0007F800) +
44 (((c1 & 0xFF00FF)*5 + (c2 & 0xFF00FF)*2 + (c3 & 0xFF00FF) ) & 0x07F807F8)) >> 3;
45 }
46
Interp7(unsigned char * pc,int c1,int c2,int c3)47 static inline void Interp7(unsigned char * pc, int c1, int c2, int c3)
48 {
49 *((int*)pc) = ((((c1 & 0x00FF00)*6 + (c2 & 0x00FF00) + (c3 & 0x00FF00) ) & 0x0007F800) +
50 (((c1 & 0xFF00FF)*6 + (c2 & 0xFF00FF) + (c3 & 0xFF00FF) ) & 0x07F807F8)) >> 3;
51 }
52
Interp9(unsigned char * pc,int c1,int c2,int c3)53 static inline void Interp9(unsigned char * pc, int c1, int c2, int c3)
54 {
55 *((int*)pc) = ((((c1 & 0x00FF00)*2 + ((c2 & 0x00FF00) + (c3 & 0x00FF00))*3 ) & 0x0007F800) +
56 (((c1 & 0xFF00FF)*2 + ((c2 & 0xFF00FF) + (c3 & 0xFF00FF))*3 ) & 0x07F807F8)) >> 3;
57 }
58
Interp10(unsigned char * pc,int c1,int c2,int c3)59 static inline void Interp10(unsigned char * pc, int c1, int c2, int c3)
60 {
61 *((int*)pc) = ((((c1 & 0x00FF00)*14 + (c2 & 0x00FF00) + (c3 & 0x00FF00) ) & 0x000FF000) +
62 (((c1 & 0xFF00FF)*14 + (c2 & 0xFF00FF) + (c3 & 0xFF00FF) ) & 0x0FF00FF0)) >> 4;
63 }
64
65
66 #define PIXEL00_0 *((int*)(pOut)) = w[5];
67 #define PIXEL00_10 Interp1(pOut, w[5], w[1]);
68 #define PIXEL00_11 Interp1(pOut, w[5], w[4]);
69 #define PIXEL00_12 Interp1(pOut, w[5], w[2]);
70 #define PIXEL00_20 Interp2(pOut, w[5], w[4], w[2]);
71 #define PIXEL00_21 Interp2(pOut, w[5], w[1], w[2]);
72 #define PIXEL00_22 Interp2(pOut, w[5], w[1], w[4]);
73 #define PIXEL00_60 Interp6(pOut, w[5], w[2], w[4]);
74 #define PIXEL00_61 Interp6(pOut, w[5], w[4], w[2]);
75 #define PIXEL00_70 Interp7(pOut, w[5], w[4], w[2]);
76 #define PIXEL00_90 Interp9(pOut, w[5], w[4], w[2]);
77 #define PIXEL00_100 Interp10(pOut, w[5], w[4], w[2]);
78 #define PIXEL01_0 *((int*)(pOut+4)) = w[5];
79 #define PIXEL01_10 Interp1(pOut+4, w[5], w[3]);
80 #define PIXEL01_11 Interp1(pOut+4, w[5], w[2]);
81 #define PIXEL01_12 Interp1(pOut+4, w[5], w[6]);
82 #define PIXEL01_20 Interp2(pOut+4, w[5], w[2], w[6]);
83 #define PIXEL01_21 Interp2(pOut+4, w[5], w[3], w[6]);
84 #define PIXEL01_22 Interp2(pOut+4, w[5], w[3], w[2]);
85 #define PIXEL01_60 Interp6(pOut+4, w[5], w[6], w[2]);
86 #define PIXEL01_61 Interp6(pOut+4, w[5], w[2], w[6]);
87 #define PIXEL01_70 Interp7(pOut+4, w[5], w[2], w[6]);
88 #define PIXEL01_90 Interp9(pOut+4, w[5], w[2], w[6]);
89 #define PIXEL01_100 Interp10(pOut+4, w[5], w[2], w[6]);
90 #define PIXEL10_0 *((int*)(pOut+BpL)) = w[5];
91 #define PIXEL10_10 Interp1(pOut+BpL, w[5], w[7]);
92 #define PIXEL10_11 Interp1(pOut+BpL, w[5], w[8]);
93 #define PIXEL10_12 Interp1(pOut+BpL, w[5], w[4]);
94 #define PIXEL10_20 Interp2(pOut+BpL, w[5], w[8], w[4]);
95 #define PIXEL10_21 Interp2(pOut+BpL, w[5], w[7], w[4]);
96 #define PIXEL10_22 Interp2(pOut+BpL, w[5], w[7], w[8]);
97 #define PIXEL10_60 Interp6(pOut+BpL, w[5], w[4], w[8]);
98 #define PIXEL10_61 Interp6(pOut+BpL, w[5], w[8], w[4]);
99 #define PIXEL10_70 Interp7(pOut+BpL, w[5], w[8], w[4]);
100 #define PIXEL10_90 Interp9(pOut+BpL, w[5], w[8], w[4]);
101 #define PIXEL10_100 Interp10(pOut+BpL, w[5], w[8], w[4]);
102 #define PIXEL11_0 *((int*)(pOut+BpL+4)) = w[5];
103 #define PIXEL11_10 Interp1(pOut+BpL+4, w[5], w[9]);
104 #define PIXEL11_11 Interp1(pOut+BpL+4, w[5], w[6]);
105 #define PIXEL11_12 Interp1(pOut+BpL+4, w[5], w[8]);
106 #define PIXEL11_20 Interp2(pOut+BpL+4, w[5], w[6], w[8]);
107 #define PIXEL11_21 Interp2(pOut+BpL+4, w[5], w[9], w[8]);
108 #define PIXEL11_22 Interp2(pOut+BpL+4, w[5], w[9], w[6]);
109 #define PIXEL11_60 Interp6(pOut+BpL+4, w[5], w[8], w[6]);
110 #define PIXEL11_61 Interp6(pOut+BpL+4, w[5], w[6], w[8]);
111 #define PIXEL11_70 Interp7(pOut+BpL+4, w[5], w[6], w[8]);
112 #define PIXEL11_90 Interp9(pOut+BpL+4, w[5], w[6], w[8]);
113 #define PIXEL11_100 Interp10(pOut+BpL+4, w[5], w[6], w[8]);
114
Diff(unsigned int w1,unsigned int w2)115 static int MDFN_FASTCALL Diff(unsigned int w1, unsigned int w2)
116 {
117 int YUV1;
118 int YUV2;
119
120 YUV1 = hqxx_RGB_to_YUV(w1);
121 YUV2 = hqxx_RGB_to_YUV(w2);
122
123 return ( ( abs((YUV1 & Ymask) - (YUV2 & Ymask)) > trY ) ||
124 ( abs((YUV1 & Umask) - (YUV2 & Umask)) > trU ) ||
125 ( abs((YUV1 & Vmask) - (YUV2 & Vmask)) > trV ) );
126 }
127
hq2x_32(unsigned char * pIn,unsigned char * pOut,int Xres,int Yres,int srcBpL,int BpL)128 void hq2x_32( unsigned char * pIn, unsigned char * pOut, int Xres, int Yres, int srcBpL, int BpL )
129 {
130 int i, j, k;
131 int prevline, nextline;
132 unsigned int w[10];
133
134 // +----+----+----+
135 // | | | |
136 // | w1 | w2 | w3 |
137 // +----+----+----+
138 // | | | |
139 // | w4 | w5 | w6 |
140 // +----+----+----+
141 // | | | |
142 // | w7 | w8 | w9 |
143 // +----+----+----+
144
145 for (j=0; j<Yres; j++)
146 {
147 if (j>0) prevline = -srcBpL; else prevline = 0;
148 if (j<Yres-1) nextline = srcBpL; else nextline = 0;
149
150 for (i=0; i<Xres; i++)
151 {
152 int pattern;
153 int flag;
154 int YUV1Y,YUV1U,YUV1V;
155
156 w[2] = *((unsigned int*)(pIn + prevline)) & 0xFCFCFC;
157 w[5] = *((unsigned int*)pIn) & 0xFCFCFC;
158 w[8] = *((unsigned int*)(pIn + nextline)) & 0xFCFCFC;
159
160 if (i>0)
161 {
162 w[1] = *((unsigned int*)(pIn + prevline - sizeof(uint32))) & 0xFCFCFC;
163 w[4] = *((unsigned int*)(pIn - sizeof(uint32))) & 0xFCFCFC;
164 w[7] = *((unsigned int*)(pIn + nextline - sizeof(uint32))) & 0xFCFCFC;
165 }
166 else
167 {
168 w[1] = w[2];
169 w[4] = w[5];
170 w[7] = w[8];
171 }
172
173 if (i<Xres-1)
174 {
175 w[3] = *((unsigned int*)(pIn + prevline + sizeof(uint32))) & 0xFCFCFC;
176 w[6] = *((unsigned int*)(pIn + sizeof(uint32))) & 0xFCFCFC;
177 w[9] = *((unsigned int*)(pIn + nextline + sizeof(uint32))) & 0xFCFCFC;
178 }
179 else
180 {
181 w[3] = w[2];
182 w[6] = w[5];
183 w[9] = w[8];
184 }
185
186 pattern = 0;
187 flag = 1;
188
189 YUV1Y = YUV1U = YUV1V = hqxx_RGB_to_YUV(w[5]);
190
191 YUV1Y &= Ymask;
192 YUV1U &= Umask;
193 YUV1V &= Vmask;
194
195 for (k=1; k<=9; k++)
196 {
197 if (k==5) continue;
198
199 if ( w[k] != w[5] )
200 {
201 int YUV2 = hqxx_RGB_to_YUV(w[k]);
202
203 if ( ( abs(YUV1Y - (YUV2 & Ymask)) > trY ) ||
204 ( abs(YUV1U - (YUV2 & Umask)) > trU ) ||
205 ( abs(YUV1V - (YUV2 & Vmask)) > trV ) )
206 pattern |= flag;
207 }
208 flag <<= 1;
209 }
210
211 switch (pattern)
212 {
213 case 0:
214 case 1:
215 case 4:
216 case 32:
217 case 128:
218 case 5:
219 case 132:
220 case 160:
221 case 33:
222 case 129:
223 case 36:
224 case 133:
225 case 164:
226 case 161:
227 case 37:
228 case 165:
229 {
230 PIXEL00_20
231 PIXEL01_20
232 PIXEL10_20
233 PIXEL11_20
234 break;
235 }
236 case 2:
237 case 34:
238 case 130:
239 case 162:
240 {
241 PIXEL00_22
242 PIXEL01_21
243 PIXEL10_20
244 PIXEL11_20
245 break;
246 }
247 case 16:
248 case 17:
249 case 48:
250 case 49:
251 {
252 PIXEL00_20
253 PIXEL01_22
254 PIXEL10_20
255 PIXEL11_21
256 break;
257 }
258 case 64:
259 case 65:
260 case 68:
261 case 69:
262 {
263 PIXEL00_20
264 PIXEL01_20
265 PIXEL10_21
266 PIXEL11_22
267 break;
268 }
269 case 8:
270 case 12:
271 case 136:
272 case 140:
273 {
274 PIXEL00_21
275 PIXEL01_20
276 PIXEL10_22
277 PIXEL11_20
278 break;
279 }
280 case 3:
281 case 35:
282 case 131:
283 case 163:
284 {
285 PIXEL00_11
286 PIXEL01_21
287 PIXEL10_20
288 PIXEL11_20
289 break;
290 }
291 case 6:
292 case 38:
293 case 134:
294 case 166:
295 {
296 PIXEL00_22
297 PIXEL01_12
298 PIXEL10_20
299 PIXEL11_20
300 break;
301 }
302 case 20:
303 case 21:
304 case 52:
305 case 53:
306 {
307 PIXEL00_20
308 PIXEL01_11
309 PIXEL10_20
310 PIXEL11_21
311 break;
312 }
313 case 144:
314 case 145:
315 case 176:
316 case 177:
317 {
318 PIXEL00_20
319 PIXEL01_22
320 PIXEL10_20
321 PIXEL11_12
322 break;
323 }
324 case 192:
325 case 193:
326 case 196:
327 case 197:
328 {
329 PIXEL00_20
330 PIXEL01_20
331 PIXEL10_21
332 PIXEL11_11
333 break;
334 }
335 case 96:
336 case 97:
337 case 100:
338 case 101:
339 {
340 PIXEL00_20
341 PIXEL01_20
342 PIXEL10_12
343 PIXEL11_22
344 break;
345 }
346 case 40:
347 case 44:
348 case 168:
349 case 172:
350 {
351 PIXEL00_21
352 PIXEL01_20
353 PIXEL10_11
354 PIXEL11_20
355 break;
356 }
357 case 9:
358 case 13:
359 case 137:
360 case 141:
361 {
362 PIXEL00_12
363 PIXEL01_20
364 PIXEL10_22
365 PIXEL11_20
366 break;
367 }
368 case 18:
369 case 50:
370 {
371 PIXEL00_22
372 if (Diff(w[2], w[6]))
373 {
374 PIXEL01_10
375 }
376 else
377 {
378 PIXEL01_20
379 }
380 PIXEL10_20
381 PIXEL11_21
382 break;
383 }
384 case 80:
385 case 81:
386 {
387 PIXEL00_20
388 PIXEL01_22
389 PIXEL10_21
390 if (Diff(w[6], w[8]))
391 {
392 PIXEL11_10
393 }
394 else
395 {
396 PIXEL11_20
397 }
398 break;
399 }
400 case 72:
401 case 76:
402 {
403 PIXEL00_21
404 PIXEL01_20
405 if (Diff(w[8], w[4]))
406 {
407 PIXEL10_10
408 }
409 else
410 {
411 PIXEL10_20
412 }
413 PIXEL11_22
414 break;
415 }
416 case 10:
417 case 138:
418 {
419 if (Diff(w[4], w[2]))
420 {
421 PIXEL00_10
422 }
423 else
424 {
425 PIXEL00_20
426 }
427 PIXEL01_21
428 PIXEL10_22
429 PIXEL11_20
430 break;
431 }
432 case 66:
433 {
434 PIXEL00_22
435 PIXEL01_21
436 PIXEL10_21
437 PIXEL11_22
438 break;
439 }
440 case 24:
441 {
442 PIXEL00_21
443 PIXEL01_22
444 PIXEL10_22
445 PIXEL11_21
446 break;
447 }
448 case 7:
449 case 39:
450 case 135:
451 {
452 PIXEL00_11
453 PIXEL01_12
454 PIXEL10_20
455 PIXEL11_20
456 break;
457 }
458 case 148:
459 case 149:
460 case 180:
461 {
462 PIXEL00_20
463 PIXEL01_11
464 PIXEL10_20
465 PIXEL11_12
466 break;
467 }
468 case 224:
469 case 228:
470 case 225:
471 {
472 PIXEL00_20
473 PIXEL01_20
474 PIXEL10_12
475 PIXEL11_11
476 break;
477 }
478 case 41:
479 case 169:
480 case 45:
481 {
482 PIXEL00_12
483 PIXEL01_20
484 PIXEL10_11
485 PIXEL11_20
486 break;
487 }
488 case 22:
489 case 54:
490 {
491 PIXEL00_22
492 if (Diff(w[2], w[6]))
493 {
494 PIXEL01_0
495 }
496 else
497 {
498 PIXEL01_20
499 }
500 PIXEL10_20
501 PIXEL11_21
502 break;
503 }
504 case 208:
505 case 209:
506 {
507 PIXEL00_20
508 PIXEL01_22
509 PIXEL10_21
510 if (Diff(w[6], w[8]))
511 {
512 PIXEL11_0
513 }
514 else
515 {
516 PIXEL11_20
517 }
518 break;
519 }
520 case 104:
521 case 108:
522 {
523 PIXEL00_21
524 PIXEL01_20
525 if (Diff(w[8], w[4]))
526 {
527 PIXEL10_0
528 }
529 else
530 {
531 PIXEL10_20
532 }
533 PIXEL11_22
534 break;
535 }
536 case 11:
537 case 139:
538 {
539 if (Diff(w[4], w[2]))
540 {
541 PIXEL00_0
542 }
543 else
544 {
545 PIXEL00_20
546 }
547 PIXEL01_21
548 PIXEL10_22
549 PIXEL11_20
550 break;
551 }
552 case 19:
553 case 51:
554 {
555 if (Diff(w[2], w[6]))
556 {
557 PIXEL00_11
558 PIXEL01_10
559 }
560 else
561 {
562 PIXEL00_60
563 PIXEL01_90
564 }
565 PIXEL10_20
566 PIXEL11_21
567 break;
568 }
569 case 146:
570 case 178:
571 {
572 PIXEL00_22
573 if (Diff(w[2], w[6]))
574 {
575 PIXEL01_10
576 PIXEL11_12
577 }
578 else
579 {
580 PIXEL01_90
581 PIXEL11_61
582 }
583 PIXEL10_20
584 break;
585 }
586 case 84:
587 case 85:
588 {
589 PIXEL00_20
590 if (Diff(w[6], w[8]))
591 {
592 PIXEL01_11
593 PIXEL11_10
594 }
595 else
596 {
597 PIXEL01_60
598 PIXEL11_90
599 }
600 PIXEL10_21
601 break;
602 }
603 case 112:
604 case 113:
605 {
606 PIXEL00_20
607 PIXEL01_22
608 if (Diff(w[6], w[8]))
609 {
610 PIXEL10_12
611 PIXEL11_10
612 }
613 else
614 {
615 PIXEL10_61
616 PIXEL11_90
617 }
618 break;
619 }
620 case 200:
621 case 204:
622 {
623 PIXEL00_21
624 PIXEL01_20
625 if (Diff(w[8], w[4]))
626 {
627 PIXEL10_10
628 PIXEL11_11
629 }
630 else
631 {
632 PIXEL10_90
633 PIXEL11_60
634 }
635 break;
636 }
637 case 73:
638 case 77:
639 {
640 if (Diff(w[8], w[4]))
641 {
642 PIXEL00_12
643 PIXEL10_10
644 }
645 else
646 {
647 PIXEL00_61
648 PIXEL10_90
649 }
650 PIXEL01_20
651 PIXEL11_22
652 break;
653 }
654 case 42:
655 case 170:
656 {
657 if (Diff(w[4], w[2]))
658 {
659 PIXEL00_10
660 PIXEL10_11
661 }
662 else
663 {
664 PIXEL00_90
665 PIXEL10_60
666 }
667 PIXEL01_21
668 PIXEL11_20
669 break;
670 }
671 case 14:
672 case 142:
673 {
674 if (Diff(w[4], w[2]))
675 {
676 PIXEL00_10
677 PIXEL01_12
678 }
679 else
680 {
681 PIXEL00_90
682 PIXEL01_61
683 }
684 PIXEL10_22
685 PIXEL11_20
686 break;
687 }
688 case 67:
689 {
690 PIXEL00_11
691 PIXEL01_21
692 PIXEL10_21
693 PIXEL11_22
694 break;
695 }
696 case 70:
697 {
698 PIXEL00_22
699 PIXEL01_12
700 PIXEL10_21
701 PIXEL11_22
702 break;
703 }
704 case 28:
705 {
706 PIXEL00_21
707 PIXEL01_11
708 PIXEL10_22
709 PIXEL11_21
710 break;
711 }
712 case 152:
713 {
714 PIXEL00_21
715 PIXEL01_22
716 PIXEL10_22
717 PIXEL11_12
718 break;
719 }
720 case 194:
721 {
722 PIXEL00_22
723 PIXEL01_21
724 PIXEL10_21
725 PIXEL11_11
726 break;
727 }
728 case 98:
729 {
730 PIXEL00_22
731 PIXEL01_21
732 PIXEL10_12
733 PIXEL11_22
734 break;
735 }
736 case 56:
737 {
738 PIXEL00_21
739 PIXEL01_22
740 PIXEL10_11
741 PIXEL11_21
742 break;
743 }
744 case 25:
745 {
746 PIXEL00_12
747 PIXEL01_22
748 PIXEL10_22
749 PIXEL11_21
750 break;
751 }
752 case 26:
753 case 31:
754 {
755 if (Diff(w[4], w[2]))
756 {
757 PIXEL00_0
758 }
759 else
760 {
761 PIXEL00_20
762 }
763 if (Diff(w[2], w[6]))
764 {
765 PIXEL01_0
766 }
767 else
768 {
769 PIXEL01_20
770 }
771 PIXEL10_22
772 PIXEL11_21
773 break;
774 }
775 case 82:
776 case 214:
777 {
778 PIXEL00_22
779 if (Diff(w[2], w[6]))
780 {
781 PIXEL01_0
782 }
783 else
784 {
785 PIXEL01_20
786 }
787 PIXEL10_21
788 if (Diff(w[6], w[8]))
789 {
790 PIXEL11_0
791 }
792 else
793 {
794 PIXEL11_20
795 }
796 break;
797 }
798 case 88:
799 case 248:
800 {
801 PIXEL00_21
802 PIXEL01_22
803 if (Diff(w[8], w[4]))
804 {
805 PIXEL10_0
806 }
807 else
808 {
809 PIXEL10_20
810 }
811 if (Diff(w[6], w[8]))
812 {
813 PIXEL11_0
814 }
815 else
816 {
817 PIXEL11_20
818 }
819 break;
820 }
821 case 74:
822 case 107:
823 {
824 if (Diff(w[4], w[2]))
825 {
826 PIXEL00_0
827 }
828 else
829 {
830 PIXEL00_20
831 }
832 PIXEL01_21
833 if (Diff(w[8], w[4]))
834 {
835 PIXEL10_0
836 }
837 else
838 {
839 PIXEL10_20
840 }
841 PIXEL11_22
842 break;
843 }
844 case 27:
845 {
846 if (Diff(w[4], w[2]))
847 {
848 PIXEL00_0
849 }
850 else
851 {
852 PIXEL00_20
853 }
854 PIXEL01_10
855 PIXEL10_22
856 PIXEL11_21
857 break;
858 }
859 case 86:
860 {
861 PIXEL00_22
862 if (Diff(w[2], w[6]))
863 {
864 PIXEL01_0
865 }
866 else
867 {
868 PIXEL01_20
869 }
870 PIXEL10_21
871 PIXEL11_10
872 break;
873 }
874 case 216:
875 {
876 PIXEL00_21
877 PIXEL01_22
878 PIXEL10_10
879 if (Diff(w[6], w[8]))
880 {
881 PIXEL11_0
882 }
883 else
884 {
885 PIXEL11_20
886 }
887 break;
888 }
889 case 106:
890 {
891 PIXEL00_10
892 PIXEL01_21
893 if (Diff(w[8], w[4]))
894 {
895 PIXEL10_0
896 }
897 else
898 {
899 PIXEL10_20
900 }
901 PIXEL11_22
902 break;
903 }
904 case 30:
905 {
906 PIXEL00_10
907 if (Diff(w[2], w[6]))
908 {
909 PIXEL01_0
910 }
911 else
912 {
913 PIXEL01_20
914 }
915 PIXEL10_22
916 PIXEL11_21
917 break;
918 }
919 case 210:
920 {
921 PIXEL00_22
922 PIXEL01_10
923 PIXEL10_21
924 if (Diff(w[6], w[8]))
925 {
926 PIXEL11_0
927 }
928 else
929 {
930 PIXEL11_20
931 }
932 break;
933 }
934 case 120:
935 {
936 PIXEL00_21
937 PIXEL01_22
938 if (Diff(w[8], w[4]))
939 {
940 PIXEL10_0
941 }
942 else
943 {
944 PIXEL10_20
945 }
946 PIXEL11_10
947 break;
948 }
949 case 75:
950 {
951 if (Diff(w[4], w[2]))
952 {
953 PIXEL00_0
954 }
955 else
956 {
957 PIXEL00_20
958 }
959 PIXEL01_21
960 PIXEL10_10
961 PIXEL11_22
962 break;
963 }
964 case 29:
965 {
966 PIXEL00_12
967 PIXEL01_11
968 PIXEL10_22
969 PIXEL11_21
970 break;
971 }
972 case 198:
973 {
974 PIXEL00_22
975 PIXEL01_12
976 PIXEL10_21
977 PIXEL11_11
978 break;
979 }
980 case 184:
981 {
982 PIXEL00_21
983 PIXEL01_22
984 PIXEL10_11
985 PIXEL11_12
986 break;
987 }
988 case 99:
989 {
990 PIXEL00_11
991 PIXEL01_21
992 PIXEL10_12
993 PIXEL11_22
994 break;
995 }
996 case 57:
997 {
998 PIXEL00_12
999 PIXEL01_22
1000 PIXEL10_11
1001 PIXEL11_21
1002 break;
1003 }
1004 case 71:
1005 {
1006 PIXEL00_11
1007 PIXEL01_12
1008 PIXEL10_21
1009 PIXEL11_22
1010 break;
1011 }
1012 case 156:
1013 {
1014 PIXEL00_21
1015 PIXEL01_11
1016 PIXEL10_22
1017 PIXEL11_12
1018 break;
1019 }
1020 case 226:
1021 {
1022 PIXEL00_22
1023 PIXEL01_21
1024 PIXEL10_12
1025 PIXEL11_11
1026 break;
1027 }
1028 case 60:
1029 {
1030 PIXEL00_21
1031 PIXEL01_11
1032 PIXEL10_11
1033 PIXEL11_21
1034 break;
1035 }
1036 case 195:
1037 {
1038 PIXEL00_11
1039 PIXEL01_21
1040 PIXEL10_21
1041 PIXEL11_11
1042 break;
1043 }
1044 case 102:
1045 {
1046 PIXEL00_22
1047 PIXEL01_12
1048 PIXEL10_12
1049 PIXEL11_22
1050 break;
1051 }
1052 case 153:
1053 {
1054 PIXEL00_12
1055 PIXEL01_22
1056 PIXEL10_22
1057 PIXEL11_12
1058 break;
1059 }
1060 case 58:
1061 {
1062 if (Diff(w[4], w[2]))
1063 {
1064 PIXEL00_10
1065 }
1066 else
1067 {
1068 PIXEL00_70
1069 }
1070 if (Diff(w[2], w[6]))
1071 {
1072 PIXEL01_10
1073 }
1074 else
1075 {
1076 PIXEL01_70
1077 }
1078 PIXEL10_11
1079 PIXEL11_21
1080 break;
1081 }
1082 case 83:
1083 {
1084 PIXEL00_11
1085 if (Diff(w[2], w[6]))
1086 {
1087 PIXEL01_10
1088 }
1089 else
1090 {
1091 PIXEL01_70
1092 }
1093 PIXEL10_21
1094 if (Diff(w[6], w[8]))
1095 {
1096 PIXEL11_10
1097 }
1098 else
1099 {
1100 PIXEL11_70
1101 }
1102 break;
1103 }
1104 case 92:
1105 {
1106 PIXEL00_21
1107 PIXEL01_11
1108 if (Diff(w[8], w[4]))
1109 {
1110 PIXEL10_10
1111 }
1112 else
1113 {
1114 PIXEL10_70
1115 }
1116 if (Diff(w[6], w[8]))
1117 {
1118 PIXEL11_10
1119 }
1120 else
1121 {
1122 PIXEL11_70
1123 }
1124 break;
1125 }
1126 case 202:
1127 {
1128 if (Diff(w[4], w[2]))
1129 {
1130 PIXEL00_10
1131 }
1132 else
1133 {
1134 PIXEL00_70
1135 }
1136 PIXEL01_21
1137 if (Diff(w[8], w[4]))
1138 {
1139 PIXEL10_10
1140 }
1141 else
1142 {
1143 PIXEL10_70
1144 }
1145 PIXEL11_11
1146 break;
1147 }
1148 case 78:
1149 {
1150 if (Diff(w[4], w[2]))
1151 {
1152 PIXEL00_10
1153 }
1154 else
1155 {
1156 PIXEL00_70
1157 }
1158 PIXEL01_12
1159 if (Diff(w[8], w[4]))
1160 {
1161 PIXEL10_10
1162 }
1163 else
1164 {
1165 PIXEL10_70
1166 }
1167 PIXEL11_22
1168 break;
1169 }
1170 case 154:
1171 {
1172 if (Diff(w[4], w[2]))
1173 {
1174 PIXEL00_10
1175 }
1176 else
1177 {
1178 PIXEL00_70
1179 }
1180 if (Diff(w[2], w[6]))
1181 {
1182 PIXEL01_10
1183 }
1184 else
1185 {
1186 PIXEL01_70
1187 }
1188 PIXEL10_22
1189 PIXEL11_12
1190 break;
1191 }
1192 case 114:
1193 {
1194 PIXEL00_22
1195 if (Diff(w[2], w[6]))
1196 {
1197 PIXEL01_10
1198 }
1199 else
1200 {
1201 PIXEL01_70
1202 }
1203 PIXEL10_12
1204 if (Diff(w[6], w[8]))
1205 {
1206 PIXEL11_10
1207 }
1208 else
1209 {
1210 PIXEL11_70
1211 }
1212 break;
1213 }
1214 case 89:
1215 {
1216 PIXEL00_12
1217 PIXEL01_22
1218 if (Diff(w[8], w[4]))
1219 {
1220 PIXEL10_10
1221 }
1222 else
1223 {
1224 PIXEL10_70
1225 }
1226 if (Diff(w[6], w[8]))
1227 {
1228 PIXEL11_10
1229 }
1230 else
1231 {
1232 PIXEL11_70
1233 }
1234 break;
1235 }
1236 case 90:
1237 {
1238 if (Diff(w[4], w[2]))
1239 {
1240 PIXEL00_10
1241 }
1242 else
1243 {
1244 PIXEL00_70
1245 }
1246 if (Diff(w[2], w[6]))
1247 {
1248 PIXEL01_10
1249 }
1250 else
1251 {
1252 PIXEL01_70
1253 }
1254 if (Diff(w[8], w[4]))
1255 {
1256 PIXEL10_10
1257 }
1258 else
1259 {
1260 PIXEL10_70
1261 }
1262 if (Diff(w[6], w[8]))
1263 {
1264 PIXEL11_10
1265 }
1266 else
1267 {
1268 PIXEL11_70
1269 }
1270 break;
1271 }
1272 case 55:
1273 case 23:
1274 {
1275 if (Diff(w[2], w[6]))
1276 {
1277 PIXEL00_11
1278 PIXEL01_0
1279 }
1280 else
1281 {
1282 PIXEL00_60
1283 PIXEL01_90
1284 }
1285 PIXEL10_20
1286 PIXEL11_21
1287 break;
1288 }
1289 case 182:
1290 case 150:
1291 {
1292 PIXEL00_22
1293 if (Diff(w[2], w[6]))
1294 {
1295 PIXEL01_0
1296 PIXEL11_12
1297 }
1298 else
1299 {
1300 PIXEL01_90
1301 PIXEL11_61
1302 }
1303 PIXEL10_20
1304 break;
1305 }
1306 case 213:
1307 case 212:
1308 {
1309 PIXEL00_20
1310 if (Diff(w[6], w[8]))
1311 {
1312 PIXEL01_11
1313 PIXEL11_0
1314 }
1315 else
1316 {
1317 PIXEL01_60
1318 PIXEL11_90
1319 }
1320 PIXEL10_21
1321 break;
1322 }
1323 case 241:
1324 case 240:
1325 {
1326 PIXEL00_20
1327 PIXEL01_22
1328 if (Diff(w[6], w[8]))
1329 {
1330 PIXEL10_12
1331 PIXEL11_0
1332 }
1333 else
1334 {
1335 PIXEL10_61
1336 PIXEL11_90
1337 }
1338 break;
1339 }
1340 case 236:
1341 case 232:
1342 {
1343 PIXEL00_21
1344 PIXEL01_20
1345 if (Diff(w[8], w[4]))
1346 {
1347 PIXEL10_0
1348 PIXEL11_11
1349 }
1350 else
1351 {
1352 PIXEL10_90
1353 PIXEL11_60
1354 }
1355 break;
1356 }
1357 case 109:
1358 case 105:
1359 {
1360 if (Diff(w[8], w[4]))
1361 {
1362 PIXEL00_12
1363 PIXEL10_0
1364 }
1365 else
1366 {
1367 PIXEL00_61
1368 PIXEL10_90
1369 }
1370 PIXEL01_20
1371 PIXEL11_22
1372 break;
1373 }
1374 case 171:
1375 case 43:
1376 {
1377 if (Diff(w[4], w[2]))
1378 {
1379 PIXEL00_0
1380 PIXEL10_11
1381 }
1382 else
1383 {
1384 PIXEL00_90
1385 PIXEL10_60
1386 }
1387 PIXEL01_21
1388 PIXEL11_20
1389 break;
1390 }
1391 case 143:
1392 case 15:
1393 {
1394 if (Diff(w[4], w[2]))
1395 {
1396 PIXEL00_0
1397 PIXEL01_12
1398 }
1399 else
1400 {
1401 PIXEL00_90
1402 PIXEL01_61
1403 }
1404 PIXEL10_22
1405 PIXEL11_20
1406 break;
1407 }
1408 case 124:
1409 {
1410 PIXEL00_21
1411 PIXEL01_11
1412 if (Diff(w[8], w[4]))
1413 {
1414 PIXEL10_0
1415 }
1416 else
1417 {
1418 PIXEL10_20
1419 }
1420 PIXEL11_10
1421 break;
1422 }
1423 case 203:
1424 {
1425 if (Diff(w[4], w[2]))
1426 {
1427 PIXEL00_0
1428 }
1429 else
1430 {
1431 PIXEL00_20
1432 }
1433 PIXEL01_21
1434 PIXEL10_10
1435 PIXEL11_11
1436 break;
1437 }
1438 case 62:
1439 {
1440 PIXEL00_10
1441 if (Diff(w[2], w[6]))
1442 {
1443 PIXEL01_0
1444 }
1445 else
1446 {
1447 PIXEL01_20
1448 }
1449 PIXEL10_11
1450 PIXEL11_21
1451 break;
1452 }
1453 case 211:
1454 {
1455 PIXEL00_11
1456 PIXEL01_10
1457 PIXEL10_21
1458 if (Diff(w[6], w[8]))
1459 {
1460 PIXEL11_0
1461 }
1462 else
1463 {
1464 PIXEL11_20
1465 }
1466 break;
1467 }
1468 case 118:
1469 {
1470 PIXEL00_22
1471 if (Diff(w[2], w[6]))
1472 {
1473 PIXEL01_0
1474 }
1475 else
1476 {
1477 PIXEL01_20
1478 }
1479 PIXEL10_12
1480 PIXEL11_10
1481 break;
1482 }
1483 case 217:
1484 {
1485 PIXEL00_12
1486 PIXEL01_22
1487 PIXEL10_10
1488 if (Diff(w[6], w[8]))
1489 {
1490 PIXEL11_0
1491 }
1492 else
1493 {
1494 PIXEL11_20
1495 }
1496 break;
1497 }
1498 case 110:
1499 {
1500 PIXEL00_10
1501 PIXEL01_12
1502 if (Diff(w[8], w[4]))
1503 {
1504 PIXEL10_0
1505 }
1506 else
1507 {
1508 PIXEL10_20
1509 }
1510 PIXEL11_22
1511 break;
1512 }
1513 case 155:
1514 {
1515 if (Diff(w[4], w[2]))
1516 {
1517 PIXEL00_0
1518 }
1519 else
1520 {
1521 PIXEL00_20
1522 }
1523 PIXEL01_10
1524 PIXEL10_22
1525 PIXEL11_12
1526 break;
1527 }
1528 case 188:
1529 {
1530 PIXEL00_21
1531 PIXEL01_11
1532 PIXEL10_11
1533 PIXEL11_12
1534 break;
1535 }
1536 case 185:
1537 {
1538 PIXEL00_12
1539 PIXEL01_22
1540 PIXEL10_11
1541 PIXEL11_12
1542 break;
1543 }
1544 case 61:
1545 {
1546 PIXEL00_12
1547 PIXEL01_11
1548 PIXEL10_11
1549 PIXEL11_21
1550 break;
1551 }
1552 case 157:
1553 {
1554 PIXEL00_12
1555 PIXEL01_11
1556 PIXEL10_22
1557 PIXEL11_12
1558 break;
1559 }
1560 case 103:
1561 {
1562 PIXEL00_11
1563 PIXEL01_12
1564 PIXEL10_12
1565 PIXEL11_22
1566 break;
1567 }
1568 case 227:
1569 {
1570 PIXEL00_11
1571 PIXEL01_21
1572 PIXEL10_12
1573 PIXEL11_11
1574 break;
1575 }
1576 case 230:
1577 {
1578 PIXEL00_22
1579 PIXEL01_12
1580 PIXEL10_12
1581 PIXEL11_11
1582 break;
1583 }
1584 case 199:
1585 {
1586 PIXEL00_11
1587 PIXEL01_12
1588 PIXEL10_21
1589 PIXEL11_11
1590 break;
1591 }
1592 case 220:
1593 {
1594 PIXEL00_21
1595 PIXEL01_11
1596 if (Diff(w[8], w[4]))
1597 {
1598 PIXEL10_10
1599 }
1600 else
1601 {
1602 PIXEL10_70
1603 }
1604 if (Diff(w[6], w[8]))
1605 {
1606 PIXEL11_0
1607 }
1608 else
1609 {
1610 PIXEL11_20
1611 }
1612 break;
1613 }
1614 case 158:
1615 {
1616 if (Diff(w[4], w[2]))
1617 {
1618 PIXEL00_10
1619 }
1620 else
1621 {
1622 PIXEL00_70
1623 }
1624 if (Diff(w[2], w[6]))
1625 {
1626 PIXEL01_0
1627 }
1628 else
1629 {
1630 PIXEL01_20
1631 }
1632 PIXEL10_22
1633 PIXEL11_12
1634 break;
1635 }
1636 case 234:
1637 {
1638 if (Diff(w[4], w[2]))
1639 {
1640 PIXEL00_10
1641 }
1642 else
1643 {
1644 PIXEL00_70
1645 }
1646 PIXEL01_21
1647 if (Diff(w[8], w[4]))
1648 {
1649 PIXEL10_0
1650 }
1651 else
1652 {
1653 PIXEL10_20
1654 }
1655 PIXEL11_11
1656 break;
1657 }
1658 case 242:
1659 {
1660 PIXEL00_22
1661 if (Diff(w[2], w[6]))
1662 {
1663 PIXEL01_10
1664 }
1665 else
1666 {
1667 PIXEL01_70
1668 }
1669 PIXEL10_12
1670 if (Diff(w[6], w[8]))
1671 {
1672 PIXEL11_0
1673 }
1674 else
1675 {
1676 PIXEL11_20
1677 }
1678 break;
1679 }
1680 case 59:
1681 {
1682 if (Diff(w[4], w[2]))
1683 {
1684 PIXEL00_0
1685 }
1686 else
1687 {
1688 PIXEL00_20
1689 }
1690 if (Diff(w[2], w[6]))
1691 {
1692 PIXEL01_10
1693 }
1694 else
1695 {
1696 PIXEL01_70
1697 }
1698 PIXEL10_11
1699 PIXEL11_21
1700 break;
1701 }
1702 case 121:
1703 {
1704 PIXEL00_12
1705 PIXEL01_22
1706 if (Diff(w[8], w[4]))
1707 {
1708 PIXEL10_0
1709 }
1710 else
1711 {
1712 PIXEL10_20
1713 }
1714 if (Diff(w[6], w[8]))
1715 {
1716 PIXEL11_10
1717 }
1718 else
1719 {
1720 PIXEL11_70
1721 }
1722 break;
1723 }
1724 case 87:
1725 {
1726 PIXEL00_11
1727 if (Diff(w[2], w[6]))
1728 {
1729 PIXEL01_0
1730 }
1731 else
1732 {
1733 PIXEL01_20
1734 }
1735 PIXEL10_21
1736 if (Diff(w[6], w[8]))
1737 {
1738 PIXEL11_10
1739 }
1740 else
1741 {
1742 PIXEL11_70
1743 }
1744 break;
1745 }
1746 case 79:
1747 {
1748 if (Diff(w[4], w[2]))
1749 {
1750 PIXEL00_0
1751 }
1752 else
1753 {
1754 PIXEL00_20
1755 }
1756 PIXEL01_12
1757 if (Diff(w[8], w[4]))
1758 {
1759 PIXEL10_10
1760 }
1761 else
1762 {
1763 PIXEL10_70
1764 }
1765 PIXEL11_22
1766 break;
1767 }
1768 case 122:
1769 {
1770 if (Diff(w[4], w[2]))
1771 {
1772 PIXEL00_10
1773 }
1774 else
1775 {
1776 PIXEL00_70
1777 }
1778 if (Diff(w[2], w[6]))
1779 {
1780 PIXEL01_10
1781 }
1782 else
1783 {
1784 PIXEL01_70
1785 }
1786 if (Diff(w[8], w[4]))
1787 {
1788 PIXEL10_0
1789 }
1790 else
1791 {
1792 PIXEL10_20
1793 }
1794 if (Diff(w[6], w[8]))
1795 {
1796 PIXEL11_10
1797 }
1798 else
1799 {
1800 PIXEL11_70
1801 }
1802 break;
1803 }
1804 case 94:
1805 {
1806 if (Diff(w[4], w[2]))
1807 {
1808 PIXEL00_10
1809 }
1810 else
1811 {
1812 PIXEL00_70
1813 }
1814 if (Diff(w[2], w[6]))
1815 {
1816 PIXEL01_0
1817 }
1818 else
1819 {
1820 PIXEL01_20
1821 }
1822 if (Diff(w[8], w[4]))
1823 {
1824 PIXEL10_10
1825 }
1826 else
1827 {
1828 PIXEL10_70
1829 }
1830 if (Diff(w[6], w[8]))
1831 {
1832 PIXEL11_10
1833 }
1834 else
1835 {
1836 PIXEL11_70
1837 }
1838 break;
1839 }
1840 case 218:
1841 {
1842 if (Diff(w[4], w[2]))
1843 {
1844 PIXEL00_10
1845 }
1846 else
1847 {
1848 PIXEL00_70
1849 }
1850 if (Diff(w[2], w[6]))
1851 {
1852 PIXEL01_10
1853 }
1854 else
1855 {
1856 PIXEL01_70
1857 }
1858 if (Diff(w[8], w[4]))
1859 {
1860 PIXEL10_10
1861 }
1862 else
1863 {
1864 PIXEL10_70
1865 }
1866 if (Diff(w[6], w[8]))
1867 {
1868 PIXEL11_0
1869 }
1870 else
1871 {
1872 PIXEL11_20
1873 }
1874 break;
1875 }
1876 case 91:
1877 {
1878 if (Diff(w[4], w[2]))
1879 {
1880 PIXEL00_0
1881 }
1882 else
1883 {
1884 PIXEL00_20
1885 }
1886 if (Diff(w[2], w[6]))
1887 {
1888 PIXEL01_10
1889 }
1890 else
1891 {
1892 PIXEL01_70
1893 }
1894 if (Diff(w[8], w[4]))
1895 {
1896 PIXEL10_10
1897 }
1898 else
1899 {
1900 PIXEL10_70
1901 }
1902 if (Diff(w[6], w[8]))
1903 {
1904 PIXEL11_10
1905 }
1906 else
1907 {
1908 PIXEL11_70
1909 }
1910 break;
1911 }
1912 case 229:
1913 {
1914 PIXEL00_20
1915 PIXEL01_20
1916 PIXEL10_12
1917 PIXEL11_11
1918 break;
1919 }
1920 case 167:
1921 {
1922 PIXEL00_11
1923 PIXEL01_12
1924 PIXEL10_20
1925 PIXEL11_20
1926 break;
1927 }
1928 case 173:
1929 {
1930 PIXEL00_12
1931 PIXEL01_20
1932 PIXEL10_11
1933 PIXEL11_20
1934 break;
1935 }
1936 case 181:
1937 {
1938 PIXEL00_20
1939 PIXEL01_11
1940 PIXEL10_20
1941 PIXEL11_12
1942 break;
1943 }
1944 case 186:
1945 {
1946 if (Diff(w[4], w[2]))
1947 {
1948 PIXEL00_10
1949 }
1950 else
1951 {
1952 PIXEL00_70
1953 }
1954 if (Diff(w[2], w[6]))
1955 {
1956 PIXEL01_10
1957 }
1958 else
1959 {
1960 PIXEL01_70
1961 }
1962 PIXEL10_11
1963 PIXEL11_12
1964 break;
1965 }
1966 case 115:
1967 {
1968 PIXEL00_11
1969 if (Diff(w[2], w[6]))
1970 {
1971 PIXEL01_10
1972 }
1973 else
1974 {
1975 PIXEL01_70
1976 }
1977 PIXEL10_12
1978 if (Diff(w[6], w[8]))
1979 {
1980 PIXEL11_10
1981 }
1982 else
1983 {
1984 PIXEL11_70
1985 }
1986 break;
1987 }
1988 case 93:
1989 {
1990 PIXEL00_12
1991 PIXEL01_11
1992 if (Diff(w[8], w[4]))
1993 {
1994 PIXEL10_10
1995 }
1996 else
1997 {
1998 PIXEL10_70
1999 }
2000 if (Diff(w[6], w[8]))
2001 {
2002 PIXEL11_10
2003 }
2004 else
2005 {
2006 PIXEL11_70
2007 }
2008 break;
2009 }
2010 case 206:
2011 {
2012 if (Diff(w[4], w[2]))
2013 {
2014 PIXEL00_10
2015 }
2016 else
2017 {
2018 PIXEL00_70
2019 }
2020 PIXEL01_12
2021 if (Diff(w[8], w[4]))
2022 {
2023 PIXEL10_10
2024 }
2025 else
2026 {
2027 PIXEL10_70
2028 }
2029 PIXEL11_11
2030 break;
2031 }
2032 case 205:
2033 case 201:
2034 {
2035 PIXEL00_12
2036 PIXEL01_20
2037 if (Diff(w[8], w[4]))
2038 {
2039 PIXEL10_10
2040 }
2041 else
2042 {
2043 PIXEL10_70
2044 }
2045 PIXEL11_11
2046 break;
2047 }
2048 case 174:
2049 case 46:
2050 {
2051 if (Diff(w[4], w[2]))
2052 {
2053 PIXEL00_10
2054 }
2055 else
2056 {
2057 PIXEL00_70
2058 }
2059 PIXEL01_12
2060 PIXEL10_11
2061 PIXEL11_20
2062 break;
2063 }
2064 case 179:
2065 case 147:
2066 {
2067 PIXEL00_11
2068 if (Diff(w[2], w[6]))
2069 {
2070 PIXEL01_10
2071 }
2072 else
2073 {
2074 PIXEL01_70
2075 }
2076 PIXEL10_20
2077 PIXEL11_12
2078 break;
2079 }
2080 case 117:
2081 case 116:
2082 {
2083 PIXEL00_20
2084 PIXEL01_11
2085 PIXEL10_12
2086 if (Diff(w[6], w[8]))
2087 {
2088 PIXEL11_10
2089 }
2090 else
2091 {
2092 PIXEL11_70
2093 }
2094 break;
2095 }
2096 case 189:
2097 {
2098 PIXEL00_12
2099 PIXEL01_11
2100 PIXEL10_11
2101 PIXEL11_12
2102 break;
2103 }
2104 case 231:
2105 {
2106 PIXEL00_11
2107 PIXEL01_12
2108 PIXEL10_12
2109 PIXEL11_11
2110 break;
2111 }
2112 case 126:
2113 {
2114 PIXEL00_10
2115 if (Diff(w[2], w[6]))
2116 {
2117 PIXEL01_0
2118 }
2119 else
2120 {
2121 PIXEL01_20
2122 }
2123 if (Diff(w[8], w[4]))
2124 {
2125 PIXEL10_0
2126 }
2127 else
2128 {
2129 PIXEL10_20
2130 }
2131 PIXEL11_10
2132 break;
2133 }
2134 case 219:
2135 {
2136 if (Diff(w[4], w[2]))
2137 {
2138 PIXEL00_0
2139 }
2140 else
2141 {
2142 PIXEL00_20
2143 }
2144 PIXEL01_10
2145 PIXEL10_10
2146 if (Diff(w[6], w[8]))
2147 {
2148 PIXEL11_0
2149 }
2150 else
2151 {
2152 PIXEL11_20
2153 }
2154 break;
2155 }
2156 case 125:
2157 {
2158 if (Diff(w[8], w[4]))
2159 {
2160 PIXEL00_12
2161 PIXEL10_0
2162 }
2163 else
2164 {
2165 PIXEL00_61
2166 PIXEL10_90
2167 }
2168 PIXEL01_11
2169 PIXEL11_10
2170 break;
2171 }
2172 case 221:
2173 {
2174 PIXEL00_12
2175 if (Diff(w[6], w[8]))
2176 {
2177 PIXEL01_11
2178 PIXEL11_0
2179 }
2180 else
2181 {
2182 PIXEL01_60
2183 PIXEL11_90
2184 }
2185 PIXEL10_10
2186 break;
2187 }
2188 case 207:
2189 {
2190 if (Diff(w[4], w[2]))
2191 {
2192 PIXEL00_0
2193 PIXEL01_12
2194 }
2195 else
2196 {
2197 PIXEL00_90
2198 PIXEL01_61
2199 }
2200 PIXEL10_10
2201 PIXEL11_11
2202 break;
2203 }
2204 case 238:
2205 {
2206 PIXEL00_10
2207 PIXEL01_12
2208 if (Diff(w[8], w[4]))
2209 {
2210 PIXEL10_0
2211 PIXEL11_11
2212 }
2213 else
2214 {
2215 PIXEL10_90
2216 PIXEL11_60
2217 }
2218 break;
2219 }
2220 case 190:
2221 {
2222 PIXEL00_10
2223 if (Diff(w[2], w[6]))
2224 {
2225 PIXEL01_0
2226 PIXEL11_12
2227 }
2228 else
2229 {
2230 PIXEL01_90
2231 PIXEL11_61
2232 }
2233 PIXEL10_11
2234 break;
2235 }
2236 case 187:
2237 {
2238 if (Diff(w[4], w[2]))
2239 {
2240 PIXEL00_0
2241 PIXEL10_11
2242 }
2243 else
2244 {
2245 PIXEL00_90
2246 PIXEL10_60
2247 }
2248 PIXEL01_10
2249 PIXEL11_12
2250 break;
2251 }
2252 case 243:
2253 {
2254 PIXEL00_11
2255 PIXEL01_10
2256 if (Diff(w[6], w[8]))
2257 {
2258 PIXEL10_12
2259 PIXEL11_0
2260 }
2261 else
2262 {
2263 PIXEL10_61
2264 PIXEL11_90
2265 }
2266 break;
2267 }
2268 case 119:
2269 {
2270 if (Diff(w[2], w[6]))
2271 {
2272 PIXEL00_11
2273 PIXEL01_0
2274 }
2275 else
2276 {
2277 PIXEL00_60
2278 PIXEL01_90
2279 }
2280 PIXEL10_12
2281 PIXEL11_10
2282 break;
2283 }
2284 case 237:
2285 case 233:
2286 {
2287 PIXEL00_12
2288 PIXEL01_20
2289 if (Diff(w[8], w[4]))
2290 {
2291 PIXEL10_0
2292 }
2293 else
2294 {
2295 PIXEL10_100
2296 }
2297 PIXEL11_11
2298 break;
2299 }
2300 case 175:
2301 case 47:
2302 {
2303 if (Diff(w[4], w[2]))
2304 {
2305 PIXEL00_0
2306 }
2307 else
2308 {
2309 PIXEL00_100
2310 }
2311 PIXEL01_12
2312 PIXEL10_11
2313 PIXEL11_20
2314 break;
2315 }
2316 case 183:
2317 case 151:
2318 {
2319 PIXEL00_11
2320 if (Diff(w[2], w[6]))
2321 {
2322 PIXEL01_0
2323 }
2324 else
2325 {
2326 PIXEL01_100
2327 }
2328 PIXEL10_20
2329 PIXEL11_12
2330 break;
2331 }
2332 case 245:
2333 case 244:
2334 {
2335 PIXEL00_20
2336 PIXEL01_11
2337 PIXEL10_12
2338 if (Diff(w[6], w[8]))
2339 {
2340 PIXEL11_0
2341 }
2342 else
2343 {
2344 PIXEL11_100
2345 }
2346 break;
2347 }
2348 case 250:
2349 {
2350 PIXEL00_10
2351 PIXEL01_10
2352 if (Diff(w[8], w[4]))
2353 {
2354 PIXEL10_0
2355 }
2356 else
2357 {
2358 PIXEL10_20
2359 }
2360 if (Diff(w[6], w[8]))
2361 {
2362 PIXEL11_0
2363 }
2364 else
2365 {
2366 PIXEL11_20
2367 }
2368 break;
2369 }
2370 case 123:
2371 {
2372 if (Diff(w[4], w[2]))
2373 {
2374 PIXEL00_0
2375 }
2376 else
2377 {
2378 PIXEL00_20
2379 }
2380 PIXEL01_10
2381 if (Diff(w[8], w[4]))
2382 {
2383 PIXEL10_0
2384 }
2385 else
2386 {
2387 PIXEL10_20
2388 }
2389 PIXEL11_10
2390 break;
2391 }
2392 case 95:
2393 {
2394 if (Diff(w[4], w[2]))
2395 {
2396 PIXEL00_0
2397 }
2398 else
2399 {
2400 PIXEL00_20
2401 }
2402 if (Diff(w[2], w[6]))
2403 {
2404 PIXEL01_0
2405 }
2406 else
2407 {
2408 PIXEL01_20
2409 }
2410 PIXEL10_10
2411 PIXEL11_10
2412 break;
2413 }
2414 case 222:
2415 {
2416 PIXEL00_10
2417 if (Diff(w[2], w[6]))
2418 {
2419 PIXEL01_0
2420 }
2421 else
2422 {
2423 PIXEL01_20
2424 }
2425 PIXEL10_10
2426 if (Diff(w[6], w[8]))
2427 {
2428 PIXEL11_0
2429 }
2430 else
2431 {
2432 PIXEL11_20
2433 }
2434 break;
2435 }
2436 case 252:
2437 {
2438 PIXEL00_21
2439 PIXEL01_11
2440 if (Diff(w[8], w[4]))
2441 {
2442 PIXEL10_0
2443 }
2444 else
2445 {
2446 PIXEL10_20
2447 }
2448 if (Diff(w[6], w[8]))
2449 {
2450 PIXEL11_0
2451 }
2452 else
2453 {
2454 PIXEL11_100
2455 }
2456 break;
2457 }
2458 case 249:
2459 {
2460 PIXEL00_12
2461 PIXEL01_22
2462 if (Diff(w[8], w[4]))
2463 {
2464 PIXEL10_0
2465 }
2466 else
2467 {
2468 PIXEL10_100
2469 }
2470 if (Diff(w[6], w[8]))
2471 {
2472 PIXEL11_0
2473 }
2474 else
2475 {
2476 PIXEL11_20
2477 }
2478 break;
2479 }
2480 case 235:
2481 {
2482 if (Diff(w[4], w[2]))
2483 {
2484 PIXEL00_0
2485 }
2486 else
2487 {
2488 PIXEL00_20
2489 }
2490 PIXEL01_21
2491 if (Diff(w[8], w[4]))
2492 {
2493 PIXEL10_0
2494 }
2495 else
2496 {
2497 PIXEL10_100
2498 }
2499 PIXEL11_11
2500 break;
2501 }
2502 case 111:
2503 {
2504 if (Diff(w[4], w[2]))
2505 {
2506 PIXEL00_0
2507 }
2508 else
2509 {
2510 PIXEL00_100
2511 }
2512 PIXEL01_12
2513 if (Diff(w[8], w[4]))
2514 {
2515 PIXEL10_0
2516 }
2517 else
2518 {
2519 PIXEL10_20
2520 }
2521 PIXEL11_22
2522 break;
2523 }
2524 case 63:
2525 {
2526 if (Diff(w[4], w[2]))
2527 {
2528 PIXEL00_0
2529 }
2530 else
2531 {
2532 PIXEL00_100
2533 }
2534 if (Diff(w[2], w[6]))
2535 {
2536 PIXEL01_0
2537 }
2538 else
2539 {
2540 PIXEL01_20
2541 }
2542 PIXEL10_11
2543 PIXEL11_21
2544 break;
2545 }
2546 case 159:
2547 {
2548 if (Diff(w[4], w[2]))
2549 {
2550 PIXEL00_0
2551 }
2552 else
2553 {
2554 PIXEL00_20
2555 }
2556 if (Diff(w[2], w[6]))
2557 {
2558 PIXEL01_0
2559 }
2560 else
2561 {
2562 PIXEL01_100
2563 }
2564 PIXEL10_22
2565 PIXEL11_12
2566 break;
2567 }
2568 case 215:
2569 {
2570 PIXEL00_11
2571 if (Diff(w[2], w[6]))
2572 {
2573 PIXEL01_0
2574 }
2575 else
2576 {
2577 PIXEL01_100
2578 }
2579 PIXEL10_21
2580 if (Diff(w[6], w[8]))
2581 {
2582 PIXEL11_0
2583 }
2584 else
2585 {
2586 PIXEL11_20
2587 }
2588 break;
2589 }
2590 case 246:
2591 {
2592 PIXEL00_22
2593 if (Diff(w[2], w[6]))
2594 {
2595 PIXEL01_0
2596 }
2597 else
2598 {
2599 PIXEL01_20
2600 }
2601 PIXEL10_12
2602 if (Diff(w[6], w[8]))
2603 {
2604 PIXEL11_0
2605 }
2606 else
2607 {
2608 PIXEL11_100
2609 }
2610 break;
2611 }
2612 case 254:
2613 {
2614 PIXEL00_10
2615 if (Diff(w[2], w[6]))
2616 {
2617 PIXEL01_0
2618 }
2619 else
2620 {
2621 PIXEL01_20
2622 }
2623 if (Diff(w[8], w[4]))
2624 {
2625 PIXEL10_0
2626 }
2627 else
2628 {
2629 PIXEL10_20
2630 }
2631 if (Diff(w[6], w[8]))
2632 {
2633 PIXEL11_0
2634 }
2635 else
2636 {
2637 PIXEL11_100
2638 }
2639 break;
2640 }
2641 case 253:
2642 {
2643 PIXEL00_12
2644 PIXEL01_11
2645 if (Diff(w[8], w[4]))
2646 {
2647 PIXEL10_0
2648 }
2649 else
2650 {
2651 PIXEL10_100
2652 }
2653 if (Diff(w[6], w[8]))
2654 {
2655 PIXEL11_0
2656 }
2657 else
2658 {
2659 PIXEL11_100
2660 }
2661 break;
2662 }
2663 case 251:
2664 {
2665 if (Diff(w[4], w[2]))
2666 {
2667 PIXEL00_0
2668 }
2669 else
2670 {
2671 PIXEL00_20
2672 }
2673 PIXEL01_10
2674 if (Diff(w[8], w[4]))
2675 {
2676 PIXEL10_0
2677 }
2678 else
2679 {
2680 PIXEL10_100
2681 }
2682 if (Diff(w[6], w[8]))
2683 {
2684 PIXEL11_0
2685 }
2686 else
2687 {
2688 PIXEL11_20
2689 }
2690 break;
2691 }
2692 case 239:
2693 {
2694 if (Diff(w[4], w[2]))
2695 {
2696 PIXEL00_0
2697 }
2698 else
2699 {
2700 PIXEL00_100
2701 }
2702 PIXEL01_12
2703 if (Diff(w[8], w[4]))
2704 {
2705 PIXEL10_0
2706 }
2707 else
2708 {
2709 PIXEL10_100
2710 }
2711 PIXEL11_11
2712 break;
2713 }
2714 case 127:
2715 {
2716 if (Diff(w[4], w[2]))
2717 {
2718 PIXEL00_0
2719 }
2720 else
2721 {
2722 PIXEL00_100
2723 }
2724 if (Diff(w[2], w[6]))
2725 {
2726 PIXEL01_0
2727 }
2728 else
2729 {
2730 PIXEL01_20
2731 }
2732 if (Diff(w[8], w[4]))
2733 {
2734 PIXEL10_0
2735 }
2736 else
2737 {
2738 PIXEL10_20
2739 }
2740 PIXEL11_10
2741 break;
2742 }
2743 case 191:
2744 {
2745 if (Diff(w[4], w[2]))
2746 {
2747 PIXEL00_0
2748 }
2749 else
2750 {
2751 PIXEL00_100
2752 }
2753 if (Diff(w[2], w[6]))
2754 {
2755 PIXEL01_0
2756 }
2757 else
2758 {
2759 PIXEL01_100
2760 }
2761 PIXEL10_11
2762 PIXEL11_12
2763 break;
2764 }
2765 case 223:
2766 {
2767 if (Diff(w[4], w[2]))
2768 {
2769 PIXEL00_0
2770 }
2771 else
2772 {
2773 PIXEL00_20
2774 }
2775 if (Diff(w[2], w[6]))
2776 {
2777 PIXEL01_0
2778 }
2779 else
2780 {
2781 PIXEL01_100
2782 }
2783 PIXEL10_10
2784 if (Diff(w[6], w[8]))
2785 {
2786 PIXEL11_0
2787 }
2788 else
2789 {
2790 PIXEL11_20
2791 }
2792 break;
2793 }
2794 case 247:
2795 {
2796 PIXEL00_11
2797 if (Diff(w[2], w[6]))
2798 {
2799 PIXEL01_0
2800 }
2801 else
2802 {
2803 PIXEL01_100
2804 }
2805 PIXEL10_12
2806 if (Diff(w[6], w[8]))
2807 {
2808 PIXEL11_0
2809 }
2810 else
2811 {
2812 PIXEL11_100
2813 }
2814 break;
2815 }
2816 case 255:
2817 {
2818 if (Diff(w[4], w[2]))
2819 {
2820 PIXEL00_0
2821 }
2822 else
2823 {
2824 PIXEL00_100
2825 }
2826 if (Diff(w[2], w[6]))
2827 {
2828 PIXEL01_0
2829 }
2830 else
2831 {
2832 PIXEL01_100
2833 }
2834 if (Diff(w[8], w[4]))
2835 {
2836 PIXEL10_0
2837 }
2838 else
2839 {
2840 PIXEL10_100
2841 }
2842 if (Diff(w[6], w[8]))
2843 {
2844 PIXEL11_0
2845 }
2846 else
2847 {
2848 PIXEL11_100
2849 }
2850 break;
2851 }
2852 }
2853 pIn += sizeof(uint32);
2854 pOut += sizeof(uint32) * 2;
2855 }
2856 pOut += BpL + (BpL - Xres * 2 * sizeof(uint32));
2857 pIn += srcBpL - Xres * sizeof(uint32);
2858 }
2859 }
2860