1 |
;/************************************************************************** |
;/**************************************************************************** |
2 |
; * |
; * |
3 |
; * XVID MPEG-4 VIDEO CODEC |
; * XVID MPEG-4 VIDEO CODEC |
4 |
; * sse2 cbp calc |
; * - SSE2 CBP computation - |
5 |
; * |
; * |
6 |
; * This program is an implementation of a part of one or more MPEG-4 |
; * Copyright (C) 2002 Daniel Smith <danielsmith@astroboymail.com> |
7 |
; * Video tools as specified in ISO/IEC 14496-2 standard. Those intending |
; * 2002 Pascal Massimino <skal@planet-d.net> |
|
; * 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. |
|
8 |
; * |
; * |
9 |
; * This program is free software; you can redistribute it and/or modify |
; * This program is free software; you can redistribute it and/or modify |
10 |
; * 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 |
18 |
; * |
; * |
19 |
; * You should have received a copy of the GNU General Public License |
; * You should have received a copy of the GNU General Public License |
20 |
; * along with this program; if not, write to the Free Software |
; * along with this program; if not, write to the Free Software |
21 |
; * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
; * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
22 |
; * |
; * |
23 |
; *************************************************************************/ |
; * $Id$ |
|
|
|
|
;/************************************************************************** |
|
|
; * |
|
|
; * History: |
|
24 |
; * |
; * |
25 |
; * 14.06.2002 cleanup -Skal- |
; ***************************************************************************/ |
|
; * 24.04.2002 had to use sse2's movdqu instead of movdqa (???) |
|
|
; * 17.04.2002 initial version (c) 2002 Daniel Smith |
|
|
; * |
|
|
; *************************************************************************/ |
|
|
|
|
26 |
|
|
27 |
bits 32 |
BITS 32 |
28 |
|
|
29 |
section .data |
;============================================================================= |
30 |
|
; Macros |
31 |
|
;============================================================================= |
32 |
|
|
33 |
%macro cglobal 1 |
%macro cglobal 1 |
34 |
%ifdef PREFIX |
%ifdef PREFIX |
35 |
|
%ifdef MARK_FUNCS |
36 |
|
global _%1:function %1.endfunc-%1 |
37 |
|
%define %1 _%1:function %1.endfunc-%1 |
38 |
|
%else |
39 |
global _%1 |
global _%1 |
40 |
%define %1 _%1 |
%define %1 _%1 |
41 |
|
%endif |
42 |
|
%else |
43 |
|
%ifdef MARK_FUNCS |
44 |
|
global %1:function %1.endfunc-%1 |
45 |
%else |
%else |
46 |
global %1 |
global %1 |
47 |
%endif |
%endif |
48 |
|
%endif |
49 |
%endmacro |
%endmacro |
50 |
|
|
|
align 16 |
|
|
|
|
|
ignore_dc dw 0, -1, -1, -1, -1, -1, -1, -1 |
|
|
|
|
|
section .text |
|
|
|
|
|
cglobal calc_cbp_sse2 |
|
|
|
|
|
;=========================================================================== |
|
|
; |
|
|
; uint32_t calc_cbp_sse2(const int16_t coeff[6][64]); |
|
|
; |
|
|
; not enabled - slower than mmx? |
|
|
; |
|
|
;=========================================================================== |
|
|
|
|
51 |
%macro LOOP_SSE2 1 |
%macro LOOP_SSE2 1 |
52 |
movdqa xmm0, [edx+(%1)*128] |
movdqa xmm0, [edx+(%1)*128] |
53 |
pand xmm0, xmm7 |
pand xmm0, xmm7 |
68 |
test ecx, ecx |
test ecx, ecx |
69 |
%endmacro |
%endmacro |
70 |
|
|
71 |
align 16 |
;============================================================================= |
72 |
|
; Data (Read Only) |
73 |
|
;============================================================================= |
74 |
|
|
75 |
|
%ifdef FORMAT_COFF |
76 |
|
SECTION .rodata |
77 |
|
%else |
78 |
|
SECTION .rodata align=16 |
79 |
|
%endif |
80 |
|
|
81 |
|
ALIGN 16 |
82 |
|
ignore_dc: |
83 |
|
dw 0, -1, -1, -1, -1, -1, -1, -1 |
84 |
|
|
85 |
|
;============================================================================= |
86 |
|
; Code |
87 |
|
;============================================================================= |
88 |
|
|
89 |
|
SECTION .text |
90 |
|
|
91 |
|
;----------------------------------------------------------------------------- |
92 |
|
; uint32_t calc_cbp_sse2(const int16_t coeff[6*64]); |
93 |
|
;----------------------------------------------------------------------------- |
94 |
|
|
95 |
|
ALIGN 16 |
96 |
|
cglobal calc_cbp_sse2 |
97 |
calc_cbp_sse2: |
calc_cbp_sse2: |
98 |
mov edx, [esp+4] ; coeff[] |
mov edx, [esp+4] ; coeff[] |
99 |
xor eax, eax ; cbp = 0 |
xor eax, eax ; cbp = 0 |
105 |
test ecx, ecx |
test ecx, ecx |
106 |
jz .blk2 |
jz .blk2 |
107 |
or eax, (1<<5) |
or eax, (1<<5) |
108 |
|
|
109 |
.blk2 |
.blk2 |
110 |
LOOP_SSE2 1 |
LOOP_SSE2 1 |
111 |
test ecx, ecx |
test ecx, ecx |
112 |
jz .blk3 |
jz .blk3 |
113 |
or eax, (1<<4) |
or eax, (1<<4) |
114 |
|
|
115 |
.blk3 |
.blk3 |
116 |
LOOP_SSE2 2 |
LOOP_SSE2 2 |
117 |
test ecx, ecx |
test ecx, ecx |
118 |
jz .blk4 |
jz .blk4 |
119 |
or eax, (1<<3) |
or eax, (1<<3) |
120 |
|
|
121 |
.blk4 |
.blk4 |
122 |
LOOP_SSE2 3 |
LOOP_SSE2 3 |
123 |
test ecx, ecx |
test ecx, ecx |
124 |
jz .blk5 |
jz .blk5 |
125 |
or eax, (1<<2) |
or eax, (1<<2) |
126 |
|
|
127 |
.blk5 |
.blk5 |
128 |
LOOP_SSE2 4 |
LOOP_SSE2 4 |
129 |
test ecx, ecx |
test ecx, ecx |
130 |
jz .blk6 |
jz .blk6 |
131 |
or eax, (1<<1) |
or eax, (1<<1) |
132 |
|
|
133 |
.blk6 |
.blk6 |
134 |
LOOP_SSE2 5 |
LOOP_SSE2 5 |
135 |
test ecx, ecx |
test ecx, ecx |
136 |
jz .finished |
jz .finished |
137 |
or eax, (1<<0) |
or eax, (1<<0) |
|
.finished |
|
138 |
|
|
139 |
|
.finished |
140 |
ret |
ret |
141 |
|
.endfunc |
142 |
|
|