1 |
;/************************************************************************** |
;/**************************************************************************** |
2 |
; * |
; * |
3 |
; * XVID MPEG-4 VIDEO CODEC |
; * XVID MPEG-4 VIDEO CODEC |
4 |
; * colorspace |
; * - MMX and XMM YUYV<->YV12 conversion - |
5 |
; * |
; * |
6 |
; * This program is free software; you can redistribute it and/or modify |
; * Copyright(C) 2002 Peter Ross <pross@xvid.org> |
7 |
; * it under the terms of the GNU General Public License as published by |
; * |
8 |
|
; * This program is free software; you can redistribute it and/or modify it |
9 |
|
; * under the terms of the GNU General Public License as published by |
10 |
; * the Free Software Foundation; either version 2 of the License, or |
; * the Free Software Foundation; either version 2 of the License, or |
11 |
; * (at your option) any later version. |
; * (at your option) any later version. |
12 |
; * |
; * |
17 |
; * |
; * |
18 |
; * You should have received a copy of the GNU General Public License |
; * You should have received a copy of the GNU General Public License |
19 |
; * along with this program; if not, write to the Free Software |
; * along with this program; if not, write to the Free Software |
20 |
; * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
; * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|
; * |
|
|
; *************************************************************************/ |
|
|
|
|
|
;/************************************************************************** |
|
|
; * |
|
|
; * History: |
|
21 |
; * |
; * |
22 |
; * 10.10.2001 initial version; (c)2002 peter ross <pross@xvid.org> |
; * $Id: colorspace_yuyv_mmx.asm,v 1.3 2004-03-22 22:36:24 edgomez Exp $ |
23 |
; * |
; * |
24 |
; *************************************************************************/ |
; ***************************************************************************/ |
25 |
|
|
26 |
|
BITS 32 |
|
bits 32 |
|
27 |
|
|
28 |
%macro cglobal 1 |
%macro cglobal 1 |
29 |
%ifdef PREFIX |
%ifdef PREFIX |
34 |
%endif |
%endif |
35 |
%endmacro |
%endmacro |
36 |
|
|
37 |
|
;============================================================================= |
38 |
|
; Read only data |
39 |
|
;============================================================================= |
40 |
|
|
41 |
section .data |
%ifdef FORMAT_COFF |
42 |
align 16 |
SECTION .rodata data |
43 |
|
%else |
44 |
|
SECTION .rodata data align=16 |
45 |
|
%endif |
46 |
|
|
47 |
;=========================================================================== |
;----------------------------------------------------------------------------- |
48 |
; yuyv/uyvy mask for extracting yuv components |
; yuyv/uyvy mask for extracting yuv components |
49 |
;=========================================================================== |
;----------------------------------------------------------------------------- |
50 |
; y u y v y u y v |
; y u y v y u y v |
|
yuyv_mask db 0xff, 0, 0xff, 0, 0xff, 0, 0xff, 0 |
|
|
mmx_one dw 1, 1, 1, 1 |
|
|
|
|
|
|
|
|
|
|
|
section .text |
|
|
|
|
|
%include "colorspace_mmx.inc" |
|
51 |
|
|
52 |
|
ALIGN 16 |
53 |
|
yuyv_mask: db 0xff, 0, 0xff, 0, 0xff, 0, 0xff, 0 |
54 |
|
mmx_one: dw 1, 1, 1, 1 |
55 |
|
|
56 |
|
;============================================================================= |
57 |
|
; helper macros used with colorspace_mmx.inc |
58 |
|
;============================================================================= |
59 |
|
|
60 |
;==================================================================== |
;----------------------------------------------------------------------------- |
61 |
; YUYV_TO_YV12( TYPE, PAVG ) |
; YUYV_TO_YV12( TYPE, PAVG ) |
62 |
; |
; |
63 |
; TYPE 0=yuyv, 1=uyvy |
; TYPE 0=yuyv, 1=uyvy |
64 |
; PAVG 0=mmx, pavgusb=3dnow, pavgb=xmm |
; PAVG 0=mmx, pavgusb=3dnow, pavgb=xmm |
65 |
; |
; |
66 |
; bytes=2, pixels = 8, vpixels=2 |
; bytes=2, pixels = 8, vpixels=2 |
67 |
;==================================================================== |
;----------------------------------------------------------------------------- |
68 |
|
|
69 |
%macro YUYV_TO_YV12_INIT 2 |
%macro YUYV_TO_YV12_INIT 2 |
70 |
movq mm7, [yuyv_mask] |
movq mm7, [yuyv_mask] |
71 |
%endmacro |
%endmacro |
159 |
movd [ebx],mm5 |
movd [ebx],mm5 |
160 |
movd [ecx],mm4 |
movd [ecx],mm4 |
161 |
%endmacro |
%endmacro |
|
;==================================================================== |
|
162 |
|
|
163 |
|
;----------------------------------------------------------------------------- |
|
;------------------------------------------------------------------------------ |
|
164 |
; YV12_TO_YUYV( TYPE ) |
; YV12_TO_YUYV( TYPE ) |
165 |
; |
; |
166 |
; TYPE 0=yuyv, 1=uyvy |
; TYPE 0=yuyv, 1=uyvy |
167 |
; |
; |
168 |
; bytes=2, pixels = 8, vpixels=2 |
; bytes=2, pixels = 8, vpixels=2 |
169 |
;------------------------------------------------------------------------------ |
;----------------------------------------------------------------------------- |
170 |
|
|
171 |
%macro YV12_TO_YUYV_INIT 2 |
%macro YV12_TO_YUYV_INIT 2 |
172 |
%endmacro |
%endmacro |
173 |
|
|
204 |
movq [edi+edx+8], mm7 |
movq [edi+edx+8], mm7 |
205 |
%endif |
%endif |
206 |
%endmacro |
%endmacro |
|
;------------------------------------------------------------------------------ |
|
|
|
|
207 |
|
|
208 |
;------------------------------------------------------------------------------ |
;------------------------------------------------------------------------------ |
209 |
; YV12_TO_YUYVI( TYPE ) |
; YV12_TO_YUYVI( TYPE ) |
212 |
; |
; |
213 |
; bytes=2, pixels = 8, vpixels=4 |
; bytes=2, pixels = 8, vpixels=4 |
214 |
;------------------------------------------------------------------------------ |
;------------------------------------------------------------------------------ |
215 |
|
|
216 |
%macro YV12_TO_YUYVI_INIT 2 |
%macro YV12_TO_YUYVI_INIT 2 |
217 |
%endmacro |
%endmacro |
218 |
|
|
294 |
pop esi |
pop esi |
295 |
%endif |
%endif |
296 |
%endmacro |
%endmacro |
|
;------------------------------------------------------------------------------ |
|
297 |
|
|
298 |
|
;============================================================================= |
299 |
|
; Code |
300 |
|
;============================================================================= |
301 |
|
|
302 |
|
SECTION .text |
303 |
|
|
304 |
|
%include "colorspace_mmx.inc" |
305 |
|
|
306 |
; input |
; input |
307 |
|
|