[XviD-devel] [BUG]

skal skal at planet-d.net
Mon Oct 27 15:45:59 CET 2003


	Hi,

On Mon, 2003-10-27 at 14:30, Edouard Gomez wrote:
> Still doing ASM cleanup (quite boring)
> 
> 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!

Skal

(btw: please, very please, don't replace spaces by tabs. This is
a very Bad Habit).


-------------- next part --------------
;
; extern uint32_t dev16_sse2(const uint8_t * const cur, const uint32_t stride);
;

%macro MEAN_16x16_SSE2 0  ; eax: src, ecx:stride, mm7: zero or mean => mm6: result
  movdqu xmm0, [eax]
  movdqu xmm1, [eax+ecx]
  lea eax, [eax+2*ecx]    ; + 2*stride
  psadbw xmm0, xmm7
  paddusw xmm6, xmm0
  psadbw xmm1, xmm7
  paddusw xmm6, xmm1
%endmacro


align 16
dev16_sse2:
  mov eax, [esp+ 4]   ; src
  mov ecx, [esp+ 8]   ; stride

  pxor xmm6, xmm6     ; accum
  pxor xmm7, xmm7     ; zero

  MEAN_16x16_SSE2
  MEAN_16x16_SSE2
  MEAN_16x16_SSE2
  MEAN_16x16_SSE2

  MEAN_16x16_SSE2
  MEAN_16x16_SSE2
  MEAN_16x16_SSE2
  MEAN_16x16_SSE2

  mov eax, [esp+ 4]       ; src again

  pshufd   xmm7, xmm6, 0010b
  paddusw  xmm7, xmm6
  pxor     xmm6, xmm6     ; zero accum
  psrlw    xmm7, 8        ; => Mean
  pshuflw  xmm7, xmm7, 0  ; replicate Mean
  packuswb xmm7,xmm7

  MEAN_16x16_SSE2
  MEAN_16x16_SSE2
  MEAN_16x16_SSE2
  MEAN_16x16_SSE2

  MEAN_16x16_SSE2
  MEAN_16x16_SSE2
  MEAN_16x16_SSE2
  MEAN_16x16_SSE2

  pshufd  xmm5, xmm6, 0010b
  paddusw xmm6, xmm5
  pextrw  eax, xmm6, 0

  ret



More information about the XviD-devel mailing list