summaryrefslogtreecommitdiffstats
path: root/libswscale/swscale_template.c
diff options
context:
space:
mode:
authormichael <michael@b3059339-0415-0410-9bf9-f77b7e298cf2>2007-04-15 00:53:32 +0000
committermichael <michael@b3059339-0415-0410-9bf9-f77b7e298cf2>2007-04-15 00:53:32 +0000
commit31be9659501961dbc616d821c803befe2bca156b (patch)
tree66aa3a6f7a98be52dc7cfc6a004eec90d321c1b2 /libswscale/swscale_template.c
parent4d63a7827781e9d3c195698cbabb90a60879c2bd (diff)
downloadmpv-31be9659501961dbc616d821c803befe2bca156b.tar.bz2
mpv-31be9659501961dbc616d821c803befe2bca156b.tar.xz
convert palette to yuv instead of converting each pixel after pal->rgb
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@22993 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'libswscale/swscale_template.c')
-rw-r--r--libswscale/swscale_template.c12
1 files changed, 3 insertions, 9 deletions
diff --git a/libswscale/swscale_template.c b/libswscale/swscale_template.c
index 9c1bb5fd4e..a8616efcb0 100644
--- a/libswscale/swscale_template.c
+++ b/libswscale/swscale_template.c
@@ -2285,11 +2285,8 @@ static inline void RENAME(palToY)(uint8_t *dst, uint8_t *src, int width, uint32_
for(i=0; i<width; i++)
{
int d= src[i];
- int b= pal[d] &0xFF;
- int g=(pal[d]>>8 )&0xFF;
- int r= pal[d]>>16;
- dst[i]= ((RY*r + GY*g + BY*b)>>RGB2YUV_SHIFT) + 16;
+ dst[i]= pal[d] & 0xFF;
}
}
@@ -2302,12 +2299,9 @@ static inline void RENAME(palToUV)(uint8_t *dstU, uint8_t *dstV, uint8_t *src1,
int d0= src1[2*i ];
int d1= src1[2*i+1];
int p = (pal[d0]&0xFF00FF) + (pal[d1]&0xFF00FF);
- int g = (pal[d0]+pal[d1]-p)>>8;
- int b= p&0x1FF;
- int r= p>>16;
- dstU[i]= ((RU*r + GU*g + BU*b)>>(RGB2YUV_SHIFT+1)) + 128;
- dstV[i]= ((RV*r + GV*g + BV*b)>>(RGB2YUV_SHIFT+1)) + 128;
+ dstU[i]= (pal[d0]+pal[d1]-p)>>9;
+ dstV[i]= p>>17;
}
}