changeset 27536:dded40ae9728

Change RGB2YUV_SHIFT from 16 to 15 to make it able to work with 16bit signed constants (like SIMD might use).
author michael
date Wed, 10 Sep 2008 16:39:56 +0000
parents d92059f10deb
children 3c8584b0ac41
files libswscale/swscale.c libswscale/swscale_template.c
diffstat 2 files changed, 3 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/libswscale/swscale.c	Wed Sep 10 13:55:51 2008 +0000
+++ b/libswscale/swscale.c	Wed Sep 10 16:39:56 2008 +0000
@@ -152,7 +152,7 @@
         || isBGR(x)                 \
     )
 
-#define RGB2YUV_SHIFT 16
+#define RGB2YUV_SHIFT 15
 #define BY ((int)( 0.098*(1<<RGB2YUV_SHIFT)+0.5))
 #define BV ((int)(-0.071*(1<<RGB2YUV_SHIFT)+0.5))
 #define BU ((int)( 0.439*(1<<RGB2YUV_SHIFT)+0.5))
--- a/libswscale/swscale_template.c	Wed Sep 10 13:55:51 2008 +0000
+++ b/libswscale/swscale_template.c	Wed Sep 10 16:39:56 2008 +0000
@@ -1891,10 +1891,8 @@
 \
         g>>=shg;\
 \
-        dstU[i]= (((RU)>>1)*r + ((GU)>>1)*g + ((BU)>>1)*b + (257<<((S)-1)))>>(S);\
-        dstV[i]= (((RV)>>1)*r + ((GV)>>1)*g + ((BV)>>1)*b + (257<<((S)-1)))>>(S);\
-/*        dstU[i]= ((RU)*r + (GU)*g + (BU)*b + (257<<(S)))>>((S)+1);\
-        dstV[i]= ((RV)*r + (GV)*g + (BV)*b + (257<<(S)))>>((S)+1);*/\
+        dstU[i]= ((RU)*r + (GU)*g + (BU)*b + (257<<(S)))>>((S)+1);\
+        dstV[i]= ((RV)*r + (GV)*g + (BV)*b + (257<<(S)))>>((S)+1);\
     }\
 }