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 752842 - gloverlaycompositor: Wrong color format
gloverlaycompositor: Wrong color format
Status: RESOLVED FIXED
Product: GStreamer
Classification: Platform
Component: gst-plugins-bad
git master
Other Linux
: Normal normal
: 1.5.90
Assigned To: Lubosz Sarnecki
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2015-07-24 20:50 UTC by Nicolas Dufresne (ndufresne)
Modified: 2015-08-16 13:39 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
gloverlaycompositor: Add shader to convert BGRA/ARGB -> RGBA (1.93 KB, patch)
2015-08-08 18:48 UTC, Nicolas Dufresne (ndufresne)
committed Details | Review

Description Nicolas Dufresne (ndufresne) 2015-07-24 20:50:15 UTC
When rendering overlay compotion in glimagesink the color are wrong. I supposed we have picked the wrong color format. It needs to be checked and fixed. This is probably trivial (but I don't want to forget).

Here's a pipeline with blue text, that show as red.

gst-launch-1.0 videotestsrc ! textoverlay text="COLOR or COLOUR, is that a question ?" color=0xFF0000FF ! glimagesink
Comment 1 Nicolas Dufresne (ndufresne) 2015-07-24 21:34:20 UTC
I've given a quick look, it's in fact a bit of work. The compositor assumes the colors are RGBA, but they are BGRA. The R and G need to be swapped. Not sure how expensive that would be with the uploader/convert stuff, may just adding this to the compsitor shader is whiser. Note that on big endian the compsition buffer will be in ARGB.
Comment 2 Nicolas Dufresne (ndufresne) 2015-08-06 13:48:59 UTC
Ping ?
Comment 3 Nicolas Dufresne (ndufresne) 2015-08-08 18:48:46 UTC
Created attachment 308961 [details] [review]
gloverlaycompositor: Add shader to convert BGRA/ARGB -> RGBA

Depending on the bytes order we will get BGRA (little) and ARGB (big)
from the composition overlay buffer while our GL code expects RGBA. Add
a fragment shader that do this conversion.
Comment 4 Nicolas Dufresne (ndufresne) 2015-08-08 20:33:47 UTC
Attachment 308961 [details] pushed as d6baf8d - gloverlaycompositor: Add shader to convert BGRA/ARGB -> RGBA
Comment 5 Matthew Waters (ystreet00) 2015-08-09 12:50:24 UTC
So the problem with this is that GL transfers are in host endianness already for GL_UNSIGNED_BYTE conversion which is currently used everywhere so the endianness is not an issue for the texture transfers.
Comment 6 Nicolas Dufresne (ndufresne) 2015-08-10 03:12:18 UTC
(In reply to Matthew Waters from comment #5)
> So the problem with this is that GL transfers are in host endianness already
> for GL_UNSIGNED_BYTE conversion which is currently used everywhere so the
> endianness is not an issue for the texture transfers.

I'm still in doubt, but if you could provide more detail of your thinking I could confirm. Unlike all the other case, the reason we have this byte order check is not because of GL, as you just confirmed, we read per byte which will indeed not affect the shader for the same format.

Though, gst_video_overlay_rectangle_get_pixels_unscaled_argb() will return GST_VIDEO_FORMAT_BGRA when the host is little endian, and GST_VIDEO_FORMAT_ARGB when it's big endian. These are two different formats that requires two different shaders.

Are you still completely sure that I made a mistake ? And if so, can you provide technical details ?
Comment 7 Matthew Waters (ystreet00) 2015-08-10 08:19:50 UTC
Gahh, gst_video_overlay_rectangle_get_pixels_unscaled_argb does not return data with native endianness.  Confusing.
Comment 8 Nicolas Dufresne (ndufresne) 2015-08-10 11:46:03 UTC
(In reply to Matthew Waters from comment #7)
> Gahh, gst_video_overlay_rectangle_get_pixels_unscaled_argb does not return
> data with native endianness.  Confusing.

It is, I agree.