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.3 2004-03-22 22:36:24 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 |
|
|
34 |
%endif |
%endif |
35 |
%endmacro |
%endmacro |
36 |
|
|
37 |
SECTION .text |
;============================================================================= |
38 |
|
; Helper macros |
39 |
ALIGN 64 |
;============================================================================= |
40 |
|
|
41 |
;------------------------------------------------------------------------------ |
;------------------------------------------------------------------------------ |
42 |
; PLANE_COPY ( DST, DST_DIF, SRC, SRC_DIF, WIDTH, HEIGHT, OPT ) |
; PLANE_COPY ( DST, DST_DIF, SRC, SRC_DIF, WIDTH, HEIGHT, OPT ) |
48 |
; HEIGHT height |
; HEIGHT height |
49 |
; OPT 0=plain mmx, 1=xmm |
; OPT 0=plain mmx, 1=xmm |
50 |
;------------------------------------------------------------------------------ |
;------------------------------------------------------------------------------ |
51 |
|
|
52 |
%macro PLANE_COPY 7 |
%macro PLANE_COPY 7 |
53 |
%define DST %1 |
%define DST %1 |
54 |
%define DST_DIF %2 |
%define DST_DIF %2 |
67 |
shr eax, 6 ; $eax$ = width / 64 |
shr eax, 6 ; $eax$ = width / 64 |
68 |
and ebx, 63 ; remainder = width % 64 |
and ebx, 63 ; remainder = width % 64 |
69 |
mov edx, ebx |
mov edx, ebx |
70 |
shr ebx, 4 ; $ebx$ = reaminder / 16 |
shr ebx, 4 ; $ebx$ = remainder / 16 |
71 |
and edx, 15 ; $edx$ = remainder % 16 |
and edx, 15 ; $edx$ = remainder % 16 |
72 |
|
|
73 |
%%loop64_start |
%%loop64_start |
144 |
dec ebp |
dec ebp |
145 |
jnz near %%loop64_start |
jnz near %%loop64_start |
146 |
%endmacro |
%endmacro |
|
;------------------------------------------------------------------------------ |
|
|
|
|
|
|
|
147 |
|
|
148 |
;------------------------------------------------------------------------------ |
;------------------------------------------------------------------------------ |
149 |
; MAKE_YV12_TO_YV12( NAME, OPT ) |
; MAKE_YV12_TO_YV12( NAME, OPT ) |
159 |
%macro MAKE_YV12_TO_YV12 2 |
%macro MAKE_YV12_TO_YV12 2 |
160 |
%define NAME %1 |
%define NAME %1 |
161 |
%define OPT %2 |
%define OPT %2 |
162 |
align 16 |
ALIGN 16 |
163 |
cglobal NAME |
cglobal NAME |
164 |
NAME |
NAME: |
165 |
%define pushsize 16 |
%define pushsize 16 |
166 |
%define localsize 24 |
%define localsize 24 |
167 |
|
|
259 |
|
|
260 |
ret |
ret |
261 |
%endmacro |
%endmacro |
|
;------------------------------------------------------------------------------ |
|
262 |
|
|
263 |
|
;============================================================================= |
264 |
|
; Code |
265 |
|
;============================================================================= |
266 |
|
|
267 |
|
SECTION .text |
268 |
|
|
269 |
MAKE_YV12_TO_YV12 yv12_to_yv12_mmx, 0 |
MAKE_YV12_TO_YV12 yv12_to_yv12_mmx, 0 |
270 |
|
|
271 |
MAKE_YV12_TO_YV12 yv12_to_yv12_xmm, 1 |
MAKE_YV12_TO_YV12 yv12_to_yv12_xmm, 1 |