1 |
;------------------------------------------------------------------------------ |
;/**************************************************************************** |
2 |
; |
; * |
3 |
; This file is part of XviD, a free MPEG-4 video encoder/decoder |
; * XVID MPEG-4 VIDEO CODEC |
4 |
; |
; * - MMX and XMM YV12->YV12 conversion - |
5 |
; This program is free software; you can redistribute it and/or modify it |
; * |
6 |
; under the terms of the GNU General Public License as published by |
; * Copyright(C) 2001 Michael Militzer <isibaar@xvid.org> |
7 |
; the Free Software Foundation; either version 2 of the License, or |
; * |
8 |
; (at your option) any later version. |
; * 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 |
; This program is distributed in the hope that it will be useful, but |
; * the Free Software Foundation; either version 2 of the License, or |
11 |
; WITHOUT ANY WARRANTY; without even the implied warranty of |
; * (at your option) any later version. |
12 |
; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
; * |
13 |
; GNU General Public License for more details. |
; * This program is distributed in the hope that it will be useful, |
14 |
; |
; * but WITHOUT ANY WARRANTY; without even the implied warranty of |
15 |
; You should have received a copy of the GNU General Public License |
; * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
16 |
; along with this program; if not, write to the Free Software |
; * GNU General Public License for more details. |
17 |
; Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
; * |
18 |
; |
; * You should have received a copy of the GNU General Public License |
19 |
;------------------------------------------------------------------------------ |
; * along with this program; if not, write to the Free Software |
20 |
;------------------------------------------------------------------------------ |
; * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
21 |
; |
; * |
22 |
; yuv_to_yuv.asm, MMX optimized color conversion |
; * $Id: colorspace_yuv_mmx.asm,v 1.5 2004-08-29 10:02:38 edgomez Exp $ |
23 |
; |
; * |
24 |
; Copyright (C) 2001 - Michael Militzer <isibaar@xvid.org> |
; ***************************************************************************/ |
|
; |
|
|
; For more information visit the XviD homepage: http://www.xvid.org |
|
|
; |
|
|
;------------------------------------------------------------------------------ |
|
|
;------------------------------------------------------------------------------ |
|
|
; |
|
|
; Revision history: |
|
|
; |
|
|
; 24.11.2001 initial version (Isibaar) |
|
|
; 23.07.2002 thread safe (edgomez) |
|
|
; |
|
|
; $Id: colorspace_yuv_mmx.asm,v 1.2 2003-02-15 15:22:18 edgomez Exp $ |
|
|
; |
|
|
;------------------------------------------------------------------------------ |
|
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 |
SECTION .text |
;============================================================================= |
47 |
|
; Helper macros |
48 |
ALIGN 64 |
;============================================================================= |
49 |
|
|
50 |
;------------------------------------------------------------------------------ |
;------------------------------------------------------------------------------ |
51 |
; PLANE_COPY ( DST, DST_DIF, SRC, SRC_DIF, WIDTH, HEIGHT, OPT ) |
; PLANE_COPY ( DST, DST_DIF, SRC, SRC_DIF, WIDTH, HEIGHT, OPT ) |
57 |
; HEIGHT height |
; HEIGHT height |
58 |
; OPT 0=plain mmx, 1=xmm |
; OPT 0=plain mmx, 1=xmm |
59 |
;------------------------------------------------------------------------------ |
;------------------------------------------------------------------------------ |
60 |
|
|
61 |
%macro PLANE_COPY 7 |
%macro PLANE_COPY 7 |
62 |
%define DST %1 |
%define DST %1 |
63 |
%define DST_DIF %2 |
%define DST_DIF %2 |
76 |
shr eax, 6 ; $eax$ = width / 64 |
shr eax, 6 ; $eax$ = width / 64 |
77 |
and ebx, 63 ; remainder = width % 64 |
and ebx, 63 ; remainder = width % 64 |
78 |
mov edx, ebx |
mov edx, ebx |
79 |
shr ebx, 4 ; $ebx$ = reaminder / 16 |
shr ebx, 4 ; $ebx$ = remainder / 16 |
80 |
and edx, 15 ; $edx$ = remainder % 16 |
and edx, 15 ; $edx$ = remainder % 16 |
81 |
|
|
82 |
%%loop64_start |
%%loop64_start |
153 |
dec ebp |
dec ebp |
154 |
jnz near %%loop64_start |
jnz near %%loop64_start |
155 |
%endmacro |
%endmacro |
|
;------------------------------------------------------------------------------ |
|
|
|
|
|
|
|
156 |
|
|
157 |
;------------------------------------------------------------------------------ |
;------------------------------------------------------------------------------ |
158 |
; MAKE_YV12_TO_YV12( NAME, OPT ) |
; MAKE_YV12_TO_YV12( NAME, OPT ) |
168 |
%macro MAKE_YV12_TO_YV12 2 |
%macro MAKE_YV12_TO_YV12 2 |
169 |
%define NAME %1 |
%define NAME %1 |
170 |
%define OPT %2 |
%define OPT %2 |
171 |
align 16 |
ALIGN 16 |
172 |
cglobal NAME |
cglobal NAME |
173 |
NAME |
NAME: |
174 |
%define pushsize 16 |
%define pushsize 16 |
175 |
%define localsize 24 |
%define localsize 24 |
176 |
|
|
267 |
pop ebx |
pop ebx |
268 |
|
|
269 |
ret |
ret |
270 |
|
.endfunc |
271 |
%endmacro |
%endmacro |
|
;------------------------------------------------------------------------------ |
|
272 |
|
|
273 |
|
;============================================================================= |
274 |
|
; Code |
275 |
|
;============================================================================= |
276 |
|
|
277 |
|
SECTION .text |
278 |
|
|
279 |
MAKE_YV12_TO_YV12 yv12_to_yv12_mmx, 0 |
MAKE_YV12_TO_YV12 yv12_to_yv12_mmx, 0 |
280 |
|
|
281 |
MAKE_YV12_TO_YV12 yv12_to_yv12_xmm, 1 |
MAKE_YV12_TO_YV12 yv12_to_yv12_xmm, 1 |