[FFmpeg-devel] [PATCH] swscale alpha channel support

Øyvind Kolås islewind
Sun Mar 22 19:48:16 CET 2009

On Sun, Mar 22, 2009 at 6:01 PM, Michael Niedermayer <michaelni at gmx.at> wrote:
> On Sun, Mar 22, 2009 at 12:51:18PM +0000, ?yvind Kol?s wrote:
>> On Tue, Mar 17, 2009 at 4:40 PM, C?dric Schieli <cschieli at gmail.com> wrote:
>> > 2009/3/17 ?yvind Kol?s <islewind at gmail.com>:
>> > Or are you suggesting that scaling non-premultiplied alpha can't work
>> > ? What I'm sure is that fully transparent stays fully transparent, and
>> > fully opaque stays fully opaque.
>> Yes the alpha component is treated correctly, the color components are not.
> what is correct when it comes to resampling is a matter of definition as
> well as what input one has and what output one expects.
> And above all "correct" resampling is not seperable or linear nor linear
> of a scalar non linear transform. Still we use linear & seperable stuff
> because its good enough and the alternative is non trivial and rather
> slow

Correct as in expected result that can be used in compositing without
surprise is what I aim for. Knowing that ffmpeg doesn't resample
images correctly I would know to avoid using ffmpeg for frame scaling
for video compositing needs (if I start using videos with alpha for
some reason
using ffmpeg and GEGL I would only add the code to get the unscaled
frame out anyways.)

Video compositing is normally done using pre-multiplied alpha sine it
makes the equations and
computation simpler. What for instance GIMP does for blurs,
resamplings warps etc is to bake the premultiplication into the
equations complicating them.

> Optional because this surely causes a noticeable speed loss ...

It indeed does, but is video with alpha primarily a real-time deoding
concern or a feature to be
used by compositing applications?

> i wonder if ignoring gamma correction leads to any artifacts at all
> it would be interresting to see a example of such artifacts if you
> have one?

See http://www.4p8.com/eric.brasseur/gamma.html

/?yvind K.
?The future is already here. It's just not very evenly distributed?
                                                 -- William Gibson
http://pippin.gimp.org/                            http://ffii.org/

More information about the ffmpeg-devel mailing list