1 ; VirtualDub - Video processing and capture application
2 ; Copyright (C) 1998-2001 Avery Lee
4 ; This program is free software; you can redistribute it and/or modify
5 ; it under the terms of the GNU General Public License as published by
6 ; the Free Software Foundation; either version 2 of the License, or
7 ; (at your option) any later version.
9 ; This program is distributed in the hope that it will be useful,
10 ; but WITHOUT ANY WARRANTY; without even the implied warranty of
11 ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 ; GNU General Public License for more details.
14 ; You should have received a copy of the GNU General Public License
15 ; along with this program; if not, write to the Free Software
16 ; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
23 extern
_YUV_Y_table: dword
24 extern
_YUV_U_table: dword
25 extern
_YUV_V_table: dword
26 extern
_YUV_clip_table: byte
27 extern
_YUV_clip_table16: byte
33 MMX_10w
dq 00010001000100010h
34 MMX_80w
dq 00080008000800080h
35 MMX_00FFw
dq 000FF00FF00FF00FFh
36 MMX_FF00w
dq 0FF00FF00FF00FF00h
37 MMX_Ublucoeff
dq 00081008100810081h
38 MMX_Vredcoeff
dq 00066006600660066h
39 MMX_Ugrncoeff
dq 0FFE7FFE7FFE7FFE7h
40 MMX_Vgrncoeff
dq 0FFCCFFCCFFCCFFCCh
41 MMX_Ycoeff
dq 0004A004A004A004Ah
42 MMX_rbmask
dq 07c1f7c1f7c1f7c1fh
43 MMX_grnmask
dq 003e003e003e003e0h
44 MMX_grnmask2
dq 000f800f800f800f8h
45 MMX_clip
dq 07c007c007c007c00h
47 MMX_Ucoeff0
dq 000810000FFE70081h
48 MMX_Ucoeff1
dq 0FFE700810000FFE7h
49 MMX_Ucoeff2
dq 00000FFE700810000h
50 MMX_Vcoeff0
dq 000000066FFCC0000h
51 MMX_Vcoeff1
dq 0FFCC00000066FFCCh
52 MMX_Vcoeff2
dq 00066FFCC00000066h
56 public _asm_YUVtoRGB32_row
57 public _asm_YUVtoRGB24_row
58 public _asm_YUVtoRGB16_row
59 public _asm_YUVtoRGB32_row_MMX
60 public _asm_YUVtoRGB24_row_MMX
61 public _asm_YUVtoRGB16_row_MMX
62 public _asm_YUVtoRGB32_row_ISSE
63 public _asm_YUVtoRGB24_row_ISSE
64 public _asm_YUVtoRGB16_row_ISSE
67 ; Pixel *ARGB1_pointer,
68 ; Pixel *ARGB2_pointer,
69 ; YUVPixel *Y1_pointer,
70 ; YUVPixel *Y2_pointer,
71 ; YUVPixel *U_pointer,
72 ; YUVPixel *V_pointer,
76 ARGB1_pointer
equ [esp+ 4+16]
77 ARGB2_pointer
equ [esp+ 8+16]
78 Y1_pointer
equ [esp+12+16]
79 Y2_pointer
equ [esp+16+16]
80 U_pointer
equ [esp+20+16]
81 V_pointer
equ [esp+24+16]
103 mov esi,U_pointer
;[C]
104 mov edi,V_pointer
;[C]
107 jmp short col_loop_start
110 mov ch,[_YUV_clip_table
+ebx-3f00h
] ;[4] edx = [0][0][red][green]
111 mov esi,U_pointer
;[C]
112 shl ecx,8 ;[4] edx = [0][red][green][0]
113 mov edi,V_pointer
;[C]
114 mov cl,[_YUV_clip_table
+edx-3f00h
] ;[4] edx = [0][r][g][b] !!
116 mov [eax+ebp*8-4],ecx ;[4]
119 mov cl,[esi + ebp] ;[C] eax = U
120 mov dl,[edi + ebp] ;[C] ebx = V
121 mov eax,Y1_pointer
;[1]
123 mov esi,[_YUV_U_table
+ ecx*4] ;[C] eax = [b impact][u-g impact]
124 mov ecx,[_YUV_V_table
+ edx*4] ;[C] ebx = [r impact][v-g impact]
126 mov bl,[eax + ebp*2] ;[1] ebx = Y1 value
127 shr esi,16 ;[C] eax = blue impact
128 add edi,ecx ;[C] edi = [junk][g impact]
129 mov ebx,[_YUV_Y_table
+ ebx*4] ;[1] ebx = Y impact
130 and ecx,0ffff0000h
;[C]
131 mov edx,ebx ;[1] edx = Y impact
132 add esi,ecx ;[C] eax = [r impact][b impact]
133 and edi,0000ffffh
;[C]
134 add ebx,esi ;[1] ebx = [red][blue]
135 mov ecx,ebx ;[1] edi = [red][blue]
136 and edx,0000ffffh
;[1] ecx = green
137 shr ebx,16 ;[1] ebx = red
138 and ecx,0000ffffh
;[1] edi = blue
139 mov dl,[_YUV_clip_table
+edx+edi-3f00h
] ;[1] edx = [0][0][junk][green]
140 mov eax,Y1_pointer
;[2]
141 mov dh,[_YUV_clip_table
+ebx-3f00h
] ;[1] edx = [0][0][red][green]
143 shl edx,8 ;[1] edx = [0][red][green][0]
144 mov bl,[eax + ebp*2 + 1] ;[2] ebx = Y1 value
145 mov eax,ARGB1_pointer
;[1]
146 mov dl,[_YUV_clip_table
+ecx-3f00h
] ;[1] edx = [0][r][g][b] !!
147 mov ebx,[_YUV_Y_table
+ ebx*4] ;[2] ebx = Y impact
148 mov ecx,0000ffffh
;[2]
151 add ebx,esi ;[2] ebx = [red][blue]
153 mov [eax+ebp*8],edx ;[1]
156 shr ebx,16 ;[2] ebx = red
157 mov eax,Y2_pointer
;[3]
159 and edx,0000ffffh
;[2]
160 mov cl,[_YUV_clip_table
+ecx+edi-3f00h
] ;[2] edx = [0][0][junk][green]
162 mov al,[eax + ebp*2] ;[3] ebx = Y1 value
163 mov ch,[_YUV_clip_table
+ebx-3f00h
] ;[2] edx = [0][0][red][green]
165 shl ecx,8 ;[2] edx = [0][red][green][0]
166 and eax,000000ffh
;[3]
168 mov cl,[_YUV_clip_table
+edx-3f00h
] ;[2] edx = [0][r][g][b] !!
169 mov edx,ARGB1_pointer
;[2]
171 mov ebx,[_YUV_Y_table
+ eax*4] ;[3] ebx = Y impact
174 and eax,ebx ;[3] edi = [red][blue]
175 add ebx,esi ;[3] ebx = [red][blue]
177 mov [edx+ebp*8+4],ecx ;[2]
180 shr ebx,16 ;[3] ebx = red
181 mov ecx,Y2_pointer
;[4]
183 and edx,0000ffffh
;[3] ecx = green
184 mov al,[_YUV_clip_table
+eax+edi-3f00h
] ;[3] edx = [0][0][junk][green]
186 mov cl,[ecx + ebp*2+1] ;[4] ebx = Y1 value
187 mov ah,[_YUV_clip_table
+ebx-3f00h
] ;[3] edx = [0][0][red][green]
189 shl eax,8 ;[3] edx = [0][red][green][0]
190 and ecx,000000ffh
;[4]
192 mov al,[_YUV_clip_table
+edx-3f00h
] ;[3] edx = [0][r][g][b] !!
193 mov edx,ARGB2_pointer
;[3]
195 mov ebx,[_YUV_Y_table
+ ecx*4] ;[4] ebx = Y impact
196 mov ecx,0000ffffh
;[4]
198 and ecx,ebx ;[4] ecx = [0][Y-impact]
199 add ebx,esi ;[4] ebx = [red][blue]
201 mov [edx+ebp*8],eax ;[3]
202 mov edx,ebx ;[4] edx = [red][blue]
204 shr ebx,16 ;[4] ebx = red
205 mov cl,[_YUV_clip_table
+ecx+edi-3f00h
] ;[4] edx = [0][0][junk][green]
207 and edx,0000ffffh
;[4] edx = blue
208 mov eax,ARGB2_pointer
;[4]
214 mov ch,[_YUV_clip_table
+ebx-3f00h
] ;[4] edx = [0][0][red][green]
215 shl ecx,8 ;[4] edx = [0][red][green][0]
216 mov cl,[_YUV_clip_table
+edx-3f00h
] ;[4] edx = [0][r][g][b] !!
217 mov [eax+ebp*8-4],ecx ;[4]
225 ;MMX_test dq 7060504030201000h
227 _asm_YUVtoRGB32_row_MMX:
238 add ARGB1_pointer
,ebx
239 add ARGB2_pointer
,ebx
250 mov eax,ARGB1_pointer
251 mov ebx,ARGB2_pointer
254 movd mm0
, dword ptr [esi+ebp] ;U (byte)
257 movd mm1
, dword ptr [edi+ebp] ;V (byte)
258 punpcklbw mm0
,mm7
;U (word)
261 punpcklbw mm1
,mm7
;V (word)
266 pmullw mm2
,MMX_Ugrncoeff
269 pmullw mm3
,MMX_Vgrncoeff
270 pmullw mm0
,MMX_Ublucoeff
271 pmullw mm1
,MMX_Vredcoeff
278 movq mm6
,[ecx+ebp*2] ;Y
281 pmullw mm6
,MMX_Ycoeff
283 paddw mm6
,mm0
;mm6: <B3><B2><B1><B0>
285 paddw mm4
,mm1
;mm4: <R3><R2><R1><R0>
286 paddw mm5
,mm2
;mm5: <G3><G2><G1><G0>
289 packuswb mm6
,mm6
;mm6: B3B2B1B0B3B2B1B0
291 packuswb mm4
,mm4
;mm4: R3R2R1R0R3R2R1R0
292 punpcklbw mm6
,mm4
;mm6: R3B3R2B2R1B1R0B0
293 packuswb mm5
,mm5
;mm5: G3G2G1G0G3G2G1G0
294 punpcklbw mm5
,mm5
;mm5: G3G3G2G2G1G1G0G0
296 punpcklbw mm6
,mm5
;mm6: G1R1G1B2G0R0G0B0
297 punpckhbw mm4
,mm5
;mm4: G3R3G3B3G2R2G2B2
299 movq mm7
,[ecx+ebp*2] ;Y
302 pmullw mm7
,MMX_Ycoeff
304 paddw mm7
,mm0
;mm7: final blue
306 paddw mm3
,mm1
;mm3: final red
307 paddw mm5
,mm2
;mm5: final green
310 packuswb mm7
,mm7
;mm7: B3B2B1B0B3B2B1B0
312 packuswb mm3
,mm3
;mm3: R3R2R1R0R3R2R1R0
313 punpcklbw mm7
,mm3
;mm7: R3B3R2B2R1B1R0B0
314 packuswb mm5
,mm5
;mm5: G3G2G1G0G3G2G1G0
315 punpcklbw mm5
,mm5
;mm5: G3G3G2G2G1G1G0G0
317 punpcklbw mm7
,mm5
;mm7: G1R1G1B2G0R0G0B0
318 punpckhbw mm3
,mm5
;mm3: G3R3G3B3G2R2G2B2
326 punpckldq mm5
,mm7
;P1:P0
327 punpckhdq mm6
,mm7
;P3:P2
329 punpckldq mm4
,mm3
;P5:P4
330 punpckhdq mm7
,mm3
;P7:P6
333 movq
[eax+ebp*8+8],mm6
334 movq
[eax+ebp*8+16],mm4
335 movq
[eax+ebp*8+24],mm7
337 movq mm6
,[edx+ebp*2] ;Y
340 pmullw mm6
,MMX_Ycoeff
342 paddw mm6
,mm0
;mm6: <B3><B2><B1><B0>
344 paddw mm4
,mm1
;mm4: <R3><R2><R1><R0>
345 paddw mm5
,mm2
;mm5: <G3><G2><G1><G0>
348 packuswb mm6
,mm6
;mm6: B3B2B1B0B3B2B1B0
350 packuswb mm4
,mm4
;mm4: R3R2R1R0R3R2R1R0
351 punpcklbw mm6
,mm4
;mm6: R3B3R2B2R1B1R0B0
352 packuswb mm5
,mm5
;mm5: G3G2G1G0G3G2G1G0
353 punpcklbw mm5
,mm5
;mm5: G3G3G2G2G1G1G0G0
355 punpcklbw mm6
,mm5
;mm6: G1R1G1B2G0R0G0B0
356 punpckhbw mm4
,mm5
;mm4: G3R3G3B3G2R2G2B2
358 movq mm7
,[edx+ebp*2] ;Y
361 pmullw mm7
,MMX_Ycoeff
363 paddw mm7
,mm0
;mm7: final blue
365 paddw mm3
,mm1
;mm3: final red
366 paddw mm5
,mm2
;mm5: final green
369 packuswb mm7
,mm7
;mm7: B3B2B1B0B3B2B1B0
371 packuswb mm3
,mm3
;mm3: R3R2R1R0R3R2R1R0
372 punpcklbw mm7
,mm3
;mm7: R3B3R2B2R1B1R0B0
373 packuswb mm5
,mm5
;mm5: G3G2G1G0G3G2G1G0
374 punpcklbw mm5
,mm5
;mm5: G3G3G2G2G1G1G0G0
376 punpcklbw mm7
,mm5
;mm7: G1R1G1B2G0R0G0B0
377 punpckhbw mm3
,mm5
;mm3: G3R3G3B3G2R2G2B2
385 punpckldq mm5
,mm7
;P1:P0
386 punpckhdq mm6
,mm7
;P3:P2
388 punpckldq mm4
,mm3
;P5:P4
389 punpckhdq mm7
,mm3
;P7:P6
391 movq
[ebx+ebp*8 ],mm5
392 movq
[ebx+ebp*8+ 8],mm6
394 movq
[ebx+ebp*8+16],mm4
395 movq
[ebx+ebp*8+24],mm7
407 ;**************************************************************************
409 ; asm_YUVtoRGB24_row(
410 ; Pixel *ARGB1_pointer,
411 ; Pixel *ARGB2_pointer,
412 ; YUVPixel *Y1_pointer,
413 ; YUVPixel *Y2_pointer,
414 ; YUVPixel *U_pointer,
415 ; YUVPixel *V_pointer,
419 ARGB1_pointer
equ [esp+ 4+16]
420 ARGB2_pointer
equ [esp+ 8+16]
421 Y1_pointer
equ [esp+12+16]
422 Y2_pointer
equ [esp+16+16]
423 U_pointer
equ [esp+20+16]
424 V_pointer
equ [esp+24+16]
425 count
equ [esp+28+16]
442 mov esi,U_pointer
;[C]
443 mov edi,V_pointer
;[C]
452 mov al,[esi + ebp] ;eax = U
453 mov bl,[edi + ebp] ;ebx = V
454 mov eax,[_YUV_U_table
+ eax*4] ;eax = [b impact][u-g impact]
455 mov edi,[_YUV_V_table
+ ebx*4] ;edi = [r impact][v-g impact]
458 mov esi,Y1_pointer
;[1]
463 shr eax,16 ;[C] eax = blue impact
464 mov bl,[esi + ebp*2] ;[1] ebx = Y1 value
466 and edi,0ffff0000h
;[C] edi = [r impact][0]
467 add ecx,edx ;[C] ecx = [junk][g impact]
469 add eax,edi ;[C] eax = [r impact][b impact]
470 mov ebx,[_YUV_Y_table
+ ebx*4] ;[1] ebx = Y impact
476 add ebx,eax ;[1] ebx = [red][blue]
478 add esi,ecx ;[1] edx = [junk][green]
479 mov edi,ebx ;[1] edi = [red][blue]
481 shr ebx,16 ;[1] ebx = red
482 and esi,0000ffffh
;[1] ecx = green
484 and edi,0000ffffh
;edi = blue
487 mov bh,[_YUV_clip_table
+ebx-3f00h
] ;bh = red
488 mov dl,[_YUV_clip_table
+esi-3f00h
] ;dl = green
490 mov esi,Y1_pointer
;[2]
491 mov bl,[_YUV_clip_table
+edi-3f00h
] ;bl = blue
493 mov edi,ARGB1_pointer
;[1]
501 mov bl,[esi + ebp*2 + 1] ;[2] ebx = Y1 value
504 mov ebx,[_YUV_Y_table
+ ebx*4] ;[2] ebx = Y impact
505 mov edi,0000ffffh
;[2]
507 add esi,ebx ;[2] edx = [junk][green]
508 add ebx,eax ;[2] ebx = [red][blue]
510 and edi,ebx ;[2] edi = blue
511 and esi,0000ffffh
;[2] ecx = green
513 shr ebx,16 ;ebx = red
516 mov bh,[_YUV_clip_table
+ebx-3f00h
] ;bh = red
517 mov dl,[_YUV_clip_table
+esi-3f00h
] ;dl = green
519 mov esi,Y2_pointer
;[3]
520 mov bl,[_YUV_clip_table
+edi-3f00h
] ;bl = blue
522 mov edi,ARGB1_pointer
;[2]
530 mov bl,[esi + ebp*2] ;[3] ebx = Y1 value
533 mov ebx,[_YUV_Y_table
+ ebx*4] ;[3] ebx = Y impact
534 mov esi,0000ffffh
;[3]
536 add edi,ebx ;[3] edx = [junk][green]
537 add ebx,eax ;[3] ebx = [red][blue]
539 and esi,ebx ;[3] edi = blue
540 and edi,0000ffffh
;ecx = green
542 shr ebx,16 ;ebx = red
545 mov dl,[_YUV_clip_table
+edi-3f00h
] ;dl = green
546 mov edi,ARGB2_pointer
;[3]
548 mov bh,[_YUV_clip_table
+ebx-3f00h
] ;bh = red
549 mov bl,[_YUV_clip_table
+esi-3f00h
] ;bl = blue
551 mov esi,Y2_pointer
;[4]
558 mov bl,[esi + ebp*2 + 1] ;[4] ebx = Y1 value
560 mov edi,0000ffffh
;[4]
562 mov ebx,[_YUV_Y_table
+ ebx*4] ;[4] ebx = Y impact
565 add ecx,ebx ;[4] ecx = [junk][green]
566 add ebx,eax ;ebx = [red][blue]
568 and edi,ebx ;edi = blue
569 and ecx,0000ffffh
;ecx = green
571 shr ebx,16 ;ebx = red
572 mov esi,ARGB2_pointer
574 mov bl,[_YUV_clip_table
+ebx-3f00h
] ;bh = red
575 mov dl,[_YUV_clip_table
+ecx-3f00h
] ;dl = green
577 mov al,[_YUV_clip_table
+edi-3f00h
] ;bl = blue
581 mov ecx,ARGB1_pointer
586 mov ARGB2_pointer
,esi
589 mov ARGB1_pointer
,ecx
600 _asm_YUVtoRGB24_row_MMX:
619 mov eax,ARGB1_pointer
620 mov ebx,ARGB2_pointer
623 movd mm0
, dword ptr [esi+ebp] ;U (byte)
626 movd mm1
, dword ptr [edi+ebp] ;V (byte)
627 punpcklbw mm0
,mm7
;U (word)
629 movd mm2
, dword ptr [ecx+ebp*2] ;Y low
630 punpcklbw mm1
,mm7
;V (word)
632 movd mm3
, dword ptr [edx+ebp*2] ;Y high
633 punpcklbw mm2
,mm7
;Y1 (word)
636 punpcklbw mm3
,mm7
;Y2 (word)
645 pmullw mm2
,MMX_Ycoeff
;[lazy]
647 pmullw mm3
,MMX_Ycoeff
;[lazy]
649 punpcklwd mm6
,mm6
;mm6 = U1U1U0U0
650 movq mm4
,mm2
;mm4 = Y3Y2Y1Y0 [high]
651 punpckldq mm6
,mm6
;mm6 = U0U0U0U0
652 movq mm5
,mm3
;mm3 = Y3Y2Y1Y0 [low]
653 punpcklwd mm7
,mm7
;mm7 = V1V1V0V0
654 punpckldq mm7
,mm7
;mm7 = V0V0V0V0
656 pmullw mm6
,MMX_Ucoeff0
657 punpcklwd mm4
,mm4
;mm4 = Y1Y1Y0Y0 [high]
658 pmullw mm7
,MMX_Vcoeff0
659 punpcklwd mm5
,mm5
;mm5 = Y1Y1Y0Y0 [low]
661 punpcklwd mm4
,mm2
;mm4 = Y1Y0Y0Y0
662 punpcklwd mm5
,mm3
;mm5 = Y1Y0Y0Y0
677 movd
dword ptr [eax+0],mm4
;[lazy write]
679 movd
dword ptr [ebx+0],mm5
;[lazy write]
682 punpcklwd mm4
,mm4
;mm6 = U1U1U0U0
683 movq mm6
,mm2
;mm4 = Y3Y2Y1Y0 [high]
684 punpcklwd mm5
,mm5
;mm6 = V1V1V0V0
685 movq mm7
,mm3
;mm3 = Y3Y2Y1Y0 [low]
687 pmullw mm4
,MMX_Ucoeff1
688 psrlq mm6
,16 ;mm4 = 00Y3Y2Y1 [high]
689 pmullw mm5
,MMX_Vcoeff1
690 psrlq mm7
,16 ;mm4 = 00Y3Y2Y1 [low]
692 punpcklwd mm6
,mm6
;mm4 = Y2Y2Y1Y1 [high]
693 punpcklwd mm7
,mm7
;mm5 = Y2Y2Y1Y1 [high]
708 movd
dword ptr [eax+4],mm6
;[lazy write]
710 movd
dword ptr [ebx+4],mm7
;[lazy write]
713 movq mm4
,mm2
;mm4 = Y3Y2Y1Y0 [high]
714 punpcklwd mm6
,mm6
;mm6 = U1U1U0U0
715 movq mm5
,mm3
;mm3 = Y3Y2Y1Y0 [low]
716 punpckhdq mm6
,mm6
;mm6 = U1U1U1U1
717 punpcklwd mm7
,mm7
;mm7 = V1V1V0V0
718 punpckhdq mm7
,mm7
;mm7 = V1V1V1V1
720 pmullw mm6
,MMX_Ucoeff2
721 punpckhwd mm2
,mm2
;mm2 = Y3Y3Y2Y2 [high]
722 pmullw mm7
,MMX_Vcoeff2
723 punpckhwd mm3
,mm3
;mm3 = Y3Y3Y2Y2 [low]
725 punpckhdq mm4
,mm2
;mm4 = Y3Y3Y3Y2 [high]
726 punpckhdq mm5
,mm3
;mm5 = Y3Y3Y3Y2 [low]
738 movd mm2
, dword ptr [ecx+ebp*2+4] ;Y low
739 packuswb mm4
,mm4
;[lazy]
741 movd mm3
, dword ptr [edx+ebp*2+4] ;Y high
742 packuswb mm5
,mm5
;[lazy]
744 movd
dword ptr [eax+8],mm4
;[lazy write]
747 movd
dword ptr [ebx+8],mm5
;[lazy write]
748 punpcklbw mm2
,mm7
;U (word)
752 punpcklbw mm3
,mm7
;V (word)
759 pmullw mm2
,MMX_Ycoeff
;[init]
762 pmullw mm3
,MMX_Ycoeff
;[init]
763 punpckhwd mm6
,mm6
;mm6 = U3U3U2U2
766 punpckldq mm6
,mm6
;mm6 = U2U2U2U2
767 movq mm4
,mm2
;mm4 = Y3Y2Y1Y0 [high]
768 punpckhwd mm7
,mm7
;mm7 = V3V3V2V2
769 movq mm5
,mm3
;mm3 = Y3Y2Y1Y0 [low]
770 punpckldq mm7
,mm7
;mm7 = V2V2V2V2
772 pmullw mm6
,MMX_Ucoeff0
773 punpcklwd mm4
,mm4
;mm4 = Y1Y1Y0Y0 [high]
774 pmullw mm7
,MMX_Vcoeff0
775 punpcklwd mm5
,mm5
;mm5 = Y1Y1Y0Y0 [low]
777 punpcklwd mm4
,mm2
;mm4 = Y1Y0Y0Y0
778 punpcklwd mm5
,mm3
;mm5 = Y1Y0Y0Y0
793 movd
dword ptr [eax+12],mm4
795 movd
dword ptr [ebx+12],mm5
798 punpckhwd mm6
,mm6
;mm6 = U3U3U2U2
799 movq mm4
,mm2
;mm4 = Y3Y2Y1Y0 [high]
800 punpckhwd mm7
,mm7
;mm6 = V3V3V2V2
801 movq mm5
,mm3
;mm3 = Y3Y2Y1Y0 [low]
803 pmullw mm6
,MMX_Ucoeff1
804 psrlq mm4
,16 ;mm4 = 00Y3Y2Y1 [high]
805 pmullw mm7
,MMX_Vcoeff1
806 psrlq mm5
,16 ;mm4 = 00Y3Y2Y1 [low]
808 punpcklwd mm4
,mm4
;mm4 = Y2Y2Y1Y1 [high]
809 punpcklwd mm5
,mm5
;mm5 = Y2Y2Y1Y1 [high]
824 movq mm6
,mm2
;mm4 = Y3Y2Y1Y0 [high]
825 punpckhwd mm0
,mm0
;mm6 = U3U3U2U2
827 movq mm7
,mm3
;mm3 = Y3Y2Y1Y0 [low]
828 punpckhdq mm0
,mm0
;mm6 = U3U3U3U3
830 movd
dword ptr [eax+16],mm4
;[lazy write]
831 punpckhwd mm1
,mm1
;mm7 = V3V3V2V2
833 movd
dword ptr [ebx+16],mm5
;[lazy write]
834 punpckhdq mm1
,mm1
;mm7 = V3V3V3V3
836 pmullw mm0
,MMX_Ucoeff2
837 punpckhwd mm2
,mm2
;mm2 = Y3Y3Y2Y2 [high]
838 pmullw mm1
,MMX_Vcoeff2
839 punpckhwd mm3
,mm3
;mm3 = Y3Y3Y2Y2 [low]
841 punpckhdq mm6
,mm2
;mm4 = Y3Y3Y3Y2 [high]
842 punpckhdq mm7
,mm3
;mm5 = Y3Y3Y3Y2 [low]
855 movd
dword ptr [eax+20],mm6
857 movd
dword ptr [ebx+20],mm7
871 ;**************************************************************************
883 add ARGB1_pointer
,ebx
884 add ARGB2_pointer
,ebx
892 mov esi,U_pointer
;[C]
893 mov edi,V_pointer
;[C]
902 mov al,[esi + ebp] ;eax = U
903 mov bl,[edi + ebp] ;ebx = V
904 mov eax,[_YUV_U_table
+ eax*4] ;eax = [b impact][u-g impact]
905 mov edi,[_YUV_V_table
+ ebx*4] ;edi = [r impact][v-g impact]
908 mov esi,Y1_pointer
;[1]
913 shr eax,16 ;[C] eax = blue impact
914 mov bl,[esi + ebp*2] ;[1] ebx = Y1 value
916 and edi,0ffff0000h
;[C] edi = [r impact][0]
917 add ecx,edx ;[C] ecx = [junk][g impact]
919 add eax,edi ;[C] eax = [r impact][b impact]
920 mov ebx,[_YUV_Y_table
+ ebx*4] ;[1] ebx = Y impact
926 add ebx,eax ;[1] ebx = [red][blue]
928 add esi,ecx ;[1] edx = [junk][green]
929 mov edi,ebx ;[1] edi = [red][blue]
931 shr ebx,16 ;[1] ebx = red
932 and esi,0000ffffh
;[1] ecx = green
934 and edi,0000ffffh
;edi = blue
937 mov bh,[_YUV_clip_table16
+ebx-3f00h
] ;bh = red
938 mov dl,[_YUV_clip_table16
+esi-3f00h
] ;dl = green
940 mov bl,[_YUV_clip_table16
+edi-3f00h
] ;bl = blue
943 ;565fix shl bh,2 ;[1]
945 mov edi,ARGB1_pointer
;[1]
947 ;565fix shl edx,5 ;[1]
949 mov esi,Y1_pointer
;[2]
954 mov [edi+ebp*4+0],dl ;[1]
955 mov bl,[esi + ebp*2 + 1] ;[2] ebx = Y1 value
957 mov [edi+ebp*4+1],dh ;[1]
960 mov ebx,[_YUV_Y_table
+ ebx*4] ;[2] ebx = Y impact
961 mov edi,0000ffffh
;[2]
963 add esi,ebx ;[2] edx = [junk][green]
964 add ebx,eax ;[2] ebx = [red][blue]
966 and edi,ebx ;[2] edi = blue
967 and esi,0000ffffh
;[2] ecx = green
969 shr ebx,16 ;ebx = red
972 mov bh,[_YUV_clip_table16
+ebx-3f00h
] ;bh = red
974 mov dl,[_YUV_clip_table16
+esi-3f00h
] ;dl = green
975 mov bl,[_YUV_clip_table16
+edi-3f00h
] ;bl = blue
977 ;565fix shl edx,5 ;[2]
979 mov edi,ARGB1_pointer
;[2]
981 ;565fix shl bh,2 ;[2]
983 mov esi,Y2_pointer
;[3]
988 mov [edi+ebp*4+2],dl ;[2]
989 mov bl,[esi + ebp*2] ;[3] ebx = Y1 value
991 mov [edi+ebp*4+3],dh ;[2]
994 mov ebx,[_YUV_Y_table
+ ebx*4] ;[3] ebx = Y impact
995 mov esi,0000ffffh
;[3]
997 add edi,ebx ;[3] edx = [junk][green]
998 add ebx,eax ;[3] ebx = [red][blue]
1000 and esi,ebx ;[3] edi = blue
1001 and edi,0000ffffh
;ecx = green
1003 shr ebx,16 ;ebx = red
1006 mov dl,[_YUV_clip_table16
+edi-3f00h
] ;dl = green
1007 mov edi,ARGB2_pointer
;[3]
1011 mov bh,[_YUV_clip_table16
+ebx-3f00h
] ;bh = red
1013 mov bl,[_YUV_clip_table16
+esi-3f00h
] ;bl = blue
1014 mov esi,Y2_pointer
;[4]
1016 ;565fix shl bh,2 ;[3]
1023 mov [edi+ebp*4+0],dl ;[3]
1024 mov bl,[esi + ebp*2 + 1] ;[4] ebx = Y1 value
1026 mov [edi+ebp*4+1],dh ;[3]
1027 mov edi,0000ffffh
;[4]
1029 mov ebx,[_YUV_Y_table
+ ebx*4] ;[4] ebx = Y impact
1032 add ecx,ebx ;[4] ecx = [junk][green]
1033 add ebx,eax ;ebx = [red][blue]
1035 and edi,ebx ;edi = blue
1036 and ecx,0000ffffh
;ecx = green
1038 shr ebx,16 ;ebx = red
1039 mov esi,ARGB2_pointer
1041 mov dl,[_YUV_clip_table16
+ecx-3f00h
] ;dl = green
1042 mov al,[_YUV_clip_table16
+edi-3f00h
] ;bl = blue
1046 mov ah,[_YUV_clip_table16
+ebx-3f00h
] ;bh = red
1053 mov [esi+ebp*4+2],al
1054 mov [esi+ebp*4+3],ah
1067 _asm_YUVtoRGB16_row_MMX:
1078 add ARGB1_pointer
,ebx
1079 add ARGB2_pointer
,ebx
1090 mov eax,ARGB1_pointer
1091 mov ebx,ARGB2_pointer
1094 movd mm0
, dword ptr [esi+ebp] ;[0 ] U (byte)
1097 movd mm1
, dword ptr [edi+ebp] ;[01 7] V (byte)
1098 punpcklbw mm0
,mm7
;[01 7] U (word)
1100 psubw mm0
,MMX_80w
;[01 7]
1101 punpcklbw mm1
,mm7
;[01 7] V (word)
1103 psubw mm1
,MMX_80w
;[01 ]
1104 movq mm2
,mm0
;[012 ]
1106 pmullw mm2
,MMX_Ugrncoeff
;[012 ]
1107 movq mm3
,mm1
;[0123 ]
1113 movq mm6
,[ecx+ebp*2] ;[0123 6 ] [1] Y
1116 pmullw mm3
,MMX_Vgrncoeff
;[0123 ]
1117 movq mm7
,mm6
;[012 67] [2] Y
1119 pmullw mm0
,MMX_Ublucoeff
;[0123 ]
1120 psrlw mm7
,8 ;[012 67] [2]
1122 pmullw mm1
,MMX_Vredcoeff
;[0123 ]
1125 pand mm6
,MMX_00FFw
;[012 67] [1]
1126 paddw mm2
,mm3
;[012 6 ] [C]
1128 psubw mm6
,MMX_10w
;[012 67] [1]
1130 pmullw mm6
,MMX_Ycoeff
;[012 67] [1]
1132 psubw mm7
,MMX_10w
;[012 67] [2]
1133 movq mm4
,mm6
;[012 4 67] [1]
1135 pmullw mm7
,MMX_Ycoeff
;[012 67] [2]
1136 movq mm5
,mm6
;[012 4567] [1]
1138 paddw mm6
,mm0
;[012 4 67] [1] mm6: <B3><B2><B1><B0>
1139 paddw mm4
,mm1
;[012 4567] [1] mm4: <R3><R2><R1><R0>
1141 paddw mm5
,mm2
;[012 4567] [1] mm5: <G3><G2><G1><G0>
1142 psraw mm4
,6 ;[012 4567] [1]
1144 movq mm3
,mm7
;[01234567] [2]
1145 psraw mm5
,4 ;[01234567] [1]
1147 paddw mm7
,mm0
;[01234567] [2] mm6: <B3><B2><B1><B0>
1148 psraw mm6
,6 ;[01234567] [1]
1151 packuswb mm6
,mm6
;[01234567] [1] mm6: B3B2B1B0B3B2B1B0
1153 psubusw mm5
,MMX_clip
1154 packuswb mm4
,mm4
;[01234567] [1] mm4: R3R2R1R0R3R2R1R0
1156 pand mm5
,MMX_grnmask
;[01234567] [1] mm7: <G3><G2><G1><G0>
1157 psrlq mm6
,2 ;[01234567] [1]
1159 punpcklbw mm6
,mm4
;[0123 567] [1] mm4: R3B3R2B2R1B1R0B0
1161 movq mm4
,[edx+ebp*2] ;[01234567] [3] Y
1162 psrlw mm6
,1 ;[01234567] [1]
1164 pand mm6
,MMX_rbmask
;[01234567] [1] mm6: <RB3><RB2><RB1><RB0>
1166 por mm6
,mm5
;[01234 67] [1] mm6: P6P4P2P0
1167 movq mm5
,mm3
;[01234567] [2]
1169 paddw mm3
,mm1
;[01234567] [2] mm4: <R3><R2><R1><R0>
1170 paddw mm5
,mm2
;[01234567] [2] mm5: <G3><G2><G1><G0>
1172 pand mm4
,MMX_00FFw
;[01234567] [3]
1173 psraw mm3
,6 ;[01234567] [2]
1175 psubw mm4
,MMX_10w
;[01234567] [3]
1176 psraw mm5
,4 ;[01234567] [2]
1178 pmullw mm4
,MMX_Ycoeff
;[01234567] [3]
1179 psraw mm7
,6 ;[01234567] [2]
1182 packuswb mm3
,mm3
;[01234567] [2] mm4: R3R2R1R0R3R2R1R0
1184 psubusw mm5
,MMX_clip
1185 packuswb mm7
,mm7
;[01234567] [2] mm6: B3B2B1B0B3B2B1B0
1187 pand mm5
,MMX_grnmask
;[012 4567] [2] mm7: <G3><G2><G1><G0>
1188 psrlq mm7
,2 ;[01234567] [2]
1190 punpcklbw mm7
,mm3
;[012 4567] [2] mm6: R3B3R2B2R1B1R0B0
1192 movq mm3
,[edx+ebp*2] ;[01234567] [4] Y
1193 psrlw mm7
,1 ;[01234567] [2]
1195 pand mm7
,MMX_rbmask
;[01234567] [2] mm6: <RB3><RB2><RB1><RB0>
1196 psrlw mm3
,8 ;[01234567] [4]
1198 por mm7
,mm5
;[01234567] [2] mm7: P7P5P3P1
1199 movq mm5
,mm6
;[01234567] [A]
1201 psubw mm3
,MMX_10w
;[01234567] [4]
1202 punpcklwd mm6
,mm7
;[01234567] [A] mm4: P3P2P1P0
1204 pmullw mm3
,MMX_Ycoeff
;[0123456 ] [4]
1205 punpckhwd mm5
,mm7
;[0123456 ] [A} mm5: P7P6P5P4
1207 movq
[eax+ebp*4 ],mm6
;[012345 ] [A]
1208 movq mm6
,mm4
;[0123456 ] [3]
1210 movq
[eax+ebp*4+ 8],mm5
;[0123456 ] [A]
1211 paddw mm6
,mm0
;[01234 6 ] [3] mm6: <B3><B2><B1><B0>
1213 movq mm5
,mm4
;[0123456 ] [3]
1214 paddw mm4
,mm1
;[0123456 ] [3] mm4: <R3><R2><R1><R0>
1216 paddw mm5
,mm2
;[0123456 ] [3] mm5: <G3><G2><G1><G0>
1217 psraw mm4
,6 ;[0123456 ] [3]
1219 movq mm7
,mm3
;[01234567] [4]
1220 psraw mm5
,4 ;[01234567] [3]
1222 paddw mm7
,mm0
;[01234567] [4] mm6: <B3><B2><B1><B0>
1223 psraw mm6
,6 ;[01234567] [3]
1225 movq mm0
,mm3
;[01234567] [4]
1226 packuswb mm4
,mm4
;[01234567] [3] mm4: R3R2R1R0R3R2R1R0
1229 packuswb mm6
,mm6
;[01 34567] [3] mm6: B3B2B1B0B3B2B1B0
1230 paddw mm3
,mm1
;[01234567] [4] mm4: <R3><R2><R1><R0>
1233 paddw mm0
,mm2
;[01 34567] [4] mm5: <G3><G2><G1><G0>
1236 punpcklbw mm6
,mm4
;[01 3 567] [3] mm6: B3B3B2B2B1B1B0B0
1238 psubusw mm5
,MMX_clip
1239 psrlw mm6
,1 ;[01 3 567] [3]
1241 pand mm6
,MMX_rbmask
;[01 3 567] [3] mm6: <B3><B2><B1><B0>
1242 psraw mm3
,6 ;[01 3 567] [4]
1244 pand mm5
,MMX_grnmask
;[01 3 567] [3] mm7: <G3><G2><G1><G0>
1245 psraw mm0
,4 ;[01 3 567] [4]
1247 por mm6
,mm5
;[01 3 67] [3] mm4: P6P4P2P0
1248 psraw mm7
,6 ;[01 3 67] [4]
1251 packuswb mm3
,mm3
;[01 3 67] [4] mm4: R3R2R1R0R3R2R1R0
1253 psubusw mm0
,MMX_clip
1254 packuswb mm7
,mm7
;[01 3 67] mm6: B3B2B1B0B3B2B1B0
1256 pand mm0
,MMX_grnmask
;[01 67] mm7: <G3><G2><G1><G0>
1259 punpcklbw mm7
,mm3
;[01 67] mm6: R3B3R2B2R1B1R0B0
1265 pand mm7
,MMX_rbmask
;[01 67] mm6: <B3><B2><B1><B0>
1267 por mm0
,mm7
;[01 67] mm0: P7P5P3P1
1269 punpcklwd mm6
,mm0
;[01 6 ] mm4: P3P2P1P0
1271 punpckhwd mm1
,mm0
;[ 1 6 ] mm5: P7P6P5P4
1272 movq
[ebx+ebp*4-16],mm6
1274 movq
[ebx+ebp*4- 8],mm1
1283 ;--------------------------------------------------------------------------
1285 _asm_YUVtoRGB32_row_ISSE:
1296 add ARGB1_pointer
,ebx
1297 add ARGB2_pointer
,ebx
1308 mov eax,ARGB1_pointer
1309 mov ebx,ARGB2_pointer
1312 prefetchnta
[esi+ebp+32]
1313 prefetchnta
[edi+ebp+32]
1314 prefetchnta
[ecx+ebp*2+32]
1315 prefetchnta
[edx+ebp*2+32]
1317 movd mm0
, dword ptr [esi+ebp] ;U (byte)
1320 movd mm1
, dword ptr [edi+ebp] ;V (byte)
1321 punpcklbw mm0
,mm7
;U (word)
1324 punpcklbw mm1
,mm7
;V (word)
1329 pmullw mm2
,MMX_Ugrncoeff
1332 pmullw mm3
,MMX_Vgrncoeff
1333 pmullw mm0
,MMX_Ublucoeff
1334 pmullw mm1
,MMX_Vredcoeff
1341 movq mm6
,[ecx+ebp*2] ;Y
1344 pmullw mm6
,MMX_Ycoeff
1346 paddw mm6
,mm0
;mm6: <B3><B2><B1><B0>
1348 paddw mm4
,mm1
;mm4: <R3><R2><R1><R0>
1349 paddw mm5
,mm2
;mm5: <G3><G2><G1><G0>
1352 packuswb mm6
,mm6
;mm6: B3B2B1B0B3B2B1B0
1354 packuswb mm4
,mm4
;mm4: R3R2R1R0R3R2R1R0
1355 punpcklbw mm6
,mm4
;mm6: R3B3R2B2R1B1R0B0
1356 packuswb mm5
,mm5
;mm5: G3G2G1G0G3G2G1G0
1357 punpcklbw mm5
,mm5
;mm5: G3G3G2G2G1G1G0G0
1359 punpcklbw mm6
,mm5
;mm6: G1R1G1B2G0R0G0B0
1360 punpckhbw mm4
,mm5
;mm4: G3R3G3B3G2R2G2B2
1362 movq mm7
,[ecx+ebp*2] ;Y
1365 pmullw mm7
,MMX_Ycoeff
1367 paddw mm7
,mm0
;mm7: final blue
1369 paddw mm3
,mm1
;mm3: final red
1370 paddw mm5
,mm2
;mm5: final green
1373 packuswb mm7
,mm7
;mm7: B3B2B1B0B3B2B1B0
1375 packuswb mm3
,mm3
;mm3: R3R2R1R0R3R2R1R0
1376 punpcklbw mm7
,mm3
;mm7: R3B3R2B2R1B1R0B0
1377 packuswb mm5
,mm5
;mm5: G3G2G1G0G3G2G1G0
1378 punpcklbw mm5
,mm5
;mm5: G3G3G2G2G1G1G0G0
1380 punpcklbw mm7
,mm5
;mm7: G1R1G1B2G0R0G0B0
1381 punpckhbw mm3
,mm5
;mm3: G3R3G3B3G2R2G2B2
1389 punpckldq mm5
,mm7
;P1:P0
1390 punpckhdq mm6
,mm7
;P3:P2
1392 punpckldq mm4
,mm3
;P5:P4
1393 punpckhdq mm7
,mm3
;P7:P6
1395 movntq
[eax+ebp*8],mm5
1396 movntq
[eax+ebp*8+8],mm6
1397 movntq
[eax+ebp*8+16],mm4
1398 movntq
[eax+ebp*8+24],mm7
1400 movq mm6
,[edx+ebp*2] ;Y
1403 pmullw mm6
,MMX_Ycoeff
1405 paddw mm6
,mm0
;mm6: <B3><B2><B1><B0>
1407 paddw mm4
,mm1
;mm4: <R3><R2><R1><R0>
1408 paddw mm5
,mm2
;mm5: <G3><G2><G1><G0>
1411 packuswb mm6
,mm6
;mm6: B3B2B1B0B3B2B1B0
1413 packuswb mm4
,mm4
;mm4: R3R2R1R0R3R2R1R0
1414 punpcklbw mm6
,mm4
;mm6: R3B3R2B2R1B1R0B0
1415 packuswb mm5
,mm5
;mm5: G3G2G1G0G3G2G1G0
1416 punpcklbw mm5
,mm5
;mm5: G3G3G2G2G1G1G0G0
1418 punpcklbw mm6
,mm5
;mm6: G1R1G1B2G0R0G0B0
1419 punpckhbw mm4
,mm5
;mm4: G3R3G3B3G2R2G2B2
1421 movq mm7
,[edx+ebp*2] ;Y
1424 pmullw mm7
,MMX_Ycoeff
1426 paddw mm7
,mm0
;mm7: final blue
1428 paddw mm3
,mm1
;mm3: final red
1429 paddw mm5
,mm2
;mm5: final green
1432 packuswb mm7
,mm7
;mm7: B3B2B1B0B3B2B1B0
1434 packuswb mm3
,mm3
;mm3: R3R2R1R0R3R2R1R0
1435 punpcklbw mm7
,mm3
;mm7: R3B3R2B2R1B1R0B0
1436 packuswb mm5
,mm5
;mm5: G3G2G1G0G3G2G1G0
1437 punpcklbw mm5
,mm5
;mm5: G3G3G2G2G1G1G0G0
1439 punpcklbw mm7
,mm5
;mm7: G1R1G1B2G0R0G0B0
1440 punpckhbw mm3
,mm5
;mm3: G3R3G3B3G2R2G2B2
1448 punpckldq mm5
,mm7
;P1:P0
1449 punpckhdq mm6
,mm7
;P3:P2
1451 punpckldq mm4
,mm3
;P5:P4
1452 punpckhdq mm7
,mm3
;P7:P6
1454 movntq
[ebx+ebp*8 ],mm5
1455 movntq
[ebx+ebp*8+ 8],mm6
1457 movntq
[ebx+ebp*8+16],mm4
1458 movntq
[ebx+ebp*8+24],mm7
1470 _asm_YUVtoRGB24_row_ISSE:
1489 mov eax,ARGB1_pointer
1490 mov ebx,ARGB2_pointer
1495 movd
dword ptr [esp+16],mm0
1498 prefetchnta
[esi+ebp+32]
1499 prefetchnta
[edi+ebp+32]
1500 prefetchnta
[ecx+ebp*2+32]
1501 prefetchnta
[edx+ebp*2+32]
1503 movd mm0
, dword ptr [esi+ebp] ;U (byte)
1506 movd mm1
, dword ptr [edi+ebp] ;V (byte)
1507 punpcklbw mm0
,mm7
;U (word)
1509 movd mm2
, dword ptr [ecx+ebp*2] ;Y low
1510 punpcklbw mm1
,mm7
;V (word)
1512 movd mm3
, dword ptr [edx+ebp*2] ;Y high
1513 punpcklbw mm2
,mm7
;Y1 (word)
1516 punpcklbw mm3
,mm7
;Y2 (word)
1528 pmullw mm2
,MMX_Ycoeff
;[lazy]
1529 pmullw mm3
,MMX_Ycoeff
;[lazy]
1531 pshufw mm6
,mm0
,00000000b ;mm6 = U0U0U0U0
1532 pshufw mm7
,mm1
,00000000b ;mm7 = V0V0V0V0
1534 pmullw mm6
,MMX_Ucoeff0
1535 pshufw mm4
,mm2
,01000000b ;mm4 = Y1Y0Y0Y0 [high]
1536 pmullw mm7
,MMX_Vcoeff0
1537 pshufw mm5
,mm3
,01000000b ;mm4 = Y1Y0Y0Y0 [low]
1549 pshufw mm6
,[esp+0],01010000b ;mm6 = U1U1U0U0
1550 pshufw mm7
,[esp+8],01010000b ;mm7 = V1V1V0V0
1552 pmullw mm6
,MMX_Ucoeff1
1553 pshufw mm0
,mm2
,10100101b ;mm0 = Y2Y2Y1Y1 [high]
1554 pmullw mm7
,MMX_Vcoeff1
1555 pshufw mm1
,mm3
,10100101b ;mm1 = Y2Y2Y1Y1 [low]
1570 pshufw mm6
,[esp+0],01010101b ;mm6 = U1U1U1U1
1571 pshufw mm7
,[esp+8],01010101b ;mm7 = V1V1V1V1
1573 movntq
[eax],mm4
;[lazy write]
1574 movntq
[ebx],mm5
;[lazy write]
1576 pmullw mm6
,MMX_Ucoeff2
1577 pshufw mm4
,mm2
,11111110b ;mm4 = Y3Y3Y3Y2 [high]
1578 pmullw mm7
,MMX_Vcoeff2
1579 pshufw mm5
,mm3
,11111110b ;mm5 = Y3Y3Y3Y2 [low]
1591 movd mm2
, dword ptr [ecx+ebp*2+4] ;Y low
1594 movd mm3
, dword ptr [edx+ebp*2+4] ;Y high
1595 punpcklbw mm2
,mm7
;U (word)
1598 punpcklbw mm3
,mm7
;V (word)
1605 pmullw mm2
,MMX_Ycoeff
;[init]
1606 pmullw mm3
,MMX_Ycoeff
;[init]
1608 pshufw mm6
,[esp+0],10101010b ;mm6 = U2U2U2U2
1609 pshufw mm7
,[esp+8],10101010b ;mm7 = V2V2V2V2
1611 pmullw mm6
,MMX_Ucoeff0
1612 pshufw mm0
,mm2
,01000000b ;mm0 = Y1Y0Y0Y0 [high]
1613 pmullw mm7
,MMX_Vcoeff0
1614 pshufw mm1
,mm3
,01000000b ;mm1 = Y1Y0Y0Y0 [low]
1629 pshufw mm6
,[esp+0],11111010b ;mm6 = U3U3U2U2
1630 pshufw mm7
,[esp+8],11111010b ;mm7 = V3V3V2V2
1635 pmullw mm6
,MMX_Ucoeff1
1636 pshufw mm4
,mm2
,10100101b ;mm4 = Y2Y2Y1Y1 [high]
1637 pmullw mm7
,MMX_Vcoeff1
1638 pshufw mm5
,mm3
,10100101b ;mm5 = Y2Y2Y1Y1 [low]
1650 pshufw mm0
,[esp+0],11111111b ;mm6 = U3U3U3U3
1651 pshufw mm1
,[esp+8],11111111b ;mm7 = V3V3V3V3
1653 pmullw mm0
,MMX_Ucoeff2
1654 pshufw mm2
,mm2
,11111110b ;mm6 = Y3Y3Y3Y2 [high]
1655 pmullw mm1
,MMX_Vcoeff2
1656 pshufw mm3
,mm3
,11111110b ;mm7 = Y3Y3Y3Y2 [low]
1687 _asm_YUVtoRGB16_row_ISSE:
1698 add ARGB1_pointer
,ebx
1699 add ARGB2_pointer
,ebx
1710 mov eax,ARGB1_pointer
1711 mov ebx,ARGB2_pointer
1714 prefetchnta
[esi+ebp+32]
1715 prefetchnta
[edi+ebp+32]
1717 movd mm0
, dword ptr [esi+ebp] ;[0 ] U (byte)
1720 movd mm1
, dword ptr [edi+ebp] ;[01 7] V (byte)
1721 punpcklbw mm0
,mm7
;[01 7] U (word)
1723 psubw mm0
,MMX_80w
;[01 7]
1724 punpcklbw mm1
,mm7
;[01 7] V (word)
1726 psubw mm1
,MMX_80w
;[01 ]
1727 movq mm2
,mm0
;[012 ]
1729 pmullw mm2
,MMX_Ugrncoeff
;[012 ]
1730 movq mm3
,mm1
;[0123 ]
1736 prefetchnta
[ecx+ebp*2+32]
1737 prefetchnta
[edx+ebp*2+32]
1739 movq mm6
,[ecx+ebp*2] ;[0123 6 ] [1] Y
1742 pmullw mm3
,MMX_Vgrncoeff
;[0123 ]
1743 movq mm7
,mm6
;[012 67] [2] Y
1745 pmullw mm0
,MMX_Ublucoeff
;[0123 ]
1746 psrlw mm7
,8 ;[012 67] [2]
1748 pmullw mm1
,MMX_Vredcoeff
;[0123 ]
1751 pand mm6
,MMX_00FFw
;[012 67] [1]
1752 paddw mm2
,mm3
;[012 6 ] [C]
1754 psubw mm6
,MMX_10w
;[012 67] [1]
1756 pmullw mm6
,MMX_Ycoeff
;[012 67] [1]
1758 psubw mm7
,MMX_10w
;[012 67] [2]
1759 movq mm4
,mm6
;[012 4 67] [1]
1761 pmullw mm7
,MMX_Ycoeff
;[012 67] [2]
1762 movq mm5
,mm6
;[012 4567] [1]
1764 paddw mm6
,mm0
;[012 4 67] [1] mm6: <B3><B2><B1><B0>
1765 paddw mm4
,mm1
;[012 4567] [1] mm4: <R3><R2><R1><R0>
1767 paddw mm5
,mm2
;[012 4567] [1] mm5: <G3><G2><G1><G0>
1768 psraw mm4
,6 ;[012 4567] [1]
1770 movq mm3
,mm7
;[01234567] [2]
1771 psraw mm5
,4 ;[01234567] [1]
1773 paddw mm7
,mm0
;[01234567] [2] mm6: <B3><B2><B1><B0>
1774 psraw mm6
,6 ;[01234567] [1]
1777 packuswb mm6
,mm6
;[01234567] [1] mm6: B3B2B1B0B3B2B1B0
1779 psubusw mm5
,MMX_clip
1780 packuswb mm4
,mm4
;[01234567] [1] mm4: R3R2R1R0R3R2R1R0
1782 pand mm5
,MMX_grnmask
;[01234567] [1] mm7: <G3><G2><G1><G0>
1783 psrlq mm6
,2 ;[01234567] [1]
1785 punpcklbw mm6
,mm4
;[0123 567] [1] mm4: R3B3R2B2R1B1R0B0
1787 movq mm4
,[edx+ebp*2] ;[01234567] [3] Y
1788 psrlw mm6
,1 ;[01234567] [1]
1790 pand mm6
,MMX_rbmask
;[01234567] [1] mm6: <RB3><RB2><RB1><RB0>
1792 por mm6
,mm5
;[01234 67] [1] mm6: P6P4P2P0
1793 movq mm5
,mm3
;[01234567] [2]
1795 paddw mm3
,mm1
;[01234567] [2] mm4: <R3><R2><R1><R0>
1796 paddw mm5
,mm2
;[01234567] [2] mm5: <G3><G2><G1><G0>
1798 pand mm4
,MMX_00FFw
;[01234567] [3]
1799 psraw mm3
,6 ;[01234567] [2]
1801 psubw mm4
,MMX_10w
;[01234567] [3]
1802 psraw mm5
,4 ;[01234567] [2]
1804 pmullw mm4
,MMX_Ycoeff
;[01234567] [3]
1805 psraw mm7
,6 ;[01234567] [2]
1808 packuswb mm3
,mm3
;[01234567] [2] mm4: R3R2R1R0R3R2R1R0
1810 psubusw mm5
,MMX_clip
1811 packuswb mm7
,mm7
;[01234567] [2] mm6: B3B2B1B0B3B2B1B0
1813 pand mm5
,MMX_grnmask
;[012 4567] [2] mm7: <G3><G2><G1><G0>
1814 psrlq mm7
,2 ;[01234567] [2]
1816 punpcklbw mm7
,mm3
;[012 4567] [2] mm6: R3B3R2B2R1B1R0B0
1818 movq mm3
,[edx+ebp*2] ;[01234567] [4] Y
1819 psrlw mm7
,1 ;[01234567] [2]
1821 pand mm7
,MMX_rbmask
;[01234567] [2] mm6: <RB3><RB2><RB1><RB0>
1822 psrlw mm3
,8 ;[01234567] [4]
1824 por mm7
,mm5
;[01234567] [2] mm7: P7P5P3P1
1825 movq mm5
,mm6
;[01234567] [A]
1827 psubw mm3
,MMX_10w
;[01234567] [4]
1828 punpcklwd mm6
,mm7
;[01234567] [A] mm4: P3P2P1P0
1830 pmullw mm3
,MMX_Ycoeff
;[0123456 ] [4]
1831 punpckhwd mm5
,mm7
;[0123456 ] [A} mm5: P7P6P5P4
1833 movntq
[eax+ebp*4 ],mm6
;[012345 ] [A]
1834 movq mm6
,mm4
;[0123456 ] [3]
1836 movntq
[eax+ebp*4+ 8],mm5
;[0123456 ] [A]
1837 paddw mm6
,mm0
;[01234 6 ] [3] mm6: <B3><B2><B1><B0>
1839 movq mm5
,mm4
;[0123456 ] [3]
1840 paddw mm4
,mm1
;[0123456 ] [3] mm4: <R3><R2><R1><R0>
1842 paddw mm5
,mm2
;[0123456 ] [3] mm5: <G3><G2><G1><G0>
1843 psraw mm4
,6 ;[0123456 ] [3]
1845 movq mm7
,mm3
;[01234567] [4]
1846 psraw mm5
,4 ;[01234567] [3]
1848 paddw mm7
,mm0
;[01234567] [4] mm6: <B3><B2><B1><B0>
1849 psraw mm6
,6 ;[01234567] [3]
1851 movq mm0
,mm3
;[01234567] [4]
1852 packuswb mm4
,mm4
;[01234567] [3] mm4: R3R2R1R0R3R2R1R0
1855 packuswb mm6
,mm6
;[01 34567] [3] mm6: B3B2B1B0B3B2B1B0
1856 paddw mm3
,mm1
;[01234567] [4] mm4: <R3><R2><R1><R0>
1859 paddw mm0
,mm2
;[01 34567] [4] mm5: <G3><G2><G1><G0>
1862 punpcklbw mm6
,mm4
;[01 3 567] [3] mm6: B3B3B2B2B1B1B0B0
1864 psubusw mm5
,MMX_clip
1865 psrlw mm6
,1 ;[01 3 567] [3]
1867 pand mm6
,MMX_rbmask
;[01 3 567] [3] mm6: <B3><B2><B1><B0>
1868 psraw mm3
,6 ;[01 3 567] [4]
1870 pand mm5
,MMX_grnmask
;[01 3 567] [3] mm7: <G3><G2><G1><G0>
1871 psraw mm0
,4 ;[01 3 567] [4]
1873 por mm6
,mm5
;[01 3 67] [3] mm4: P6P4P2P0
1874 psraw mm7
,6 ;[01 3 67] [4]
1877 packuswb mm3
,mm3
;[01 3 67] [4] mm4: R3R2R1R0R3R2R1R0
1879 psubusw mm0
,MMX_clip
1880 packuswb mm7
,mm7
;[01 3 67] mm6: B3B2B1B0B3B2B1B0
1882 pand mm0
,MMX_grnmask
;[01 67] mm7: <G3><G2><G1><G0>
1885 punpcklbw mm7
,mm3
;[01 67] mm6: R3B3R2B2R1B1R0B0
1891 pand mm7
,MMX_rbmask
;[01 67] mm6: <B3><B2><B1><B0>
1893 por mm0
,mm7
;[01 67] mm0: P7P5P3P1
1895 punpcklwd mm6
,mm0
;[01 6 ] mm4: P3P2P1P0
1897 punpckhwd mm1
,mm0
;[ 1 6 ] mm5: P7P6P5P4
1898 movntq
[ebx+ebp*4-16],mm6
1900 movntq
[ebx+ebp*4- 8],mm1