changeset 28881:340e60d5b46b

Mask all unused bits for packed pixel format instead of green and alpha mask only. That fixes the case when converting 15-bit RGB/BGR to YUV and high bit is set for input value(s).
author kostya
date Mon, 09 Mar 2009 17:25:43 +0000
parents fa0b56ac4423
children 15f93fd5cd48
files libswscale/swscale_template.c
diffstat 1 files changed, 1 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/libswscale/swscale_template.c	Mon Mar 09 15:01:53 2009 +0000
+++ b/libswscale/swscale_template.c	Mon Mar 09 17:25:43 2009 +0000
@@ -1663,7 +1663,7 @@
     {\
         int pix0= ((type*)src)[2*i+0];\
         int pix1= ((type*)src)[2*i+1];\
-        int g= (pix0&(maskg|maska))+(pix1&(maskg|maska));\
+        int g= (pix0&~(maskr|maskb))+(pix1&~(maskr|maskb));\
         int b= ((pix0+pix1-g)&(maskb|(2*maskb)))>>shb;\
         int r= ((pix0+pix1-g)&(maskr|(2*maskr)))>>shr;\
         g&= maskg|(2*maskg);\