[svn] / trunk / xvidcore / src / motion / x86_asm / sad_mmx.asm Repository:
ViewVC logotype

Diff of /trunk/xvidcore/src/motion/x86_asm/sad_mmx.asm

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

revision 1382, Mon Mar 22 22:36:25 2004 UTC revision 1535, Sun Aug 22 11:46:10 2004 UTC
# Line 20  Line 20 
20  ; *  along with this program; if not, write to the Free Software  ; *  along with this program; if not, write to the Free Software
21  ; *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA  ; *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
22  ; *  ; *
23  ; * $Id: sad_mmx.asm,v 1.12 2004-03-22 22:36:24 edgomez Exp $  ; * $Id: sad_mmx.asm,v 1.15 2004-08-22 11:46:10 edgomez Exp $
24  ; *  ; *
25  ; ***************************************************************************/  ; ***************************************************************************/
26    
# Line 28  Line 28 
28    
29  %macro cglobal 1  %macro cglobal 1
30          %ifdef PREFIX          %ifdef PREFIX
31                    %ifdef MARK_FUNCS
32                            global _%1:function
33                            %define %1 _%1:function
34                    %else
35                  global _%1                  global _%1
36                  %define %1 _%1                  %define %1 _%1
37                    %endif
38            %else
39                    %ifdef MARK_FUNCS
40                            global %1:function
41          %else          %else
42                  global %1                  global %1
43          %endif          %endif
44            %endif
45  %endmacro  %endmacro
46    
47  ;=============================================================================  ;=============================================================================
# Line 40  Line 49 
49  ;=============================================================================  ;=============================================================================
50    
51  %ifdef FORMAT_COFF  %ifdef FORMAT_COFF
52  SECTION .rodata data  SECTION .rodata
53  %else  %else
54  SECTION .rodata data align=16  SECTION .rodata align=16
55  %endif  %endif
56    
57  ALIGN 16  ALIGN 16
# Line 270  Line 279 
279  cglobal sad8bi_mmx  cglobal sad8bi_mmx
280  cglobal dev16_mmx  cglobal dev16_mmx
281  cglobal sse8_16bit_mmx  cglobal sse8_16bit_mmx
282    cglobal sse8_8bit_mmx
283    
284  ;-----------------------------------------------------------------------------  ;-----------------------------------------------------------------------------
285  ;  ;
# Line 630  Line 640 
640  ;  ;
641  ;-----------------------------------------------------------------------------  ;-----------------------------------------------------------------------------
642    
643  %macro ROW_SSE_MMX 2  %macro ROW_SSE_16bit_MMX 2
644    movq mm0, [%1]    movq mm0, [%1]
645    movq mm1, [%1+8]    movq mm1, [%1+8]
646    psubw mm0, [%2]    psubw mm0, [%2]
# Line 654  Line 664 
664    pxor mm2, mm2    pxor mm2, mm2
665    
666    ;; Let's go    ;; Let's go
667    ROW_SSE_MMX esi, edi  %rep 8
668    lea esi, [esi+edx]    ROW_SSE_16bit_MMX esi, edi
   lea edi, [edi+edx]  
   ROW_SSE_MMX esi, edi  
   lea esi, [esi+edx]  
   lea edi, [edi+edx]  
   ROW_SSE_MMX esi, edi  
   lea esi, [esi+edx]  
   lea edi, [edi+edx]  
   ROW_SSE_MMX esi, edi  
   lea esi, [esi+edx]  
   lea edi, [edi+edx]  
   ROW_SSE_MMX esi, edi  
   lea esi, [esi+edx]  
   lea edi, [edi+edx]  
   ROW_SSE_MMX esi, edi  
   lea esi, [esi+edx]  
   lea edi, [edi+edx]  
   ROW_SSE_MMX esi, edi  
   lea esi, [esi+edx]  
   lea edi, [edi+edx]  
   ROW_SSE_MMX esi, edi  
669    lea esi, [esi+edx]    lea esi, [esi+edx]
670    lea edi, [edi+edx]    lea edi, [edi+edx]
671    %endrep
672    
673    ;; Finish adding each dword of the accumulator    ;; Finish adding each dword of the accumulator
674    movq mm3, mm2    movq mm3, mm2
# Line 689  Line 680 
680    pop edi    pop edi
681    pop esi    pop esi
682    ret    ret
683    
684    ;-----------------------------------------------------------------------------
685    ;
686    ; uint32_t sse8_8bit_mmx(const int8_t *b1,
687    ;                        const int8_t *b2,
688    ;                        const uint32_t stride);
689    ;
690    ;-----------------------------------------------------------------------------
691    
692    %macro ROW_SSE_8bit_MMX 2
693      movq mm0, [%1] ; load a row
694      movq mm2, [%2] ; load a row
695    
696      movq mm1, mm0  ; copy row
697      movq mm3, mm2  ; copy row
698    
699      punpcklbw mm0, mm7 ; turn the 4low elements into 16bit
700      punpckhbw mm1, mm7 ; turn the 4high elements into 16bit
701    
702      punpcklbw mm2, mm7 ; turn the 4low elements into 16bit
703      punpckhbw mm3, mm7 ; turn the 4high elements into 16bit
704    
705      psubw mm0, mm2 ; low  part of src-dst
706      psubw mm1, mm3 ; high part of src-dst
707    
708      pmaddwd mm0, mm0 ; compute the square sum
709      pmaddwd mm1, mm1 ; compute the square sum
710    
711      paddd mm6, mm0 ; add to the accumulator
712      paddd mm6, mm1 ; add to the accumulator
713    %endmacro
714    
715    sse8_8bit_mmx:
716      push esi
717      push edi
718    
719      ;; Load the function params
720      mov esi, [esp+8+4]
721      mov edi, [esp+8+8]
722      mov edx, [esp+8+12]
723    
724      ;; Reset the sse accumulator
725      pxor mm6, mm6
726    
727      ;; Used to interleave 8bit data with 0x00 values
728      pxor mm7, mm7
729    
730      ;; Let's go
731    %rep 8
732      ROW_SSE_8bit_MMX esi, edi
733      lea esi, [esi+edx]
734      lea edi, [edi+edx]
735    %endrep
736    
737      ;; Finish adding each dword of the accumulator
738      movq mm7, mm6
739      psrlq mm6, 32
740      paddd mm6, mm7
741      movd eax, mm6
742    
743      ;; All done
744      pop edi
745      pop esi
746      ret

Legend:
Removed from v.1382  
changed lines
  Added in v.1535

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