[MPlayer-dev-eng] [PATCH] altivec fixes, part 2: missing vec_splat
Alan Curry
pacman at TheWorld.com
Mon Feb 6 22:34:50 CET 2006
Diego Biurrun writes the following:
>
>On Mon, Feb 06, 2006 at 01:28:02AM -0500, Alan Curry wrote:
>> The vec_clip() macro didn't work correctly because it didn't vec_splat() its
>> constants.
>
>Please elaborate...
As modified by me, it reads:
#define vec_clip(x) \
vec_max (vec_min (x, vec_splat((typeof(x))AVV(235),0)), \
vec_splat((typeof(x))AVV(16),0))
This creates a vector full of 235's and a vector full of 16's, and uses min
and max to clamp all components the x vector between 16 and 235. Without the
vec_splat, the constant vectors generated by AVV() are {16,0,0,0,...} and
{235,0,0,0,...} so the first element of the result is correct, and the rest
are all 0.
Maybe the behavior of AVV() is compiler-dependent; mine is
gcc version 3.3.5 (Debian 1:3.3.5-13)
All other uses of the AVV() macro with a single non-zero argument are
surrounded by vec_splat(...,0) which makes them work around this compiler
bug/feature.
More information about the MPlayer-dev-eng
mailing list