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$ |
23 |
; * |
; * |
24 |
; *************************************************************************/ |
; ***************************************************************************/ |
25 |
|
|
26 |
|
BITS 32 |
|
bits 32 |
|
27 |
|
|
28 |
%macro cglobal 1 |
%macro cglobal 1 |
29 |
%ifdef PREFIX |
%ifdef PREFIX |
30 |
|
%ifdef MARK_FUNCS |
31 |
|
global _%1:function %1.endfunc-%1 |
32 |
|
%define %1 _%1:function %1.endfunc-%1 |
33 |
|
%else |
34 |
global _%1 |
global _%1 |
35 |
%define %1 _%1 |
%define %1 _%1 |
36 |
|
%endif |
37 |
|
%else |
38 |
|
%ifdef MARK_FUNCS |
39 |
|
global %1:function %1.endfunc-%1 |
40 |
%else |
%else |
41 |
global %1 |
global %1 |
42 |
%endif |
%endif |
43 |
|
%endif |
44 |
%endmacro |
%endmacro |
45 |
|
|
46 |
|
;============================================================================= |
47 |
|
; Read only data |
48 |
|
;============================================================================= |
49 |
|
|
50 |
section .data |
%ifdef FORMAT_COFF |
51 |
align 16 |
SECTION .rodata |
52 |
|
%else |
53 |
|
SECTION .rodata align=16 |
54 |
|
%endif |
55 |
|
|
56 |
;=========================================================================== |
;----------------------------------------------------------------------------- |
57 |
; yuyv/uyvy mask for extracting yuv components |
; yuyv/uyvy mask for extracting yuv components |
58 |
;=========================================================================== |
;----------------------------------------------------------------------------- |
59 |
; 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 |
|
|
|
|
|
|
|
60 |
|
|
61 |
section .text |
ALIGN 16 |
62 |
|
yuyv_mask: db 0xff, 0, 0xff, 0, 0xff, 0, 0xff, 0 |
63 |
|
mmx_one: dw 1, 1, 1, 1 |
64 |
|
|
65 |
|
;============================================================================= |
66 |
|
; helper macros used with colorspace_mmx.inc |
67 |
|
;============================================================================= |
68 |
|
|
69 |
%include "colorspace_mmx.inc" |
;----------------------------------------------------------------------------- |
|
|
|
|
|
|
|
;==================================================================== |
|
70 |
; YUYV_TO_YV12( TYPE, PAVG ) |
; YUYV_TO_YV12( TYPE, PAVG ) |
71 |
; |
; |
72 |
; TYPE 0=yuyv, 1=uyvy |
; TYPE 0=yuyv, 1=uyvy |
73 |
; PAVG 0=mmx, pavgusb=3dnow, pavgb=xmm |
; PAVG 0=mmx, pavgusb=3dnow, pavgb=xmm |
74 |
; |
; |
75 |
; bytes=2, pixels = 8, vpixels=2 |
; bytes=2, pixels = 8, vpixels=2 |
76 |
;==================================================================== |
;----------------------------------------------------------------------------- |
77 |
|
|
78 |
%macro YUYV_TO_YV12_INIT 2 |
%macro YUYV_TO_YV12_INIT 2 |
79 |
movq mm7, [yuyv_mask] |
movq mm7, [yuyv_mask] |
80 |
%endmacro |
%endmacro |
168 |
movd [ebx],mm5 |
movd [ebx],mm5 |
169 |
movd [ecx],mm4 |
movd [ecx],mm4 |
170 |
%endmacro |
%endmacro |
|
;==================================================================== |
|
171 |
|
|
172 |
|
;----------------------------------------------------------------------------- |
|
;------------------------------------------------------------------------------ |
|
173 |
; YV12_TO_YUYV( TYPE ) |
; YV12_TO_YUYV( TYPE ) |
174 |
; |
; |
175 |
; TYPE 0=yuyv, 1=uyvy |
; TYPE 0=yuyv, 1=uyvy |
176 |
; |
; |
177 |
; bytes=2, pixels = 8, vpixels=2 |
; bytes=2, pixels = 8, vpixels=2 |
178 |
;------------------------------------------------------------------------------ |
;----------------------------------------------------------------------------- |
179 |
|
|
180 |
%macro YV12_TO_YUYV_INIT 2 |
%macro YV12_TO_YUYV_INIT 2 |
181 |
%endmacro |
%endmacro |
182 |
|
|
213 |
movq [edi+edx+8], mm7 |
movq [edi+edx+8], mm7 |
214 |
%endif |
%endif |
215 |
%endmacro |
%endmacro |
|
;------------------------------------------------------------------------------ |
|
|
|
|
216 |
|
|
217 |
;------------------------------------------------------------------------------ |
;------------------------------------------------------------------------------ |
218 |
; YV12_TO_YUYVI( TYPE ) |
; YV12_TO_YUYVI( TYPE ) |
221 |
; |
; |
222 |
; bytes=2, pixels = 8, vpixels=4 |
; bytes=2, pixels = 8, vpixels=4 |
223 |
;------------------------------------------------------------------------------ |
;------------------------------------------------------------------------------ |
224 |
|
|
225 |
%macro YV12_TO_YUYVI_INIT 2 |
%macro YV12_TO_YUYVI_INIT 2 |
226 |
%endmacro |
%endmacro |
227 |
|
|
303 |
pop esi |
pop esi |
304 |
%endif |
%endif |
305 |
%endmacro |
%endmacro |
|
;------------------------------------------------------------------------------ |
|
306 |
|
|
307 |
|
;============================================================================= |
308 |
|
; Code |
309 |
|
;============================================================================= |
310 |
|
|
311 |
|
SECTION .text |
312 |
|
|
313 |
|
%include "colorspace_mmx.inc" |
314 |
|
|
315 |
; input |
; input |
316 |
|
|