[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 1540, Sun Aug 29 10:02:38 2004 UTC revision 1844, Thu Dec 4 14:41:50 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  
                 %else  
                         global _%1  
                         %define %1 _%1  
                 %endif  
         %else  
                 %ifdef MARK_FUNCS  
                         global %1:function %1.endfunc-%1  
                 %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  TEXT
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    %ifdef ARCH_IS_X86_64
70      XVID_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  .yloop  %endif
97    xor eax, eax  
98    .yloop:
99  .xloop    xor _EAX, _EAX
   movdqa xmm0, [edx + eax]  
   movdqa xmm1, [edx + eax + 16] ; xmm0 = [dst]  
   
   paddb xmm0, xmm6              ; unsigned -> signed domain  
   paddb xmm1, xmm6  
   paddsb xmm0, xmm7  
   paddsb xmm1, xmm7             ; xmm0 += offset  
   psubb xmm0, xmm6  
   psubb xmm1, xmm6              ; signed -> unsigned domain  
100    
101    movdqa [edx + eax], xmm0  .xloop:
102    movdqa [edx + eax + 16], xmm1 ; [dst] = xmm0    movdqa xmm0, [TMP1 + _EAX]
103      movdqa xmm1, [TMP1 + _EAX + 16] ; xmm0 = [dst]
104    
105      paddb xmm0, xmm2              ; unsigned -> signed domain
106      paddb xmm1, xmm2
107      paddsb xmm0, xmm3
108      paddsb xmm1, xmm3             ; xmm0 += offset
109      psubb xmm0, xmm2
110      psubb xmm1, xmm2              ; signed -> unsigned domain
111    
112    add eax,32    movdqa [TMP1 + _EAX], xmm0
113    cmp eax,esi    movdqa [TMP1 + _EAX + 16], xmm1 ; [dst] = xmm0
114    
115      add _EAX,32
116      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
129  ;//////////////////////////////////////////////////////////////////////  ;//////////////////////////////////////////////////////////////////////
130    
131    %ifidn __OUTPUT_FORMAT__,elf
132    section ".note.GNU-stack" noalloc noexec nowrite progbits
133    %endif
134    

Legend:
Removed from v.1540  
changed lines
  Added in v.1844

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