Mercurial > mplayer.hg
comparison libswscale/swscale.c @ 27530:dbdc77f8b041
More accurate rounding for 8bit inputs.
author | michael |
---|---|
date | Tue, 09 Sep 2008 23:39:32 +0000 |
parents | ffb573fae5e8 |
children | 1ecce17e826f |
comparison
equal
deleted
inserted
replaced
27529:ffb573fae5e8 | 27530:dbdc77f8b041 |
---|---|
2669 }else if(c->srcFormat == PIX_FMT_BGR4_BYTE){ | 2669 }else if(c->srcFormat == PIX_FMT_BGR4_BYTE){ |
2670 b= (i>>3 )*255; | 2670 b= (i>>3 )*255; |
2671 g= ((i>>1)&3)*85; | 2671 g= ((i>>1)&3)*85; |
2672 r= (i&1 )*255; | 2672 r= (i&1 )*255; |
2673 } | 2673 } |
2674 y= av_clip_uint8(((RY*r + GY*g + BY*b)>>RGB2YUV_SHIFT) + 16 ); | 2674 y= av_clip_uint8((RY*r + GY*g + BY*b + ( 33<<(RGB2YUV_SHIFT-1)))>>RGB2YUV_SHIFT); |
2675 u= av_clip_uint8(((RU*r + GU*g + BU*b)>>RGB2YUV_SHIFT) + 128); | 2675 u= av_clip_uint8((RU*r + GU*g + BU*b + (257<<(RGB2YUV_SHIFT-1)))>>RGB2YUV_SHIFT); |
2676 v= av_clip_uint8(((RV*r + GV*g + BV*b)>>RGB2YUV_SHIFT) + 128); | 2676 v= av_clip_uint8((RV*r + GV*g + BV*b + (257<<(RGB2YUV_SHIFT-1)))>>RGB2YUV_SHIFT); |
2677 pal[i]= y + (u<<8) + (v<<16); | 2677 pal[i]= y + (u<<8) + (v<<16); |
2678 } | 2678 } |
2679 src2[1]= (uint8_t*)pal; | 2679 src2[1]= (uint8_t*)pal; |
2680 } | 2680 } |
2681 | 2681 |