comparison libswscale/swscale.c @ 31967:45e6a4af3006

swscale: fix internal rgb->yv12 chroma conversion used by the main scaler path The shift must be applied before the masking.
author ramiro
date Mon, 06 Sep 2010 02:02:53 +0000
parents 58ecd8282065
children b793cbb9afd1
comparison
equal deleted inserted replaced
31966:6fd0de7a6fd2 31967:45e6a4af3006
1067 #define BGR2UV(type, name, shr, shg, shb, shp, maskr, maskg, maskb, RU, GU, BU, RV, GV, BV, S) \ 1067 #define BGR2UV(type, name, shr, shg, shb, shp, maskr, maskg, maskb, RU, GU, BU, RV, GV, BV, S) \
1068 static inline void name(uint8_t *dstU, uint8_t *dstV, const uint8_t *src, const uint8_t *dummy, long width, uint32_t *unused)\ 1068 static inline void name(uint8_t *dstU, uint8_t *dstV, const uint8_t *src, const uint8_t *dummy, long width, uint32_t *unused)\
1069 {\ 1069 {\
1070 int i;\ 1070 int i;\
1071 for (i=0; i<width; i++) {\ 1071 for (i=0; i<width; i++) {\
1072 int b= (((const type*)src)[i]&maskb)>>(shb+shp);\ 1072 int b= ((((const type*)src)[i]>>shp)&maskb)>>shb;\
1073 int g= (((const type*)src)[i]&maskg)>>(shg+shp);\ 1073 int g= ((((const type*)src)[i]>>shp)&maskg)>>shg;\
1074 int r= (((const type*)src)[i]&maskr)>>(shr+shp);\ 1074 int r= ((((const type*)src)[i]>>shp)&maskr)>>shr;\
1075 \ 1075 \
1076 dstU[i]= ((RU)*r + (GU)*g + (BU)*b + (257<<((S)-1)))>>(S);\ 1076 dstU[i]= ((RU)*r + (GU)*g + (BU)*b + (257<<((S)-1)))>>(S);\
1077 dstV[i]= ((RV)*r + (GV)*g + (BV)*b + (257<<((S)-1)))>>(S);\ 1077 dstV[i]= ((RV)*r + (GV)*g + (BV)*b + (257<<((S)-1)))>>(S);\
1078 }\ 1078 }\
1079 }\ 1079 }\