mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2024-11-26 19:01:44 +02:00
Fix 4 of the unscaled rgb15/16 converters, each of these contained
2-3 bugs each of which made it fail completely, this code clearly has never been tested and been written by somone who knows the difference between a potato and a computer is that the first is round. Originally committed as revision 27519 to svn://svn.mplayerhq.hu/mplayer/trunk/libswscale
This commit is contained in:
parent
6107059c2c
commit
7372e9bbe5
@ -416,13 +416,8 @@ void rgb16tobgr16(const uint8_t *src, uint8_t *dst, long src_size)
|
|||||||
|
|
||||||
for (i=0; i<num_pixels; i++)
|
for (i=0; i<num_pixels; i++)
|
||||||
{
|
{
|
||||||
unsigned b,g,r;
|
unsigned rgb = ((const uint16_t*)src)[i];
|
||||||
register uint16_t rgb;
|
((uint16_t*)dst)[i] = (rgb>>11) | (rgb&0x7E0) | (rgb<<11);
|
||||||
rgb = src[2*i];
|
|
||||||
r = rgb&0x1F;
|
|
||||||
g = (rgb&0x7E0)>>5;
|
|
||||||
b = (rgb&0xF800)>>11;
|
|
||||||
dst[2*i] = (b&0x1F) | ((g&0x3F)<<5) | ((r&0x1F)<<11);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -433,13 +428,8 @@ void rgb16tobgr15(const uint8_t *src, uint8_t *dst, long src_size)
|
|||||||
|
|
||||||
for (i=0; i<num_pixels; i++)
|
for (i=0; i<num_pixels; i++)
|
||||||
{
|
{
|
||||||
unsigned b,g,r;
|
unsigned rgb = ((const uint16_t*)src)[i];
|
||||||
register uint16_t rgb;
|
((uint16_t*)dst)[i] = (rgb>>11) | ((rgb&0x7C0)>>1) | ((rgb&0x1F)<<10);
|
||||||
rgb = src[2*i];
|
|
||||||
r = rgb&0x1F;
|
|
||||||
g = (rgb&0x7E0)>>5;
|
|
||||||
b = (rgb&0xF800)>>11;
|
|
||||||
dst[2*i] = (b&0x1F) | ((g&0x1F)<<5) | ((r&0x1F)<<10);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -490,13 +480,8 @@ void rgb15tobgr16(const uint8_t *src, uint8_t *dst, long src_size)
|
|||||||
|
|
||||||
for (i=0; i<num_pixels; i++)
|
for (i=0; i<num_pixels; i++)
|
||||||
{
|
{
|
||||||
unsigned b,g,r;
|
unsigned rgb = ((const uint16_t*)src)[i];
|
||||||
register uint16_t rgb;
|
((uint16_t*)dst)[i] = ((rgb&0x7C00)>>10) | ((rgb&0x3E0)<<1) | (rgb<<11);
|
||||||
rgb = src[2*i];
|
|
||||||
r = rgb&0x1F;
|
|
||||||
g = (rgb&0x3E0)>>5;
|
|
||||||
b = (rgb&0x7C00)>>10;
|
|
||||||
dst[2*i] = (b&0x1F) | ((g&0x3F)<<5) | ((r&0x1F)<<11);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -507,13 +492,10 @@ void rgb15tobgr15(const uint8_t *src, uint8_t *dst, long src_size)
|
|||||||
|
|
||||||
for (i=0; i<num_pixels; i++)
|
for (i=0; i<num_pixels; i++)
|
||||||
{
|
{
|
||||||
unsigned b,g,r;
|
unsigned br;
|
||||||
register uint16_t rgb;
|
unsigned rgb = ((const uint16_t*)src)[i];
|
||||||
rgb = src[2*i];
|
br = rgb&0x7c1F;
|
||||||
r = rgb&0x1F;
|
((uint16_t*)dst)[i] = (br>>10) | (rgb&0x3E0) | (br<<10);
|
||||||
g = (rgb&0x3E0)>>5;
|
|
||||||
b = (rgb&0x7C00)>>10;
|
|
||||||
dst[2*i] = (b&0x1F) | ((g&0x1F)<<5) | ((r&0x1F)<<10);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user