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

Kostya kostya.shishkov
Mon Mar 9 18:20:11 CET 2009


On Mon, Mar 09, 2009 at 04:14:47PM +0100, Michael Niedermayer wrote:
> On Mon, Mar 09, 2009 at 08:41:35AM +0200, Kostya wrote:
> > 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?
> 
> ok if tested

It is, but how about this patch (also works fine)?
I feel it is a bit more correct.
 
> [...]
> -- 
> Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
-------------- next part --------------
Index: swscale_template.c
===================================================================
--- swscale_template.c	(revision 28896)
+++ swscale_template.c	(working copy)
@@ -1663,7 +1663,7 @@
     {\
         int pix0= ((type*)src)[2*i+0];\
         int pix1= ((type*)src)[2*i+1];\
-        int g= (pix0&(maskg|maska))+(pix1&(maskg|maska));\
+        int g= (pix0&~(maskr|maskb))+(pix1&~(maskr|maskb));\
         int b= ((pix0+pix1-g)&(maskb|(2*maskb)))>>shb;\
         int r= ((pix0+pix1-g)&(maskr|(2*maskr)))>>shr;\
         g&= maskg|(2*maskg);\



More information about the ffmpeg-devel mailing list