[FFmpeg-devel] [PATCH] Fix swapped colours for RGB555 and RGB565 in swscale

Kostya kostya.shishkov
Wed Oct 24 14:48:00 CEST 2007


Looks like rgb1[56]toUV have color values swapped.
Fixes roundup issue 162 and reported problem with 15-bit TSCC files.
-------------- next part --------------
Index: libswscale/swscale_template.c
===================================================================
--- libswscale/swscale_template.c	(revision 24845)
+++ libswscale/swscale_template.c	(working copy)
@@ -2231,8 +2231,8 @@
         int dl= (d0&0x07E0F81F);
         int d= dl + (((d0>>16) + (d0<<16))&0x07E0F81F);
 
-        int r= d&0x3F;
-        int b= (d>>11)&0x3F;
+        int b= d&0x3F;
+        int r= (d>>11)&0x3F;
         int g= d>>21;
         dstU[i]= ((2*RU*r + GU*g + 2*BU*b)>>(RGB2YUV_SHIFT+1-2)) + 128;
         dstV[i]= ((2*RV*r + GV*g + 2*BV*b)>>(RGB2YUV_SHIFT+1-2)) + 128;
@@ -2264,8 +2264,8 @@
         int dl= (d0&0x03E07C1F);
         int d= dl + (((d0>>16) + (d0<<16))&0x03E07C1F);
 
-        int r= d&0x3F;
-        int b= (d>>10)&0x3F;
+        int b= d&0x3F;
+        int r= (d>>10)&0x3F;
         int g= d>>21;
         dstU[i]= ((RU*r + GU*g + BU*b)>>(RGB2YUV_SHIFT+1-3)) + 128;
         dstV[i]= ((RV*r + GV*g + BV*b)>>(RGB2YUV_SHIFT+1-3)) + 128;



More information about the ffmpeg-devel mailing list