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: |
|
23 |
; * |
; * |
24 |
; * 04.09.2002 initial version; (c)2002 daniel smith |
; ***************************************************************************/ |
|
; * |
|
|
; *************************************************************************/ |
|
|
|
|
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 .text |
%ifdef FORMAT_COFF |
42 |
|
SECTION .rodata data |
43 |
cglobal MBFieldTest_mmx |
%else |
44 |
|
SECTION .rodata data align=16 |
45 |
|
%endif |
46 |
|
|
47 |
; advances to next block on right |
; advances to next block on right |
48 |
align 16 |
ALIGN 16 |
49 |
nexts dd 0, 0, 8, 120, 8 |
nexts: |
50 |
|
dd 0, 0, 8, 120, 8 |
51 |
|
|
52 |
; multiply word sums into dwords |
; multiply word sums into dwords |
53 |
align 16 |
ALIGN 16 |
54 |
ones times 4 dw 1 |
ones: |
55 |
|
times 4 dw 1 |
56 |
|
|
57 |
|
;============================================================================= |
58 |
|
; Code |
59 |
|
;============================================================================= |
60 |
|
|
61 |
|
SECTION .text |
62 |
|
|
63 |
|
cglobal MBFieldTest_mmx |
64 |
|
|
65 |
; neater |
; neater |
66 |
%define line0 esi |
%define line0 esi |
120 |
paddw mm7, mm3 |
paddw mm7, mm3 |
121 |
%endmacro |
%endmacro |
122 |
|
|
123 |
section .text |
;----------------------------------------------------------------------------- |
|
|
|
|
;=========================================================================== |
|
124 |
; |
; |
125 |
; uint32_t MBFieldTest_mmx(int16_t * const data); |
; uint32_t MBFieldTest_mmx(int16_t * const data); |
126 |
; |
; |
127 |
;=========================================================================== |
;----------------------------------------------------------------------------- |
128 |
|
|
129 |
align 16 |
ALIGN 16 |
130 |
MBFieldTest_mmx: |
MBFieldTest_mmx: |
131 |
|
|
132 |
push esi |
push esi |
141 |
|
|
142 |
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 |
143 |
; then left 8 bytes of data[1*64], then last 8 bytes |
; then left 8 bytes of data[1*64], then last 8 bytes |
144 |
|
.loop: |
|
_loop: |
|
145 |
movq m00, [line0] ; line0 |
movq m00, [line0] ; line0 |
146 |
movq m01, [line1] ; line1 |
movq m01, [line1] ; line1 |
147 |
|
|
180 |
add edi, ecx |
add edi, ecx |
181 |
|
|
182 |
dec eax |
dec eax |
183 |
jnz near _loop |
jnz near .loop |
184 |
|
|
185 |
_decide: |
.decide: |
186 |
movq mm0, [ones] ; add packed words into single dwords |
movq mm0, [ones] ; add packed words into single dwords |
187 |
pmaddwd mm6, mm0 |
pmaddwd mm6, mm0 |
188 |
pmaddwd mm7, mm0 |
pmaddwd mm7, mm0 |
196 |
movd ecx, mm0 |
movd ecx, mm0 |
197 |
movd edx, mm1 |
movd edx, mm1 |
198 |
|
|
199 |
|
add edx, 350 ; add bias against field decision |
200 |
cmp ecx, edx |
cmp ecx, edx |
201 |
jb _end ; if frame<field, don't use field dct |
jb .end ; if frame<field, don't use field dct |
202 |
inc eax ; if frame>=field, use field dct (return 1) |
inc eax ; if frame>=field, use field dct (return 1) |
203 |
|
|
204 |
_end: |
.end: |
205 |
pop edi |
pop edi |
206 |
pop esi |
pop esi |
207 |
|
|