[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 1839, Tue Dec 2 13:44:55 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    %ifdef ARCH_IS_X86_64
70      movsx _EAX, prm5d
71    %else
72      mov eax, prm5   ; brightness offset value
73    %endif
74      mov TMP1, prm1  ; Dst
75      mov TMP0, prm2  ; stride
76    
77    push esi    push _ESI
78    push edi    ; 8 bytes offset for push    push _EDI    ; 8 bytes offset for push
79    sub esp, 32 ; 32 bytes for local data (16bytes will be used, 16bytes more to align correctly mod 16)    sub _ESP, 32 ; 32 bytes for local data (16bytes will be used, 16bytes more to align correctly mod 16)
80    
81    movdqa xmm6, [xmm_0x80]    movdqa xmm2, [xmm_0x80]
82    
83    ; Create a offset...offset vector    ; Create a offset...offset vector
84    mov eax, [esp+8+32+20] ; brightness offset value    mov _ESI, _ESP          ; TMP1 will be esp aligned mod 16
85    mov edx, esp           ; edx will be esp aligned mod 16    add _ESI, 15            ; TMP1 = esp + 15
86    add edx, 15            ; edx = esp + 15    and _ESI, ~15           ; TMP1 = (esp + 15)&(~15)
87    and edx, ~15           ; edx = (esp + 15)&(~15)    CREATE_OFFSET_VECTOR _ESI, al
88    CREATE_OFFSET_VECTOR edx, al    movdqa xmm3, [_ESI]
89    movdqa xmm7, [edx]  
90    %ifdef ARCH_IS_X86_64
91    mov edx, [esp+8+32+4]  ; Dst    mov _ESI, prm3
92    mov ecx, [esp+8+32+8]  ; stride    mov _EDI, prm4
93    mov esi, [esp+8+32+12] ; width  %else
94    mov edi, [esp+8+32+16] ; height    mov _ESI, [_ESP+8+32+12] ; width
95      mov _EDI, [_ESP+8+32+16] ; height
96    %endif
97    
98  .yloop:  .yloop:
99    xor eax, eax    xor _EAX, _EAX
100    
101  .xloop:  .xloop:
102    movdqa xmm0, [edx + eax]    movdqa xmm0, [TMP1 + _EAX]
103    movdqa xmm1, [edx + eax + 16] ; xmm0 = [dst]    movdqa xmm1, [TMP1 + _EAX + 16] ; xmm0 = [dst]
104    
105    paddb xmm0, xmm6              ; unsigned -> signed domain    paddb xmm0, xmm2              ; unsigned -> signed domain
106    paddb xmm1, xmm6    paddb xmm1, xmm2
107    paddsb xmm0, xmm7    paddsb xmm0, xmm3
108    paddsb xmm1, xmm7             ; xmm0 += offset    paddsb xmm1, xmm3             ; xmm0 += offset
109    psubb xmm0, xmm6    psubb xmm0, xmm2
110    psubb xmm1, xmm6              ; signed -> unsigned domain    psubb xmm1, xmm2              ; signed -> unsigned domain
111    
112    movdqa [edx + eax], xmm0    movdqa [TMP1 + _EAX], xmm0
113    movdqa [edx + eax + 16], xmm1 ; [dst] = xmm0    movdqa [TMP1 + _EAX + 16], xmm1 ; [dst] = xmm0
114    
115    add eax,32    add _EAX,32
116    cmp eax,esi    cmp _EAX,_ESI
117    jl .xloop    jl .xloop
118    
119    add edx, ecx                  ; dst += stride    add TMP1, TMP0                  ; dst += stride
120    sub edi, 1    dec _EDI
121    jg .yloop    jg .yloop
122    
123    add esp, 32    add _ESP, 32
124    pop edi    pop _EDI
125    pop esi    pop _ESI
126    
127    ret    ret
128  ENDFUNC  ENDFUNC

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

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