aboutsummaryrefslogtreecommitdiffstats
path: root/libswscale/swscale_template.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2007-04-15 00:53:32 +0000
committerMichael Niedermayer <michaelni@gmx.at>2007-04-15 00:53:32 +0000
commit21c08a3f1c91c6a9fa7dbaf48d14078ecb4b985d (patch)
treeb240c5c59022747f1468f19a6a9cbb1899ab9690 /libswscale/swscale_template.c
parentfe2ad119e91eab9dead56c737ccc899655ae5618 (diff)
downloadffmpeg-21c08a3f1c91c6a9fa7dbaf48d14078ecb4b985d.tar.gz
convert palette to yuv instead of converting each pixel after pal->rgb
Originally committed as revision 22993 to svn://svn.mplayerhq.hu/mplayer/trunk/libswscale
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;
}
}