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

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