[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 1535 - (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 : edgomez 1535 ; * $Id: postprocessing_mmx.asm,v 1.3 2004-08-22 11:46:10 edgomez 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 :     global _%1:function
32 :     %define %1 _%1:function
33 :     %else
34 :     global _%1
35 :     %define %1 _%1
36 :     %endif
37 : suxen_drol 1397 %else
38 : edgomez 1535 %ifdef MARK_FUNCS
39 :     global %1:function
40 :     %else
41 :     global %1
42 :     %endif
43 : suxen_drol 1397 %endif
44 :     %endmacro
45 :    
46 :     ;===========================================================================
47 :     ; read only data
48 :     ;===========================================================================
49 :    
50 :     %ifdef FORMAT_COFF
51 : edgomez 1519 SECTION .rodata
52 : suxen_drol 1397 %else
53 : edgomez 1519 SECTION .rodata align=16
54 : suxen_drol 1397 %endif
55 :    
56 :     mmx_0x80:
57 :     times 8 db 0x80
58 :    
59 :     mmx_offset:
60 :     %assign i -128
61 :     %rep 256
62 :     times 8 db i
63 :     %assign i i+1
64 :     %endrep
65 :    
66 :    
67 :     ;=============================================================================
68 :     ; Code
69 :     ;=============================================================================
70 :    
71 :     SECTION .text
72 :    
73 :     cglobal image_brightness_mmx
74 :    
75 :    
76 :     ;//////////////////////////////////////////////////////////////////////
77 :     ;// image_brightness_mmx
78 :     ;//////////////////////////////////////////////////////////////////////
79 :    
80 :     align 16
81 :     image_brightness_mmx:
82 :    
83 :     push esi
84 :     push edi
85 :    
86 :     movq mm6, [mmx_0x80]
87 :    
88 :     mov eax, [esp+8+20] ; offset
89 :     movq mm7, [mmx_offset + (eax + 128)*8] ; being lazy
90 :    
91 :     mov edx, [esp+8+4] ; Dst
92 :     mov ecx, [esp+8+8] ; stride
93 :     mov esi, [esp+8+12] ; width
94 :     mov edi, [esp+8+16] ; height
95 :    
96 :     .yloop
97 :     xor eax, eax
98 :    
99 :     .xloop
100 :     movq mm0, [edx + eax]
101 :     movq mm1, [edx + eax + 8] ; mm0 = [dst]
102 :    
103 :     paddb mm0, mm6 ; unsigned -> signed domain
104 :     paddb mm1, mm6
105 :     paddsb mm0, mm7
106 :     paddsb mm1, mm7 ; mm0 += offset
107 :     psubb mm0, mm6
108 :     psubb mm1, mm6 ; signed -> unsigned domain
109 :    
110 :     movq [edx + eax], mm0
111 :     movq [edx + eax + 8], mm1 ; [dst] = mm0
112 :    
113 :     add eax,16
114 :     cmp eax,esi
115 :     jl .xloop
116 :    
117 :     add edx, ecx ; dst += stride
118 :     sub edi, 1
119 :     jg .yloop
120 :    
121 :     pop edi
122 :     pop esi
123 :    
124 :     ret
125 :     ;//////////////////////////////////////////////////////////////////////

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