[Mplayer-cvslog] CVS: main/postproc rgb2rgb.c,1.22,1.23 rgb2rgb.h,1.9,1.10

Michael Niedermayer michaelni at gmx.at
Mon Nov 5 13:01:01 CET 2001


On Monday 05 November 2001 09:55, Nick Kurshev wrote:
>
> -void rgb32to16(const uint8_t *src, uint8_t *dst, uint32_t num_pixels)
> +void rgb32to16(const uint8_t *src, uint8_t *dst, uint32_t src_size)
>  {
> -	uint32_t i;
> -	for(i=0; i<num_pixels; i+=4)
> +	const uint8_t *end, *s;
> +	s = src;
> +	end = s + src_size;
> +	while(s < end)
>  	{
> -		const int b= src[i+0];
> -		const int g= src[i+1];
> -		const int r= src[i+2];
> +		const int b= *s++;
> +		const int g= *s++;
> +		const int r= *s++;
>
> -		((uint16_t *)dst)[i]= (b>>3) | ((g&0xFC)<<3) | ((r&0xF8)<<8);
> +		*((uint16_t *)dst) = (b>>3) | ((g&0xFC)<<3) | ((r&0xF8)<<8);
> +		dst+=2;
> +		s++;
>  	}
>  }
this is inacceptable, it is harder to read and very likely slower (arrays 
tend to be faster than pointers)

did u try a -benchmark? if not than please reverse this change

Michael



More information about the MPlayer-cvslog mailing list