Commit graph

7 commits

Author SHA1 Message Date
Sebastian Dröge
779704b885 compositor: Replace shift and conv opcodes by convh in BGRA SOURCE operator
Potentially speeds up processing a bit.
2019-05-24 15:56:56 +00:00
Sebastian Dröge
2933ef6336 compositor: Remove unneeded left shift for ARGB/AYUV SOURCE operator
The alpha value is already in the lower 8 bits from the beginning in
this case.

Fixes https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/issues/610
2019-05-24 15:56:56 +00:00
Sebastian Dröge
e87fa73e60 compositor: Implement different operators via per-pad property
This removes the crossfade-ratio property and replaces it with an
operator property. Currently this implements the following operators:

- SOURCE: Copy over the source and don't look at the destination
- OVER: Default blending of the source over the destination
- ADD: Like OVER but simply adding the alpha instead

See the example for how to implement crossfading with this.

https://bugzilla.gnome.org/show_bug.cgi?id=797169
2018-10-28 17:13:26 +00:00
Thibault Saunier
effb593a93 compositor: Add support for crossfade blending
Crossfading is a bit more complex than just having two pads with the
right keyframes as the blending is not exactly the same.

The difference is in the way we compute the alpha channel, in the case
of crossfading, we have to compute an additive operation between
the destination and the source (factored by the alpha property of both
the input pad alpha property and the crossfading ratio) basically so
that the crossfade result of 2 opaque frames is also fully opaque at any
time in the crossfading process, avoid bleeding through the layer
blending.

Some rationnal can be found in https://phabricator.freedesktop.org/T7773.

https://bugzilla.gnome.org/show_bug.cgi?id=784827
2017-08-03 12:59:43 -04:00
Jan Schmidt
d9a96ac2ec compositor: Revert most of previous patch.
The calculation doesn't produce the same results.
Keep just the change to divide alpha by 255 instead of 256,
for slightly better accuracy
2015-03-16 04:00:44 +11:00
Jan Schmidt
6a1f97cd50 compositor: Fix blending functions
Correctly calculate alpha in a few places by dividing by 255,
not 256.

Fix the argb and bgra blending functions to avoid an off-by-one
error in the calculations, so painting with alpha = 0xff doesn't
ever bleed through from behind
2015-03-16 00:33:23 +11:00
Mathieu Duponchelle
75c71741a2 compositor: Add a new compositor based on the new GstVideoAggregator base class
It is a replacement for videomixer with a similare API

Co-Authored by: Thibault Saunier <tsaunier@gnome.org>

https://bugzilla.gnome.org/show_bug.cgi?id=731919
2014-06-20 19:53:33 +02:00