1 |
;/************************************************************************** |
;/**************************************************************************** |
2 |
; * |
; * |
3 |
; * XVID MPEG-4 VIDEO CODEC |
; * XVID MPEG-4 VIDEO CODEC |
4 |
; * mmx interlacing decision |
; * - Interlacing Field test - |
5 |
; * |
; * |
6 |
; * This program is an implementation of a part of one or more MPEG-4 |
; * Copyright(C) 2002 Daniel Smith <danielsmith@astroboymail.com> |
|
; * Video tools as specified in ISO/IEC 14496-2 standard. Those intending |
|
|
; * to use this software module in hardware or software products are |
|
|
; * advised that its use may infringe existing patents or copyrights, and |
|
|
; * any such use would be at such party's own risk. The original |
|
|
; * developer of this software module and his/her company, and subsequent |
|
|
; * editors and their companies, will have no liability for use of this |
|
|
; * software or modifications or derivatives thereof. |
|
7 |
; * |
; * |
8 |
; * This program is free software; you can redistribute it and/or modify |
; * This program is free software; you can redistribute it and/or modify |
9 |
; * it under the terms of the GNU General Public License as published by |
; * it under the terms of the GNU General Public License as published by |
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 |
21 |
; * |
; * |
22 |
; *************************************************************************/ |
; * $Id$ |
|
|
|
|
;/************************************************************************** |
|
|
; * |
|
|
; * History: |
|
|
; * |
|
|
; * 04.09.2002 initial version; (c)2002 daniel smith |
|
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 .text |
%ifdef FORMAT_COFF |
51 |
|
SECTION .rodata |
52 |
cglobal MBFieldTest_mmx |
%else |
53 |
|
SECTION .rodata align=16 |
54 |
|
%endif |
55 |
|
|
56 |
; advances to next block on right |
; advances to next block on right |
57 |
align 16 |
ALIGN 16 |
58 |
nexts dd 0, 0, 8, 120, 8 |
nexts: |
59 |
|
dd 0, 0, 8, 120, 8 |
60 |
|
|
61 |
; multiply word sums into dwords |
; multiply word sums into dwords |
62 |
align 16 |
ALIGN 16 |
63 |
ones times 4 dw 1 |
ones: |
64 |
|
times 4 dw 1 |
65 |
|
|
66 |
|
;============================================================================= |
67 |
|
; Code |
68 |
|
;============================================================================= |
69 |
|
|
70 |
|
SECTION .text |
71 |
|
|
72 |
|
cglobal MBFieldTest_mmx |
73 |
|
|
74 |
; neater |
; neater |
75 |
%define line0 esi |
%define line0 esi |
129 |
paddw mm7, mm3 |
paddw mm7, mm3 |
130 |
%endmacro |
%endmacro |
131 |
|
|
132 |
section .text |
;----------------------------------------------------------------------------- |
|
|
|
|
;=========================================================================== |
|
133 |
; |
; |
134 |
; uint32_t MBFieldTest_mmx(int16_t * const data); |
; uint32_t MBFieldTest_mmx(int16_t * const data); |
135 |
; |
; |
136 |
;=========================================================================== |
;----------------------------------------------------------------------------- |
137 |
|
|
138 |
align 16 |
ALIGN 16 |
139 |
MBFieldTest_mmx: |
MBFieldTest_mmx: |
140 |
|
|
141 |
push esi |
push esi |
150 |
|
|
151 |
mov eax, 4 ; we do left 8 bytes of data[0*64], then right 8 bytes |
mov eax, 4 ; we do left 8 bytes of data[0*64], then right 8 bytes |
152 |
; then left 8 bytes of data[1*64], then last 8 bytes |
; then left 8 bytes of data[1*64], then last 8 bytes |
153 |
|
.loop: |
|
_loop: |
|
154 |
movq m00, [line0] ; line0 |
movq m00, [line0] ; line0 |
155 |
movq m01, [line1] ; line1 |
movq m01, [line1] ; line1 |
156 |
|
|
189 |
add edi, ecx |
add edi, ecx |
190 |
|
|
191 |
dec eax |
dec eax |
192 |
jnz near _loop |
jnz near .loop |
193 |
|
|
194 |
_decide: |
.decide: |
195 |
movq mm0, [ones] ; add packed words into single dwords |
movq mm0, [ones] ; add packed words into single dwords |
196 |
pmaddwd mm6, mm0 |
pmaddwd mm6, mm0 |
197 |
pmaddwd mm7, mm0 |
pmaddwd mm7, mm0 |
205 |
movd ecx, mm0 |
movd ecx, mm0 |
206 |
movd edx, mm1 |
movd edx, mm1 |
207 |
|
|
208 |
|
add edx, 350 ; add bias against field decision |
209 |
cmp ecx, edx |
cmp ecx, edx |
210 |
jb _end ; if frame<field, don't use field dct |
jb .end ; if frame<field, don't use field dct |
211 |
inc eax ; if frame>=field, use field dct (return 1) |
inc eax ; if frame>=field, use field dct (return 1) |
212 |
|
|
213 |
_end: |
.end: |
214 |
pop edi |
pop edi |
215 |
pop esi |
pop esi |
216 |
|
|
217 |
ret |
ret |
218 |
|
.endfunc |
219 |
|
|