[svn] / trunk / xvidcore / src / image / x86_asm / postprocessing_sse2.asm Repository:
ViewVC logotype

Annotation of /trunk/xvidcore/src/image/x86_asm/postprocessing_sse2.asm

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1535 - (view) (download)

1 : suxen_drol 1493 ;/*****************************************************************************
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 1535 %ifdef MARK_FUNCS
30 :     global _%1:function
31 :     %define %1 _%1:function
32 :     %else
33 :     global _%1
34 :     %define %1 _%1
35 :     %endif
36 : suxen_drol 1493 %else
37 : edgomez 1535 %ifdef MARK_FUNCS
38 :     global %1:function
39 :     %else
40 :     global %1
41 :     %endif
42 : suxen_drol 1493 %endif
43 :     %endmacro
44 :    
45 :     %macro FILLBYTES 2
46 :    
47 :     mov [%1], %2
48 :     mov [%1 + 1], %2
49 :     mov [%1 + 2], %2
50 :     mov [%1 + 3], %2
51 :     mov [%1 + 4], %2
52 :     mov [%1 + 5], %2
53 :     mov [%1 + 6], %2
54 :     mov [%1 + 7], %2
55 :     mov [%1 + 8], %2
56 :     mov [%1 + 9], %2
57 :     mov [%1 + 10], %2
58 :     mov [%1 + 11], %2
59 :     mov [%1 + 12], %2
60 :     mov [%1 + 13], %2
61 :     mov [%1 + 14], %2
62 :     mov [%1 + 15], %2
63 :    
64 :     %endmacro
65 :    
66 :    
67 :     ;===========================================================================
68 :     ; read only data
69 :     ;===========================================================================
70 :    
71 :     %ifdef FORMAT_COFF
72 : edgomez 1519 SECTION .rodata
73 : suxen_drol 1493 %else
74 : edgomez 1519 SECTION .rodata align=16
75 : suxen_drol 1493 %endif
76 :    
77 :     xmm_0x80:
78 :     times 16 db 0x80
79 :    
80 :     offset_xmm:
81 :     times 16 db 0x00
82 :    
83 :     ;=============================================================================
84 :     ; Code
85 :     ;=============================================================================
86 :    
87 :     SECTION .text
88 :    
89 :     cglobal image_brightness_sse2
90 :    
91 :    
92 :     ;//////////////////////////////////////////////////////////////////////
93 :     ;// image_brightness_sse2
94 :     ;//////////////////////////////////////////////////////////////////////
95 :    
96 :     align 16
97 :     image_brightness_sse2:
98 :    
99 :     push esi
100 :     push edi
101 :    
102 :     movdqa xmm6, [xmm_0x80]
103 :    
104 :     mov eax, [esp+8+20] ; offset
105 :    
106 :     FILLBYTES offset_xmm, al
107 :    
108 :     movdqa xmm7, [offset_xmm]
109 :    
110 :     mov edx, [esp+8+4] ; Dst
111 :     mov ecx, [esp+8+8] ; stride
112 :     mov esi, [esp+8+12] ; width
113 :     mov edi, [esp+8+16] ; height
114 :    
115 :     .yloop
116 :     xor eax, eax
117 :    
118 :     .xloop
119 :     movdqa xmm0, [edx + eax]
120 :     movdqa xmm1, [edx + eax + 16] ; xmm0 = [dst]
121 :    
122 :     paddb xmm0, xmm6 ; unsigned -> signed domain
123 :     paddb xmm1, xmm6
124 :     paddsb xmm0, xmm7
125 :     paddsb xmm1, xmm7 ; xmm0 += offset
126 :     psubb xmm0, xmm6
127 :     psubb xmm1, xmm6 ; signed -> unsigned domain
128 :    
129 :     movdqa [edx + eax], xmm0
130 :     movdqa [edx + eax + 16], xmm1 ; [dst] = xmm0
131 :    
132 :     add eax,32
133 :     cmp eax,esi
134 :     jl .xloop
135 :    
136 :     add edx, ecx ; dst += stride
137 :     sub edi, 1
138 :     jg .yloop
139 :    
140 :     pop edi
141 :     pop esi
142 :    
143 :     ret
144 :     ;//////////////////////////////////////////////////////////////////////

No admin address has been configured
ViewVC Help
Powered by ViewVC 1.0.4