[svn] / trunk / xvidcore / src / image / x86_asm / postprocessing_mmx.asm Repository:
ViewVC logotype

Annotation of /trunk/xvidcore/src/image/x86_asm/postprocessing_mmx.asm

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1793 - (view) (download)

1 : suxen_drol 1397 ;/*****************************************************************************
2 :     ; *
3 :     ; * XVID MPEG-4 VIDEO CODEC
4 :     ; * - mmx post processing -
5 :     ; *
6 :     ; * Copyright(C) 2004 Peter Ross <pross@xvid.org>
7 :     ; *
8 :     ; * XviD is free software; you can redistribute it and/or modify it
9 :     ; * under the terms of the GNU General Public License as published by
10 :     ; * the Free Software Foundation; either version 2 of the License, or
11 :     ; * (at your option) any later version.
12 :     ; *
13 :     ; * This program is distributed in the hope that it will be useful,
14 :     ; * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 :     ; * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 :     ; * GNU General Public License for more details.
17 :     ; *
18 :     ; * You should have received a copy of the GNU General Public License
19 :     ; * along with this program; if not, write to the Free Software
20 :     ; * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 :     ; *
22 : Isibaar 1793 ; * $Id: postprocessing_mmx.asm,v 1.6 2008-11-11 20:46:24 Isibaar Exp $
23 : suxen_drol 1397 ; *
24 :     ; *************************************************************************/
25 :    
26 :     BITS 32
27 :    
28 :     %macro cglobal 1
29 :     %ifdef PREFIX
30 : edgomez 1535 %ifdef MARK_FUNCS
31 : edgomez 1540 global _%1:function %1.endfunc-%1
32 :     %define %1 _%1:function %1.endfunc-%1
33 : Isibaar 1793 %define ENDFUNC .endfunc
34 : edgomez 1535 %else
35 :     global _%1
36 :     %define %1 _%1
37 : Isibaar 1793 %define ENDFUNC
38 : edgomez 1535 %endif
39 : suxen_drol 1397 %else
40 : edgomez 1535 %ifdef MARK_FUNCS
41 : edgomez 1540 global %1:function %1.endfunc-%1
42 : Isibaar 1793 %define ENDFUNC .endfunc
43 : edgomez 1535 %else
44 :     global %1
45 : Isibaar 1793 %define ENDFUNC
46 : edgomez 1535 %endif
47 : suxen_drol 1397 %endif
48 :     %endmacro
49 :    
50 :     ;===========================================================================
51 :     ; read only data
52 :     ;===========================================================================
53 :    
54 :     %ifdef FORMAT_COFF
55 : edgomez 1519 SECTION .rodata
56 : suxen_drol 1397 %else
57 : edgomez 1519 SECTION .rodata align=16
58 : suxen_drol 1397 %endif
59 :    
60 :     mmx_0x80:
61 :     times 8 db 0x80
62 :    
63 :     mmx_offset:
64 :     %assign i -128
65 :     %rep 256
66 :     times 8 db i
67 :     %assign i i+1
68 :     %endrep
69 :    
70 :    
71 :     ;=============================================================================
72 :     ; Code
73 :     ;=============================================================================
74 :    
75 :     SECTION .text
76 :    
77 :     cglobal image_brightness_mmx
78 :    
79 :    
80 :     ;//////////////////////////////////////////////////////////////////////
81 :     ;// image_brightness_mmx
82 :     ;//////////////////////////////////////////////////////////////////////
83 :    
84 :     align 16
85 :     image_brightness_mmx:
86 :    
87 :     push esi
88 :     push edi
89 :    
90 :     movq mm6, [mmx_0x80]
91 :    
92 :     mov eax, [esp+8+20] ; offset
93 :     movq mm7, [mmx_offset + (eax + 128)*8] ; being lazy
94 :    
95 :     mov edx, [esp+8+4] ; Dst
96 :     mov ecx, [esp+8+8] ; stride
97 :     mov esi, [esp+8+12] ; width
98 :     mov edi, [esp+8+16] ; height
99 :    
100 : Isibaar 1793 .yloop:
101 : suxen_drol 1397 xor eax, eax
102 :    
103 : Isibaar 1793 .xloop:
104 : suxen_drol 1397 movq mm0, [edx + eax]
105 :     movq mm1, [edx + eax + 8] ; mm0 = [dst]
106 :    
107 :     paddb mm0, mm6 ; unsigned -> signed domain
108 :     paddb mm1, mm6
109 :     paddsb mm0, mm7
110 :     paddsb mm1, mm7 ; mm0 += offset
111 :     psubb mm0, mm6
112 :     psubb mm1, mm6 ; signed -> unsigned domain
113 :    
114 :     movq [edx + eax], mm0
115 :     movq [edx + eax + 8], mm1 ; [dst] = mm0
116 :    
117 :     add eax,16
118 :     cmp eax,esi
119 :     jl .xloop
120 :    
121 :     add edx, ecx ; dst += stride
122 :     sub edi, 1
123 :     jg .yloop
124 :    
125 :     pop edi
126 :     pop esi
127 :    
128 :     ret
129 : Isibaar 1793 ENDFUNC
130 : suxen_drol 1397 ;//////////////////////////////////////////////////////////////////////
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