summaryrefslogtreecommitdiffstats
path: root/libswscale
diff options
context:
space:
mode:
authormichael <michael@b3059339-0415-0410-9bf9-f77b7e298cf2>2008-09-04 19:49:13 +0000
committermichael <michael@b3059339-0415-0410-9bf9-f77b7e298cf2>2008-09-04 19:49:13 +0000
commita56ed81a5c20c262a7f7675e2fdf38a633364bc5 (patch)
treeb3785fcec83d08ef479b4491fe75eaddc7b9795e /libswscale
parent6dcd5a4e7aecb5ee03297a1bb56871158aee9918 (diff)
downloadmpv-a56ed81a5c20c262a7f7675e2fdf38a633364bc5.tar.bz2
mpv-a56ed81a5c20c262a7f7675e2fdf38a633364bc5.tar.xz
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. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@27519 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'libswscale')
-rw-r--r--libswscale/rgb2rgb.c38
1 files changed, 10 insertions, 28 deletions
diff --git a/libswscale/rgb2rgb.c b/libswscale/rgb2rgb.c
index 6f935e997a..e3ac5a6ace 100644
--- a/libswscale/rgb2rgb.c
+++ b/libswscale/rgb2rgb.c
@@ -416,13 +416,8 @@ void rgb16tobgr16(const uint8_t *src, uint8_t *dst, long src_size)
for (i=0; i<num_pixels; i++)
{
- unsigned b,g,r;
- register uint16_t rgb;
- 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);
+ unsigned rgb = ((const uint16_t*)src)[i];
+ ((uint16_t*)dst)[i] = (rgb>>11) | (rgb&0x7E0) | (rgb<<11);
}
}
@@ -433,13 +428,8 @@ void rgb16tobgr15(const uint8_t *src, uint8_t *dst, long src_size)
for (i=0; i<num_pixels; i++)
{
- unsigned b,g,r;
- register uint16_t rgb;
- 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);
+ unsigned rgb = ((const uint16_t*)src)[i];
+ ((uint16_t*)dst)[i] = (rgb>>11) | ((rgb&0x7C0)>>1) | ((rgb&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++)
{
- unsigned b,g,r;
- register uint16_t rgb;
- 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);
+ unsigned rgb = ((const uint16_t*)src)[i];
+ ((uint16_t*)dst)[i] = ((rgb&0x7C00)>>10) | ((rgb&0x3E0)<<1) | (rgb<<11);
}
}
@@ -507,13 +492,10 @@ void rgb15tobgr15(const uint8_t *src, uint8_t *dst, long src_size)
for (i=0; i<num_pixels; i++)
{
- unsigned b,g,r;
- register uint16_t rgb;
- rgb = src[2*i];
- r = rgb&0x1F;
- g = (rgb&0x3E0)>>5;
- b = (rgb&0x7C00)>>10;
- dst[2*i] = (b&0x1F) | ((g&0x1F)<<5) | ((r&0x1F)<<10);
+ unsigned br;
+ unsigned rgb = ((const uint16_t*)src)[i];
+ br = rgb&0x7c1F;
+ ((uint16_t*)dst)[i] = (br>>10) | (rgb&0x3E0) | (br<<10);
}
}