[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 1795 - (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 1795 ; * $Id: postprocessing_mmx.asm,v 1.7 2008-11-26 01:04:34 Isibaar Exp $
23 : suxen_drol 1397 ; *
24 :     ; *************************************************************************/
25 :    
26 : Isibaar 1795 %include "nasm.inc"
27 : suxen_drol 1397
28 :     ;===========================================================================
29 :     ; read only data
30 :     ;===========================================================================
31 :    
32 : Isibaar 1795 DATA
33 : suxen_drol 1397
34 :     mmx_0x80:
35 :     times 8 db 0x80
36 :    
37 :     mmx_offset:
38 :     %assign i -128
39 :     %rep 256
40 :     times 8 db i
41 :     %assign i i+1
42 :     %endrep
43 :    
44 :    
45 :     ;=============================================================================
46 :     ; Code
47 :     ;=============================================================================
48 :    
49 : Isibaar 1795 SECTION .rotext align=SECTION_ALIGN
50 : suxen_drol 1397
51 :     cglobal image_brightness_mmx
52 :    
53 :    
54 :     ;//////////////////////////////////////////////////////////////////////
55 :     ;// image_brightness_mmx
56 :     ;//////////////////////////////////////////////////////////////////////
57 :    
58 : Isibaar 1795 align SECTION_ALIGN
59 : suxen_drol 1397 image_brightness_mmx:
60 :    
61 :     movq mm6, [mmx_0x80]
62 :    
63 : Isibaar 1795 mov eax, prm5d ; offset
64 :     %ifdef ARCH_IS_X86_64
65 :     lea r9, [mmx_offset]
66 :     movq mm7, [r9 + (_EAX + 128)*8] ; being lazy
67 :     %else
68 :     movq mm7, [mmx_offset + (_EAX + 128)*8] ; being lazy
69 :     %endif
70 : suxen_drol 1397
71 : Isibaar 1795 mov TMP1, prm1 ; Dst
72 :     mov TMP0, prm2 ; stride
73 : suxen_drol 1397
74 : Isibaar 1795 push _ESI
75 :     push _EDI
76 :     %ifdef ARCH_IS_X86_64
77 :     mov _ESI, prm3
78 :     mov _EDI, prm4
79 :     %else
80 :     mov _ESI, [_ESP+8+12] ; width
81 :     mov _EDI, [_ESP+8+16] ; height
82 :     %endif
83 :    
84 : Isibaar 1793 .yloop:
85 : Isibaar 1795 xor _EAX, _EAX
86 : suxen_drol 1397
87 : Isibaar 1793 .xloop:
88 : Isibaar 1795 movq mm0, [TMP1 + _EAX]
89 :     movq mm1, [TMP1 + _EAX + 8] ; mm0 = [dst]
90 : suxen_drol 1397
91 :     paddb mm0, mm6 ; unsigned -> signed domain
92 :     paddb mm1, mm6
93 :     paddsb mm0, mm7
94 :     paddsb mm1, mm7 ; mm0 += offset
95 :     psubb mm0, mm6
96 :     psubb mm1, mm6 ; signed -> unsigned domain
97 :    
98 : Isibaar 1795 movq [TMP1 + _EAX], mm0
99 :     movq [TMP1 + _EAX + 8], mm1 ; [dst] = mm0
100 : suxen_drol 1397
101 : Isibaar 1795 add _EAX,16
102 :     cmp _EAX,_ESI
103 : suxen_drol 1397 jl .xloop
104 :    
105 : Isibaar 1795 add TMP1, TMP0 ; dst += stride
106 :     sub _EDI, 1
107 : suxen_drol 1397 jg .yloop
108 :    
109 : Isibaar 1795 pop _EDI
110 :     pop _ESI
111 : suxen_drol 1397
112 :     ret
113 : Isibaar 1793 ENDFUNC
114 : suxen_drol 1397 ;//////////////////////////////////////////////////////////////////////
115 : Isibaar 1790
116 :     %ifidn __OUTPUT_FORMAT__,elf
117 :     section ".note.GNU-stack" noalloc noexec nowrite progbits
118 :     %endif
119 :    

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