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 724131 - colorbalance: add colorbalance meta API
colorbalance: add colorbalance meta API
Status: RESOLVED OBSOLETE
Product: GStreamer
Classification: Platform
Component: gst-plugins-base
git master
Other Linux
: Normal enhancement
: git master
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2014-02-11 16:31 UTC by Matthieu Bouron
Modified: 2018-11-03 11:28 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
colorbalance: add video colorbalance meta API (5.94 KB, patch)
2014-02-11 17:11 UTC, Matthieu Bouron
none Details | Review
tests: add colorbalance meta API unit test (3.49 KB, patch)
2014-02-11 17:12 UTC, Matthieu Bouron
none Details | Review
colorbalance: add video colorbalance meta API (9.97 KB, patch)
2014-02-12 19:29 UTC, Matthieu Bouron
none Details | Review
tests: add colorbalance meta API unit test (4.32 KB, patch)
2014-02-12 19:30 UTC, Matthieu Bouron
none Details | Review

Description Matthieu Bouron 2014-02-11 16:31:38 UTC
Hello there,

Here is a patch that adds a colorbalance meta API to -base, which uses a minimal meta containing contrast, brightness, hue and saturation (stored as double) like in the videobalance element.
Comment 1 Nicolas Dufresne (ndufresne) 2014-02-11 17:06:56 UTC
I'm not sure this is the right design, or at least it does not seem coherent with GstColorBalance interface. ColorBalance, suggest that an element can have an arbitrary amount of Channels that can be controlled. Base on that, if an element wants to offload it's work to downstream it should negotiate the required channels. This negotiation could be made dynamic, in a way that if downstream support only hue, and only hue is set to non default, then we would still do passthrough. But at soon as "unsupported" brightness gets set, then it will use software path (if allocation permits it, e.g. system memory and known color format).
Comment 2 Matthieu Bouron 2014-02-11 17:11:41 UTC
Created attachment 268814 [details] [review]
colorbalance: add video colorbalance meta API
Comment 3 Matthieu Bouron 2014-02-11 17:12:00 UTC
Created attachment 268815 [details] [review]
tests: add colorbalance meta API unit test
Comment 4 Matthieu Bouron 2014-02-11 18:49:06 UTC
(In reply to comment #1)
> I'm not sure this is the right design, or at least it does not seem coherent
> with GstColorBalance interface. ColorBalance, suggest that an element can have
> an arbitrary amount of Channels that can be controlled. Base on that, if an
> element wants to offload it's work to downstream it should negotiate the
> required channels. This negotiation could be made dynamic, in a way that if
> downstream support only hue, and only hue is set to non default, then we would
> still do passthrough. But at soon as "unsupported" brightness gets set, then it
> will use software path (if allocation permits it, e.g. system memory and known
> color format).

From what I understand, currently, playsink only uses one videobalance element
(the more upstream one).

So I agree with you that upstream videobalance elements should look if
downstream supports the colorbalance API (per channel) and enter passthrough
mode depending on what downstream supports.

IMHO, a kind of API like the one proposed here is still needed because only one
element is controlled by playsink and this element will need to tell the
downstream videobalance element to modify the videobalance properties.

The allocation query might be used here to see if downstream supports the colorbalance API and which channels are supported.
Comment 5 Sebastian Dröge (slomo) 2014-02-11 19:12:23 UTC
You could do the negotiation about which channels are supported with the allocation query with the second parameter of gst_query_add_allocation_meta().

I think in general this approach is good, but you shouldn't limit the powers of the colorbalance interface :) Even if nobody uses anything else than the 4 channels.
Comment 6 Matthieu Bouron 2014-02-11 19:17:34 UTC
(In reply to comment #5)
> You could do the negotiation about which channels are supported with the
> allocation query with the second parameter of gst_query_add_allocation_meta().
> 
> I think in general this approach is good, but you shouldn't limit the powers of
> the colorbalance interface :) Even if nobody uses anything else than the 4
> channels.

So do you think that having contrast, brightness, hue and saturation in the meta is enough or not ?
Comment 7 Sebastian Dröge (slomo) 2014-02-11 19:27:36 UTC
Yes, not enough.


Well, I think it is enough and also the colorbalance interface should only use these 4... but that's not how the API is currently. Something to fix in 2.0.
Comment 8 Matthieu Bouron 2014-02-11 22:46:08 UTC
So the meta API should also use channels like in the interface, right ?
Comment 9 Sebastian Dröge (slomo) 2014-02-12 08:38:48 UTC
I think so
Comment 10 Matthieu Bouron 2014-02-12 15:30:28 UTC
I'm considering doing the following stuff:

GstVideoColorBalanceMeta owns a GstVideoColorBalance reference.

typedef GstVideoColorBalance {
  GArray *channels; // Array of GstColorBalanceChannel
  GArray *values; // Array of gint
};

Adding the two following functions:

gboolean gst_video_color_balance_set_value (GstVideoColorBalance * colorbalance, GstColorBalanceChannel *, int);
int gst_video_color_balance_get_value (GstVideoColorBalance * colorbalance, GstColorBalanceChannel *);

What do you think ?
Comment 11 Nicolas Dufresne (ndufresne) 2014-02-12 15:47:03 UTC
(In reply to comment #10) 
> typedef GstVideoColorBalance {

Isn't it a bit confusing, gst_color_balance vs gst_video_color_balance ?
Comment 12 Matthieu Bouron 2014-02-12 15:57:03 UTC
(In reply to comment #11)
> (In reply to comment #10) 
> > typedef GstVideoColorBalance {
> 
> Isn't it a bit confusing, gst_color_balance vs gst_video_color_balance ?

gst_color_balance_ and GstColorBalance is already taken by the interface.
Comment 13 Matthieu Bouron 2014-02-12 18:24:55 UTC
By the way, the GstVideoColorBalance object should only contains a GHashTable to make the association between the channel label (gchar*) and the value (int).
Comment 14 Matthieu Bouron 2014-02-12 19:29:20 UTC
Created attachment 268954 [details] [review]
colorbalance: add video colorbalance meta API

Here is a WIP:
  * GstVideoColorBalanceMeta now owns a GstVideoColorBalance object.
  * The GstVideoColorBalance constains an hashtable to associate a channel label to a value. Maybe a GstVideoColorBalanceChannel is needed ?
  * It introduces: gst_video_color_balance_(set|get)_value + gst_video_color_balance_get_channels which returns the list of channel labels.
  * Documentation not done yet.

What do you think ?
Comment 15 Matthieu Bouron 2014-02-12 19:30:02 UTC
Created attachment 268955 [details] [review]
tests: add colorbalance meta API unit test

Unit tests updated according to the last changes in the API.
Comment 16 Sebastian Dröge (slomo) 2014-02-12 19:30:53 UTC
You could let the meta implement GstColorBalance to make the confusion complete ;)

Don't use a GHashTable for this btw, the overhead will be immense for the usually 4 channels that are usually supported.
Comment 17 Sebastian Dröge (slomo) 2014-02-12 19:31:28 UTC
Instead of a hash table it could just be a list of struct { name, value }
Comment 18 Nicolas Dufresne (ndufresne) 2014-02-12 20:59:59 UTC
As a follow up, I think this would be against what is currently implemented in playbin for this. Currently playbin will introspect the sink to check if it supports ColorBalance interface and at least the four mandatory channels, BRIGHTNESS, CONTRAST, HUE and SATURATION. If this is found, it will not plug a color balance element, which is another way to solve the passthrough issue.

It requires the application or a smart element like playbin to make decision, but it solves the problem at smaller complexity cost. Leaving as needinfo for now, but I cannot come with argument that would let me think we should go for a more complex mechanism.
Comment 19 Sebastian Dröge (slomo) 2014-05-26 13:04:24 UTC
So what should we do about this?
Comment 20 Nicolas Dufresne (ndufresne) 2014-05-26 17:28:01 UTC
The fact is that playbin already do (at least tries to do) the right thing for this use case. This bug wasn't filed with an actual issue, just a let's do this. I would close/invalid this one.

Transformation metas would be nice at some point, but they will need to be a single meta that stack the transformation to maintain order. The problem that would remains is that if you have:

trans1 ! trans2 ! trans3 ! sink

And sink does not support trans3, then trans1 and trans2 need to do the job in SW and not passthrough.

Now, it's a nice feature to be able to stack transformations, but at the same time, we have the opengl elements that can do that already, so I don't feel it's essential. For cogl/clutter, I think the way forward is to keep pushing for interoperability, and then we can focus on enhancing playsink toward fully GL if possible, otherwise standard SW elements we've been using so far. Remains to find how, but to be honest I'd keep it simple.
Comment 21 Vivia Nikolaidou 2018-05-06 10:29:16 UTC
Setting back to NEW because it's not NEEDINFO anymore.
Comment 22 GStreamer system administrator 2018-11-03 11:28:59 UTC
-- GitLab Migration Automatic Message --

This bug has been migrated to freedesktop.org's GitLab instance and has been closed from further activity.

You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/issues/111.