On Thu, Jun 09, 2011 at 02:26:29PM +0100, Måns Rullgård wrote:
> Kostya <[email protected]> writes:
> 
> > On Wed, Jun 08, 2011 at 12:55:01PM -0400, Ronald S. Bultje wrote:
> >> This generates better code on some non-x86 architectures.
> >> ---
> >>  libswscale/swscale.c |   49 
> >> ++++++++++++++++++-------------------------------
> >>  1 files changed, 18 insertions(+), 31 deletions(-)
> >> 
> >> diff --git a/libswscale/swscale.c b/libswscale/swscale.c
> >> index 9833101..500d838 100644
> >> --- a/libswscale/swscale.c
> >> +++ b/libswscale/swscale.c
> >> @@ -404,6 +404,12 @@ static void yuv2nv12X_c(SwsContext *c, const int16_t 
> >> *lumFilter,
> >>          Y2>>=19;\
> >>          U >>=19;\
> >>          V >>=19;\
> >> +        if ((Y1|Y2|U|V)&256) {\
> >> +            Y1 = av_clip_uint8(Y1); \
> >> +            Y2 = av_clip_uint8(Y2); \
> >> +            U  = av_clip_uint8(U); \
> >> +            V  = av_clip_uint8(V); \
> >> +        }\
> >
> > I'd write condition as (Y1|Y2|U|V) & 0x100 (since it needs some spaces and 
> > hex
> > constants are more readable here), the same below with 65536. Otherwise OK.
> 
> The condition seems strange.  Why should they be clipped if bit 8 it
> set, but not if bit 9 or higher is?

because somebody hoped it won't overflow that much in calculations, but ~0xFF
would be better indeed
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to