Parent Directory | Revision Log
Revision 1.6 - (view) (download)
1 : | edgomez | 1.4 | ;/**************************************************************************** |
2 : | Isibaar | 1.1 | ; * |
3 : | edgomez | 1.4 | ; * XVID MPEG-4 VIDEO CODEC |
4 : | ; * - SSE2 CBP computation - | ||
5 : | Isibaar | 1.1 | ; * |
6 : | edgomez | 1.4 | ; * Copyright (C) 2002 Daniel Smith <danielsmith@astroboymail.com> |
7 : | ; * 2002 Pascal Massimino <skal@planet-d.net> | ||
8 : | edgomez | 1.3 | ; * |
9 : | edgomez | 1.4 | ; * 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 | ||
11 : | ; * the Free Software Foundation ; either version 2 of the License, or | ||
12 : | ; * (at your option) any later version. | ||
13 : | edgomez | 1.3 | ; * |
14 : | edgomez | 1.4 | ; * This program is distributed in the hope that it will be useful, |
15 : | ; * but WITHOUT ANY WARRANTY ; without even the implied warranty of | ||
16 : | ; * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
17 : | ; * GNU General Public License for more details. | ||
18 : | edgomez | 1.3 | ; * |
19 : | edgomez | 1.4 | ; * You should have received a copy of the GNU General Public License |
20 : | ; * along with this program ; if not, write to the Free Software | ||
21 : | ; * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
22 : | Isibaar | 1.1 | ; * |
23 : | edgomez | 1.4 | ; * $Id$ |
24 : | Isibaar | 1.1 | ; * |
25 : | edgomez | 1.4 | ; ***************************************************************************/ |
26 : | edgomez | 1.3 | |
27 : | edgomez | 1.4 | BITS 32 |
28 : | Isibaar | 1.1 | |
29 : | edgomez | 1.4 | ;============================================================================= |
30 : | ; Macros | ||
31 : | ;============================================================================= | ||
32 : | Isibaar | 1.1 | |
33 : | %macro cglobal 1 | ||
34 : | %ifdef PREFIX | ||
35 : | edgomez | 1.6 | %ifdef MARK_FUNCS |
36 : | global _%1:function | ||
37 : | %define %1 _%1:function | ||
38 : | %else | ||
39 : | global _%1 | ||
40 : | %define %1 _%1 | ||
41 : | %endif | ||
42 : | Isibaar | 1.1 | %else |
43 : | edgomez | 1.6 | %ifdef MARK_FUNCS |
44 : | global %1:function | ||
45 : | %else | ||
46 : | global %1 | ||
47 : | %endif | ||
48 : | Isibaar | 1.1 | %endif |
49 : | %endmacro | ||
50 : | |||
51 : | %macro LOOP_SSE2 1 | ||
52 : | edgomez | 1.4 | movdqa xmm0, [edx+(%1)*128] |
53 : | pand xmm0, xmm7 | ||
54 : | movdqa xmm1, [edx+(%1)*128+16] | ||
55 : | |||
56 : | por xmm0, [edx+(%1)*128+32] | ||
57 : | por xmm1, [edx+(%1)*128+48] | ||
58 : | por xmm0, [edx+(%1)*128+64] | ||
59 : | por xmm1, [edx+(%1)*128+80] | ||
60 : | por xmm0, [edx+(%1)*128+96] | ||
61 : | por xmm1, [edx+(%1)*128+112] | ||
62 : | |||
63 : | por xmm0, xmm1 ; xmm0 = xmm1 = 128 bits worth of info | ||
64 : | psadbw xmm0, xmm6 ; contains 2 dwords with sums | ||
65 : | movhlps xmm1, xmm0 ; move high dword from xmm0 to low xmm1 | ||
66 : | por xmm0, xmm1 ; combine | ||
67 : | movd ecx, xmm0 ; if ecx set, values were found | ||
68 : | test ecx, ecx | ||
69 : | Isibaar | 1.1 | %endmacro |
70 : | |||
71 : | edgomez | 1.4 | ;============================================================================= |
72 : | ; Data (Read Only) | ||
73 : | ;============================================================================= | ||
74 : | |||
75 : | %ifdef FORMAT_COFF | ||
76 : | edgomez | 1.5 | SECTION .rodata |
77 : | edgomez | 1.4 | %else |
78 : | edgomez | 1.5 | SECTION .rodata align=16 |
79 : | edgomez | 1.4 | %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 : | Isibaar | 1.1 | |
95 : | edgomez | 1.4 | ALIGN 16 |
96 : | cglobal calc_cbp_sse2 | ||
97 : | Isibaar | 1.1 | calc_cbp_sse2: |
98 : | edgomez | 1.4 | mov edx, [esp+4] ; coeff[] |
99 : | xor eax, eax ; cbp = 0 | ||
100 : | Isibaar | 1.1 | |
101 : | edgomez | 1.4 | movdqu xmm7, [ignore_dc] ; mask to ignore dc value |
102 : | pxor xmm6, xmm6 ; zero | ||
103 : | Isibaar | 1.1 | |
104 : | LOOP_SSE2 0 | ||
105 : | edgomez | 1.4 | test ecx, ecx |
106 : | jz .blk2 | ||
107 : | or eax, (1<<5) | ||
108 : | |||
109 : | Isibaar | 1.1 | .blk2 |
110 : | LOOP_SSE2 1 | ||
111 : | edgomez | 1.4 | test ecx, ecx |
112 : | jz .blk3 | ||
113 : | Isibaar | 1.1 | or eax, (1<<4) |
114 : | edgomez | 1.4 | |
115 : | Isibaar | 1.1 | .blk3 |
116 : | LOOP_SSE2 2 | ||
117 : | edgomez | 1.4 | test ecx, ecx |
118 : | jz .blk4 | ||
119 : | Isibaar | 1.1 | or eax, (1<<3) |
120 : | edgomez | 1.4 | |
121 : | Isibaar | 1.1 | .blk4 |
122 : | LOOP_SSE2 3 | ||
123 : | edgomez | 1.4 | test ecx, ecx |
124 : | jz .blk5 | ||
125 : | Isibaar | 1.1 | or eax, (1<<2) |
126 : | edgomez | 1.4 | |
127 : | Isibaar | 1.1 | .blk5 |
128 : | LOOP_SSE2 4 | ||
129 : | edgomez | 1.4 | test ecx, ecx |
130 : | jz .blk6 | ||
131 : | Isibaar | 1.1 | or eax, (1<<1) |
132 : | edgomez | 1.4 | |
133 : | Isibaar | 1.1 | .blk6 |
134 : | LOOP_SSE2 5 | ||
135 : | edgomez | 1.4 | test ecx, ecx |
136 : | jz .finished | ||
137 : | Isibaar | 1.1 | or eax, (1<<0) |
138 : | edgomez | 1.4 | |
139 : | Isibaar | 1.1 | .finished |
140 : | edgomez | 1.4 | ret |
No admin address has been configured | ViewVC Help |
Powered by ViewVC 1.0.4 |