# HG changeset patch # User michael # Date 1220557753 0 # Node ID 31ac930fd1d49133cefeb773f17e5b0d7805fcd0 # Parent e05965c550fca669aabe17de447a29dda8650316 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. diff -r e05965c550fc -r 31ac930fd1d4 libswscale/rgb2rgb.c --- a/libswscale/rgb2rgb.c Thu Sep 04 19:11:39 2008 +0000 +++ b/libswscale/rgb2rgb.c Thu Sep 04 19:49:13 2008 +0000 @@ -416,13 +416,8 @@ for (i=0; i>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 @@ for (i=0; i>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 @@ for (i=0; i>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 @@ for (i=0; i>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); } }