[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 1798 - (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 1795 SECTION .rotext align=SECTION_ALIGN
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 :    
70 : Isibaar 1798 %ifdef ARCH_IS_X86_64
71 :     movsx _EAX, prm5d
72 :     %else
73 :     mov eax, prm5 ; brightness offset value
74 :     %endif
75 : Isibaar 1795 mov TMP1, prm1 ; Dst
76 :     mov TMP0, prm2 ; stride
77 : suxen_drol 1493
78 : Isibaar 1795 push _ESI
79 :     push _EDI ; 8 bytes offset for push
80 :     sub _ESP, 32 ; 32 bytes for local data (16bytes will be used, 16bytes more to align correctly mod 16)
81 :    
82 : edgomez 1538 movdqa xmm6, [xmm_0x80]
83 : suxen_drol 1493
84 : edgomez 1538 ; Create a offset...offset vector
85 : Isibaar 1795 mov TMP1, _ESP ; TMP1 will be esp aligned mod 16
86 :     add TMP1, 15 ; TMP1 = esp + 15
87 :     and TMP1, ~15 ; TMP1 = (esp + 15)&(~15)
88 :     CREATE_OFFSET_VECTOR TMP1, al
89 :     movdqa xmm7, [TMP1]
90 : suxen_drol 1493
91 : Isibaar 1795 %ifdef ARCH_IS_X86_64
92 :     mov _ESI, prm3
93 :     mov _EDI, prm4
94 :     %else
95 :     mov _ESI, [_ESP+8+32+12] ; width
96 :     mov _EDI, [_ESP+8+32+16] ; height
97 :     %endif
98 : suxen_drol 1493
99 : Isibaar 1793 .yloop:
100 : Isibaar 1795 xor _EAX, _EAX
101 : suxen_drol 1493
102 : Isibaar 1793 .xloop:
103 : Isibaar 1795 movdqa xmm0, [TMP1 + _EAX]
104 :     movdqa xmm1, [TMP1 + _EAX + 16] ; xmm0 = [dst]
105 : suxen_drol 1493
106 : edgomez 1538 paddb xmm0, xmm6 ; unsigned -> signed domain
107 :     paddb xmm1, xmm6
108 :     paddsb xmm0, xmm7
109 :     paddsb xmm1, xmm7 ; xmm0 += offset
110 :     psubb xmm0, xmm6
111 :     psubb xmm1, xmm6 ; signed -> unsigned domain
112 : suxen_drol 1493
113 : Isibaar 1795 movdqa [TMP1 + _EAX], xmm0
114 :     movdqa [TMP1 + _EAX + 16], xmm1 ; [dst] = xmm0
115 : suxen_drol 1493
116 : Isibaar 1795 add _EAX,32
117 :     cmp _EAX,_ESI
118 : edgomez 1538 jl .xloop
119 : suxen_drol 1493
120 : Isibaar 1795 add TMP1, TMP0 ; dst += stride
121 :     sub _EDI, 1
122 : edgomez 1538 jg .yloop
123 : suxen_drol 1493
124 : Isibaar 1795 add _ESP, 32
125 :     pop _EDI
126 :     pop _ESI
127 : suxen_drol 1493
128 : edgomez 1538 ret
129 : Isibaar 1793 ENDFUNC
130 : suxen_drol 1493 ;//////////////////////////////////////////////////////////////////////
131 : Isibaar 1790
132 :     %ifidn __OUTPUT_FORMAT__,elf
133 :     section ".note.GNU-stack" noalloc noexec nowrite progbits
134 :     %endif
135 :    

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