[XviD-devel] [BUG]

skal skal at planet-d.net
Tue Oct 28 15:46:42 CET 2003


	Hi,

On Tue, 2003-10-28 at 16:41, Edouard Gomez wrote:
> skal (skal at planet-d.net) wrote:
> > > I just noticed dev16_sse2 is using a buffer, as usual that is not thread
> > > safe (nor encore instance safe).
> > 
> > 	here's one, not very tested, but should be ok.
> > 
> > 	bye!
> 
> And do you have a clean sad16 sse2, 

	Sure.

> the current code is bit complicated for
> what this function is supposed to do,  and most of it is just jumping to
> subcases  to  handle  alignment  or  best  sad  cases

	... which i doubt is an overall gain in the end...

	bye!
Skal


-------------- next part --------------
; uint32_t sad16_sse2 (const uint8_t * const cur,   ; <- assumed aligned!
;                      const uint8_t * const ref,
;	               const uint32_t stride,
;                      const uint32_t /*ignored*/);


%macro SAD_16x16_SSE2 0
  movdqu  xmm0, [edx]  
  movdqu  xmm1, [edx+ecx]
  lea edx,[edx+2*ecx]
  movdqa  xmm2, [eax]
  movdqa  xmm3, [eax+ecx]
  lea eax,[eax+2*ecx]
  psadbw  xmm0, xmm2 
  paddusw xmm6,xmm0  
  psadbw  xmm1, xmm3 
  paddusw xmm6,xmm1  
%endmacro

align 16
sad16_sse2:
  mov eax, [esp+ 4] ; cur (assumed aligned)
  mov edx, [esp+ 8] ; ref
  mov ecx, [esp+12] ; stride 

  pxor xmm6, xmm6 ; accum

  SAD_16x16_SSE2
  SAD_16x16_SSE2
  SAD_16x16_SSE2
  SAD_16x16_SSE2
  SAD_16x16_SSE2
  SAD_16x16_SSE2
  SAD_16x16_SSE2
  SAD_16x16_SSE2

  pshufd  xmm5, xmm6, 00000010b
  paddusw xmm6, xmm5
  pextrw  eax, xmm6, 0
  ret



More information about the XviD-devel mailing list