1;hq2x filter
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 General Public License
7;as published by the Free Software Foundation; either
8;version 2 of the License, or (at your option) any later
9;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
14;GNU General Public License for more details.
15;
16;You should have received a copy of the GNU General Public License
17;along with this program; if not, write to the Free Software
18;Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
19
20GLOBAL _hq2x_32
21
22EXTERN _LUT16to32
23EXTERN _RGBtoYUV
24
25SECTION .bss
26linesleft resd 1
27xcounter  resd 1
28cross     resd 1
29nextline  resd 1
30prevline  resd 1
31w1        resd 1
32w2        resd 1
33w3        resd 1
34w4        resd 1
35w5        resd 1
36w6        resd 1
37w7        resd 1
38w8        resd 1
39w9        resd 1
40c1        resd 1
41c2        resd 1
42c3        resd 1
43c4        resd 1
44c5        resd 1
45c6        resd 1
46c7        resd 1
47c8        resd 1
48c9        resd 1
49
50SECTION .data
51
52reg_blank    dd  0,0
53const3       dd  0x00030003,0x00000003
54const5       dd  0x00050005,0x00000005
55const6       dd  0x00060006,0x00000006
56const14      dd  0x000E000E,0x0000000E
57threshold    dd  0x00300706,0x00000000
58
59SECTION .text
60
61%macro TestDiff 2
62    xor     ecx,ecx
63    mov     edx,[%1]
64    cmp     edx,[%2]
65    je      %%fin
66    mov     ecx,_RGBtoYUV
67    movd    mm1,[ecx+edx*4]
68    movq    mm5,mm1
69    mov     edx,[%2]
70    movd    mm2,[ecx+edx*4]
71    psubusb mm1,mm2
72    psubusb mm2,mm5
73    por     mm1,mm2
74    psubusb mm1,[threshold]
75    movd    ecx,mm1
76%%fin:
77%endmacro
78
79%macro DiffOrNot 4
80   TestDiff %1,%2
81   test ecx,ecx
82   jz   %%same
83   %3
84   jmp %%fin
85%%same:
86   %4
87%%fin
88%endmacro
89
90%macro DiffOrNot 6
91   TestDiff %1,%2
92   test ecx,ecx
93   jz   %%same
94   %3
95   %4
96   jmp %%fin
97%%same:
98   %5
99   %6
100%%fin
101%endmacro
102
103%macro DiffOrNot 8
104   TestDiff %1,%2
105   test ecx,ecx
106   jz   %%same
107   %3
108   %4
109   %5
110   jmp %%fin
111%%same:
112   %6
113   %7
114   %8
115%%fin
116%endmacro
117
118%macro DiffOrNot 10
119   TestDiff %1,%2
120   test ecx,ecx
121   jz %%same
122   %3
123   %4
124   %5
125   %6
126   jmp %%fin
127%%same:
128   %7
129   %8
130   %9
131   %10
132%%fin
133%endmacro
134
135%macro Interp1 3
136    mov edx,%2
137    shl edx,2
138    add edx,%3
139    sub edx,%2
140    shr edx,2
141    mov %1,edx
142%endmacro
143
144%macro Interp2 4
145    mov edx,%2
146    shl edx,1
147    add edx,%3
148    add edx,%4
149    shr edx,2
150    mov %1,edx
151%endmacro
152
153%macro Interp5 3
154    mov edx,%2
155    add edx,%3
156    shr edx,1
157    mov %1,edx
158%endmacro
159
160%macro Interp6 3
161    movd       mm1, eax
162    movd       mm2, %2
163    movd       mm3, %3
164    punpcklbw  mm1, [reg_blank]
165    punpcklbw  mm2, [reg_blank]
166    punpcklbw  mm3, [reg_blank]
167    pmullw     mm1, [const5]
168    psllw      mm2, 1
169    paddw      mm1, mm3
170    paddw      mm1, mm2
171    psrlw      mm1, 3
172    packuswb   mm1, [reg_blank]
173    movd       %1, mm1
174%endmacro
175
176%macro Interp7 3
177    movd       mm1, eax
178    movd       mm2, %2
179    movd       mm3, %3
180    punpcklbw  mm1, [reg_blank]
181    punpcklbw  mm2, [reg_blank]
182    punpcklbw  mm3, [reg_blank]
183    pmullw     mm1, [const6]
184    paddw      mm2, mm3
185    paddw      mm1, mm2
186    psrlw      mm1, 3
187    packuswb   mm1, [reg_blank]
188    movd       %1, mm1
189%endmacro
190
191%macro Interp9 3
192    movd       mm1, eax
193    movd       mm2, %2
194    movd       mm3, %3
195    punpcklbw  mm1, [reg_blank]
196    punpcklbw  mm2, [reg_blank]
197    punpcklbw  mm3, [reg_blank]
198    psllw      mm1, 1
199    paddw      mm2, mm3
200    pmullw     mm2, [const3]
201    paddw      mm1, mm2
202    psrlw      mm1, 3
203    packuswb   mm1, [reg_blank]
204    movd       %1, mm1
205%endmacro
206
207%macro Interp10 3
208    movd       mm1, eax
209    movd       mm2, %2
210    movd       mm3, %3
211    punpcklbw  mm1, [reg_blank]
212    punpcklbw  mm2, [reg_blank]
213    punpcklbw  mm3, [reg_blank]
214    pmullw     mm1, [const14]
215    paddw      mm2, mm3
216    paddw      mm1, mm2
217    psrlw      mm1, 4
218    packuswb   mm1, [reg_blank]
219    movd       %1, mm1
220%endmacro
221
222%macro PIXEL00_0 0
223    mov [edi],eax
224%endmacro
225
226%macro PIXEL00_10 0
227    Interp1 [edi],eax,[c1]
228%endmacro
229
230%macro PIXEL00_11 0
231    Interp1 [edi],eax,[c4]
232%endmacro
233
234%macro PIXEL00_12 0
235    Interp1 [edi],eax,[c2]
236%endmacro
237
238%macro PIXEL00_20 0
239    Interp2 [edi],eax,[c4],[c2]
240%endmacro
241
242%macro PIXEL00_21 0
243    Interp2 [edi],eax,[c1],[c2]
244%endmacro
245
246%macro PIXEL00_22 0
247    Interp2 [edi],eax,[c1],[c4]
248%endmacro
249
250%macro PIXEL00_60 0
251    Interp6 [edi],[c2],[c4]
252%endmacro
253
254%macro PIXEL00_61 0
255    Interp6 [edi],[c4],[c2]
256%endmacro
257
258%macro PIXEL00_70 0
259    Interp7 [edi],[c4],[c2]
260%endmacro
261
262%macro PIXEL00_90 0
263    Interp9 [edi],[c4],[c2]
264%endmacro
265
266%macro PIXEL00_100 0
267    Interp10 [edi],[c4],[c2]
268%endmacro
269
270%macro PIXEL01_0 0
271    mov [edi+4],eax
272%endmacro
273
274%macro PIXEL01_10 0
275    Interp1 [edi+4],eax,[c3]
276%endmacro
277
278%macro PIXEL01_11 0
279    Interp1 [edi+4],eax,[c2]
280%endmacro
281
282%macro PIXEL01_12 0
283    Interp1 [edi+4],eax,[c6]
284%endmacro
285
286%macro PIXEL01_20 0
287    Interp2 [edi+4],eax,[c2],[c6]
288%endmacro
289
290%macro PIXEL01_21 0
291    Interp2 [edi+4],eax,[c3],[c6]
292%endmacro
293
294%macro PIXEL01_22 0
295    Interp2 [edi+4],eax,[c3],[c2]
296%endmacro
297
298%macro PIXEL01_60 0
299    Interp6 [edi+4],[c6],[c2]
300%endmacro
301
302%macro PIXEL01_61 0
303    Interp6 [edi+4],[c2],[c6]
304%endmacro
305
306%macro PIXEL01_70 0
307    Interp7 [edi+4],[c2],[c6]
308%endmacro
309
310%macro PIXEL01_90 0
311    Interp9 [edi+4],[c2],[c6]
312%endmacro
313
314%macro PIXEL01_100 0
315    Interp10 [edi+4],[c2],[c6]
316%endmacro
317
318%macro PIXEL10_0 0
319    mov [edi+ebx],eax
320%endmacro
321
322%macro PIXEL10_10 0
323    Interp1 [edi+ebx],eax,[c7]
324%endmacro
325
326%macro PIXEL10_11 0
327    Interp1 [edi+ebx],eax,[c8]
328%endmacro
329
330%macro PIXEL10_12 0
331    Interp1 [edi+ebx],eax,[c4]
332%endmacro
333
334%macro PIXEL10_20 0
335    Interp2 [edi+ebx],eax,[c8],[c4]
336%endmacro
337
338%macro PIXEL10_21 0
339    Interp2 [edi+ebx],eax,[c7],[c4]
340%endmacro
341
342%macro PIXEL10_22 0
343    Interp2 [edi+ebx],eax,[c7],[c8]
344%endmacro
345
346%macro PIXEL10_60 0
347    Interp6 [edi+ebx],[c4],[c8]
348%endmacro
349
350%macro PIXEL10_61 0
351    Interp6 [edi+ebx],[c8],[c4]
352%endmacro
353
354%macro PIXEL10_70 0
355    Interp7 [edi+ebx],[c8],[c4]
356%endmacro
357
358%macro PIXEL10_90 0
359    Interp9 [edi+ebx],[c8],[c4]
360%endmacro
361
362%macro PIXEL10_100 0
363    Interp10 [edi+ebx],[c8],[c4]
364%endmacro
365
366%macro PIXEL11_0 0
367    mov [edi+ebx+4],eax
368%endmacro
369
370%macro PIXEL11_10 0
371    Interp1 [edi+ebx+4],eax,[c9]
372%endmacro
373
374%macro PIXEL11_11 0
375    Interp1 [edi+ebx+4],eax,[c6]
376%endmacro
377
378%macro PIXEL11_12 0
379    Interp1 [edi+ebx+4],eax,[c8]
380%endmacro
381
382%macro PIXEL11_20 0
383    Interp2 [edi+ebx+4],eax,[c6],[c8]
384%endmacro
385
386%macro PIXEL11_21 0
387    Interp2 [edi+ebx+4],eax,[c9],[c8]
388%endmacro
389
390%macro PIXEL11_22 0
391    Interp2 [edi+ebx+4],eax,[c9],[c6]
392%endmacro
393
394%macro PIXEL11_60 0
395    Interp6 [edi+ebx+4],[c8],[c6]
396%endmacro
397
398%macro PIXEL11_61 0
399    Interp6 [edi+ebx+4],[c6],[c8]
400%endmacro
401
402%macro PIXEL11_70 0
403    Interp7 [edi+ebx+4],[c6],[c8]
404%endmacro
405
406%macro PIXEL11_90 0
407    Interp9 [edi+ebx+4],[c6],[c8]
408%endmacro
409
410%macro PIXEL11_100 0
411    Interp10 [edi+ebx+4],[c6],[c8]
412%endmacro
413
414inbuffer     equ 8
415outbuffer    equ 12
416Xres         equ 16
417Yres         equ 20
418pitch        equ 24
419
420_hq2x_32:
421    push ebp
422    mov ebp,esp
423    pushad
424
425    mov     esi,[ebp+inbuffer]
426    mov     edi,[ebp+outbuffer]
427    mov     edx,[ebp+Yres]
428    mov     [linesleft],edx
429    mov     ebx,[ebp+Xres]
430    shl     ebx,1
431    mov     dword[prevline],0
432    mov     dword[nextline],ebx
433.loopy
434	push	edi
435    mov     ecx,[ebp+Xres]
436    sub     ecx,2                 ; x={Xres-2, Xres-1} are special cases.
437    mov     dword[xcounter],ecx
438    ; x=0 - special case
439    mov     ebx,[prevline]
440    movq    mm5,[esi+ebx]
441    movq    mm6,[esi]
442    mov     ebx,[nextline]
443    movq    mm7,[esi+ebx]
444    movd    eax,mm5
445    movzx   edx,ax
446    mov     [w1],edx
447    mov     [w2],edx
448    shr     eax,16
449    mov     [w3],eax
450    movd    eax,mm6
451    movzx   edx,ax
452    mov     [w4],edx
453    mov     [w5],edx
454    shr     eax,16
455    mov     [w6],eax
456    movd    eax,mm7
457    movzx   edx,ax
458    mov     [w7],edx
459    mov     [w8],edx
460    shr     eax,16
461    mov     [w9],eax
462    jmp     .flags
463.loopx
464    mov     ebx,[prevline]
465    movq    mm5,[esi+ebx-2]
466    movq    mm6,[esi-2]
467    mov     ebx,[nextline]
468    movq    mm7,[esi+ebx-2]
469    movd    eax,mm5
470    movzx   edx,ax
471    mov     [w1],edx
472    shr     eax,16
473    mov     [w2],eax
474    psrlq   mm5,32
475    movd    eax,mm5
476    movzx   edx,ax
477    mov     [w3],edx
478    movd    eax,mm6
479    movzx   edx,ax
480    mov     [w4],edx
481    shr     eax,16
482    mov     [w5],eax
483    psrlq   mm6,32
484    movd    eax,mm6
485    movzx   edx,ax
486    mov     [w6],edx
487    movd    eax,mm7
488    movzx   edx,ax
489    mov     [w7],edx
490    shr     eax,16
491    mov     [w8],eax
492    psrlq   mm7,32
493    movd    eax,mm7
494    movzx   edx,ax
495    mov     [w9],edx
496.flags
497    mov     ebx,_RGBtoYUV
498    mov     eax,[w5]
499    xor     ecx,ecx
500    movd    mm5,[ebx+eax*4]
501    mov     dword[cross],0
502
503    mov     edx,[w2]
504    cmp     eax,edx
505    je      .noflag2
506    or      dword[cross],1
507    movq    mm1,mm5
508    movd    mm2,[ebx+edx*4]
509    psubusb mm1,mm2
510    psubusb mm2,mm5
511    por     mm1,mm2
512    psubusb mm1,[threshold]
513    movd    edx,mm1
514    test    edx,edx
515    jz      .noflag2
516    or      ecx,2
517.noflag2
518    mov     edx,[w4]
519    cmp     eax,edx
520    je      .noflag4
521    or      dword[cross],2
522    movq    mm1,mm5
523    movd    mm2,[ebx+edx*4]
524    psubusb mm1,mm2
525    psubusb mm2,mm5
526    por     mm1,mm2
527    psubusb mm1,[threshold]
528    movd    edx,mm1
529    test    edx,edx
530    jz      .noflag4
531    or      ecx,8
532.noflag4
533    mov     edx,[w6]
534    cmp     eax,edx
535    je      .noflag6
536    or      dword[cross],4
537    movq    mm1,mm5
538    movd    mm2,[ebx+edx*4]
539    psubusb mm1,mm2
540    psubusb mm2,mm5
541    por     mm1,mm2
542    psubusb mm1,[threshold]
543    movd    edx,mm1
544    test    edx,edx
545    jz      .noflag6
546    or      ecx,16
547.noflag6
548    mov     edx,[w8]
549    cmp     eax,edx
550    je      .noflag8
551    or      dword[cross],8
552    movq    mm1,mm5
553    movd    mm2,[ebx+edx*4]
554    psubusb mm1,mm2
555    psubusb mm2,mm5
556    por     mm1,mm2
557    psubusb mm1,[threshold]
558    movd    edx,mm1
559    test    edx,edx
560    jz      .noflag8
561    or      ecx,64
562.noflag8
563    test    ecx,ecx
564    jnz     .testflag1
565    mov     ecx,[cross]
566    mov     ebx,_LUT16to32
567    mov     eax,[ebx+eax*4]
568    jmp     [FuncTable2+ecx*4]
569.testflag1
570    mov     edx,[w1]
571    cmp     eax,edx
572    je      .noflag1
573    movq    mm1,mm5
574    movd    mm2,[ebx+edx*4]
575    psubusb mm1,mm2
576    psubusb mm2,mm5
577    por     mm1,mm2
578    psubusb mm1,[threshold]
579    movd    edx,mm1
580    test    edx,edx
581    jz      .noflag1
582    or      ecx,1
583.noflag1
584    mov     edx,[w3]
585    cmp     eax,edx
586    je      .noflag3
587    movq    mm1,mm5
588    movd    mm2,[ebx+edx*4]
589    psubusb mm1,mm2
590    psubusb mm2,mm5
591    por     mm1,mm2
592    psubusb mm1,[threshold]
593    movd    edx,mm1
594    test    edx,edx
595    jz      .noflag3
596    or      ecx,4
597.noflag3
598    mov     edx,[w7]
599    cmp     eax,edx
600    je      .noflag7
601    movq    mm1,mm5
602    movd    mm2,[ebx+edx*4]
603    psubusb mm1,mm2
604    psubusb mm2,mm5
605    por     mm1,mm2
606    psubusb mm1,[threshold]
607    movd    edx,mm1
608    test    edx,edx
609    jz      .noflag7
610    or      ecx,32
611.noflag7
612    mov     edx,[w9]
613    cmp     eax,edx
614    je      .noflag9
615    movq    mm1,mm5
616    movd    mm2,[ebx+edx*4]
617    psubusb mm1,mm2
618    psubusb mm2,mm5
619    por     mm1,mm2
620    psubusb mm1,[threshold]
621    movd    edx,mm1
622    test    edx,edx
623    jz      .noflag9
624    or      ecx,128
625.noflag9
626    mov  ebx,_LUT16to32
627    mov  eax,[ebx+eax*4]
628    mov  edx,[w2]
629    mov  edx,[ebx+edx*4]
630    mov  [c2],edx
631    mov  edx,[w4]
632    mov  edx,[ebx+edx*4]
633    mov  [c4],edx
634    mov  edx,[w6]
635    mov  edx,[ebx+edx*4]
636    mov  [c6],edx
637    mov  edx,[w8]
638    mov  edx,[ebx+edx*4]
639    mov  [c8],edx
640    test ecx,0x005A
641    jz  .switch
642    mov  edx,[w1]
643    mov  edx,[ebx+edx*4]
644    mov  [c1],edx
645    mov  edx,[w3]
646    mov  edx,[ebx+edx*4]
647    mov  [c3],edx
648    mov  edx,[w7]
649    mov  edx,[ebx+edx*4]
650    mov  [c7],edx
651    mov  edx,[w9]
652    mov  edx,[ebx+edx*4]
653    mov  [c9],edx
654.switch
655    mov  ebx,[ebp+pitch]
656    jmp  [FuncTable+ecx*4]
657
658..@flag0
659..@flag1
660..@flag4
661..@flag32
662..@flag128
663..@flag5
664..@flag132
665..@flag160
666..@flag33
667..@flag129
668..@flag36
669..@flag133
670..@flag164
671..@flag161
672..@flag37
673..@flag165
674;    PIXEL00_20
675;    PIXEL01_20
676;    PIXEL10_20
677;    PIXEL11_20
678
679;   the same, only optimized
680    shl eax,1
681    mov ecx,eax
682    add ecx,[c2]
683    mov edx,ecx
684    add edx,[c4]
685    shr edx,2
686    mov [edi],edx
687    add ecx,[c6]
688    shr ecx,2
689    mov [edi+4],ecx
690    mov ecx,eax
691    add ecx,[c8]
692    mov edx,ecx
693    add edx,[c4]
694    shr edx,2
695    mov [edi+ebx],edx
696    add ecx,[c6]
697    shr ecx,2
698    mov [edi+ebx+4],ecx
699    jmp .loopx_end
700..@flag2
701..@flag34
702..@flag130
703..@flag162
704    PIXEL00_22
705    PIXEL01_21
706    PIXEL10_20
707    PIXEL11_20
708    jmp .loopx_end
709..@flag16
710..@flag17
711..@flag48
712..@flag49
713    PIXEL00_20
714    PIXEL01_22
715    PIXEL10_20
716    PIXEL11_21
717    jmp .loopx_end
718..@flag64
719..@flag65
720..@flag68
721..@flag69
722    PIXEL00_20
723    PIXEL01_20
724    PIXEL10_21
725    PIXEL11_22
726    jmp .loopx_end
727..@flag8
728..@flag12
729..@flag136
730..@flag140
731    PIXEL00_21
732    PIXEL01_20
733    PIXEL10_22
734    PIXEL11_20
735    jmp .loopx_end
736..@flag3
737..@flag35
738..@flag131
739..@flag163
740    PIXEL00_11
741    PIXEL01_21
742    PIXEL10_20
743    PIXEL11_20
744    jmp .loopx_end
745..@flag6
746..@flag38
747..@flag134
748..@flag166
749    PIXEL00_22
750    PIXEL01_12
751    PIXEL10_20
752    PIXEL11_20
753    jmp .loopx_end
754..@flag20
755..@flag21
756..@flag52
757..@flag53
758    PIXEL00_20
759    PIXEL01_11
760    PIXEL10_20
761    PIXEL11_21
762    jmp .loopx_end
763..@flag144
764..@flag145
765..@flag176
766..@flag177
767    PIXEL00_20
768    PIXEL01_22
769    PIXEL10_20
770    PIXEL11_12
771    jmp .loopx_end
772..@flag192
773..@flag193
774..@flag196
775..@flag197
776    PIXEL00_20
777    PIXEL01_20
778    PIXEL10_21
779    PIXEL11_11
780    jmp .loopx_end
781..@flag96
782..@flag97
783..@flag100
784..@flag101
785    PIXEL00_20
786    PIXEL01_20
787    PIXEL10_12
788    PIXEL11_22
789    jmp .loopx_end
790..@flag40
791..@flag44
792..@flag168
793..@flag172
794    PIXEL00_21
795    PIXEL01_20
796    PIXEL10_11
797    PIXEL11_20
798    jmp .loopx_end
799..@flag9
800..@flag13
801..@flag137
802..@flag141
803    PIXEL00_12
804    PIXEL01_20
805    PIXEL10_22
806    PIXEL11_20
807    jmp .loopx_end
808..@flag18
809..@flag50
810    PIXEL00_22
811    DiffOrNot w2,w6,PIXEL01_10,PIXEL01_20
812    PIXEL10_20
813    PIXEL11_21
814    jmp .loopx_end
815..@flag80
816..@flag81
817    PIXEL00_20
818    PIXEL01_22
819    PIXEL10_21
820    DiffOrNot w6,w8,PIXEL11_10,PIXEL11_20
821    jmp .loopx_end
822..@flag72
823..@flag76
824    PIXEL00_21
825    PIXEL01_20
826    DiffOrNot w8,w4,PIXEL10_10,PIXEL10_20
827    PIXEL11_22
828    jmp .loopx_end
829..@flag10
830..@flag138
831    DiffOrNot w4,w2,PIXEL00_10,PIXEL00_20
832    PIXEL01_21
833    PIXEL10_22
834    PIXEL11_20
835    jmp .loopx_end
836..@flag66
837    PIXEL00_22
838    PIXEL01_21
839    PIXEL10_21
840    PIXEL11_22
841    jmp .loopx_end
842..@flag24
843    PIXEL00_21
844    PIXEL01_22
845    PIXEL10_22
846    PIXEL11_21
847    jmp .loopx_end
848..@flag7
849..@flag39
850..@flag135
851    PIXEL00_11
852    PIXEL01_12
853    PIXEL10_20
854    PIXEL11_20
855    jmp .loopx_end
856..@flag148
857..@flag149
858..@flag180
859    PIXEL00_20
860    PIXEL01_11
861    PIXEL10_20
862    PIXEL11_12
863    jmp .loopx_end
864..@flag224
865..@flag228
866..@flag225
867    PIXEL00_20
868    PIXEL01_20
869    PIXEL10_12
870    PIXEL11_11
871    jmp .loopx_end
872..@flag41
873..@flag169
874..@flag45
875    PIXEL00_12
876    PIXEL01_20
877    PIXEL10_11
878    PIXEL11_20
879    jmp .loopx_end
880..@flag22
881..@flag54
882    PIXEL00_22
883    DiffOrNot w2,w6,PIXEL01_0,PIXEL01_20
884    PIXEL10_20
885    PIXEL11_21
886    jmp .loopx_end
887..@flag208
888..@flag209
889    PIXEL00_20
890    PIXEL01_22
891    PIXEL10_21
892    DiffOrNot w6,w8,PIXEL11_0,PIXEL11_20
893    jmp .loopx_end
894..@flag104
895..@flag108
896    PIXEL00_21
897    PIXEL01_20
898    DiffOrNot w8,w4,PIXEL10_0,PIXEL10_20
899    PIXEL11_22
900    jmp .loopx_end
901..@flag11
902..@flag139
903    DiffOrNot w4,w2,PIXEL00_0,PIXEL00_20
904    PIXEL01_21
905    PIXEL10_22
906    PIXEL11_20
907    jmp .loopx_end
908..@flag19
909..@flag51
910    DiffOrNot w2,w6,PIXEL00_11,PIXEL01_10,PIXEL00_60,PIXEL01_90
911    PIXEL10_20
912    PIXEL11_21
913    jmp .loopx_end
914..@flag146
915..@flag178
916    PIXEL00_22
917    DiffOrNot w2,w6,PIXEL01_10,PIXEL11_12,PIXEL01_90,PIXEL11_61
918    PIXEL10_20
919    jmp .loopx_end
920..@flag84
921..@flag85
922    PIXEL00_20
923    DiffOrNot w6,w8,PIXEL01_11,PIXEL11_10,PIXEL01_60,PIXEL11_90
924    PIXEL10_21
925    jmp .loopx_end
926..@flag112
927..@flag113
928    PIXEL00_20
929    PIXEL01_22
930    DiffOrNot w6,w8,PIXEL10_12,PIXEL11_10,PIXEL10_61,PIXEL11_90
931    jmp .loopx_end
932..@flag200
933..@flag204
934    PIXEL00_21
935    PIXEL01_20
936    DiffOrNot w8,w4,PIXEL10_10,PIXEL11_11,PIXEL10_90,PIXEL11_60
937    jmp .loopx_end
938..@flag73
939..@flag77
940    DiffOrNot w8,w4,PIXEL00_12,PIXEL10_10,PIXEL00_61,PIXEL10_90
941    PIXEL01_20
942    PIXEL11_22
943    jmp .loopx_end
944..@flag42
945..@flag170
946    DiffOrNot w4,w2,PIXEL00_10,PIXEL10_11,PIXEL00_90,PIXEL10_60
947    PIXEL01_21
948    PIXEL11_20
949    jmp .loopx_end
950..@flag14
951..@flag142
952    DiffOrNot w4,w2,PIXEL00_10,PIXEL01_12,PIXEL00_90,PIXEL01_61
953    PIXEL10_22
954    PIXEL11_20
955    jmp .loopx_end
956..@flag67
957    PIXEL00_11
958    PIXEL01_21
959    PIXEL10_21
960    PIXEL11_22
961    jmp .loopx_end
962..@flag70
963    PIXEL00_22
964    PIXEL01_12
965    PIXEL10_21
966    PIXEL11_22
967    jmp .loopx_end
968..@flag28
969    PIXEL00_21
970    PIXEL01_11
971    PIXEL10_22
972    PIXEL11_21
973    jmp .loopx_end
974..@flag152
975    PIXEL00_21
976    PIXEL01_22
977    PIXEL10_22
978    PIXEL11_12
979    jmp .loopx_end
980..@flag194
981    PIXEL00_22
982    PIXEL01_21
983    PIXEL10_21
984    PIXEL11_11
985    jmp .loopx_end
986..@flag98
987    PIXEL00_22
988    PIXEL01_21
989    PIXEL10_12
990    PIXEL11_22
991    jmp .loopx_end
992..@flag56
993    PIXEL00_21
994    PIXEL01_22
995    PIXEL10_11
996    PIXEL11_21
997    jmp .loopx_end
998..@flag25
999    PIXEL00_12
1000    PIXEL01_22
1001    PIXEL10_22
1002    PIXEL11_21
1003    jmp .loopx_end
1004..@flag26
1005..@flag31
1006    DiffOrNot w4,w2,PIXEL00_0,PIXEL00_20
1007    DiffOrNot w2,w6,PIXEL01_0,PIXEL01_20
1008    PIXEL10_22
1009    PIXEL11_21
1010    jmp .loopx_end
1011..@flag82
1012..@flag214
1013    PIXEL00_22
1014    DiffOrNot w2,w6,PIXEL01_0,PIXEL01_20
1015    PIXEL10_21
1016    DiffOrNot w6,w8,PIXEL11_0,PIXEL11_20
1017    jmp .loopx_end
1018..@flag88
1019..@flag248
1020    PIXEL00_21
1021    PIXEL01_22
1022    DiffOrNot w8,w4,PIXEL10_0,PIXEL10_20
1023    DiffOrNot w6,w8,PIXEL11_0,PIXEL11_20
1024    jmp .loopx_end
1025..@flag74
1026..@flag107
1027    DiffOrNot w4,w2,PIXEL00_0,PIXEL00_20
1028    PIXEL01_21
1029    DiffOrNot w8,w4,PIXEL10_0,PIXEL10_20
1030    PIXEL11_22
1031    jmp .loopx_end
1032..@flag27
1033    DiffOrNot w4,w2,PIXEL00_0,PIXEL00_20
1034    PIXEL01_10
1035    PIXEL10_22
1036    PIXEL11_21
1037    jmp .loopx_end
1038..@flag86
1039    PIXEL00_22
1040    DiffOrNot w2,w6,PIXEL01_0,PIXEL01_20
1041    PIXEL10_21
1042    PIXEL11_10
1043    jmp .loopx_end
1044..@flag216
1045    PIXEL00_21
1046    PIXEL01_22
1047    PIXEL10_10
1048    DiffOrNot w6,w8,PIXEL11_0,PIXEL11_20
1049    jmp .loopx_end
1050..@flag106
1051    PIXEL00_10
1052    PIXEL01_21
1053    DiffOrNot w8,w4,PIXEL10_0,PIXEL10_20
1054    PIXEL11_22
1055    jmp .loopx_end
1056..@flag30
1057    PIXEL00_10
1058    DiffOrNot w2,w6,PIXEL01_0,PIXEL01_20
1059    PIXEL10_22
1060    PIXEL11_21
1061    jmp .loopx_end
1062..@flag210
1063    PIXEL00_22
1064    PIXEL01_10
1065    PIXEL10_21
1066    DiffOrNot w6,w8,PIXEL11_0,PIXEL11_20
1067    jmp .loopx_end
1068..@flag120
1069    PIXEL00_21
1070    PIXEL01_22
1071    DiffOrNot w8,w4,PIXEL10_0,PIXEL10_20
1072    PIXEL11_10
1073    jmp .loopx_end
1074..@flag75
1075    DiffOrNot w4,w2,PIXEL00_0,PIXEL00_20
1076    PIXEL01_21
1077    PIXEL10_10
1078    PIXEL11_22
1079    jmp .loopx_end
1080..@flag29
1081    PIXEL00_12
1082    PIXEL01_11
1083    PIXEL10_22
1084    PIXEL11_21
1085    jmp .loopx_end
1086..@flag198
1087    PIXEL00_22
1088    PIXEL01_12
1089    PIXEL10_21
1090    PIXEL11_11
1091    jmp .loopx_end
1092..@flag184
1093    PIXEL00_21
1094    PIXEL01_22
1095    PIXEL10_11
1096    PIXEL11_12
1097    jmp .loopx_end
1098..@flag99
1099    PIXEL00_11
1100    PIXEL01_21
1101    PIXEL10_12
1102    PIXEL11_22
1103    jmp .loopx_end
1104..@flag57
1105    PIXEL00_12
1106    PIXEL01_22
1107    PIXEL10_11
1108    PIXEL11_21
1109    jmp .loopx_end
1110..@flag71
1111    PIXEL00_11
1112    PIXEL01_12
1113    PIXEL10_21
1114    PIXEL11_22
1115    jmp .loopx_end
1116..@flag156
1117    PIXEL00_21
1118    PIXEL01_11
1119    PIXEL10_22
1120    PIXEL11_12
1121    jmp .loopx_end
1122..@flag226
1123    PIXEL00_22
1124    PIXEL01_21
1125    PIXEL10_12
1126    PIXEL11_11
1127    jmp .loopx_end
1128..@flag60
1129    PIXEL00_21
1130    PIXEL01_11
1131    PIXEL10_11
1132    PIXEL11_21
1133    jmp .loopx_end
1134..@flag195
1135    PIXEL00_11
1136    PIXEL01_21
1137    PIXEL10_21
1138    PIXEL11_11
1139    jmp .loopx_end
1140..@flag102
1141    PIXEL00_22
1142    PIXEL01_12
1143    PIXEL10_12
1144    PIXEL11_22
1145    jmp .loopx_end
1146..@flag153
1147    PIXEL00_12
1148    PIXEL01_22
1149    PIXEL10_22
1150    PIXEL11_12
1151    jmp .loopx_end
1152..@flag58
1153    DiffOrNot w4,w2,PIXEL00_10,PIXEL00_70
1154    DiffOrNot w2,w6,PIXEL01_10,PIXEL01_70
1155    PIXEL10_11
1156    PIXEL11_21
1157    jmp .loopx_end
1158..@flag83
1159    PIXEL00_11
1160    DiffOrNot w2,w6,PIXEL01_10,PIXEL01_70
1161    PIXEL10_21
1162    DiffOrNot w6,w8,PIXEL11_10,PIXEL11_70
1163    jmp .loopx_end
1164..@flag92
1165    PIXEL00_21
1166    PIXEL01_11
1167    DiffOrNot w8,w4,PIXEL10_10,PIXEL10_70
1168    DiffOrNot w6,w8,PIXEL11_10,PIXEL11_70
1169    jmp .loopx_end
1170..@flag202
1171    DiffOrNot w4,w2,PIXEL00_10,PIXEL00_70
1172    PIXEL01_21
1173    DiffOrNot w8,w4,PIXEL10_10,PIXEL10_70
1174    PIXEL11_11
1175    jmp .loopx_end
1176..@flag78
1177    DiffOrNot w4,w2,PIXEL00_10,PIXEL00_70
1178    PIXEL01_12
1179    DiffOrNot w8,w4,PIXEL10_10,PIXEL10_70
1180    PIXEL11_22
1181    jmp .loopx_end
1182..@flag154
1183    DiffOrNot w4,w2,PIXEL00_10,PIXEL00_70
1184    DiffOrNot w2,w6,PIXEL01_10,PIXEL01_70
1185    PIXEL10_22
1186    PIXEL11_12
1187    jmp .loopx_end
1188..@flag114
1189    PIXEL00_22
1190    DiffOrNot w2,w6,PIXEL01_10,PIXEL01_70
1191    PIXEL10_12
1192    DiffOrNot w6,w8,PIXEL11_10,PIXEL11_70
1193    jmp .loopx_end
1194..@flag89
1195    PIXEL00_12
1196    PIXEL01_22
1197    DiffOrNot w8,w4,PIXEL10_10,PIXEL10_70
1198    DiffOrNot w6,w8,PIXEL11_10,PIXEL11_70
1199    jmp .loopx_end
1200..@flag90
1201    DiffOrNot w4,w2,PIXEL00_10,PIXEL00_70
1202    DiffOrNot w2,w6,PIXEL01_10,PIXEL01_70
1203    DiffOrNot w8,w4,PIXEL10_10,PIXEL10_70
1204    DiffOrNot w6,w8,PIXEL11_10,PIXEL11_70
1205    jmp .loopx_end
1206..@flag55
1207..@flag23
1208    DiffOrNot w2,w6,PIXEL00_11,PIXEL01_0,PIXEL00_60,PIXEL01_90
1209    PIXEL10_20
1210    PIXEL11_21
1211    jmp .loopx_end
1212..@flag182
1213..@flag150
1214    PIXEL00_22
1215    DiffOrNot w2,w6,PIXEL01_0,PIXEL11_12,PIXEL01_90,PIXEL11_61
1216    PIXEL10_20
1217    jmp .loopx_end
1218..@flag213
1219..@flag212
1220    PIXEL00_20
1221    DiffOrNot w6,w8,PIXEL01_11,PIXEL11_0,PIXEL01_60,PIXEL11_90
1222    PIXEL10_21
1223    jmp .loopx_end
1224..@flag241
1225..@flag240
1226    PIXEL00_20
1227    PIXEL01_22
1228    DiffOrNot w6,w8,PIXEL10_12,PIXEL11_0,PIXEL10_61,PIXEL11_90
1229    jmp .loopx_end
1230..@flag236
1231..@flag232
1232    PIXEL00_21
1233    PIXEL01_20
1234    DiffOrNot w8,w4,PIXEL10_0,PIXEL11_11,PIXEL10_90,PIXEL11_60
1235    jmp .loopx_end
1236..@flag109
1237..@flag105
1238    DiffOrNot w8,w4,PIXEL00_12,PIXEL10_0,PIXEL00_61,PIXEL10_90
1239    PIXEL01_20
1240    PIXEL11_22
1241    jmp .loopx_end
1242..@flag171
1243..@flag43
1244    DiffOrNot w4,w2,PIXEL00_0,PIXEL10_11,PIXEL00_90,PIXEL10_60
1245    PIXEL01_21
1246    PIXEL11_20
1247    jmp .loopx_end
1248..@flag143
1249..@flag15
1250    DiffOrNot w4,w2,PIXEL00_0,PIXEL01_12,PIXEL00_90,PIXEL01_61
1251    PIXEL10_22
1252    PIXEL11_20
1253    jmp .loopx_end
1254..@flag124
1255    PIXEL00_21
1256    PIXEL01_11
1257    DiffOrNot w8,w4,PIXEL10_0,PIXEL10_20
1258    PIXEL11_10
1259    jmp .loopx_end
1260..@flag203
1261    DiffOrNot w4,w2,PIXEL00_0,PIXEL00_20
1262    PIXEL01_21
1263    PIXEL10_10
1264    PIXEL11_11
1265    jmp .loopx_end
1266..@flag62
1267    PIXEL00_10
1268    DiffOrNot w2,w6,PIXEL01_0,PIXEL01_20
1269    PIXEL10_11
1270    PIXEL11_21
1271    jmp .loopx_end
1272..@flag211
1273    PIXEL00_11
1274    PIXEL01_10
1275    PIXEL10_21
1276    DiffOrNot w6,w8,PIXEL11_0,PIXEL11_20
1277    jmp .loopx_end
1278..@flag118
1279    PIXEL00_22
1280    DiffOrNot w2,w6,PIXEL01_0,PIXEL01_20
1281    PIXEL10_12
1282    PIXEL11_10
1283    jmp .loopx_end
1284..@flag217
1285    PIXEL00_12
1286    PIXEL01_22
1287    PIXEL10_10
1288    DiffOrNot w6,w8,PIXEL11_0,PIXEL11_20
1289    jmp .loopx_end
1290..@flag110
1291    PIXEL00_10
1292    PIXEL01_12
1293    DiffOrNot w8,w4,PIXEL10_0,PIXEL10_20
1294    PIXEL11_22
1295    jmp .loopx_end
1296..@flag155
1297    DiffOrNot w4,w2,PIXEL00_0,PIXEL00_20
1298    PIXEL01_10
1299    PIXEL10_22
1300    PIXEL11_12
1301    jmp .loopx_end
1302..@flag188
1303    PIXEL00_21
1304    PIXEL01_11
1305    PIXEL10_11
1306    PIXEL11_12
1307    jmp .loopx_end
1308..@flag185
1309    PIXEL00_12
1310    PIXEL01_22
1311    PIXEL10_11
1312    PIXEL11_12
1313    jmp .loopx_end
1314..@flag61
1315    PIXEL00_12
1316    PIXEL01_11
1317    PIXEL10_11
1318    PIXEL11_21
1319    jmp .loopx_end
1320..@flag157
1321    PIXEL00_12
1322    PIXEL01_11
1323    PIXEL10_22
1324    PIXEL11_12
1325    jmp .loopx_end
1326..@flag103
1327    PIXEL00_11
1328    PIXEL01_12
1329    PIXEL10_12
1330    PIXEL11_22
1331    jmp .loopx_end
1332..@flag227
1333    PIXEL00_11
1334    PIXEL01_21
1335    PIXEL10_12
1336    PIXEL11_11
1337    jmp .loopx_end
1338..@flag230
1339    PIXEL00_22
1340    PIXEL01_12
1341    PIXEL10_12
1342    PIXEL11_11
1343    jmp .loopx_end
1344..@flag199
1345    PIXEL00_11
1346    PIXEL01_12
1347    PIXEL10_21
1348    PIXEL11_11
1349    jmp .loopx_end
1350..@flag220
1351    PIXEL00_21
1352    PIXEL01_11
1353    DiffOrNot w8,w4,PIXEL10_10,PIXEL10_70
1354    DiffOrNot w6,w8,PIXEL11_0,PIXEL11_20
1355    jmp .loopx_end
1356..@flag158
1357    DiffOrNot w4,w2,PIXEL00_10,PIXEL00_70
1358    DiffOrNot w2,w6,PIXEL01_0,PIXEL01_20
1359    PIXEL10_22
1360    PIXEL11_12
1361    jmp .loopx_end
1362..@flag234
1363    DiffOrNot w4,w2,PIXEL00_10,PIXEL00_70
1364    PIXEL01_21
1365    DiffOrNot w8,w4,PIXEL10_0,PIXEL10_20
1366    PIXEL11_11
1367    jmp .loopx_end
1368..@flag242
1369    PIXEL00_22
1370    DiffOrNot w2,w6,PIXEL01_10,PIXEL01_70
1371    PIXEL10_12
1372    DiffOrNot w6,w8,PIXEL11_0,PIXEL11_20
1373    jmp .loopx_end
1374..@flag59
1375    DiffOrNot w4,w2,PIXEL00_0,PIXEL00_20
1376    DiffOrNot w2,w6,PIXEL01_10,PIXEL01_70
1377    PIXEL10_11
1378    PIXEL11_21
1379    jmp .loopx_end
1380..@flag121
1381    PIXEL00_12
1382    PIXEL01_22
1383    DiffOrNot w8,w4,PIXEL10_0,PIXEL10_20
1384    DiffOrNot w6,w8,PIXEL11_10,PIXEL11_70
1385    jmp .loopx_end
1386..@flag87
1387    PIXEL00_11
1388    DiffOrNot w2,w6,PIXEL01_0,PIXEL01_20
1389    PIXEL10_21
1390    DiffOrNot w6,w8,PIXEL11_10,PIXEL11_70
1391    jmp .loopx_end
1392..@flag79
1393    DiffOrNot w4,w2,PIXEL00_0,PIXEL00_20
1394    PIXEL01_12
1395    DiffOrNot w8,w4,PIXEL10_10,PIXEL10_70
1396    PIXEL11_22
1397    jmp .loopx_end
1398..@flag122
1399    DiffOrNot w4,w2,PIXEL00_10,PIXEL00_70
1400    DiffOrNot w2,w6,PIXEL01_10,PIXEL01_70
1401    DiffOrNot w8,w4,PIXEL10_0,PIXEL10_20
1402    DiffOrNot w6,w8,PIXEL11_10,PIXEL11_70
1403    jmp .loopx_end
1404..@flag94
1405    DiffOrNot w4,w2,PIXEL00_10,PIXEL00_70
1406    DiffOrNot w2,w6,PIXEL01_0,PIXEL01_20
1407    DiffOrNot w8,w4,PIXEL10_10,PIXEL10_70
1408    DiffOrNot w6,w8,PIXEL11_10,PIXEL11_70
1409    jmp .loopx_end
1410..@flag218
1411    DiffOrNot w4,w2,PIXEL00_10,PIXEL00_70
1412    DiffOrNot w2,w6,PIXEL01_10,PIXEL01_70
1413    DiffOrNot w8,w4,PIXEL10_10,PIXEL10_70
1414    DiffOrNot w6,w8,PIXEL11_0,PIXEL11_20
1415    jmp .loopx_end
1416..@flag91
1417    DiffOrNot w4,w2,PIXEL00_0,PIXEL00_20
1418    DiffOrNot w2,w6,PIXEL01_10,PIXEL01_70
1419    DiffOrNot w8,w4,PIXEL10_10,PIXEL10_70
1420    DiffOrNot w6,w8,PIXEL11_10,PIXEL11_70
1421    jmp .loopx_end
1422..@flag229
1423    PIXEL00_20
1424    PIXEL01_20
1425    PIXEL10_12
1426    PIXEL11_11
1427    jmp .loopx_end
1428..@flag167
1429    PIXEL00_11
1430    PIXEL01_12
1431    PIXEL10_20
1432    PIXEL11_20
1433    jmp .loopx_end
1434..@flag173
1435    PIXEL00_12
1436    PIXEL01_20
1437    PIXEL10_11
1438    PIXEL11_20
1439    jmp .loopx_end
1440..@flag181
1441    PIXEL00_20
1442    PIXEL01_11
1443    PIXEL10_20
1444    PIXEL11_12
1445    jmp .loopx_end
1446..@flag186
1447    DiffOrNot w4,w2,PIXEL00_10,PIXEL00_70
1448    DiffOrNot w2,w6,PIXEL01_10,PIXEL01_70
1449    PIXEL10_11
1450    PIXEL11_12
1451    jmp .loopx_end
1452..@flag115
1453    PIXEL00_11
1454    DiffOrNot w2,w6,PIXEL01_10,PIXEL01_70
1455    PIXEL10_12
1456    DiffOrNot w6,w8,PIXEL11_10,PIXEL11_70
1457    jmp .loopx_end
1458..@flag93
1459    PIXEL00_12
1460    PIXEL01_11
1461    DiffOrNot w8,w4,PIXEL10_10,PIXEL10_70
1462    DiffOrNot w6,w8,PIXEL11_10,PIXEL11_70
1463    jmp .loopx_end
1464..@flag206
1465    DiffOrNot w4,w2,PIXEL00_10,PIXEL00_70
1466    PIXEL01_12
1467    DiffOrNot w8,w4,PIXEL10_10,PIXEL10_70
1468    PIXEL11_11
1469    jmp .loopx_end
1470..@flag205
1471..@flag201
1472    PIXEL00_12
1473    PIXEL01_20
1474    DiffOrNot w8,w4,PIXEL10_10,PIXEL10_70
1475    PIXEL11_11
1476    jmp .loopx_end
1477..@flag174
1478..@flag46
1479    DiffOrNot w4,w2,PIXEL00_10,PIXEL00_70
1480    PIXEL01_12
1481    PIXEL10_11
1482    PIXEL11_20
1483    jmp .loopx_end
1484..@flag179
1485..@flag147
1486    PIXEL00_11
1487    DiffOrNot w2,w6,PIXEL01_10,PIXEL01_70
1488    PIXEL10_20
1489    PIXEL11_12
1490    jmp .loopx_end
1491..@flag117
1492..@flag116
1493    PIXEL00_20
1494    PIXEL01_11
1495    PIXEL10_12
1496    DiffOrNot w6,w8,PIXEL11_10,PIXEL11_70
1497    jmp .loopx_end
1498..@flag189
1499    PIXEL00_12
1500    PIXEL01_11
1501    PIXEL10_11
1502    PIXEL11_12
1503    jmp .loopx_end
1504..@flag231
1505    PIXEL00_11
1506    PIXEL01_12
1507    PIXEL10_12
1508    PIXEL11_11
1509    jmp .loopx_end
1510..@flag126
1511    PIXEL00_10
1512    DiffOrNot w2,w6,PIXEL01_0,PIXEL01_20
1513    DiffOrNot w8,w4,PIXEL10_0,PIXEL10_20
1514    PIXEL11_10
1515    jmp .loopx_end
1516..@flag219
1517    DiffOrNot w4,w2,PIXEL00_0,PIXEL00_20
1518    PIXEL01_10
1519    PIXEL10_10
1520    DiffOrNot w6,w8,PIXEL11_0,PIXEL11_20
1521    jmp .loopx_end
1522..@flag125
1523    DiffOrNot w8,w4,PIXEL00_12,PIXEL10_0,PIXEL00_61,PIXEL10_90
1524    PIXEL01_11
1525    PIXEL11_10
1526    jmp .loopx_end
1527..@flag221
1528    PIXEL00_12
1529    DiffOrNot w6,w8,PIXEL01_11,PIXEL11_0,PIXEL01_60,PIXEL11_90
1530    PIXEL10_10
1531    jmp .loopx_end
1532..@flag207
1533    DiffOrNot w4,w2,PIXEL00_0,PIXEL01_12,PIXEL00_90,PIXEL01_61
1534    PIXEL10_10
1535    PIXEL11_11
1536    jmp .loopx_end
1537..@flag238
1538    PIXEL00_10
1539    PIXEL01_12
1540    DiffOrNot w8,w4,PIXEL10_0,PIXEL11_11,PIXEL10_90,PIXEL11_60
1541    jmp .loopx_end
1542..@flag190
1543    PIXEL00_10
1544    DiffOrNot w2,w6,PIXEL01_0,PIXEL11_12,PIXEL01_90,PIXEL11_61
1545    PIXEL10_11
1546    jmp .loopx_end
1547..@flag187
1548    DiffOrNot w4,w2,PIXEL00_0,PIXEL10_11,PIXEL00_90,PIXEL10_60
1549    PIXEL01_10
1550    PIXEL11_12
1551    jmp .loopx_end
1552..@flag243
1553    PIXEL00_11
1554    PIXEL01_10
1555    DiffOrNot w6,w8,PIXEL10_12,PIXEL11_0,PIXEL10_61,PIXEL11_90
1556    jmp .loopx_end
1557..@flag119
1558    DiffOrNot w2,w6,PIXEL00_11,PIXEL01_0,PIXEL00_60,PIXEL01_90
1559    PIXEL10_12
1560    PIXEL11_10
1561    jmp .loopx_end
1562..@flag237
1563..@flag233
1564    PIXEL00_12
1565    PIXEL01_20
1566    DiffOrNot w8,w4,PIXEL10_0,PIXEL10_100
1567    PIXEL11_11
1568    jmp .loopx_end
1569..@flag175
1570..@flag47
1571    DiffOrNot w4,w2,PIXEL00_0,PIXEL00_100
1572    PIXEL01_12
1573    PIXEL10_11
1574    PIXEL11_20
1575    jmp .loopx_end
1576..@flag183
1577..@flag151
1578    PIXEL00_11
1579    DiffOrNot w2,w6,PIXEL01_0,PIXEL01_100
1580    PIXEL10_20
1581    PIXEL11_12
1582    jmp .loopx_end
1583..@flag245
1584..@flag244
1585    PIXEL00_20
1586    PIXEL01_11
1587    PIXEL10_12
1588    DiffOrNot w6,w8,PIXEL11_0,PIXEL11_100
1589    jmp .loopx_end
1590..@flag250
1591    PIXEL00_10
1592    PIXEL01_10
1593    DiffOrNot w8,w4,PIXEL10_0,PIXEL10_20
1594    DiffOrNot w6,w8,PIXEL11_0,PIXEL11_20
1595    jmp .loopx_end
1596..@flag123
1597    DiffOrNot w4,w2,PIXEL00_0,PIXEL00_20
1598    PIXEL01_10
1599    DiffOrNot w8,w4,PIXEL10_0,PIXEL10_20
1600    PIXEL11_10
1601    jmp .loopx_end
1602..@flag95
1603    DiffOrNot w4,w2,PIXEL00_0,PIXEL00_20
1604    DiffOrNot w2,w6,PIXEL01_0,PIXEL01_20
1605    PIXEL10_10
1606    PIXEL11_10
1607    jmp .loopx_end
1608..@flag222
1609    PIXEL00_10
1610    DiffOrNot w2,w6,PIXEL01_0,PIXEL01_20
1611    PIXEL10_10
1612    DiffOrNot w6,w8,PIXEL11_0,PIXEL11_20
1613    jmp .loopx_end
1614..@flag252
1615    PIXEL00_21
1616    PIXEL01_11
1617    DiffOrNot w8,w4,PIXEL10_0,PIXEL10_20
1618    DiffOrNot w6,w8,PIXEL11_0,PIXEL11_100
1619    jmp .loopx_end
1620..@flag249
1621    PIXEL00_12
1622    PIXEL01_22
1623    DiffOrNot w8,w4,PIXEL10_0,PIXEL10_100
1624    DiffOrNot w6,w8,PIXEL11_0,PIXEL11_20
1625    jmp .loopx_end
1626..@flag235
1627    DiffOrNot w4,w2,PIXEL00_0,PIXEL00_20
1628    PIXEL01_21
1629    DiffOrNot w8,w4,PIXEL10_0,PIXEL10_100
1630    PIXEL11_11
1631    jmp .loopx_end
1632..@flag111
1633    DiffOrNot w4,w2,PIXEL00_0,PIXEL00_100
1634    PIXEL01_12
1635    DiffOrNot w8,w4,PIXEL10_0,PIXEL10_20
1636    PIXEL11_22
1637    jmp .loopx_end
1638..@flag63
1639    DiffOrNot w4,w2,PIXEL00_0,PIXEL00_100
1640    DiffOrNot w2,w6,PIXEL01_0,PIXEL01_20
1641    PIXEL10_11
1642    PIXEL11_21
1643    jmp .loopx_end
1644..@flag159
1645    DiffOrNot w4,w2,PIXEL00_0,PIXEL00_20
1646    DiffOrNot w2,w6,PIXEL01_0,PIXEL01_100
1647    PIXEL10_22
1648    PIXEL11_12
1649    jmp .loopx_end
1650..@flag215
1651    PIXEL00_11
1652    DiffOrNot w2,w6,PIXEL01_0,PIXEL01_100
1653    PIXEL10_21
1654    DiffOrNot w6,w8,PIXEL11_0,PIXEL11_20
1655    jmp .loopx_end
1656..@flag246
1657    PIXEL00_22
1658    DiffOrNot w2,w6,PIXEL01_0,PIXEL01_20
1659    PIXEL10_12
1660    DiffOrNot w6,w8,PIXEL11_0,PIXEL11_100
1661    jmp .loopx_end
1662..@flag254
1663    PIXEL00_10
1664    DiffOrNot w2,w6,PIXEL01_0,PIXEL01_20
1665    DiffOrNot w8,w4,PIXEL10_0,PIXEL10_20
1666    DiffOrNot w6,w8,PIXEL11_0,PIXEL11_100
1667    jmp .loopx_end
1668..@flag253
1669    PIXEL00_12
1670    PIXEL01_11
1671    DiffOrNot w8,w4,PIXEL10_0,PIXEL10_100
1672    DiffOrNot w6,w8,PIXEL11_0,PIXEL11_100
1673    jmp .loopx_end
1674..@flag251
1675    DiffOrNot w4,w2,PIXEL00_0,PIXEL00_20
1676    PIXEL01_10
1677    DiffOrNot w8,w4,PIXEL10_0,PIXEL10_100
1678    DiffOrNot w6,w8,PIXEL11_0,PIXEL11_20
1679    jmp .loopx_end
1680..@flag239
1681    DiffOrNot w4,w2,PIXEL00_0,PIXEL00_100
1682    PIXEL01_12
1683    DiffOrNot w8,w4,PIXEL10_0,PIXEL10_100
1684    PIXEL11_11
1685    jmp .loopx_end
1686..@flag127
1687    DiffOrNot w4,w2,PIXEL00_0,PIXEL00_100
1688    DiffOrNot w2,w6,PIXEL01_0,PIXEL01_20
1689    DiffOrNot w8,w4,PIXEL10_0,PIXEL10_20
1690    PIXEL11_10
1691    jmp .loopx_end
1692..@flag191
1693    DiffOrNot w4,w2,PIXEL00_0,PIXEL00_100
1694    DiffOrNot w2,w6,PIXEL01_0,PIXEL01_100
1695    PIXEL10_11
1696    PIXEL11_12
1697    jmp .loopx_end
1698..@flag223
1699    DiffOrNot w4,w2,PIXEL00_0,PIXEL00_20
1700    DiffOrNot w2,w6,PIXEL01_0,PIXEL01_100
1701    PIXEL10_10
1702    DiffOrNot w6,w8,PIXEL11_0,PIXEL11_20
1703    jmp .loopx_end
1704..@flag247
1705    PIXEL00_11
1706    DiffOrNot w2,w6,PIXEL01_0,PIXEL01_100
1707    PIXEL10_12
1708    DiffOrNot w6,w8,PIXEL11_0,PIXEL11_100
1709    jmp .loopx_end
1710..@flag255
1711    DiffOrNot w4,w2,PIXEL00_0,PIXEL00_100
1712    DiffOrNot w2,w6,PIXEL01_0,PIXEL01_100
1713    DiffOrNot w8,w4,PIXEL10_0,PIXEL10_100
1714    DiffOrNot w6,w8,PIXEL11_0,PIXEL11_100
1715    jmp .loopx_end
1716
1717
1718..@cross0
1719    mov     ebx,[ebp+pitch]
1720    mov     [edi],eax
1721    mov     [edi+4],eax
1722    mov     [edi+ebx],eax
1723    mov     [edi+ebx+4],eax
1724    jmp     .loopx_end
1725..@cross1
1726    mov     ecx,[w2]
1727    mov     edx,eax
1728    shl     edx,2
1729    add     edx,[ebx+ecx*4]
1730    sub     edx,eax
1731    shr     edx,2
1732    mov     ebx,[ebp+pitch]
1733    mov     [edi],edx
1734    mov     [edi+4],edx
1735    mov     [edi+ebx],eax
1736    mov     [edi+ebx+4],eax
1737    jmp     .loopx_end
1738..@cross2
1739    mov     ecx,[w4]
1740    mov     edx,eax
1741    shl     edx,2
1742    add     edx,[ebx+ecx*4]
1743    sub     edx,eax
1744    shr     edx,2
1745    mov     ebx,[ebp+pitch]
1746    mov     [edi],edx
1747    mov     [edi+4],eax
1748    mov     [edi+ebx],edx
1749    mov     [edi+ebx+4],eax
1750    jmp     .loopx_end
1751..@cross4
1752    mov     ecx,[w6]
1753    mov     edx,eax
1754    shl     edx,2
1755    add     edx,[ebx+ecx*4]
1756    sub     edx,eax
1757    shr     edx,2
1758    mov     ebx,[ebp+pitch]
1759    mov     [edi],eax
1760    mov     [edi+4],edx
1761    mov     [edi+ebx],eax
1762    mov     [edi+ebx+4],edx
1763    jmp     .loopx_end
1764..@cross8
1765    mov     ecx,[w8]
1766    mov     edx,eax
1767    shl     edx,2
1768    add     edx,[ebx+ecx*4]
1769    sub     edx,eax
1770    shr     edx,2
1771    mov     ebx,[ebp+pitch]
1772    mov     [edi],eax
1773    mov     [edi+4],eax
1774    mov     [edi+ebx],edx
1775    mov     [edi+ebx+4],edx
1776    jmp     .loopx_end
1777..@crossN
1778    mov     edx,[w2]
1779    mov     ecx,[ebx+edx*4]
1780    mov     [c2],ecx
1781    mov     edx,[w4]
1782    mov     ecx,[ebx+edx*4]
1783    mov     [c4],ecx
1784    mov     edx,[w6]
1785    mov     ecx,[ebx+edx*4]
1786    mov     [c6],ecx
1787    mov     edx,[w8]
1788    mov     ecx,[ebx+edx*4]
1789    mov     [c8],ecx
1790    mov     ebx,[ebp+pitch]
1791    jmp     ..@flag0
1792
1793.loopx_end
1794    add     esi,2
1795    add     edi,8
1796    dec     dword[xcounter]
1797    jle     .xres_2
1798    jmp     .loopx
1799
1800.xres_2
1801    ; x=Xres-2 - special case
1802    jl      .xres_1
1803    mov     ebx,[prevline]
1804    movq    mm5,[esi+ebx-4]
1805    movq    mm6,[esi-4]
1806    mov     ebx,[nextline]
1807    movq    mm7,[esi+ebx-4]
1808    psrlq   mm5,16
1809    psrlq   mm6,16
1810    psrlq   mm7,16
1811    movd    eax,mm5
1812    movzx   edx,ax
1813    mov     [w1],edx
1814    shr     eax,16
1815    mov     [w2],eax
1816    psrlq   mm5,32
1817    movd    eax,mm5
1818    mov     [w3],eax
1819    movd    eax,mm6
1820    movzx   edx,ax
1821    mov     [w4],edx
1822    shr     eax,16
1823    mov     [w5],eax
1824    psrlq   mm6,32
1825    movd    eax,mm6
1826    mov     [w6],eax
1827    movd    eax,mm7
1828    movzx   edx,ax
1829    mov     [w7],edx
1830    shr     eax,16
1831    mov     [w8],eax
1832    psrlq   mm7,32
1833    movd    eax,mm7
1834    mov     [w9],eax
1835    jmp     .flags
1836
1837.xres_1
1838    cmp     dword[xcounter],-1
1839    jl      .nexty
1840    ; x=Xres-1 - special case
1841    mov     ebx,[prevline]
1842    movq    mm5,[esi+ebx-6]
1843    movq    mm6,[esi-6]
1844    mov     ebx,[nextline]
1845    movq    mm7,[esi+ebx-6]
1846    psrlq   mm5,32
1847    psrlq   mm6,32
1848    psrlq   mm7,32
1849    movd    eax,mm5
1850    movzx   edx,ax
1851    mov     [w1],edx
1852    shr     eax,16
1853    mov     [w2],eax
1854    mov     [w3],eax
1855    movd    eax,mm6
1856    movzx   edx,ax
1857    mov     [w4],edx
1858    shr     eax,16
1859    mov     [w5],eax
1860    mov     [w6],eax
1861    movd    eax,mm7
1862    movzx   edx,ax
1863    mov     [w7],edx
1864    shr     eax,16
1865    mov     [w8],eax
1866    mov     [w9],eax
1867    jmp     .flags
1868.nexty
1869	pop		edi
1870    add     edi,ebx
1871    add     edi,ebx
1872    dec     dword[linesleft]
1873    jz      .fin
1874    mov     ebx,[ebp+Xres]
1875    shl     ebx,1
1876    cmp     dword[linesleft],1
1877    je      .lastline
1878    mov     dword[nextline],ebx
1879    neg     ebx
1880    mov     dword[prevline],ebx
1881    jmp     .loopy
1882.lastline
1883    mov     dword[nextline],0
1884    neg     ebx
1885    mov     dword[prevline],ebx
1886    jmp     .loopy
1887.fin
1888    emms
1889    popad
1890    mov esp,ebp
1891    pop ebp
1892    ret
1893
1894SECTION .data
1895FuncTable
1896    dd ..@flag0, ..@flag1, ..@flag2, ..@flag3, ..@flag4, ..@flag5, ..@flag6, ..@flag7
1897    dd ..@flag8, ..@flag9, ..@flag10, ..@flag11, ..@flag12, ..@flag13, ..@flag14, ..@flag15
1898    dd ..@flag16, ..@flag17, ..@flag18, ..@flag19, ..@flag20, ..@flag21, ..@flag22, ..@flag23
1899    dd ..@flag24, ..@flag25, ..@flag26, ..@flag27, ..@flag28, ..@flag29, ..@flag30, ..@flag31
1900    dd ..@flag32, ..@flag33, ..@flag34, ..@flag35, ..@flag36, ..@flag37, ..@flag38, ..@flag39
1901    dd ..@flag40, ..@flag41, ..@flag42, ..@flag43, ..@flag44, ..@flag45, ..@flag46, ..@flag47
1902    dd ..@flag48, ..@flag49, ..@flag50, ..@flag51, ..@flag52, ..@flag53, ..@flag54, ..@flag55
1903    dd ..@flag56, ..@flag57, ..@flag58, ..@flag59, ..@flag60, ..@flag61, ..@flag62, ..@flag63
1904    dd ..@flag64, ..@flag65, ..@flag66, ..@flag67, ..@flag68, ..@flag69, ..@flag70, ..@flag71
1905    dd ..@flag72, ..@flag73, ..@flag74, ..@flag75, ..@flag76, ..@flag77, ..@flag78, ..@flag79
1906    dd ..@flag80, ..@flag81, ..@flag82, ..@flag83, ..@flag84, ..@flag85, ..@flag86, ..@flag87
1907    dd ..@flag88, ..@flag89, ..@flag90, ..@flag91, ..@flag92, ..@flag93, ..@flag94, ..@flag95
1908    dd ..@flag96, ..@flag97, ..@flag98, ..@flag99, ..@flag100, ..@flag101, ..@flag102, ..@flag103
1909    dd ..@flag104, ..@flag105, ..@flag106, ..@flag107, ..@flag108, ..@flag109, ..@flag110, ..@flag111
1910    dd ..@flag112, ..@flag113, ..@flag114, ..@flag115, ..@flag116, ..@flag117, ..@flag118, ..@flag119
1911    dd ..@flag120, ..@flag121, ..@flag122, ..@flag123, ..@flag124, ..@flag125, ..@flag126, ..@flag127
1912    dd ..@flag128, ..@flag129, ..@flag130, ..@flag131, ..@flag132, ..@flag133, ..@flag134, ..@flag135
1913    dd ..@flag136, ..@flag137, ..@flag138, ..@flag139, ..@flag140, ..@flag141, ..@flag142, ..@flag143
1914    dd ..@flag144, ..@flag145, ..@flag146, ..@flag147, ..@flag148, ..@flag149, ..@flag150, ..@flag151
1915    dd ..@flag152, ..@flag153, ..@flag154, ..@flag155, ..@flag156, ..@flag157, ..@flag158, ..@flag159
1916    dd ..@flag160, ..@flag161, ..@flag162, ..@flag163, ..@flag164, ..@flag165, ..@flag166, ..@flag167
1917    dd ..@flag168, ..@flag169, ..@flag170, ..@flag171, ..@flag172, ..@flag173, ..@flag174, ..@flag175
1918    dd ..@flag176, ..@flag177, ..@flag178, ..@flag179, ..@flag180, ..@flag181, ..@flag182, ..@flag183
1919    dd ..@flag184, ..@flag185, ..@flag186, ..@flag187, ..@flag188, ..@flag189, ..@flag190, ..@flag191
1920    dd ..@flag192, ..@flag193, ..@flag194, ..@flag195, ..@flag196, ..@flag197, ..@flag198, ..@flag199
1921    dd ..@flag200, ..@flag201, ..@flag202, ..@flag203, ..@flag204, ..@flag205, ..@flag206, ..@flag207
1922    dd ..@flag208, ..@flag209, ..@flag210, ..@flag211, ..@flag212, ..@flag213, ..@flag214, ..@flag215
1923    dd ..@flag216, ..@flag217, ..@flag218, ..@flag219, ..@flag220, ..@flag221, ..@flag222, ..@flag223
1924    dd ..@flag224, ..@flag225, ..@flag226, ..@flag227, ..@flag228, ..@flag229, ..@flag230, ..@flag231
1925    dd ..@flag232, ..@flag233, ..@flag234, ..@flag235, ..@flag236, ..@flag237, ..@flag238, ..@flag239
1926    dd ..@flag240, ..@flag241, ..@flag242, ..@flag243, ..@flag244, ..@flag245, ..@flag246, ..@flag247
1927    dd ..@flag248, ..@flag249, ..@flag250, ..@flag251, ..@flag252, ..@flag253, ..@flag254, ..@flag255
1928
1929FuncTable2
1930    dd ..@cross0, ..@cross1, ..@cross2, ..@crossN,
1931    dd ..@cross4, ..@crossN, ..@crossN, ..@crossN,
1932    dd ..@cross8, ..@crossN, ..@crossN, ..@crossN,
1933    dd ..@crossN, ..@crossN, ..@crossN, ..@crossN
1934
1935