[vlc-devel] commit: Do not use a macro to clip integer to?uint8 (2x faster YUVA->RV32) (Laurent Aimar )

Laurent Aimar fenrir at via.ecp.fr
Wed Jul 23 21:30:07 CEST 2008

On Wed, Jul 23, 2008, Rémi Denis-Courmont wrote:
> Le mercredi 23 juillet 2008 21:32:14 Miguel Angel Cabrera, vous avez écrit :
> > Would not be faster to do a bitmask?
> I wonder what bitmask would do that...
 A simple bitmask cannot but something like that will trade 1 test against
a few instructions:
uint8_t vlc_uint8( int v )
  if( v & ~255 )
    return (  (-v) >> ( 8*sizeof(int)-1 ) ) & 0xff;
  return v
but it did not seemed to make a real difference (and is more offuscated).

> OTOH, I suppose MMX saturation arithmetic can do this.
blend.c would be way faster with mmx/sse2 but I will not write gcc inline ASM.
(It is way too ugly)

More information about the vlc-devel mailing list