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