GNOME Bugzilla – Bug 639237
textoverlay: patch to use "A OVER B" alpha compositing
Last modified: 2011-04-01 08:41:24 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.
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.
Created attachment 178582 [details] [review] Patch to ARGB support This patch adds ARGB and the other rgb alpha variant support to textoverlay.
Ping?
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.