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 739695 - assrender poorly handles transparency
assrender poorly handles transparency
Status: RESOLVED DUPLICATE of bug 681447
Product: GStreamer
Classification: Platform
Component: gst-plugins-bad
git master
Other Linux
: Normal normal
: NONE
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2014-11-05 23:21 UTC by Andreas Frisch
Modified: 2014-11-09 14:13 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
this is how the ass images look like (BGRA) before blending (512.00 KB, text/x-log)
2014-11-05 23:21 UTC, Andreas Frisch
Details

Description Andreas Frisch 2014-11-05 23:21:36 UTC
Created attachment 290061 [details]
this is how the ass images look like (BGRA) before blending

i'm trying to render ass subtitles on top of "empty" frames so that i can blit them afterwards, expecting that the pixels that actually have subtitles rendered become visible, and the rest ("the background") stays transparent.

currently, the output frames keep the input alpha everywhere in the image, so i can either blit nothing, or mask my video with the background color.

the problem may be that the assrender blitting function tries to create a premultiplied bitmap. i did some funny ascii art output though ^_^ 
it looks like in case of a fully transparent input pixel (alpha = 0x00), it doesn't do premultiplication but instead keeps the alpha.
that's visible in the log
(i'm simply doing a 
printf("%02x%02x%02x%02x ",dst[0],dst[1],dst[2],dst[3]);
in the blit function)

however, the transparency byte of the ass images seems to get overwritten somewhere later on during the composition process, maybe the gst_video_overlay_composition_blend operation
Comment 1 Andreas Frisch 2014-11-06 09:40:17 UTC
so i went through and wrote the raw data into files at different spots and it turns out that the bitmaps get rendered correctly and the alpha channels breaks once gst_video_overlay_composition_blend is called in gst_ass_render_chain_video()

it doesn't make a difference whether the overlay rectangle was created with GST_VIDEO_OVERLAY_FORMAT_FLAG_PREMULTIPLIED_ALPHA or GST_VIDEO_OVERLAY_FORMAT_FLAG_NONE
Comment 2 Sebastian Dröge (slomo) 2014-11-06 10:33:56 UTC
There are some patches in Bugzilla about improving the handling of src alpha and using the proper blending operation. I can't find them right now, but they should solve your problem.
Comment 3 Andreas Frisch 2014-11-09 13:15:34 UTC
Arnaud's patch https://bugzilla.gnome.org/attachment.cgi?id=263194 from 
https://bugzilla.gnome.org/show_bug.cgi?id=681447 actually does what I need!
Comment 4 Tim-Philipp Müller 2014-11-09 14:13:00 UTC
Great. Perhaps you could contribute a unit test for the issue then :)

*** This bug has been marked as a duplicate of bug 681447 ***