[FFmpeg-devel] [PATCH] Make 15-bpp MS Video 1 decoder not output 16-bpp

Kostya kostya.shishkov
Mon Mar 9 07:41:35 CET 2009


On Sun, Mar 08, 2009 at 10:13:54PM +0100, Michael Niedermayer wrote:
> On Sun, Mar 08, 2009 at 11:31:49PM +0200, Kostya wrote:
> > 15-bpp MS Video 1 decoder first colour high bit is used
> > to indicate coding mode (2 or 8-colour fill). Passing
> > that value as such to current swscaler disrupt bit magic
> > on conversion and you can see 2x2 red rectangles in
> > different places.
> > 
> > Some samples like
> > http://samples.mplayerhq.hu/V-codecs/CRAM/orbean.avi
> > manifest that problem.
> > 
> 
> > Attached SwScaler patch for reference purpose only.
> 
> the bug is that maska is not set to the remaining bit

How's this?
 
> [...]
> -- 
> Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
-------------- next part --------------
Index: swscale_template.c
===================================================================
--- swscale_template.c	(revision 28896)
+++ swscale_template.c	(working copy)
@@ -1678,9 +1678,9 @@
 BGR2UV(uint32_t, bgr32ToUV,16, 0, 0, 0xFF000000, 0xFF0000, 0xFF00,   0x00FF, RU<< 8, GU   , BU<< 8, RV<< 8, GV   , BV<< 8, RGB2YUV_SHIFT+8)
 BGR2UV(uint32_t, rgb32ToUV, 0, 0,16, 0xFF000000,   0x00FF, 0xFF00, 0xFF0000, RU<< 8, GU   , BU<< 8, RV<< 8, GV   , BV<< 8, RGB2YUV_SHIFT+8)
 BGR2UV(uint16_t, bgr16ToUV, 0, 0, 0,          0,   0x001F, 0x07E0,   0xF800, RU<<11, GU<<5, BU    , RV<<11, GV<<5, BV    , RGB2YUV_SHIFT+8)
-BGR2UV(uint16_t, bgr15ToUV, 0, 0, 0,          0,   0x001F, 0x03E0,   0x7C00, RU<<10, GU<<5, BU    , RV<<10, GV<<5, BV    , RGB2YUV_SHIFT+7)
+BGR2UV(uint16_t, bgr15ToUV, 0, 0, 0,     0x8000,   0x001F, 0x03E0,   0x7C00, RU<<10, GU<<5, BU    , RV<<10, GV<<5, BV    , RGB2YUV_SHIFT+7)
 BGR2UV(uint16_t, rgb16ToUV, 0, 0, 0,          0,   0xF800, 0x07E0,   0x001F, RU    , GU<<5, BU<<11, RV    , GV<<5, BV<<11, RGB2YUV_SHIFT+8)
-BGR2UV(uint16_t, rgb15ToUV, 0, 0, 0,          0,   0x7C00, 0x03E0,   0x001F, RU    , GU<<5, BU<<10, RV    , GV<<5, BV<<10, RGB2YUV_SHIFT+7)
+BGR2UV(uint16_t, rgb15ToUV, 0, 0, 0,     0x8000,   0x7C00, 0x03E0,   0x001F, RU    , GU<<5, BU<<10, RV    , GV<<5, BV<<10, RGB2YUV_SHIFT+7)
 
 #if HAVE_MMX
 static inline void RENAME(bgr24ToY_mmx)(uint8_t *dst, uint8_t *src, long width, int srcFormat)



More information about the ffmpeg-devel mailing list