[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 1844 - (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 : Isibaar 1795 %include "nasm.inc"
26 : suxen_drol 1493
27 :     ;===========================================================================
28 :     ; read only data
29 :     ;===========================================================================
30 :    
31 : Isibaar 1795 DATA
32 : suxen_drol 1493
33 :     xmm_0x80:
34 :     times 16 db 0x80
35 :    
36 :     ;=============================================================================
37 :     ; Code
38 :     ;=============================================================================
39 :    
40 : Isibaar 1844 TEXT
41 : suxen_drol 1493
42 :     cglobal image_brightness_sse2
43 :    
44 :     ;//////////////////////////////////////////////////////////////////////
45 :     ;// image_brightness_sse2
46 :     ;//////////////////////////////////////////////////////////////////////
47 :    
48 : edgomez 1538 %macro CREATE_OFFSET_VECTOR 2
49 :     mov [%1 + 0], %2
50 :     mov [%1 + 1], %2
51 :     mov [%1 + 2], %2
52 :     mov [%1 + 3], %2
53 :     mov [%1 + 4], %2
54 :     mov [%1 + 5], %2
55 :     mov [%1 + 6], %2
56 :     mov [%1 + 7], %2
57 :     mov [%1 + 8], %2
58 :     mov [%1 + 9], %2
59 :     mov [%1 + 10], %2
60 :     mov [%1 + 11], %2
61 :     mov [%1 + 12], %2
62 :     mov [%1 + 13], %2
63 :     mov [%1 + 14], %2
64 :     mov [%1 + 15], %2
65 :     %endmacro
66 :    
67 : Isibaar 1795 ALIGN SECTION_ALIGN
68 : suxen_drol 1493 image_brightness_sse2:
69 : Isibaar 1798 %ifdef ARCH_IS_X86_64
70 : Isibaar 1844 XVID_MOVSX _EAX, prm5d
71 : Isibaar 1798 %else
72 :     mov eax, prm5 ; brightness offset value
73 :     %endif
74 : Isibaar 1795 mov TMP1, prm1 ; Dst
75 :     mov TMP0, prm2 ; stride
76 : suxen_drol 1493
77 : Isibaar 1795 push _ESI
78 :     push _EDI ; 8 bytes offset for push
79 :     sub _ESP, 32 ; 32 bytes for local data (16bytes will be used, 16bytes more to align correctly mod 16)
80 :    
81 : Isibaar 1839 movdqa xmm2, [xmm_0x80]
82 : suxen_drol 1493
83 : edgomez 1538 ; Create a offset...offset vector
84 : Isibaar 1805 mov _ESI, _ESP ; TMP1 will be esp aligned mod 16
85 :     add _ESI, 15 ; TMP1 = esp + 15
86 :     and _ESI, ~15 ; TMP1 = (esp + 15)&(~15)
87 :     CREATE_OFFSET_VECTOR _ESI, al
88 : Isibaar 1839 movdqa xmm3, [_ESI]
89 : suxen_drol 1493
90 : Isibaar 1795 %ifdef ARCH_IS_X86_64
91 :     mov _ESI, prm3
92 :     mov _EDI, prm4
93 :     %else
94 :     mov _ESI, [_ESP+8+32+12] ; width
95 :     mov _EDI, [_ESP+8+32+16] ; height
96 :     %endif
97 : suxen_drol 1493
98 : Isibaar 1793 .yloop:
99 : Isibaar 1795 xor _EAX, _EAX
100 : suxen_drol 1493
101 : Isibaar 1793 .xloop:
102 : Isibaar 1795 movdqa xmm0, [TMP1 + _EAX]
103 :     movdqa xmm1, [TMP1 + _EAX + 16] ; xmm0 = [dst]
104 : suxen_drol 1493
105 : Isibaar 1839 paddb xmm0, xmm2 ; unsigned -> signed domain
106 :     paddb xmm1, xmm2
107 :     paddsb xmm0, xmm3
108 :     paddsb xmm1, xmm3 ; xmm0 += offset
109 :     psubb xmm0, xmm2
110 :     psubb xmm1, xmm2 ; signed -> unsigned domain
111 : suxen_drol 1493
112 : Isibaar 1795 movdqa [TMP1 + _EAX], xmm0
113 :     movdqa [TMP1 + _EAX + 16], xmm1 ; [dst] = xmm0
114 : suxen_drol 1493
115 : Isibaar 1795 add _EAX,32
116 :     cmp _EAX,_ESI
117 : edgomez 1538 jl .xloop
118 : suxen_drol 1493
119 : Isibaar 1795 add TMP1, TMP0 ; dst += stride
120 : Isibaar 1834 dec _EDI
121 : edgomez 1538 jg .yloop
122 : suxen_drol 1493
123 : Isibaar 1795 add _ESP, 32
124 :     pop _EDI
125 :     pop _ESI
126 : suxen_drol 1493
127 : edgomez 1538 ret
128 : Isibaar 1793 ENDFUNC
129 : suxen_drol 1493 ;//////////////////////////////////////////////////////////////////////
130 : Isibaar 1790
131 :     %ifidn __OUTPUT_FORMAT__,elf
132 :     section ".note.GNU-stack" noalloc noexec nowrite progbits
133 :     %endif
134 :    

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