[MPlayer-dev-eng] SwScaler YV12 to BGR32 having zeroed alpha

Rich Felker dalias at aerifal.cx
Mon May 30 08:54:09 CEST 2005


On Sun, May 29, 2005 at 03:31:55PM -0400, Jason Tackaberry wrote:
> On Sun, 2005-05-29 at 14:59 -0400, Rich Felker wrote:
> > there is no alpha channel. swscaler converts to bgr32, not some bgra
> > nonsense. 
> 
> BGR32 _is_ BGRA, at least on little endian machines.  I have no idea why
> you call BGRA "nonsense."  Yes, ok, the nomenclature is specific to
> little endian, but I wanted to make the point that one of those bytes is
> for alpha.

For your application it is. For ours and for most, it's not. Those
bytes are meaningless padding, usually specified as reserved/must be
0. For example if storing the data as raw BGR in AVI files (very
stupid but still..), I expect the padding byte is required to be 0.

> > certainly the input has no alpha, so what do you expect??
> 
> Yes, the alpha has to be created from thin air.  So why not initialize
> those bytes to 255 (i.e. fully opaque) rather than 0 (i.e. fully
> transparent)?  This makes much more sense.

Well these are meanings you made up to go with your situation...

> I'm quite happy to submit a patch to make sws do this, but obviously I
> first have to convince people that this isn't nonsense.

I don't see how it helps you do what you're trying to do. I assume
you're trying to use the output with OpenGL.. in which case, you know
the frames you converted from YUV don't have alpha, so just don't
treat the resulting texture as having an alpha channel. Surely OpenGL
supports plain BGR32 textures..

Rich




More information about the MPlayer-dev-eng mailing list