Parent Directory | Revision Log
Revision 1.5 - (view) (download)
1 : | suxen_drol | 1.1 | ;/***************************************************************************** |
2 : | ; * | ||
3 : | ; * XVID MPEG-4 VIDEO CODEC | ||
4 : | ; * - sse2 post processing - | ||
5 : | ; * | ||
6 : | ; * Copyright(C) 2004 Peter Ross <pross@xvid.org> | ||
7 : | ; * 2004 Dcoder <dcoder@alexandria.cc> | ||
8 : | ; * | ||
9 : | ; * XviD is free software; you can redistribute it and/or modify it | ||
10 : | ; * 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 : | ; * | ||
14 : | ; * 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 : | ; * | ||
19 : | ; * 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 : | ; * | ||
23 : | ; *************************************************************************/ | ||
24 : | |||
25 : | BITS 32 | ||
26 : | |||
27 : | %macro cglobal 1 | ||
28 : | %ifdef PREFIX | ||
29 : | edgomez | 1.3 | %ifdef MARK_FUNCS |
30 : | edgomez | 1.5 | global _%1:function %1.endfunc-%1 |
31 : | %define %1 _%1:function %1.endfunc-%1 | ||
32 : | edgomez | 1.3 | %else |
33 : | global _%1 | ||
34 : | %define %1 _%1 | ||
35 : | %endif | ||
36 : | suxen_drol | 1.1 | %else |
37 : | edgomez | 1.3 | %ifdef MARK_FUNCS |
38 : | edgomez | 1.5 | global %1:function %1.endfunc-%1 |
39 : | edgomez | 1.3 | %else |
40 : | global %1 | ||
41 : | %endif | ||
42 : | suxen_drol | 1.1 | %endif |
43 : | %endmacro | ||
44 : | |||
45 : | ;=========================================================================== | ||
46 : | ; read only data | ||
47 : | ;=========================================================================== | ||
48 : | |||
49 : | %ifdef FORMAT_COFF | ||
50 : | edgomez | 1.2 | SECTION .rodata |
51 : | suxen_drol | 1.1 | %else |
52 : | edgomez | 1.2 | SECTION .rodata align=16 |
53 : | suxen_drol | 1.1 | %endif |
54 : | |||
55 : | xmm_0x80: | ||
56 : | times 16 db 0x80 | ||
57 : | |||
58 : | ;============================================================================= | ||
59 : | ; Code | ||
60 : | ;============================================================================= | ||
61 : | |||
62 : | SECTION .text | ||
63 : | |||
64 : | cglobal image_brightness_sse2 | ||
65 : | |||
66 : | ;////////////////////////////////////////////////////////////////////// | ||
67 : | ;// image_brightness_sse2 | ||
68 : | ;////////////////////////////////////////////////////////////////////// | ||
69 : | |||
70 : | edgomez | 1.4 | %macro CREATE_OFFSET_VECTOR 2 |
71 : | mov [%1 + 0], %2 | ||
72 : | mov [%1 + 1], %2 | ||
73 : | mov [%1 + 2], %2 | ||
74 : | mov [%1 + 3], %2 | ||
75 : | mov [%1 + 4], %2 | ||
76 : | mov [%1 + 5], %2 | ||
77 : | mov [%1 + 6], %2 | ||
78 : | mov [%1 + 7], %2 | ||
79 : | mov [%1 + 8], %2 | ||
80 : | mov [%1 + 9], %2 | ||
81 : | mov [%1 + 10], %2 | ||
82 : | mov [%1 + 11], %2 | ||
83 : | mov [%1 + 12], %2 | ||
84 : | mov [%1 + 13], %2 | ||
85 : | mov [%1 + 14], %2 | ||
86 : | mov [%1 + 15], %2 | ||
87 : | %endmacro | ||
88 : | |||
89 : | ALIGN 16 | ||
90 : | suxen_drol | 1.1 | image_brightness_sse2: |
91 : | |||
92 : | edgomez | 1.4 | push esi |
93 : | push edi ; 8 bytes offset for push | ||
94 : | sub esp, 32 ; 32 bytes for local data (16bytes will be used, 16bytes more to align correctly mod 16) | ||
95 : | |||
96 : | movdqa xmm6, [xmm_0x80] | ||
97 : | |||
98 : | ; Create a offset...offset vector | ||
99 : | mov eax, [esp+8+32+20] ; brightness offset value | ||
100 : | mov edx, esp ; edx will be esp aligned mod 16 | ||
101 : | add edx, 15 ; edx = esp + 15 | ||
102 : | and edx, ~15 ; edx = (esp + 15)&(~15) | ||
103 : | CREATE_OFFSET_VECTOR edx, al | ||
104 : | movdqa xmm7, [edx] | ||
105 : | |||
106 : | mov edx, [esp+8+32+4] ; Dst | ||
107 : | mov ecx, [esp+8+32+8] ; stride | ||
108 : | mov esi, [esp+8+32+12] ; width | ||
109 : | mov edi, [esp+8+32+16] ; height | ||
110 : | suxen_drol | 1.1 | |
111 : | .yloop | ||
112 : | edgomez | 1.4 | xor eax, eax |
113 : | suxen_drol | 1.1 | |
114 : | .xloop | ||
115 : | edgomez | 1.4 | movdqa xmm0, [edx + eax] |
116 : | movdqa xmm1, [edx + eax + 16] ; xmm0 = [dst] | ||
117 : | suxen_drol | 1.1 | |
118 : | edgomez | 1.4 | paddb xmm0, xmm6 ; unsigned -> signed domain |
119 : | paddb xmm1, xmm6 | ||
120 : | paddsb xmm0, xmm7 | ||
121 : | paddsb xmm1, xmm7 ; xmm0 += offset | ||
122 : | psubb xmm0, xmm6 | ||
123 : | psubb xmm1, xmm6 ; signed -> unsigned domain | ||
124 : | |||
125 : | movdqa [edx + eax], xmm0 | ||
126 : | movdqa [edx + eax + 16], xmm1 ; [dst] = xmm0 | ||
127 : | |||
128 : | add eax,32 | ||
129 : | cmp eax,esi | ||
130 : | jl .xloop | ||
131 : | |||
132 : | add edx, ecx ; dst += stride | ||
133 : | sub edi, 1 | ||
134 : | jg .yloop | ||
135 : | |||
136 : | add esp, 32 | ||
137 : | pop edi | ||
138 : | pop esi | ||
139 : | suxen_drol | 1.1 | |
140 : | edgomez | 1.4 | ret |
141 : | edgomez | 1.5 | .endfunc |
142 : | suxen_drol | 1.1 | ;////////////////////////////////////////////////////////////////////// |
No admin address has been configured | ViewVC Help |
Powered by ViewVC 1.0.4 |