[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 1793, Tue Nov 11 20:46:24 2008 UTC revision 1795, Wed Nov 26 01:04:34 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 %1.endfunc-%1  
                         %define %1 _%1:function %1.endfunc-%1  
                         %define ENDFUNC .endfunc  
                 %else  
                         global _%1  
                         %define %1 _%1  
                         %define ENDFUNC  
                 %endif  
         %else  
                 %ifdef MARK_FUNCS  
                         global %1:function %1.endfunc-%1  
                         %define ENDFUNC .endfunc  
                 %else  
                         global %1  
                         %define ENDFUNC  
                 %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 63  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 90  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    mov eax, prm5d  ; brightness offset value
71    push edi    ; 8 bytes offset for push    mov TMP1, prm1  ; Dst
72    sub esp, 32 ; 32 bytes for local data (16bytes will be used, 16bytes more to align correctly mod 16)    mov TMP0, prm2  ; stride
73    
74      push _ESI
75      push _EDI    ; 8 bytes offset for push
76      sub _ESP, 32 ; 32 bytes for local data (16bytes will be used, 16bytes more to align correctly mod 16)
77    
78    movdqa xmm6, [xmm_0x80]    movdqa xmm6, [xmm_0x80]
79    
80    ; Create a offset...offset vector    ; Create a offset...offset vector
81    mov eax, [esp+8+32+20] ; brightness offset value    mov TMP1, _ESP          ; TMP1 will be esp aligned mod 16
82    mov edx, esp           ; edx will be esp aligned mod 16    add TMP1, 15            ; TMP1 = esp + 15
83    add edx, 15            ; edx = esp + 15    and TMP1, ~15           ; TMP1 = (esp + 15)&(~15)
84    and edx, ~15           ; edx = (esp + 15)&(~15)    CREATE_OFFSET_VECTOR TMP1, al
85    CREATE_OFFSET_VECTOR edx, al    movdqa xmm7, [TMP1]
86    movdqa xmm7, [edx]  
87    %ifdef ARCH_IS_X86_64
88    mov edx, [esp+8+32+4]  ; Dst    mov _ESI, prm3
89    mov ecx, [esp+8+32+8]  ; stride    mov _EDI, prm4
90    mov esi, [esp+8+32+12] ; width  %else
91    mov edi, [esp+8+32+16] ; height    mov _ESI, [_ESP+8+32+12] ; width
92      mov _EDI, [_ESP+8+32+16] ; height
93    %endif
94    
95  .yloop:  .yloop:
96    xor eax, eax    xor _EAX, _EAX
97    
98  .xloop:  .xloop:
99    movdqa xmm0, [edx + eax]    movdqa xmm0, [TMP1 + _EAX]
100    movdqa xmm1, [edx + eax + 16] ; xmm0 = [dst]    movdqa xmm1, [TMP1 + _EAX + 16] ; xmm0 = [dst]
101    
102    paddb xmm0, xmm6              ; unsigned -> signed domain    paddb xmm0, xmm6              ; unsigned -> signed domain
103    paddb xmm1, xmm6    paddb xmm1, xmm6
# Line 126  Line 106 
106    psubb xmm0, xmm6    psubb xmm0, xmm6
107    psubb xmm1, xmm6              ; signed -> unsigned domain    psubb xmm1, xmm6              ; signed -> unsigned domain
108    
109    movdqa [edx + eax], xmm0    movdqa [TMP1 + _EAX], xmm0
110    movdqa [edx + eax + 16], xmm1 ; [dst] = xmm0    movdqa [TMP1 + _EAX + 16], xmm1 ; [dst] = xmm0
111    
112    add eax,32    add _EAX,32
113    cmp eax,esi    cmp _EAX,_ESI
114    jl .xloop    jl .xloop
115    
116    add edx, ecx                  ; dst += stride    add TMP1, TMP0                  ; dst += stride
117    sub edi, 1    sub _EDI, 1
118    jg .yloop    jg .yloop
119    
120    add esp, 32    add _ESP, 32
121    pop edi    pop _EDI
122    pop esi    pop _ESI
123    
124    ret    ret
125  ENDFUNC  ENDFUNC

Legend:
Removed from v.1793  
changed lines
  Added in v.1795

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