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 350748 - [ffmpegcolorspace] ffmpeg colorspace should prefer RGBA over RGB
[ffmpegcolorspace] ffmpeg colorspace should prefer RGBA over RGB
Status: RESOLVED FIXED
Product: GStreamer
Classification: Platform
Component: gst-plugins-base
git master
Other Linux
: Normal normal
: 0.10.26
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on: 357038
Blocks:
 
 
Reported: 2006-08-10 14:33 UTC by Michal Benes
Modified: 2009-11-25 15:20 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Prefer RGBA over RGB (1.52 KB, patch)
2006-08-10 14:35 UTC, Michal Benes
rejected Details | Review
Patch to choose conversion according to FF_LOSS (9.54 KB, patch)
2007-01-07 17:20 UTC, Michal Benes
none Details | Review
ffmpcsp.diff (9.53 KB, patch)
2009-05-07 12:14 UTC, Sebastian Dröge (slomo)
rejected Details | Review
ffmpegcolorspace: Prefer transforming alpha formats to alpha formats and the other way around (3.12 KB, patch)
2009-11-25 15:19 UTC, Sebastian Dröge (slomo)
committed Details | Review

Description Michal Benes 2006-08-10 14:33:03 UTC
When converting colorspaces between plugins that supports both RGBA and RGB, ffmpegcolorspace should prefer RGBA (and not loose alpha channel).

One example when this is needed is when converting dvd subtitles to PNGs.
Comment 1 Michal Benes 2006-08-10 14:35:25 UTC
Created attachment 70648 [details] [review]
Prefer RGBA over RGB

This patch changes the order in which various formats are listed in pad templates. Since plugins usually choose the first caps structure that matches, this helps.
Comment 2 Tim-Philipp Müller 2006-08-11 17:59:32 UTC
With this patch, what's the result if the input has no alpha channel and downstream supports both RGBA and RGB?

I think what it should prefer should depend on whether the input has an alpha channel or not; I don't think it should add an alpha channel if that isn't necessary/requested (haven't actually checked the code, just idly wondering).
Comment 3 Michal Benes 2006-08-14 07:20:37 UTC
Hi Tim, you are right, with this patch, ffmpegcolorspace converts RGB to RGBA if it can. Thus a real caps negotiation will be needed for a correct solution. I will try to learn how this is done and prepare a better patch.
Comment 4 Wim Taymans 2006-08-16 09:30:50 UTC
ffmpeg also has a function to calculate the "goodness" of a conversion. We can maybe use that to generate a list of conversions sorted by goodness.
Comment 5 Michal Benes 2007-01-07 17:20:29 UTC
Created attachment 79649 [details] [review]
Patch to choose conversion according to FF_LOSS

This patch sorts conversion accoring to FF_LOSS.
It needs API addition to gstffmpegcodecmap.c: I need a function to guess pix_fmt for the given caps (one structure assumed). To obtain this, I have expported gst_ffmpeg_caps_to_pixfmt and added guess_mode parameter to this function.
I feel that this patch is not as clean as it probably should be but this best what I have in the moment.
Comment 6 Sebastian Dröge (slomo) 2009-05-07 12:14:22 UTC
Created attachment 134188 [details] [review]
ffmpcsp.diff

Updated patch for latest GIT. This breaks the ffmpegcolorspace unit test as it fails to convert to/from some formats.
Comment 7 Sebastian Dröge (slomo) 2009-11-25 14:00:45 UTC
Comment on attachment 134188 [details] [review]
ffmpcsp.diff

That patch is complete wrong btw... the avcodec_get_pix_fmt_loss() function returns an int that contains some flags about what is lost (resolution, chroma, bla), not an int that gives a metric about how much information is lost.
Comment 8 Sebastian Dröge (slomo) 2009-11-25 15:19:19 UTC
Created attachment 148450 [details] [review]
ffmpegcolorspace: Prefer transforming alpha formats to alpha formats and the other way around

Fixes bug #602834 and #350748.
Comment 9 Sebastian Dröge (slomo) 2009-11-25 15:20:28 UTC
commit 1fe9f496911f3139c977e559eb29f60066278165
Author: Sebastian Dröge <sebastian.droege@collabora.co.uk>
Date:   Wed Nov 25 16:17:13 2009 +0100

    ffmpegcolorspace: Prefer transforming alpha formats to alpha formats and the
    
    Fixes bug #602834 and #350748.