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

Diff of /trunk/xvidcore/src/image/x86_asm/postprocessing_sse2.asm

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1538, Sat Aug 28 13:07:56 2004 UTC revision 1798, Wed Nov 26 02:21:02 2008 UTC
# Line 22  Line 22 
22  ; *  ; *
23  ; *************************************************************************/  ; *************************************************************************/
24    
25  BITS 32  %include "nasm.inc"
   
 %macro cglobal 1  
         %ifdef PREFIX  
                 %ifdef MARK_FUNCS  
                         global _%1:function  
                         %define %1 _%1:function  
                 %else  
                         global _%1  
                         %define %1 _%1  
                 %endif  
         %else  
                 %ifdef MARK_FUNCS  
                         global %1:function  
                 %else  
                         global %1  
                 %endif  
         %endif  
 %endmacro  
26    
27  ;===========================================================================  ;===========================================================================
28  ; read only data  ; read only data
29  ;===========================================================================  ;===========================================================================
30    
31  %ifdef FORMAT_COFF  DATA
 SECTION .rodata  
 %else  
 SECTION .rodata align=16  
 %endif  
32    
33  xmm_0x80:  xmm_0x80:
34          times 16 db 0x80          times 16 db 0x80
# Line 59  Line 37 
37  ; Code  ; Code
38  ;=============================================================================  ;=============================================================================
39    
40  SECTION .text  SECTION .rotext align=SECTION_ALIGN
41    
42  cglobal image_brightness_sse2  cglobal image_brightness_sse2
43    
# Line 86  Line 64 
64    mov [%1 + 15], %2    mov [%1 + 15], %2
65  %endmacro  %endmacro
66    
67  ALIGN 16  ALIGN SECTION_ALIGN
68  image_brightness_sse2:  image_brightness_sse2:
69    
70    push esi  %ifdef ARCH_IS_X86_64
71    push edi    ; 8 bytes offset for push    movsx _EAX, prm5d
72    sub esp, 32 ; 32 bytes for local data (16bytes will be used, 16bytes more to align correctly mod 16)  %else
73      mov eax, prm5   ; brightness offset value
74    %endif
75      mov TMP1, prm1  ; Dst
76      mov TMP0, prm2  ; stride
77    
78      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    movdqa xmm6, [xmm_0x80]    movdqa xmm6, [xmm_0x80]
83    
84    ; Create a offset...offset vector    ; Create a offset...offset vector
85    mov eax, [esp+8+32+20] ; brightness offset value    mov TMP1, _ESP          ; TMP1 will be esp aligned mod 16
86    mov edx, esp           ; edx will be esp aligned mod 16    add TMP1, 15            ; TMP1 = esp + 15
87    add edx, 15            ; edx = esp + 15    and TMP1, ~15           ; TMP1 = (esp + 15)&(~15)
88    and edx, ~15           ; edx = (esp + 15)&(~15)    CREATE_OFFSET_VECTOR TMP1, al
89    CREATE_OFFSET_VECTOR edx, al    movdqa xmm7, [TMP1]
90    movdqa xmm7, [edx]  
91    %ifdef ARCH_IS_X86_64
92    mov edx, [esp+8+32+4]  ; Dst    mov _ESI, prm3
93    mov ecx, [esp+8+32+8]  ; stride    mov _EDI, prm4
94    mov esi, [esp+8+32+12] ; width  %else
95    mov edi, [esp+8+32+16] ; height    mov _ESI, [_ESP+8+32+12] ; width
96      mov _EDI, [_ESP+8+32+16] ; height
97  .yloop  %endif
98    xor eax, eax  
99    .yloop:
100  .xloop    xor _EAX, _EAX
101    movdqa xmm0, [edx + eax]  
102    movdqa xmm1, [edx + eax + 16] ; xmm0 = [dst]  .xloop:
103      movdqa xmm0, [TMP1 + _EAX]
104      movdqa xmm1, [TMP1 + _EAX + 16] ; xmm0 = [dst]
105    
106    paddb xmm0, xmm6              ; unsigned -> signed domain    paddb xmm0, xmm6              ; unsigned -> signed domain
107    paddb xmm1, xmm6    paddb xmm1, xmm6
# Line 122  Line 110 
110    psubb xmm0, xmm6    psubb xmm0, xmm6
111    psubb xmm1, xmm6              ; signed -> unsigned domain    psubb xmm1, xmm6              ; signed -> unsigned domain
112    
113    movdqa [edx + eax], xmm0    movdqa [TMP1 + _EAX], xmm0
114    movdqa [edx + eax + 16], xmm1 ; [dst] = xmm0    movdqa [TMP1 + _EAX + 16], xmm1 ; [dst] = xmm0
115    
116    add eax,32    add _EAX,32
117    cmp eax,esi    cmp _EAX,_ESI
118    jl .xloop    jl .xloop
119    
120    add edx, ecx                  ; dst += stride    add TMP1, TMP0                  ; dst += stride
121    sub edi, 1    sub _EDI, 1
122    jg .yloop    jg .yloop
123    
124    add esp, 32    add _ESP, 32
125    pop edi    pop _EDI
126    pop esi    pop _ESI
127    
128    ret    ret
129    ENDFUNC
130  ;//////////////////////////////////////////////////////////////////////  ;//////////////////////////////////////////////////////////////////////
131    
132    %ifidn __OUTPUT_FORMAT__,elf
133    section ".note.GNU-stack" noalloc noexec nowrite progbits
134    %endif
135    

Legend:
Removed from v.1538  
changed lines
  Added in v.1798

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