[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 1793 - (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 : Isibaar 1793 %define ENDFUNC .endfunc
33 : edgomez 1535 %else
34 :     global _%1
35 :     %define %1 _%1
36 : Isibaar 1793 %define ENDFUNC
37 : edgomez 1535 %endif
38 : suxen_drol 1493 %else
39 : edgomez 1535 %ifdef MARK_FUNCS
40 : edgomez 1540 global %1:function %1.endfunc-%1
41 : Isibaar 1793 %define ENDFUNC .endfunc
42 : edgomez 1535 %else
43 :     global %1
44 : Isibaar 1793 %define ENDFUNC
45 : edgomez 1535 %endif
46 : suxen_drol 1493 %endif
47 :     %endmacro
48 :    
49 :     ;===========================================================================
50 :     ; read only data
51 :     ;===========================================================================
52 :    
53 :     %ifdef FORMAT_COFF
54 : edgomez 1519 SECTION .rodata
55 : suxen_drol 1493 %else
56 : edgomez 1519 SECTION .rodata align=16
57 : suxen_drol 1493 %endif
58 :    
59 :     xmm_0x80:
60 :     times 16 db 0x80
61 :    
62 :     ;=============================================================================
63 :     ; Code
64 :     ;=============================================================================
65 :    
66 :     SECTION .text
67 :    
68 :     cglobal image_brightness_sse2
69 :    
70 :     ;//////////////////////////////////////////////////////////////////////
71 :     ;// image_brightness_sse2
72 :     ;//////////////////////////////////////////////////////////////////////
73 :    
74 : edgomez 1538 %macro CREATE_OFFSET_VECTOR 2
75 :     mov [%1 + 0], %2
76 :     mov [%1 + 1], %2
77 :     mov [%1 + 2], %2
78 :     mov [%1 + 3], %2
79 :     mov [%1 + 4], %2
80 :     mov [%1 + 5], %2
81 :     mov [%1 + 6], %2
82 :     mov [%1 + 7], %2
83 :     mov [%1 + 8], %2
84 :     mov [%1 + 9], %2
85 :     mov [%1 + 10], %2
86 :     mov [%1 + 11], %2
87 :     mov [%1 + 12], %2
88 :     mov [%1 + 13], %2
89 :     mov [%1 + 14], %2
90 :     mov [%1 + 15], %2
91 :     %endmacro
92 :    
93 :     ALIGN 16
94 : suxen_drol 1493 image_brightness_sse2:
95 :    
96 : edgomez 1538 push esi
97 :     push edi ; 8 bytes offset for push
98 :     sub esp, 32 ; 32 bytes for local data (16bytes will be used, 16bytes more to align correctly mod 16)
99 : suxen_drol 1493
100 : edgomez 1538 movdqa xmm6, [xmm_0x80]
101 : suxen_drol 1493
102 : edgomez 1538 ; Create a offset...offset vector
103 :     mov eax, [esp+8+32+20] ; brightness offset value
104 :     mov edx, esp ; edx will be esp aligned mod 16
105 :     add edx, 15 ; edx = esp + 15
106 :     and edx, ~15 ; edx = (esp + 15)&(~15)
107 :     CREATE_OFFSET_VECTOR edx, al
108 :     movdqa xmm7, [edx]
109 : suxen_drol 1493
110 : edgomez 1538 mov edx, [esp+8+32+4] ; Dst
111 :     mov ecx, [esp+8+32+8] ; stride
112 :     mov esi, [esp+8+32+12] ; width
113 :     mov edi, [esp+8+32+16] ; height
114 : suxen_drol 1493
115 : Isibaar 1793 .yloop:
116 : edgomez 1538 xor eax, eax
117 : suxen_drol 1493
118 : Isibaar 1793 .xloop:
119 : edgomez 1538 movdqa xmm0, [edx + eax]
120 :     movdqa xmm1, [edx + eax + 16] ; xmm0 = [dst]
121 : suxen_drol 1493
122 : edgomez 1538 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 : suxen_drol 1493
129 : edgomez 1538 movdqa [edx + eax], xmm0
130 :     movdqa [edx + eax + 16], xmm1 ; [dst] = xmm0
131 : suxen_drol 1493
132 : edgomez 1538 add eax,32
133 :     cmp eax,esi
134 :     jl .xloop
135 : suxen_drol 1493
136 : edgomez 1538 add edx, ecx ; dst += stride
137 :     sub edi, 1
138 :     jg .yloop
139 : suxen_drol 1493
140 : edgomez 1538 add esp, 32
141 :     pop edi
142 :     pop esi
143 : suxen_drol 1493
144 : edgomez 1538 ret
145 : Isibaar 1793 ENDFUNC
146 : suxen_drol 1493 ;//////////////////////////////////////////////////////////////////////
147 : Isibaar 1790
148 :     %ifidn __OUTPUT_FORMAT__,elf
149 :     section ".note.GNU-stack" noalloc noexec nowrite progbits
150 :     %endif
151 :    

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