1 /*
2 * Copyright (C) 2003 MaxSt ( maxst@hiend3d.com )
3 *
4 * Adapted for Exult: 4/7/07 - JSF
5 *
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Library General Public
8 * License as published by the Free Software Foundation; either
9 * version 2 of the License, or (at your option) any later version.
10 *
11 * This library 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 * Library General Public License for more details.
15 *
16 * You should have received a copy of the GNU Library General Public
17 * License along with this library; if not, write to the
18 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
19 * Boston, MA 02111-1307, USA.
20 */
21
22 #ifndef INCL_SCALE_HQ2X_H
23 #define INCL_SCALE_HQ2X_H 1
24
25 #ifdef USE_HQ2X_SCALER
26
27 /**
28 ** Note: This file should only be included by source files that use the
29 ** templates below; the templates will only be instantiated when they
30 ** are used anyway.
31 **/
32
33 #include "scale_hqnx.h"
34
35 /*
36 * 2X scaler.
37 */
38 #define PIXEL00_0 StoreRGB<PTYPES>(to, c[5], manip);
39 #define PIXEL00_10 Interp1<PTYPES>(to, c[5], c[1], manip);
40 #define PIXEL00_11 Interp1<PTYPES>(to, c[5], c[4], manip);
41 #define PIXEL00_12 Interp1<PTYPES>(to, c[5], c[2], manip);
42 #define PIXEL00_20 Interp2<PTYPES>(to, c[5], c[4], c[2], manip);
43 #define PIXEL00_21 Interp2<PTYPES>(to, c[5], c[1], c[2], manip);
44 #define PIXEL00_22 Interp2<PTYPES>(to, c[5], c[1], c[4], manip);
45 #define PIXEL00_60 Interp6<PTYPES>(to, c[5], c[2], c[4], manip);
46 #define PIXEL00_61 Interp6<PTYPES>(to, c[5], c[4], c[2], manip);
47 #define PIXEL00_70 Interp7<PTYPES>(to, c[5], c[4], c[2], manip);
48 #define PIXEL00_90 Interp9<PTYPES>(to, c[5], c[4], c[2], manip);
49 #define PIXEL00_100 Interp10<PTYPES>(to, c[5], c[4], c[2], manip);
50 #define PIXEL01_0 StoreRGB<PTYPES>(to+1, c[5], manip);
51 #define PIXEL01_10 Interp1<PTYPES>(to+1, c[5], c[3], manip);
52 #define PIXEL01_11 Interp1<PTYPES>(to+1, c[5], c[2], manip);
53 #define PIXEL01_12 Interp1<PTYPES>(to+1, c[5], c[6], manip);
54 #define PIXEL01_20 Interp2<PTYPES>(to+1, c[5], c[2], c[6], manip);
55 #define PIXEL01_21 Interp2<PTYPES>(to+1, c[5], c[3], c[6], manip);
56 #define PIXEL01_22 Interp2<PTYPES>(to+1, c[5], c[3], c[2], manip);
57 #define PIXEL01_60 Interp6<PTYPES>(to+1, c[5], c[6], c[2], manip);
58 #define PIXEL01_61 Interp6<PTYPES>(to+1, c[5], c[2], c[6], manip);
59 #define PIXEL01_70 Interp7<PTYPES>(to+1, c[5], c[2], c[6], manip);
60 #define PIXEL01_90 Interp9<PTYPES>(to+1, c[5], c[2], c[6], manip);
61 #define PIXEL01_100 Interp10<PTYPES>(to+1, c[5], c[2], c[6], manip);
62 #define PIXEL10_0 StoreRGB<PTYPES>(to+dline_pixels, c[5], manip);
63 #define PIXEL10_10 Interp1<PTYPES>(to+dline_pixels, c[5], c[7], manip);
64 #define PIXEL10_11 Interp1<PTYPES>(to+dline_pixels, c[5], c[8], manip);
65 #define PIXEL10_12 Interp1<PTYPES>(to+dline_pixels, c[5], c[4], manip);
66 #define PIXEL10_20 Interp2<PTYPES>(to+dline_pixels, c[5], c[8], c[4], manip);
67 #define PIXEL10_21 Interp2<PTYPES>(to+dline_pixels, c[5], c[7], c[4], manip);
68 #define PIXEL10_22 Interp2<PTYPES>(to+dline_pixels, c[5], c[7], c[8], manip);
69 #define PIXEL10_60 Interp6<PTYPES>(to+dline_pixels, c[5], c[4], c[8], manip);
70 #define PIXEL10_61 Interp6<PTYPES>(to+dline_pixels, c[5], c[8], c[4], manip);
71 #define PIXEL10_70 Interp7<PTYPES>(to+dline_pixels, c[5], c[8], c[4], manip);
72 #define PIXEL10_90 Interp9<PTYPES>(to+dline_pixels, c[5], c[8], c[4], manip);
73 #define PIXEL10_100 Interp10<PTYPES>(to+dline_pixels, c[5], c[8], c[4], manip);
74 #define PIXEL11_0 StoreRGB<PTYPES>(to+dline_pixels+1, c[5], manip);
75 #define PIXEL11_10 Interp1<PTYPES>(to+dline_pixels+1, c[5], c[9], manip);
76 #define PIXEL11_11 Interp1<PTYPES>(to+dline_pixels+1, c[5], c[6], manip);
77 #define PIXEL11_12 Interp1<PTYPES>(to+dline_pixels+1, c[5], c[8], manip);
78 #define PIXEL11_20 Interp2<PTYPES>(to+dline_pixels+1, c[5], c[6], c[8], manip);
79 #define PIXEL11_21 Interp2<PTYPES>(to+dline_pixels+1, c[5], c[9], c[8], manip);
80 #define PIXEL11_22 Interp2<PTYPES>(to+dline_pixels+1, c[5], c[9], c[6], manip);
81 #define PIXEL11_60 Interp6<PTYPES>(to+dline_pixels+1, c[5], c[8], c[6], manip);
82 #define PIXEL11_61 Interp6<PTYPES>(to+dline_pixels+1, c[5], c[6], c[8], manip);
83 #define PIXEL11_70 Interp7<PTYPES>(to+dline_pixels+1, c[5], c[6], c[8], manip);
84 #define PIXEL11_90 Interp9<PTYPES>(to+dline_pixels+1, c[5], c[6], c[8], manip);
85 #define PIXEL11_100 Interp10<PTYPES>(to+dline_pixels+1, c[5], c[6], c[8], manip);
86
87 template <class Dest_pixel, class Manip_pixels>
Scale_Hq2x(unsigned char * source,int srcx,int srcy,int srcw,int srch,int sline_pixels,int sheight,Dest_pixel * dest,int dline_pixels,const Manip_pixels & manip)88 void Scale_Hq2x(
89 unsigned char *source, // ->source pixels.
90 int srcx, int srcy, // Start of rectangle within src.
91 int srcw, int srch, // Dims. of rectangle.
92 int sline_pixels, // Pixels (words)/line for source.
93 int sheight, // Source height.
94 Dest_pixel *dest, // ->dest pixels.
95 int dline_pixels, // Pixels (words)/line for dest.
96 const Manip_pixels &manip // Manipulator methods.
97 ) {
98 int i;
99 int j;
100 int prevline;
101 int nextline;
102 int w[10];
103 int c[10];
104 int yuv[10];
105 int stopy = srcy + srch;
106 int stopx = srcx + srcw;
107 unsigned char *from = source + srcy * sline_pixels + srcx;
108 Dest_pixel *to = dest + 2 * srcy * dline_pixels + 2 * srcx;
109
110 if (stopx > sline_pixels)
111 stopx = sline_pixels;
112
113 // +----+----+----+
114 // | | | |
115 // | w1 | w2 | w3 |
116 // +----+----+----+
117 // | | | |
118 // | w4 | w5 | w6 |
119 // +----+----+----+
120 // | | | |
121 // | w7 | w8 | w9 |
122 // +----+----+----+
123
124 for (j = srcy; j < stopy; j++) {
125 unsigned char *from0 = from; // Save start of line.
126 Dest_pixel *to0 = to;
127
128 if (j > 0) prevline = -sline_pixels;
129 else prevline = 0;
130 if (j < sheight - 1) nextline = sline_pixels;
131 else nextline = 0;
132
133 for (i = srcx; i < stopx; i++) {
134 int pattern = hqx_init(w, c, yuv, from, i, sline_pixels,
135 prevline, nextline, manip);
136 switch (pattern) {
137 case 0:
138 case 1:
139 case 4:
140 case 32:
141 case 128:
142 case 5:
143 case 132:
144 case 160:
145 case 33:
146 case 129:
147 case 36:
148 case 133:
149 case 164:
150 case 161:
151 case 37:
152 case 165: {
153 PIXEL00_20
154 PIXEL01_20
155 PIXEL10_20
156 PIXEL11_20
157 break;
158 }
159 case 2:
160 case 34:
161 case 130:
162 case 162: {
163 PIXEL00_22
164 PIXEL01_21
165 PIXEL10_20
166 PIXEL11_20
167 break;
168 }
169 case 16:
170 case 17:
171 case 48:
172 case 49: {
173 PIXEL00_20
174 PIXEL01_22
175 PIXEL10_20
176 PIXEL11_21
177 break;
178 }
179 case 64:
180 case 65:
181 case 68:
182 case 69: {
183 PIXEL00_20
184 PIXEL01_20
185 PIXEL10_21
186 PIXEL11_22
187 break;
188 }
189 case 8:
190 case 12:
191 case 136:
192 case 140: {
193 PIXEL00_21
194 PIXEL01_20
195 PIXEL10_22
196 PIXEL11_20
197 break;
198 }
199 case 3:
200 case 35:
201 case 131:
202 case 163: {
203 PIXEL00_11
204 PIXEL01_21
205 PIXEL10_20
206 PIXEL11_20
207 break;
208 }
209 case 6:
210 case 38:
211 case 134:
212 case 166: {
213 PIXEL00_22
214 PIXEL01_12
215 PIXEL10_20
216 PIXEL11_20
217 break;
218 }
219 case 20:
220 case 21:
221 case 52:
222 case 53: {
223 PIXEL00_20
224 PIXEL01_11
225 PIXEL10_20
226 PIXEL11_21
227 break;
228 }
229 case 144:
230 case 145:
231 case 176:
232 case 177: {
233 PIXEL00_20
234 PIXEL01_22
235 PIXEL10_20
236 PIXEL11_12
237 break;
238 }
239 case 192:
240 case 193:
241 case 196:
242 case 197: {
243 PIXEL00_20
244 PIXEL01_20
245 PIXEL10_21
246 PIXEL11_11
247 break;
248 }
249 case 96:
250 case 97:
251 case 100:
252 case 101: {
253 PIXEL00_20
254 PIXEL01_20
255 PIXEL10_12
256 PIXEL11_22
257 break;
258 }
259 case 40:
260 case 44:
261 case 168:
262 case 172: {
263 PIXEL00_21
264 PIXEL01_20
265 PIXEL10_11
266 PIXEL11_20
267 break;
268 }
269 case 9:
270 case 13:
271 case 137:
272 case 141: {
273 PIXEL00_12
274 PIXEL01_20
275 PIXEL10_22
276 PIXEL11_20
277 break;
278 }
279 case 18:
280 case 50: {
281 PIXEL00_22
282 if (Diff(yuv[2], yuv[6])) {
283 PIXEL01_10
284 } else {
285 PIXEL01_20
286 }
287 PIXEL10_20
288 PIXEL11_21
289 break;
290 }
291 case 80:
292 case 81: {
293 PIXEL00_20
294 PIXEL01_22
295 PIXEL10_21
296 if (Diff(yuv[6], yuv[8])) {
297 PIXEL11_10
298 } else {
299 PIXEL11_20
300 }
301 break;
302 }
303 case 72:
304 case 76: {
305 PIXEL00_21
306 PIXEL01_20
307 if (Diff(yuv[8], yuv[4])) {
308 PIXEL10_10
309 } else {
310 PIXEL10_20
311 }
312 PIXEL11_22
313 break;
314 }
315 case 10:
316 case 138: {
317 if (Diff(yuv[4], yuv[2])) {
318 PIXEL00_10
319 } else {
320 PIXEL00_20
321 }
322 PIXEL01_21
323 PIXEL10_22
324 PIXEL11_20
325 break;
326 }
327 case 66: {
328 PIXEL00_22
329 PIXEL01_21
330 PIXEL10_21
331 PIXEL11_22
332 break;
333 }
334 case 24: {
335 PIXEL00_21
336 PIXEL01_22
337 PIXEL10_22
338 PIXEL11_21
339 break;
340 }
341 case 7:
342 case 39:
343 case 135: {
344 PIXEL00_11
345 PIXEL01_12
346 PIXEL10_20
347 PIXEL11_20
348 break;
349 }
350 case 148:
351 case 149:
352 case 180: {
353 PIXEL00_20
354 PIXEL01_11
355 PIXEL10_20
356 PIXEL11_12
357 break;
358 }
359 case 224:
360 case 228:
361 case 225: {
362 PIXEL00_20
363 PIXEL01_20
364 PIXEL10_12
365 PIXEL11_11
366 break;
367 }
368 case 41:
369 case 169:
370 case 45: {
371 PIXEL00_12
372 PIXEL01_20
373 PIXEL10_11
374 PIXEL11_20
375 break;
376 }
377 case 22:
378 case 54: {
379 PIXEL00_22
380 if (Diff(yuv[2], yuv[6])) {
381 PIXEL01_0
382 } else {
383 PIXEL01_20
384 }
385 PIXEL10_20
386 PIXEL11_21
387 break;
388 }
389 case 208:
390 case 209: {
391 PIXEL00_20
392 PIXEL01_22
393 PIXEL10_21
394 if (Diff(yuv[6], yuv[8])) {
395 PIXEL11_0
396 } else {
397 PIXEL11_20
398 }
399 break;
400 }
401 case 104:
402 case 108: {
403 PIXEL00_21
404 PIXEL01_20
405 if (Diff(yuv[8], yuv[4])) {
406 PIXEL10_0
407 } else {
408 PIXEL10_20
409 }
410 PIXEL11_22
411 break;
412 }
413 case 11:
414 case 139: {
415 if (Diff(yuv[4], yuv[2])) {
416 PIXEL00_0
417 } else {
418 PIXEL00_20
419 }
420 PIXEL01_21
421 PIXEL10_22
422 PIXEL11_20
423 break;
424 }
425 case 19:
426 case 51: {
427 if (Diff(yuv[2], yuv[6])) {
428 PIXEL00_11
429 PIXEL01_10
430 } else {
431 PIXEL00_60
432 PIXEL01_90
433 }
434 PIXEL10_20
435 PIXEL11_21
436 break;
437 }
438 case 146:
439 case 178: {
440 PIXEL00_22
441 if (Diff(yuv[2], yuv[6])) {
442 PIXEL01_10
443 PIXEL11_12
444 } else {
445 PIXEL01_90
446 PIXEL11_61
447 }
448 PIXEL10_20
449 break;
450 }
451 case 84:
452 case 85: {
453 PIXEL00_20
454 if (Diff(yuv[6], yuv[8])) {
455 PIXEL01_11
456 PIXEL11_10
457 } else {
458 PIXEL01_60
459 PIXEL11_90
460 }
461 PIXEL10_21
462 break;
463 }
464 case 112:
465 case 113: {
466 PIXEL00_20
467 PIXEL01_22
468 if (Diff(yuv[6], yuv[8])) {
469 PIXEL10_12
470 PIXEL11_10
471 } else {
472 PIXEL10_61
473 PIXEL11_90
474 }
475 break;
476 }
477 case 200:
478 case 204: {
479 PIXEL00_21
480 PIXEL01_20
481 if (Diff(yuv[8], yuv[4])) {
482 PIXEL10_10
483 PIXEL11_11
484 } else {
485 PIXEL10_90
486 PIXEL11_60
487 }
488 break;
489 }
490 case 73:
491 case 77: {
492 if (Diff(yuv[8], yuv[4])) {
493 PIXEL00_12
494 PIXEL10_10
495 } else {
496 PIXEL00_61
497 PIXEL10_90
498 }
499 PIXEL01_20
500 PIXEL11_22
501 break;
502 }
503 case 42:
504 case 170: {
505 if (Diff(yuv[4], yuv[2])) {
506 PIXEL00_10
507 PIXEL10_11
508 } else {
509 PIXEL00_90
510 PIXEL10_60
511 }
512 PIXEL01_21
513 PIXEL11_20
514 break;
515 }
516 case 14:
517 case 142: {
518 if (Diff(yuv[4], yuv[2])) {
519 PIXEL00_10
520 PIXEL01_12
521 } else {
522 PIXEL00_90
523 PIXEL01_61
524 }
525 PIXEL10_22
526 PIXEL11_20
527 break;
528 }
529 case 67: {
530 PIXEL00_11
531 PIXEL01_21
532 PIXEL10_21
533 PIXEL11_22
534 break;
535 }
536 case 70: {
537 PIXEL00_22
538 PIXEL01_12
539 PIXEL10_21
540 PIXEL11_22
541 break;
542 }
543 case 28: {
544 PIXEL00_21
545 PIXEL01_11
546 PIXEL10_22
547 PIXEL11_21
548 break;
549 }
550 case 152: {
551 PIXEL00_21
552 PIXEL01_22
553 PIXEL10_22
554 PIXEL11_12
555 break;
556 }
557 case 194: {
558 PIXEL00_22
559 PIXEL01_21
560 PIXEL10_21
561 PIXEL11_11
562 break;
563 }
564 case 98: {
565 PIXEL00_22
566 PIXEL01_21
567 PIXEL10_12
568 PIXEL11_22
569 break;
570 }
571 case 56: {
572 PIXEL00_21
573 PIXEL01_22
574 PIXEL10_11
575 PIXEL11_21
576 break;
577 }
578 case 25: {
579 PIXEL00_12
580 PIXEL01_22
581 PIXEL10_22
582 PIXEL11_21
583 break;
584 }
585 case 26:
586 case 31: {
587 if (Diff(yuv[4], yuv[2])) {
588 PIXEL00_0
589 } else {
590 PIXEL00_20
591 }
592 if (Diff(yuv[2], yuv[6])) {
593 PIXEL01_0
594 } else {
595 PIXEL01_20
596 }
597 PIXEL10_22
598 PIXEL11_21
599 break;
600 }
601 case 82:
602 case 214: {
603 PIXEL00_22
604 if (Diff(yuv[2], yuv[6])) {
605 PIXEL01_0
606 } else {
607 PIXEL01_20
608 }
609 PIXEL10_21
610 if (Diff(yuv[6], yuv[8])) {
611 PIXEL11_0
612 } else {
613 PIXEL11_20
614 }
615 break;
616 }
617 case 88:
618 case 248: {
619 PIXEL00_21
620 PIXEL01_22
621 if (Diff(yuv[8], yuv[4])) {
622 PIXEL10_0
623 } else {
624 PIXEL10_20
625 }
626 if (Diff(yuv[6], yuv[8])) {
627 PIXEL11_0
628 } else {
629 PIXEL11_20
630 }
631 break;
632 }
633 case 74:
634 case 107: {
635 if (Diff(yuv[4], yuv[2])) {
636 PIXEL00_0
637 } else {
638 PIXEL00_20
639 }
640 PIXEL01_21
641 if (Diff(yuv[8], yuv[4])) {
642 PIXEL10_0
643 } else {
644 PIXEL10_20
645 }
646 PIXEL11_22
647 break;
648 }
649 case 27: {
650 if (Diff(yuv[4], yuv[2])) {
651 PIXEL00_0
652 } else {
653 PIXEL00_20
654 }
655 PIXEL01_10
656 PIXEL10_22
657 PIXEL11_21
658 break;
659 }
660 case 86: {
661 PIXEL00_22
662 if (Diff(yuv[2], yuv[6])) {
663 PIXEL01_0
664 } else {
665 PIXEL01_20
666 }
667 PIXEL10_21
668 PIXEL11_10
669 break;
670 }
671 case 216: {
672 PIXEL00_21
673 PIXEL01_22
674 PIXEL10_10
675 if (Diff(yuv[6], yuv[8])) {
676 PIXEL11_0
677 } else {
678 PIXEL11_20
679 }
680 break;
681 }
682 case 106: {
683 PIXEL00_10
684 PIXEL01_21
685 if (Diff(yuv[8], yuv[4])) {
686 PIXEL10_0
687 } else {
688 PIXEL10_20
689 }
690 PIXEL11_22
691 break;
692 }
693 case 30: {
694 PIXEL00_10
695 if (Diff(yuv[2], yuv[6])) {
696 PIXEL01_0
697 } else {
698 PIXEL01_20
699 }
700 PIXEL10_22
701 PIXEL11_21
702 break;
703 }
704 case 210: {
705 PIXEL00_22
706 PIXEL01_10
707 PIXEL10_21
708 if (Diff(yuv[6], yuv[8])) {
709 PIXEL11_0
710 } else {
711 PIXEL11_20
712 }
713 break;
714 }
715 case 120: {
716 PIXEL00_21
717 PIXEL01_22
718 if (Diff(yuv[8], yuv[4])) {
719 PIXEL10_0
720 } else {
721 PIXEL10_20
722 }
723 PIXEL11_10
724 break;
725 }
726 case 75: {
727 if (Diff(yuv[4], yuv[2])) {
728 PIXEL00_0
729 } else {
730 PIXEL00_20
731 }
732 PIXEL01_21
733 PIXEL10_10
734 PIXEL11_22
735 break;
736 }
737 case 29: {
738 PIXEL00_12
739 PIXEL01_11
740 PIXEL10_22
741 PIXEL11_21
742 break;
743 }
744 case 198: {
745 PIXEL00_22
746 PIXEL01_12
747 PIXEL10_21
748 PIXEL11_11
749 break;
750 }
751 case 184: {
752 PIXEL00_21
753 PIXEL01_22
754 PIXEL10_11
755 PIXEL11_12
756 break;
757 }
758 case 99: {
759 PIXEL00_11
760 PIXEL01_21
761 PIXEL10_12
762 PIXEL11_22
763 break;
764 }
765 case 57: {
766 PIXEL00_12
767 PIXEL01_22
768 PIXEL10_11
769 PIXEL11_21
770 break;
771 }
772 case 71: {
773 PIXEL00_11
774 PIXEL01_12
775 PIXEL10_21
776 PIXEL11_22
777 break;
778 }
779 case 156: {
780 PIXEL00_21
781 PIXEL01_11
782 PIXEL10_22
783 PIXEL11_12
784 break;
785 }
786 case 226: {
787 PIXEL00_22
788 PIXEL01_21
789 PIXEL10_12
790 PIXEL11_11
791 break;
792 }
793 case 60: {
794 PIXEL00_21
795 PIXEL01_11
796 PIXEL10_11
797 PIXEL11_21
798 break;
799 }
800 case 195: {
801 PIXEL00_11
802 PIXEL01_21
803 PIXEL10_21
804 PIXEL11_11
805 break;
806 }
807 case 102: {
808 PIXEL00_22
809 PIXEL01_12
810 PIXEL10_12
811 PIXEL11_22
812 break;
813 }
814 case 153: {
815 PIXEL00_12
816 PIXEL01_22
817 PIXEL10_22
818 PIXEL11_12
819 break;
820 }
821 case 58: {
822 if (Diff(yuv[4], yuv[2])) {
823 PIXEL00_10
824 } else {
825 PIXEL00_70
826 }
827 if (Diff(yuv[2], yuv[6])) {
828 PIXEL01_10
829 } else {
830 PIXEL01_70
831 }
832 PIXEL10_11
833 PIXEL11_21
834 break;
835 }
836 case 83: {
837 PIXEL00_11
838 if (Diff(yuv[2], yuv[6])) {
839 PIXEL01_10
840 } else {
841 PIXEL01_70
842 }
843 PIXEL10_21
844 if (Diff(yuv[6], yuv[8])) {
845 PIXEL11_10
846 } else {
847 PIXEL11_70
848 }
849 break;
850 }
851 case 92: {
852 PIXEL00_21
853 PIXEL01_11
854 if (Diff(yuv[8], yuv[4])) {
855 PIXEL10_10
856 } else {
857 PIXEL10_70
858 }
859 if (Diff(yuv[6], yuv[8])) {
860 PIXEL11_10
861 } else {
862 PIXEL11_70
863 }
864 break;
865 }
866 case 202: {
867 if (Diff(yuv[4], yuv[2])) {
868 PIXEL00_10
869 } else {
870 PIXEL00_70
871 }
872 PIXEL01_21
873 if (Diff(yuv[8], yuv[4])) {
874 PIXEL10_10
875 } else {
876 PIXEL10_70
877 }
878 PIXEL11_11
879 break;
880 }
881 case 78: {
882 if (Diff(yuv[4], yuv[2])) {
883 PIXEL00_10
884 } else {
885 PIXEL00_70
886 }
887 PIXEL01_12
888 if (Diff(yuv[8], yuv[4])) {
889 PIXEL10_10
890 } else {
891 PIXEL10_70
892 }
893 PIXEL11_22
894 break;
895 }
896 case 154: {
897 if (Diff(yuv[4], yuv[2])) {
898 PIXEL00_10
899 } else {
900 PIXEL00_70
901 }
902 if (Diff(yuv[2], yuv[6])) {
903 PIXEL01_10
904 } else {
905 PIXEL01_70
906 }
907 PIXEL10_22
908 PIXEL11_12
909 break;
910 }
911 case 114: {
912 PIXEL00_22
913 if (Diff(yuv[2], yuv[6])) {
914 PIXEL01_10
915 } else {
916 PIXEL01_70
917 }
918 PIXEL10_12
919 if (Diff(yuv[6], yuv[8])) {
920 PIXEL11_10
921 } else {
922 PIXEL11_70
923 }
924 break;
925 }
926 case 89: {
927 PIXEL00_12
928 PIXEL01_22
929 if (Diff(yuv[8], yuv[4])) {
930 PIXEL10_10
931 } else {
932 PIXEL10_70
933 }
934 if (Diff(yuv[6], yuv[8])) {
935 PIXEL11_10
936 } else {
937 PIXEL11_70
938 }
939 break;
940 }
941 case 90: {
942 if (Diff(yuv[4], yuv[2])) {
943 PIXEL00_10
944 } else {
945 PIXEL00_70
946 }
947 if (Diff(yuv[2], yuv[6])) {
948 PIXEL01_10
949 } else {
950 PIXEL01_70
951 }
952 if (Diff(yuv[8], yuv[4])) {
953 PIXEL10_10
954 } else {
955 PIXEL10_70
956 }
957 if (Diff(yuv[6], yuv[8])) {
958 PIXEL11_10
959 } else {
960 PIXEL11_70
961 }
962 break;
963 }
964 case 55:
965 case 23: {
966 if (Diff(yuv[2], yuv[6])) {
967 PIXEL00_11
968 PIXEL01_0
969 } else {
970 PIXEL00_60
971 PIXEL01_90
972 }
973 PIXEL10_20
974 PIXEL11_21
975 break;
976 }
977 case 182:
978 case 150: {
979 PIXEL00_22
980 if (Diff(yuv[2], yuv[6])) {
981 PIXEL01_0
982 PIXEL11_12
983 } else {
984 PIXEL01_90
985 PIXEL11_61
986 }
987 PIXEL10_20
988 break;
989 }
990 case 213:
991 case 212: {
992 PIXEL00_20
993 if (Diff(yuv[6], yuv[8])) {
994 PIXEL01_11
995 PIXEL11_0
996 } else {
997 PIXEL01_60
998 PIXEL11_90
999 }
1000 PIXEL10_21
1001 break;
1002 }
1003 case 241:
1004 case 240: {
1005 PIXEL00_20
1006 PIXEL01_22
1007 if (Diff(yuv[6], yuv[8])) {
1008 PIXEL10_12
1009 PIXEL11_0
1010 } else {
1011 PIXEL10_61
1012 PIXEL11_90
1013 }
1014 break;
1015 }
1016 case 236:
1017 case 232: {
1018 PIXEL00_21
1019 PIXEL01_20
1020 if (Diff(yuv[8], yuv[4])) {
1021 PIXEL10_0
1022 PIXEL11_11
1023 } else {
1024 PIXEL10_90
1025 PIXEL11_60
1026 }
1027 break;
1028 }
1029 case 109:
1030 case 105: {
1031 if (Diff(yuv[8], yuv[4])) {
1032 PIXEL00_12
1033 PIXEL10_0
1034 } else {
1035 PIXEL00_61
1036 PIXEL10_90
1037 }
1038 PIXEL01_20
1039 PIXEL11_22
1040 break;
1041 }
1042 case 171:
1043 case 43: {
1044 if (Diff(yuv[4], yuv[2])) {
1045 PIXEL00_0
1046 PIXEL10_11
1047 } else {
1048 PIXEL00_90
1049 PIXEL10_60
1050 }
1051 PIXEL01_21
1052 PIXEL11_20
1053 break;
1054 }
1055 case 143:
1056 case 15: {
1057 if (Diff(yuv[4], yuv[2])) {
1058 PIXEL00_0
1059 PIXEL01_12
1060 } else {
1061 PIXEL00_90
1062 PIXEL01_61
1063 }
1064 PIXEL10_22
1065 PIXEL11_20
1066 break;
1067 }
1068 case 124: {
1069 PIXEL00_21
1070 PIXEL01_11
1071 if (Diff(yuv[8], yuv[4])) {
1072 PIXEL10_0
1073 } else {
1074 PIXEL10_20
1075 }
1076 PIXEL11_10
1077 break;
1078 }
1079 case 203: {
1080 if (Diff(yuv[4], yuv[2])) {
1081 PIXEL00_0
1082 } else {
1083 PIXEL00_20
1084 }
1085 PIXEL01_21
1086 PIXEL10_10
1087 PIXEL11_11
1088 break;
1089 }
1090 case 62: {
1091 PIXEL00_10
1092 if (Diff(yuv[2], yuv[6])) {
1093 PIXEL01_0
1094 } else {
1095 PIXEL01_20
1096 }
1097 PIXEL10_11
1098 PIXEL11_21
1099 break;
1100 }
1101 case 211: {
1102 PIXEL00_11
1103 PIXEL01_10
1104 PIXEL10_21
1105 if (Diff(yuv[6], yuv[8])) {
1106 PIXEL11_0
1107 } else {
1108 PIXEL11_20
1109 }
1110 break;
1111 }
1112 case 118: {
1113 PIXEL00_22
1114 if (Diff(yuv[2], yuv[6])) {
1115 PIXEL01_0
1116 } else {
1117 PIXEL01_20
1118 }
1119 PIXEL10_12
1120 PIXEL11_10
1121 break;
1122 }
1123 case 217: {
1124 PIXEL00_12
1125 PIXEL01_22
1126 PIXEL10_10
1127 if (Diff(yuv[6], yuv[8])) {
1128 PIXEL11_0
1129 } else {
1130 PIXEL11_20
1131 }
1132 break;
1133 }
1134 case 110: {
1135 PIXEL00_10
1136 PIXEL01_12
1137 if (Diff(yuv[8], yuv[4])) {
1138 PIXEL10_0
1139 } else {
1140 PIXEL10_20
1141 }
1142 PIXEL11_22
1143 break;
1144 }
1145 case 155: {
1146 if (Diff(yuv[4], yuv[2])) {
1147 PIXEL00_0
1148 } else {
1149 PIXEL00_20
1150 }
1151 PIXEL01_10
1152 PIXEL10_22
1153 PIXEL11_12
1154 break;
1155 }
1156 case 188: {
1157 PIXEL00_21
1158 PIXEL01_11
1159 PIXEL10_11
1160 PIXEL11_12
1161 break;
1162 }
1163 case 185: {
1164 PIXEL00_12
1165 PIXEL01_22
1166 PIXEL10_11
1167 PIXEL11_12
1168 break;
1169 }
1170 case 61: {
1171 PIXEL00_12
1172 PIXEL01_11
1173 PIXEL10_11
1174 PIXEL11_21
1175 break;
1176 }
1177 case 157: {
1178 PIXEL00_12
1179 PIXEL01_11
1180 PIXEL10_22
1181 PIXEL11_12
1182 break;
1183 }
1184 case 103: {
1185 PIXEL00_11
1186 PIXEL01_12
1187 PIXEL10_12
1188 PIXEL11_22
1189 break;
1190 }
1191 case 227: {
1192 PIXEL00_11
1193 PIXEL01_21
1194 PIXEL10_12
1195 PIXEL11_11
1196 break;
1197 }
1198 case 230: {
1199 PIXEL00_22
1200 PIXEL01_12
1201 PIXEL10_12
1202 PIXEL11_11
1203 break;
1204 }
1205 case 199: {
1206 PIXEL00_11
1207 PIXEL01_12
1208 PIXEL10_21
1209 PIXEL11_11
1210 break;
1211 }
1212 case 220: {
1213 PIXEL00_21
1214 PIXEL01_11
1215 if (Diff(yuv[8], yuv[4])) {
1216 PIXEL10_10
1217 } else {
1218 PIXEL10_70
1219 }
1220 if (Diff(yuv[6], yuv[8])) {
1221 PIXEL11_0
1222 } else {
1223 PIXEL11_20
1224 }
1225 break;
1226 }
1227 case 158: {
1228 if (Diff(yuv[4], yuv[2])) {
1229 PIXEL00_10
1230 } else {
1231 PIXEL00_70
1232 }
1233 if (Diff(yuv[2], yuv[6])) {
1234 PIXEL01_0
1235 } else {
1236 PIXEL01_20
1237 }
1238 PIXEL10_22
1239 PIXEL11_12
1240 break;
1241 }
1242 case 234: {
1243 if (Diff(yuv[4], yuv[2])) {
1244 PIXEL00_10
1245 } else {
1246 PIXEL00_70
1247 }
1248 PIXEL01_21
1249 if (Diff(yuv[8], yuv[4])) {
1250 PIXEL10_0
1251 } else {
1252 PIXEL10_20
1253 }
1254 PIXEL11_11
1255 break;
1256 }
1257 case 242: {
1258 PIXEL00_22
1259 if (Diff(yuv[2], yuv[6])) {
1260 PIXEL01_10
1261 } else {
1262 PIXEL01_70
1263 }
1264 PIXEL10_12
1265 if (Diff(yuv[6], yuv[8])) {
1266 PIXEL11_0
1267 } else {
1268 PIXEL11_20
1269 }
1270 break;
1271 }
1272 case 59: {
1273 if (Diff(yuv[4], yuv[2])) {
1274 PIXEL00_0
1275 } else {
1276 PIXEL00_20
1277 }
1278 if (Diff(yuv[2], yuv[6])) {
1279 PIXEL01_10
1280 } else {
1281 PIXEL01_70
1282 }
1283 PIXEL10_11
1284 PIXEL11_21
1285 break;
1286 }
1287 case 121: {
1288 PIXEL00_12
1289 PIXEL01_22
1290 if (Diff(yuv[8], yuv[4])) {
1291 PIXEL10_0
1292 } else {
1293 PIXEL10_20
1294 }
1295 if (Diff(yuv[6], yuv[8])) {
1296 PIXEL11_10
1297 } else {
1298 PIXEL11_70
1299 }
1300 break;
1301 }
1302 case 87: {
1303 PIXEL00_11
1304 if (Diff(yuv[2], yuv[6])) {
1305 PIXEL01_0
1306 } else {
1307 PIXEL01_20
1308 }
1309 PIXEL10_21
1310 if (Diff(yuv[6], yuv[8])) {
1311 PIXEL11_10
1312 } else {
1313 PIXEL11_70
1314 }
1315 break;
1316 }
1317 case 79: {
1318 if (Diff(yuv[4], yuv[2])) {
1319 PIXEL00_0
1320 } else {
1321 PIXEL00_20
1322 }
1323 PIXEL01_12
1324 if (Diff(yuv[8], yuv[4])) {
1325 PIXEL10_10
1326 } else {
1327 PIXEL10_70
1328 }
1329 PIXEL11_22
1330 break;
1331 }
1332 case 122: {
1333 if (Diff(yuv[4], yuv[2])) {
1334 PIXEL00_10
1335 } else {
1336 PIXEL00_70
1337 }
1338 if (Diff(yuv[2], yuv[6])) {
1339 PIXEL01_10
1340 } else {
1341 PIXEL01_70
1342 }
1343 if (Diff(yuv[8], yuv[4])) {
1344 PIXEL10_0
1345 } else {
1346 PIXEL10_20
1347 }
1348 if (Diff(yuv[6], yuv[8])) {
1349 PIXEL11_10
1350 } else {
1351 PIXEL11_70
1352 }
1353 break;
1354 }
1355 case 94: {
1356 if (Diff(yuv[4], yuv[2])) {
1357 PIXEL00_10
1358 } else {
1359 PIXEL00_70
1360 }
1361 if (Diff(yuv[2], yuv[6])) {
1362 PIXEL01_0
1363 } else {
1364 PIXEL01_20
1365 }
1366 if (Diff(yuv[8], yuv[4])) {
1367 PIXEL10_10
1368 } else {
1369 PIXEL10_70
1370 }
1371 if (Diff(yuv[6], yuv[8])) {
1372 PIXEL11_10
1373 } else {
1374 PIXEL11_70
1375 }
1376 break;
1377 }
1378 case 218: {
1379 if (Diff(yuv[4], yuv[2])) {
1380 PIXEL00_10
1381 } else {
1382 PIXEL00_70
1383 }
1384 if (Diff(yuv[2], yuv[6])) {
1385 PIXEL01_10
1386 } else {
1387 PIXEL01_70
1388 }
1389 if (Diff(yuv[8], yuv[4])) {
1390 PIXEL10_10
1391 } else {
1392 PIXEL10_70
1393 }
1394 if (Diff(yuv[6], yuv[8])) {
1395 PIXEL11_0
1396 } else {
1397 PIXEL11_20
1398 }
1399 break;
1400 }
1401 case 91: {
1402 if (Diff(yuv[4], yuv[2])) {
1403 PIXEL00_0
1404 } else {
1405 PIXEL00_20
1406 }
1407 if (Diff(yuv[2], yuv[6])) {
1408 PIXEL01_10
1409 } else {
1410 PIXEL01_70
1411 }
1412 if (Diff(yuv[8], yuv[4])) {
1413 PIXEL10_10
1414 } else {
1415 PIXEL10_70
1416 }
1417 if (Diff(yuv[6], yuv[8])) {
1418 PIXEL11_10
1419 } else {
1420 PIXEL11_70
1421 }
1422 break;
1423 }
1424 case 229: {
1425 PIXEL00_20
1426 PIXEL01_20
1427 PIXEL10_12
1428 PIXEL11_11
1429 break;
1430 }
1431 case 167: {
1432 PIXEL00_11
1433 PIXEL01_12
1434 PIXEL10_20
1435 PIXEL11_20
1436 break;
1437 }
1438 case 173: {
1439 PIXEL00_12
1440 PIXEL01_20
1441 PIXEL10_11
1442 PIXEL11_20
1443 break;
1444 }
1445 case 181: {
1446 PIXEL00_20
1447 PIXEL01_11
1448 PIXEL10_20
1449 PIXEL11_12
1450 break;
1451 }
1452 case 186: {
1453 if (Diff(yuv[4], yuv[2])) {
1454 PIXEL00_10
1455 } else {
1456 PIXEL00_70
1457 }
1458 if (Diff(yuv[2], yuv[6])) {
1459 PIXEL01_10
1460 } else {
1461 PIXEL01_70
1462 }
1463 PIXEL10_11
1464 PIXEL11_12
1465 break;
1466 }
1467 case 115: {
1468 PIXEL00_11
1469 if (Diff(yuv[2], yuv[6])) {
1470 PIXEL01_10
1471 } else {
1472 PIXEL01_70
1473 }
1474 PIXEL10_12
1475 if (Diff(yuv[6], yuv[8])) {
1476 PIXEL11_10
1477 } else {
1478 PIXEL11_70
1479 }
1480 break;
1481 }
1482 case 93: {
1483 PIXEL00_12
1484 PIXEL01_11
1485 if (Diff(yuv[8], yuv[4])) {
1486 PIXEL10_10
1487 } else {
1488 PIXEL10_70
1489 }
1490 if (Diff(yuv[6], yuv[8])) {
1491 PIXEL11_10
1492 } else {
1493 PIXEL11_70
1494 }
1495 break;
1496 }
1497 case 206: {
1498 if (Diff(yuv[4], yuv[2])) {
1499 PIXEL00_10
1500 } else {
1501 PIXEL00_70
1502 }
1503 PIXEL01_12
1504 if (Diff(yuv[8], yuv[4])) {
1505 PIXEL10_10
1506 } else {
1507 PIXEL10_70
1508 }
1509 PIXEL11_11
1510 break;
1511 }
1512 case 205:
1513 case 201: {
1514 PIXEL00_12
1515 PIXEL01_20
1516 if (Diff(yuv[8], yuv[4])) {
1517 PIXEL10_10
1518 } else {
1519 PIXEL10_70
1520 }
1521 PIXEL11_11
1522 break;
1523 }
1524 case 174:
1525 case 46: {
1526 if (Diff(yuv[4], yuv[2])) {
1527 PIXEL00_10
1528 } else {
1529 PIXEL00_70
1530 }
1531 PIXEL01_12
1532 PIXEL10_11
1533 PIXEL11_20
1534 break;
1535 }
1536 case 179:
1537 case 147: {
1538 PIXEL00_11
1539 if (Diff(yuv[2], yuv[6])) {
1540 PIXEL01_10
1541 } else {
1542 PIXEL01_70
1543 }
1544 PIXEL10_20
1545 PIXEL11_12
1546 break;
1547 }
1548 case 117:
1549 case 116: {
1550 PIXEL00_20
1551 PIXEL01_11
1552 PIXEL10_12
1553 if (Diff(yuv[6], yuv[8])) {
1554 PIXEL11_10
1555 } else {
1556 PIXEL11_70
1557 }
1558 break;
1559 }
1560 case 189: {
1561 PIXEL00_12
1562 PIXEL01_11
1563 PIXEL10_11
1564 PIXEL11_12
1565 break;
1566 }
1567 case 231: {
1568 PIXEL00_11
1569 PIXEL01_12
1570 PIXEL10_12
1571 PIXEL11_11
1572 break;
1573 }
1574 case 126: {
1575 PIXEL00_10
1576 if (Diff(yuv[2], yuv[6])) {
1577 PIXEL01_0
1578 } else {
1579 PIXEL01_20
1580 }
1581 if (Diff(yuv[8], yuv[4])) {
1582 PIXEL10_0
1583 } else {
1584 PIXEL10_20
1585 }
1586 PIXEL11_10
1587 break;
1588 }
1589 case 219: {
1590 if (Diff(yuv[4], yuv[2])) {
1591 PIXEL00_0
1592 } else {
1593 PIXEL00_20
1594 }
1595 PIXEL01_10
1596 PIXEL10_10
1597 if (Diff(yuv[6], yuv[8])) {
1598 PIXEL11_0
1599 } else {
1600 PIXEL11_20
1601 }
1602 break;
1603 }
1604 case 125: {
1605 if (Diff(yuv[8], yuv[4])) {
1606 PIXEL00_12
1607 PIXEL10_0
1608 } else {
1609 PIXEL00_61
1610 PIXEL10_90
1611 }
1612 PIXEL01_11
1613 PIXEL11_10
1614 break;
1615 }
1616 case 221: {
1617 PIXEL00_12
1618 if (Diff(yuv[6], yuv[8])) {
1619 PIXEL01_11
1620 PIXEL11_0
1621 } else {
1622 PIXEL01_60
1623 PIXEL11_90
1624 }
1625 PIXEL10_10
1626 break;
1627 }
1628 case 207: {
1629 if (Diff(yuv[4], yuv[2])) {
1630 PIXEL00_0
1631 PIXEL01_12
1632 } else {
1633 PIXEL00_90
1634 PIXEL01_61
1635 }
1636 PIXEL10_10
1637 PIXEL11_11
1638 break;
1639 }
1640 case 238: {
1641 PIXEL00_10
1642 PIXEL01_12
1643 if (Diff(yuv[8], yuv[4])) {
1644 PIXEL10_0
1645 PIXEL11_11
1646 } else {
1647 PIXEL10_90
1648 PIXEL11_60
1649 }
1650 break;
1651 }
1652 case 190: {
1653 PIXEL00_10
1654 if (Diff(yuv[2], yuv[6])) {
1655 PIXEL01_0
1656 PIXEL11_12
1657 } else {
1658 PIXEL01_90
1659 PIXEL11_61
1660 }
1661 PIXEL10_11
1662 break;
1663 }
1664 case 187: {
1665 if (Diff(yuv[4], yuv[2])) {
1666 PIXEL00_0
1667 PIXEL10_11
1668 } else {
1669 PIXEL00_90
1670 PIXEL10_60
1671 }
1672 PIXEL01_10
1673 PIXEL11_12
1674 break;
1675 }
1676 case 243: {
1677 PIXEL00_11
1678 PIXEL01_10
1679 if (Diff(yuv[6], yuv[8])) {
1680 PIXEL10_12
1681 PIXEL11_0
1682 } else {
1683 PIXEL10_61
1684 PIXEL11_90
1685 }
1686 break;
1687 }
1688 case 119: {
1689 if (Diff(yuv[2], yuv[6])) {
1690 PIXEL00_11
1691 PIXEL01_0
1692 } else {
1693 PIXEL00_60
1694 PIXEL01_90
1695 }
1696 PIXEL10_12
1697 PIXEL11_10
1698 break;
1699 }
1700 case 237:
1701 case 233: {
1702 PIXEL00_12
1703 PIXEL01_20
1704 if (Diff(yuv[8], yuv[4])) {
1705 PIXEL10_0
1706 } else {
1707 PIXEL10_100
1708 }
1709 PIXEL11_11
1710 break;
1711 }
1712 case 175:
1713 case 47: {
1714 if (Diff(yuv[4], yuv[2])) {
1715 PIXEL00_0
1716 } else {
1717 PIXEL00_100
1718 }
1719 PIXEL01_12
1720 PIXEL10_11
1721 PIXEL11_20
1722 break;
1723 }
1724 case 183:
1725 case 151: {
1726 PIXEL00_11
1727 if (Diff(yuv[2], yuv[6])) {
1728 PIXEL01_0
1729 } else {
1730 PIXEL01_100
1731 }
1732 PIXEL10_20
1733 PIXEL11_12
1734 break;
1735 }
1736 case 245:
1737 case 244: {
1738 PIXEL00_20
1739 PIXEL01_11
1740 PIXEL10_12
1741 if (Diff(yuv[6], yuv[8])) {
1742 PIXEL11_0
1743 } else {
1744 PIXEL11_100
1745 }
1746 break;
1747 }
1748 case 250: {
1749 PIXEL00_10
1750 PIXEL01_10
1751 if (Diff(yuv[8], yuv[4])) {
1752 PIXEL10_0
1753 } else {
1754 PIXEL10_20
1755 }
1756 if (Diff(yuv[6], yuv[8])) {
1757 PIXEL11_0
1758 } else {
1759 PIXEL11_20
1760 }
1761 break;
1762 }
1763 case 123: {
1764 if (Diff(yuv[4], yuv[2])) {
1765 PIXEL00_0
1766 } else {
1767 PIXEL00_20
1768 }
1769 PIXEL01_10
1770 if (Diff(yuv[8], yuv[4])) {
1771 PIXEL10_0
1772 } else {
1773 PIXEL10_20
1774 }
1775 PIXEL11_10
1776 break;
1777 }
1778 case 95: {
1779 if (Diff(yuv[4], yuv[2])) {
1780 PIXEL00_0
1781 } else {
1782 PIXEL00_20
1783 }
1784 if (Diff(yuv[2], yuv[6])) {
1785 PIXEL01_0
1786 } else {
1787 PIXEL01_20
1788 }
1789 PIXEL10_10
1790 PIXEL11_10
1791 break;
1792 }
1793 case 222: {
1794 PIXEL00_10
1795 if (Diff(yuv[2], yuv[6])) {
1796 PIXEL01_0
1797 } else {
1798 PIXEL01_20
1799 }
1800 PIXEL10_10
1801 if (Diff(yuv[6], yuv[8])) {
1802 PIXEL11_0
1803 } else {
1804 PIXEL11_20
1805 }
1806 break;
1807 }
1808 case 252: {
1809 PIXEL00_21
1810 PIXEL01_11
1811 if (Diff(yuv[8], yuv[4])) {
1812 PIXEL10_0
1813 } else {
1814 PIXEL10_20
1815 }
1816 if (Diff(yuv[6], yuv[8])) {
1817 PIXEL11_0
1818 } else {
1819 PIXEL11_100
1820 }
1821 break;
1822 }
1823 case 249: {
1824 PIXEL00_12
1825 PIXEL01_22
1826 if (Diff(yuv[8], yuv[4])) {
1827 PIXEL10_0
1828 } else {
1829 PIXEL10_100
1830 }
1831 if (Diff(yuv[6], yuv[8])) {
1832 PIXEL11_0
1833 } else {
1834 PIXEL11_20
1835 }
1836 break;
1837 }
1838 case 235: {
1839 if (Diff(yuv[4], yuv[2])) {
1840 PIXEL00_0
1841 } else {
1842 PIXEL00_20
1843 }
1844 PIXEL01_21
1845 if (Diff(yuv[8], yuv[4])) {
1846 PIXEL10_0
1847 } else {
1848 PIXEL10_100
1849 }
1850 PIXEL11_11
1851 break;
1852 }
1853 case 111: {
1854 if (Diff(yuv[4], yuv[2])) {
1855 PIXEL00_0
1856 } else {
1857 PIXEL00_100
1858 }
1859 PIXEL01_12
1860 if (Diff(yuv[8], yuv[4])) {
1861 PIXEL10_0
1862 } else {
1863 PIXEL10_20
1864 }
1865 PIXEL11_22
1866 break;
1867 }
1868 case 63: {
1869 if (Diff(yuv[4], yuv[2])) {
1870 PIXEL00_0
1871 } else {
1872 PIXEL00_100
1873 }
1874 if (Diff(yuv[2], yuv[6])) {
1875 PIXEL01_0
1876 } else {
1877 PIXEL01_20
1878 }
1879 PIXEL10_11
1880 PIXEL11_21
1881 break;
1882 }
1883 case 159: {
1884 if (Diff(yuv[4], yuv[2])) {
1885 PIXEL00_0
1886 } else {
1887 PIXEL00_20
1888 }
1889 if (Diff(yuv[2], yuv[6])) {
1890 PIXEL01_0
1891 } else {
1892 PIXEL01_100
1893 }
1894 PIXEL10_22
1895 PIXEL11_12
1896 break;
1897 }
1898 case 215: {
1899 PIXEL00_11
1900 if (Diff(yuv[2], yuv[6])) {
1901 PIXEL01_0
1902 } else {
1903 PIXEL01_100
1904 }
1905 PIXEL10_21
1906 if (Diff(yuv[6], yuv[8])) {
1907 PIXEL11_0
1908 } else {
1909 PIXEL11_20
1910 }
1911 break;
1912 }
1913 case 246: {
1914 PIXEL00_22
1915 if (Diff(yuv[2], yuv[6])) {
1916 PIXEL01_0
1917 } else {
1918 PIXEL01_20
1919 }
1920 PIXEL10_12
1921 if (Diff(yuv[6], yuv[8])) {
1922 PIXEL11_0
1923 } else {
1924 PIXEL11_100
1925 }
1926 break;
1927 }
1928 case 254: {
1929 PIXEL00_10
1930 if (Diff(yuv[2], yuv[6])) {
1931 PIXEL01_0
1932 } else {
1933 PIXEL01_20
1934 }
1935 if (Diff(yuv[8], yuv[4])) {
1936 PIXEL10_0
1937 } else {
1938 PIXEL10_20
1939 }
1940 if (Diff(yuv[6], yuv[8])) {
1941 PIXEL11_0
1942 } else {
1943 PIXEL11_100
1944 }
1945 break;
1946 }
1947 case 253: {
1948 PIXEL00_12
1949 PIXEL01_11
1950 if (Diff(yuv[8], yuv[4])) {
1951 PIXEL10_0
1952 } else {
1953 PIXEL10_100
1954 }
1955 if (Diff(yuv[6], yuv[8])) {
1956 PIXEL11_0
1957 } else {
1958 PIXEL11_100
1959 }
1960 break;
1961 }
1962 case 251: {
1963 if (Diff(yuv[4], yuv[2])) {
1964 PIXEL00_0
1965 } else {
1966 PIXEL00_20
1967 }
1968 PIXEL01_10
1969 if (Diff(yuv[8], yuv[4])) {
1970 PIXEL10_0
1971 } else {
1972 PIXEL10_100
1973 }
1974 if (Diff(yuv[6], yuv[8])) {
1975 PIXEL11_0
1976 } else {
1977 PIXEL11_20
1978 }
1979 break;
1980 }
1981 case 239: {
1982 if (Diff(yuv[4], yuv[2])) {
1983 PIXEL00_0
1984 } else {
1985 PIXEL00_100
1986 }
1987 PIXEL01_12
1988 if (Diff(yuv[8], yuv[4])) {
1989 PIXEL10_0
1990 } else {
1991 PIXEL10_100
1992 }
1993 PIXEL11_11
1994 break;
1995 }
1996 case 127: {
1997 if (Diff(yuv[4], yuv[2])) {
1998 PIXEL00_0
1999 } else {
2000 PIXEL00_100
2001 }
2002 if (Diff(yuv[2], yuv[6])) {
2003 PIXEL01_0
2004 } else {
2005 PIXEL01_20
2006 }
2007 if (Diff(yuv[8], yuv[4])) {
2008 PIXEL10_0
2009 } else {
2010 PIXEL10_20
2011 }
2012 PIXEL11_10
2013 break;
2014 }
2015 case 191: {
2016 if (Diff(yuv[4], yuv[2])) {
2017 PIXEL00_0
2018 } else {
2019 PIXEL00_100
2020 }
2021 if (Diff(yuv[2], yuv[6])) {
2022 PIXEL01_0
2023 } else {
2024 PIXEL01_100
2025 }
2026 PIXEL10_11
2027 PIXEL11_12
2028 break;
2029 }
2030 case 223: {
2031 if (Diff(yuv[4], yuv[2])) {
2032 PIXEL00_0
2033 } else {
2034 PIXEL00_20
2035 }
2036 if (Diff(yuv[2], yuv[6])) {
2037 PIXEL01_0
2038 } else {
2039 PIXEL01_100
2040 }
2041 PIXEL10_10
2042 if (Diff(yuv[6], yuv[8])) {
2043 PIXEL11_0
2044 } else {
2045 PIXEL11_20
2046 }
2047 break;
2048 }
2049 case 247: {
2050 PIXEL00_11
2051 if (Diff(yuv[2], yuv[6])) {
2052 PIXEL01_0
2053 } else {
2054 PIXEL01_100
2055 }
2056 PIXEL10_12
2057 if (Diff(yuv[6], yuv[8])) {
2058 PIXEL11_0
2059 } else {
2060 PIXEL11_100
2061 }
2062 break;
2063 }
2064 case 255: {
2065 if (Diff(yuv[4], yuv[2])) {
2066 PIXEL00_0
2067 } else {
2068 PIXEL00_100
2069 }
2070 if (Diff(yuv[2], yuv[6])) {
2071 PIXEL01_0
2072 } else {
2073 PIXEL01_100
2074 }
2075 if (Diff(yuv[8], yuv[4])) {
2076 PIXEL10_0
2077 } else {
2078 PIXEL10_100
2079 }
2080 if (Diff(yuv[6], yuv[8])) {
2081 PIXEL11_0
2082 } else {
2083 PIXEL11_100
2084 }
2085 break;
2086 }
2087 }
2088 from++;
2089 to += 2;
2090 }
2091 from = from0 + sline_pixels;
2092 to = to0 + 2 * dline_pixels;
2093 }
2094 }
2095
2096 #endif //USE_HQ2X_SCALER
2097
2098 #endif //INCL_SCALE_HQ2X_H
2099