[FFmpeg-devel] [PATCH] swscale alpha channel support
Michael Niedermayer
michaelni
Sun Mar 22 19:01:57 CET 2009
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
>
> Scaling non-premultiplied alpha will not work correctly it will lead
> to artifacts around
> edges between transparent and non-transparent parts of the frame, a
> form of haloing.
and doing what you suggest will cause artifacts in other cases, like for
example if i take the famous lena image and make her eyes 100% transparent
and then rescale and afterwards make them non transparent
the only real problem i see with the current code is that pixels that
have undefined color and 100% transparency could bleed into non transparent
areas. Thats something that could be fixed by a pre-pass.
besides this, adjusting the color values per alpha before scaling and
deadjusting them afterwards is surely welcome as optional feature if someone
wants to implement it.
Optional because this surely causes a noticeable speed loss ...
[...]
> Another concern for quality when performing resampling is whether the
> data is gamma corrected or linear
> operating on non-linear data doesn't lead to as disturbing artifacts
> as treating the components separately
> though.
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?
[...]
--
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
No great genius has ever existed without some touch of madness. -- Aristotle
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20090322/bee6f58f/attachment.pgp>
More information about the ffmpeg-devel
mailing list