After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 639237 - textoverlay: patch to use "A OVER B" alpha compositing
textoverlay: patch to use "A OVER B" alpha compositing
Status: RESOLVED FIXED
Product: GStreamer
Classification: Platform
Component: gst-plugins-base
git master
Other Linux
: Normal enhancement
: 0.10.33
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2011-01-11 17:53 UTC by Lane Brooks
Modified: 2011-04-01 08:41 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
patch (3.19 KB, patch)
2011-01-11 17:53 UTC, Lane Brooks
none Details | Review
updated patch (2.50 KB, patch)
2011-01-18 04:16 UTC, Lane Brooks
committed Details | Review
Patch to ARGB support (6.04 KB, patch)
2011-01-18 04:18 UTC, Lane Brooks
committed Details | Review

Description Lane Brooks 2011-01-11 17:53:55 UTC
Created attachment 178071 [details] [review]
patch

'A OVER B' compositing is explained at
http://en.wikipedia.org/wiki/Alpha_compositing.

Currently, overlaying text on a transparent background image leaves the text overlay also transparent (and this invisible). This pipeline shows such an example:

gst-launch videotestsrc pattern=white ! video/x-raw-yuv,format=\(fourcc\)AYUV ! alpha alpha=0.0 ! textoverlay text=Testing auto-resize=False font-desc=60px ! videomixer ! ffmpegcolorspace ! autovideosink

The attached patch changes the AYUV compositing rules put the text "OVER" the background image and thus is visible regardless of the alpha of the background image. The overlay in the above pipeline works after applying this patch.

I personally prefer this approach, but I would like to understand the reasons and advantages of the current implementation as well. Can someone comment? If "A OVER B" compositing is deemed better, I can apply it to the ARGB/BGRA formats as well.

Let me know.
Comment 1 Lane Brooks 2011-01-18 04:16:54 UTC
Created attachment 178581 [details] [review]
updated patch

This is an updated patch. I no longer convert YUV to RGB prior to compositing. Instead I composite directly in YUV space. So the only real change this patch introduces compared to the original is to "A OVER B" compositing instead of "A BLEND B". It makes more sense to me to use "A OVER B" when you have an alpha that gets passed on.
Comment 2 Lane Brooks 2011-01-18 04:18:32 UTC
Created attachment 178582 [details] [review]
Patch to ARGB support

This patch adds ARGB and the other rgb alpha variant support to textoverlay.
Comment 3 Lane Brooks 2011-01-26 16:46:12 UTC
Ping?
Comment 4 Sebastian Dröge (slomo) 2011-04-01 08:40:29 UTC
commit 200ee96338e73932074ad977d2187a7b7c163d96
Author: Lane Brooks <dirjud@gmail.com>
Date:   Mon Jan 17 21:12:18 2011 -0700

    textoverlay: Added support for ARGB and other RGB alpha variants

commit e2150b11ff8a98a3b7081d8106bca496a91c6b2b
Author: Lane Brooks <dirjud@gmail.com>
Date:   Tue Jan 11 10:34:33 2011 -0700

    textoverlay: converted AYUV to use 'A OVER B' alpha compositing
    
    'A OVER B' compositing is explained at
    http://en.wikipedia.org/wiki/Alpha_compositing.
    
    Previously, overlaying text on a transparent background image left the
    text overlay also transparent. This pipeline shows such an example:
    
    gst-launch videotestsrc pattern=white ! video/x-raw-yuv,format=\(fourcc\)AYU
    
    With this patch, text is composited "OVER" the background image and
    thus is visible regardless of the alpha of the background image. The
    overlay in the above pipeline works after applying this patch.