GNOME Bugzilla – Bug 784827
compositor: Add support for crossfade blending
Last modified: 2018-09-19 08:34:15 UTC
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.
Created attachment 355370 [details] [review] compositor: Add support for crossfade blending
Created attachment 355371 [details] [review] video-transition: Make use of the new `compositor::crossfade-ratio` property To achieve a real transition about to handle several level of layers.
Created attachment 355378 [details] [review] 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.
Created attachment 355379 [details] [review] tests: examples: Add a simple crossfade example
Review of attachment 355378 [details] [review]: Looking good to me apart from these comments :) ::: gst-libs/gst/video/gstvideoaggregatorpad.h @@ +71,3 @@ /* < private > */ GstVideoAggregatorPadPrivate *priv; + union { Need a comment to explain why a pad may have this set to true. ::: gst/compositor/blend.c @@ +1032,3 @@ "video compositor blending functions"); + gst_compositor_blend_argb = GST_DEBUG_FUNCPTR (blend_argb); I would suggest making this a separate commit, it's a pretty large unrelated diff :) ::: gst/compositor/blend.h @@ +27,3 @@ + * GstCompositorBlendMode: + * @COMPOSITOR_BLEND_MODE_NORMAL: Normal blending + * @COMPOSITOR_BLEND_MODE_ADDITION: Alphas are simply added, I'd call the mode "additive" rather
Review of attachment 355371 [details] [review]: lgtm
Review of attachment 355379 [details] [review]: lgtm
Attachment 355378 [details] pushed as 806ff70 - compositor: Add support for crossfade blending Attachment 355379 [details] pushed as 9c57524 - tests: examples: Add a simple crossfade example