[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 1790 - (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 : edgomez 1540 global _%1:function %1.endfunc-%1
31 :     %define %1 _%1:function %1.endfunc-%1
32 : edgomez 1535 %else
33 :     global _%1
34 :     %define %1 _%1
35 :     %endif
36 : suxen_drol 1493 %else
37 : edgomez 1535 %ifdef MARK_FUNCS
38 : edgomez 1540 global %1:function %1.endfunc-%1
39 : edgomez 1535 %else
40 :     global %1
41 :     %endif
42 : suxen_drol 1493 %endif
43 :     %endmacro
44 :    
45 :     ;===========================================================================
46 :     ; read only data
47 :     ;===========================================================================
48 :    
49 :     %ifdef FORMAT_COFF
50 : edgomez 1519 SECTION .rodata
51 : suxen_drol 1493 %else
52 : edgomez 1519 SECTION .rodata align=16
53 : suxen_drol 1493 %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 1538 %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 1493 image_brightness_sse2:
91 :    
92 : edgomez 1538 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 : suxen_drol 1493
96 : edgomez 1538 movdqa xmm6, [xmm_0x80]
97 : suxen_drol 1493
98 : edgomez 1538 ; 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 : suxen_drol 1493
106 : edgomez 1538 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 1493
111 :     .yloop
112 : edgomez 1538 xor eax, eax
113 : suxen_drol 1493
114 :     .xloop
115 : edgomez 1538 movdqa xmm0, [edx + eax]
116 :     movdqa xmm1, [edx + eax + 16] ; xmm0 = [dst]
117 : suxen_drol 1493
118 : edgomez 1538 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 : suxen_drol 1493
125 : edgomez 1538 movdqa [edx + eax], xmm0
126 :     movdqa [edx + eax + 16], xmm1 ; [dst] = xmm0
127 : suxen_drol 1493
128 : edgomez 1538 add eax,32
129 :     cmp eax,esi
130 :     jl .xloop
131 : suxen_drol 1493
132 : edgomez 1538 add edx, ecx ; dst += stride
133 :     sub edi, 1
134 :     jg .yloop
135 : suxen_drol 1493
136 : edgomez 1538 add esp, 32
137 :     pop edi
138 :     pop esi
139 : suxen_drol 1493
140 : edgomez 1538 ret
141 : edgomez 1540 .endfunc
142 : suxen_drol 1493 ;//////////////////////////////////////////////////////////////////////
143 : Isibaar 1790
144 :     %ifidn __OUTPUT_FORMAT__,elf
145 :     section ".note.GNU-stack" noalloc noexec nowrite progbits
146 :     %endif
147 :    

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