[MPlayer-dev-eng] altivec patch 4/5: RGB/BGR confusion

Diego Biurrun diego at biurrun.de
Wed Feb 8 17:07:25 CET 2006


On Wed, Feb 08, 2006 at 12:41:54PM +0100, Michael Niedermayer wrote:
> 
> On Tue, Feb 07, 2006 at 05:54:56AM -0500, Alan Curry wrote:
> > This patch corrects RGB vs. BGR confusion in yuv2rgb_altivec.c
> > 
> > First, the macros vec_mstrgb24 and vec_mstbgr24 each do the opposite of what
> > they say. (Although it's hard to be sure what they were intended to do since
> > the arguments are named "x0,x1,x2" rather than "r,g,b").
> > vec_mstrgb24(r,g,b,ptr) actually generates output conforming to IMGFMT_BGR24,
> > and vice versa. To fix this, I have simply switched the names.
> > 
> > The next one is even weirder. Look at these 2 macros, before my patch:
> > 
> >   #define out_rgb24(a,b,c,ptr) vec_mstrgb24(a,b,c,ptr)
> >   #define out_bgr24(a,b,c,ptr) vec_mstbgr24(c,b,a,ptr)
> > 
> > Regardless of whether vec_mstrgb24 and vec_mstbgr24 are named correctly or
> > not, they are definitely opposites of each other. So how does out_bgr24
> > compare to out_rgb24? It is reversed in 2 ways: the a,b,c arguments are
> > reversed and the opposite vec_mst* macro is called. Those 2 reversals cancel
> > each other and out_bgr24 actually does the exact same thing as out_rgb24.
> > (Before this patch, they both generate output conforming to IMGFMT_BGR24.)
> > 
> > This can be easily seen in the output of -vo jpeg, in which blue and red are
> > reversed.
> 
> patch ok if colors are ok with rgb24/bgr24 on all -vo's which work on the
> ppc developers machine

Hmmm, 

  mplayer -vo x11 -vf format=bgr24,scale movie.avi
  mplayer -vo x11 -vf format=rgb24,scale movie.avi

both produce wrong colors while vo_xv is fine.  This problem is not
caused by this patch, though, it was present before.  Disabling AltiVec
does not make a difference.

I assume the patch is still OK to apply then?

Diego




More information about the MPlayer-dev-eng mailing list