[XviD-devel] Quality optimization

skal skal at planet-d.net
Thu Feb 27 18:32:17 CET 2003


	Hi Tom,

On Thu, 2003-02-27 at 18:02, trbarry at trbarry.com wrote:

> Although thinking about it, for machines that support these instructions
> it seems you
> could just use:
> 
>      movq	  mm2, mm0  ; make a copy of source
>      pminsw mm0, mm1  ; signed word min
>      pmaxsw mm1, mm2  ; signed word max
> 	psubw  mm1, mm0  ; big - small
> 

	the problem with this method is that it uses 1 register
	for copy; even with the special case mm1==0 i'm interested
	in. 
	Moreover, 'mm0' can't be a memory address here.
	Hence, instead, I've used:
  pxor    mm7, mm7
  pcmpgtw mm7, %1 
  pxor    mm5, mm5
  pcmpgtw mm5, %2  
  psubw   mm6, mm7
  pxor    mm7, %1  
  psubw   mm6, mm5
  paddw   mm6, mm7
  pxor    mm5, %2 
  paddw   mm6, mm5

	to perform two abs value in //. 
	It uses 2 regs, 1 accum (mm6) and sources [%1] and [%2]
	can be in memory...

	bye
		Skal




More information about the XviD-devel mailing list