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 745901 - vaapidecodebin: Expose more properties to the user
vaapidecodebin: Expose more properties to the user
Status: RESOLVED FIXED
Product: gstreamer-vaapi
Classification: Other
Component: general
0.5.11
Other Linux
: Normal enhancement
: ---
Assigned To: gstreamer-vaapi maintainer(s)
gstreamer-vaapi maintainer(s)
Depends on:
Blocks: 743569
 
 
Reported: 2015-03-09 14:52 UTC by sreerenj
Modified: 2015-06-30 06:38 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Expose deinterlace-method property from inner vaapipostproc (3.74 KB, patch)
2015-04-29 14:47 UTC, Jacobo Aragunde Pérez
committed Details | Review
vaapidecodebin: Add property to disable VPP (6.37 KB, patch)
2015-06-22 12:08 UTC, sreerenj
none Details | Review

Description sreerenj 2015-03-09 14:52:25 UTC
This is to discuss/track the development of vaapidecodebin.
The vaapidecodebin is a bin having child elements, "vaapidecode ! queue ! vaapipostproc" .

Right now vaapidecodebin is only exposing a couple of queue element properties (max-size-buffers, max-size-bytes, max-size-time). And basically targeted for playbin usage.
Exposing more properties of vaapipostproc (eg: choice of deinterlacing algorithm) should be handy for specific usages.
Comment 1 sreerenj 2015-03-09 14:54:50 UTC
Copy&Paste from 745216

Simon Farnsworth 2015-03-05 14:04:30 UTC :
One comment on the code (not been able to test yet); you don't expose any of the vaapipostproc properties to the user, nor are they controlled by other means (e.g. GstMeta).
We've found that the default deinterlace-mode looks bad in most situations, and it's useful to be able to change it from 'bob' to 'motion-compensated' or 'motion-adaptive'.

sreerenj [reporter] [gstreamer-vaapi developer] 2015-03-05 14:31:44 UTC :
I deliberately  did that :) ..
I would like to get some discussion on this topic. 
Whether to make it simple which is only useful for playbin and don't expose any properties OR to make it as a replaceable element for vaapipostproc too.


Simon Farnsworth 2015-03-05 14:34:36 UTC:
Maybe worth discussing a change to the default deinterlace-method? "bob" looks awful, whereas (assuming field order is right in the source material) "motion-compensated" looks good on HSW, and falls back nicely to "motion-adaptive" on SNB and "bob" on things that can't do advanced deinterlacing.
Comment 2 Simon Farnsworth 2015-03-10 10:45:58 UTC
Two thoughts (on top of the need to fix the default deinterlace-method):

 1. Can vaapidecodebin and vaapipostproc implement http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gst-plugins-base-libs/html/gst-plugins-base-libs-gstcolorbalance.html for controlling hue, saturation etc? That way, there's an alternative to just setting properties that's easy to machine-discover.

 2. Can vaapipostproc be enhanced to be fully caps-driven, so that a downstream capable of coping with interlaced content (e.g. a H.265 encoder) gets interlaced content, and scaling is done based on upstream and downstream caps?

IOW, can things be changed so that "src ! vaapidecodebin ! video/x-raw,width=720,height=480 ! x264enc ! mux ! sink" gives x264enc 720x480 video, same framerate and interlacing as the src, while "src ! vaapidecodebin ! vaapisink" uses vaapipostproc to deinterlace for display?
Comment 3 Jacobo Aragunde Pérez 2015-04-29 14:47:59 UTC
Created attachment 302571 [details] [review]
Expose deinterlace-method property from inner vaapipostproc

This patch manually exposes the deinterlace-method property from the inner vaapipostproc.

This might be considered a suboptimal way of resolving the bug, since the ~20 lines of code from this patch should be repeated with minimal variations for every property from vaapipostproc we want to expose through.

Another way to resolve this would be using a more general method to expose child properties like GstChildProxy. It would depend on the approach we want to take: would we want to expose all the properties from vaapipostproc as a general rule, or only some specific ones?
Comment 4 sreerenj 2015-06-02 11:05:23 UTC
-more suggestions from Gwenole:

BTW, as a placeholder for vaapidecodebin, it might be interesting to
add an option to disable vaapipostproc insertion, or at least allow
for propagating deinterlacing flags to it, or allow for disabling
deinterlacing actually.
Comment 5 sreerenj 2015-06-17 13:25:41 UTC
(In reply to Simon Farnsworth from comment #2)
> Two thoughts (on top of the need to fix the default deinterlace-method):
> 
>  1. Can vaapidecodebin and vaapipostproc implement
> http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gst-plugins-base-
> libs/html/gst-plugins-base-libs-gstcolorbalance.html for controlling hue,
> saturation etc? That way, there's an alternative to just setting properties
> that's easy to machine-discover.


We have colorbalance interface support in vaapipostproc now.

> 
>  2. Can vaapipostproc be enhanced to be fully caps-driven, so that a
> downstream capable of coping with interlaced content (e.g. a H.265 encoder)
> gets interlaced content, 


A general solution could be problematic, we cannot rely on downstream capabilities all the time. For eg, playbin will autoplug a software deinterlacer in downstream which will do deinterlacing instead of the upstream vaapipostproc.

>and scaling is done based on upstream and
> downstream caps?
> 
> IOW, can things be changed so that "src ! vaapidecodebin !
> video/x-raw,width=720,height=480 ! x264enc ! mux ! sink" gives x264enc
> 720x480 video, same framerate and interlacing as the src, while "src !
> vaapidecodebin ! vaapisink" uses vaapipostproc to deinterlace for display?
Comment 6 sreerenj 2015-06-17 13:30:01 UTC
(In reply to sreerenj from comment #4)
> -more suggestions from Gwenole:
> 
> BTW, as a placeholder for vaapidecodebin, it might be interesting to
> add an option to disable vaapipostproc insertion, or at least allow
> for propagating deinterlacing flags to it, or allow for disabling
> deinterlacing actually.

It seems, vaapidecodebin introduces issues with negotiation(#745660,#749554) even for 1.4...
How about a property to disable vaapipostproc insertion and keep the default value as FALSE for now. This will be helpful atleast for the next release. We can change the default value to TRUE in future :)

Suggestions?
Comment 7 Gwenole Beauchesne 2015-06-17 13:34:01 UTC
vaapidecodebin was supposed to be particularly useful for 1.4 where autoplugging of SW/HW deinterlace elements are not available/possible. Without for 1.4, the usefulness of vaapidecodebin decreases dramatically IMHO :)
Comment 8 Víctor Manuel Jáquez Leal 2015-06-17 14:18:14 UTC
bug #745660 and bug #749554 aims to situations where VAEntrypointVideoProc is not available (vdpau backend and g45 chipset).

My naive approach would be a conditional registration of vaapipostproc, whether the entry is available or not.
Comment 9 Gwenole Beauchesne 2015-06-17 14:24:49 UTC
(In reply to Víctor Manuel Jáquez Leal from comment #8)
> bug #745660 and bug #749554 aims to situations where VAEntrypointVideoProc
> is not available (vdpau backend and g45 chipset).
> 
> My naive approach would be a conditional registration of vaapipostproc,
> whether the entry is available or not.

That's desirable.

As a side note, and IIRC, thaytan also suggested to additionally register only the supported set of vaapiencode_* elements.

My point of divergence could be that run-time checks for those (encode, vpp, etc.) would incur additional costs, thus increased start-up latency of the application. Hard to tell exactly, needs to be measured.
Comment 10 Víctor Manuel Jáquez Leal 2015-06-18 10:06:49 UTC
(In reply to Gwenole Beauchesne from comment #9)
> My point of divergence could be that run-time checks for those (encode, vpp,
> etc.) would incur additional costs, thus increased start-up latency of the
> application. Hard to tell exactly, needs to be measured.

Yes, but, as far as I understand, it will only happen when the plugins' cache is created or updated.
Comment 11 Gwenole Beauchesne 2015-06-18 10:54:20 UTC
(In reply to Víctor Manuel Jáquez Leal from comment #10)
> (In reply to Gwenole Beauchesne from comment #9)
> > My point of divergence could be that run-time checks for those (encode, vpp,
> > etc.) would incur additional costs, thus increased start-up latency of the
> > application. Hard to tell exactly, needs to be measured.
> 
> Yes, but, as far as I understand, it will only happen when the plugins'
> cache is created or updated.

Interesting. What are the criteria for cache updates?

I mean, imagine you have a some hardware that supports codecs C1 and C2. VA driver version n1 supports only C1 and further enablement causes C2 to be supported in version n2 only. Does this mean that, if this is cached, we wouldn't support C2 despite the fact that driver n2 is installed?
Comment 12 Víctor Manuel Jáquez Leal 2015-06-18 11:18:04 UTC
(In reply to Gwenole Beauchesne from comment #11)
>
> Interesting. What are the criteria for cache updates?

AFAIK: when 

1) the envvar GST_REGISTRY_UPDATE is _not_ set to "no" AND (
2) the user removes ~/.cache/gstreamer-1.0/ or wherever aims the envvar GST_REGISTRY.
3) OR the plugins path has a different mtime  -with new/removed/changed plugins-. )

> I mean, imagine you have a some hardware that supports codecs C1 and C2. VA
> driver version n1 supports only C1 and further enablement causes C2 to be
> supported in version n2 only. Does this mean that, if this is cached, we
> wouldn't support C2 despite the fact that driver n2 is installed?

That's an interesting situation: the user should "force" the cache update, otherwise the element won't appear.
Comment 13 Gwenole Beauchesne 2015-06-18 11:27:56 UTC
Well, the user is presumed/supposed to not be aware of underlying driver changes. Anyway, for an interim solution, that's a good starter imho.

There should be a way for the registry cache engine to hash or do something else on the processed caps on either pad. This is another interesting topic that would require core gstreamer changes anyway.
Comment 14 sreerenj 2015-06-18 11:47:53 UTC
May be we can check the VPP capabilities inside vaapipostproc when changing state from READY to PAUSED. I think playbin will automatically switch to vaapidecode instead of vaapidecodebin if it failed to change the state of vaapidecodebin...
Comment 15 Gwenole Beauchesne 2015-06-18 11:57:20 UTC
(In reply to sreerenj from comment #14)
> May be we can check the VPP capabilities inside vaapipostproc when changing
> state from READY to PAUSED. I think playbin will automatically switch to
> vaapidecode instead of vaapidecodebin if it failed to change the state of
> vaapidecodebin...

Besides, specifically to vaapipostproc, there should be an easy and readily available way to act exclusively in "passthrough" mode. Well, unless this didn't get through my mind at this time. :)
Comment 16 Víctor Manuel Jáquez Leal 2015-06-18 12:55:25 UTC
(In reply to sreerenj from comment #14)
> May be we can check the VPP capabilities inside vaapipostproc when changing
> state from READY to PAUSED. I think playbin will automatically switch to
> vaapidecode instead of vaapidecodebin if it failed to change the state of
> vaapidecodebin...

This is happening in gstreamer 1.5, but not in gstreamer 1.4
Comment 17 sreerenj 2015-06-19 08:10:04 UTC
(In reply to Víctor Manuel Jáquez Leal from comment #16)
> (In reply to sreerenj from comment #14)
> > May be we can check the VPP capabilities inside vaapipostproc when changing
> > state from READY to PAUSED. I think playbin will automatically switch to
> > vaapidecode instead of vaapidecodebin if it failed to change the state of
> > vaapidecodebin...
> 
> This is happening in gstreamer 1.5, but not in gstreamer 1.4

Aha, that could be a different bug then,,but only with nvidia right???
Comment 18 sreerenj 2015-06-19 08:12:25 UTC
Regarding the property expose,
I don't want to duplicate all code in vaapipostproc to vaapidecodebin..
For convenience we can expose deinterlace-method , and another property for disable/enable vaapipostproc... Customer can utilize GstChildProxy interface to set other properties of child elements...
Comment 19 Víctor Manuel Jáquez Leal 2015-06-19 08:26:31 UTC
(In reply to sreerenj from comment #17)
> (In reply to Víctor Manuel Jáquez Leal from comment #16)
> > (In reply to sreerenj from comment #14)
> > > May be we can check the VPP capabilities inside vaapipostproc when changing
> > > state from READY to PAUSED. I think playbin will automatically switch to
> > > vaapidecode instead of vaapidecodebin if it failed to change the state of
> > > vaapidecodebin...
> > 
> > This is happening in gstreamer 1.5, but not in gstreamer 1.4
> 
> Aha, that could be a different bug then,,but only with nvidia right???

All those backends/chipsets that don't provide VAEntrypointVideoProc, such as nvidia and G45 chipset.
Comment 20 sreerenj 2015-06-19 08:49:44 UTC
(In reply to Víctor Manuel Jáquez Leal from comment #19)
> (In reply to sreerenj from comment #17)
> > (In reply to Víctor Manuel Jáquez Leal from comment #16)
> > > (In reply to sreerenj from comment #14)
> > > > May be we can check the VPP capabilities inside vaapipostproc when changing
> > > > state from READY to PAUSED. I think playbin will automatically switch to
> > > > vaapidecode instead of vaapidecodebin if it failed to change the state of
> > > > vaapidecodebin...
> > > 
> > > This is happening in gstreamer 1.5, but not in gstreamer 1.4
> > 
> > Aha, that could be a different bug then,,but only with nvidia right???
> 
> All those backends/chipsets that don't provide VAEntrypointVideoProc, such
> as nvidia and G45 chipset.

I seriously think that there is some major change in playbin negotiation while moving from 1.4 to git master(1.5)..

A similar case but issue only with 1.5, https://bugzilla.gnome.org/show_bug.cgi?id=750944
Comment 21 sreerenj 2015-06-22 12:08:00 UTC
Review of attachment 302571 [details] [review]:

lgtm
Comment 22 sreerenj 2015-06-22 12:08:55 UTC
Created attachment 305829 [details] [review]
vaapidecodebin: Add property to disable VPP
Comment 23 Víctor Manuel Jáquez Leal 2015-06-22 12:24:51 UTC
Review of attachment 305829 [details] [review]:

::: gst/vaapi/gstvaapidecodebin.c
@@ +145,3 @@
+        gst_object_unref (pad);
+      }
+      break;

An what about when we want to disable the vpp in runtime? In that case, the code will be more complex, so I also think we should move it into a function.
Comment 24 Víctor Manuel Jáquez Leal 2015-06-22 12:32:58 UTC
Review of attachment 302571 [details] [review]:

::: gst/vaapi/gstvaapidecodebin.h
@@ +52,3 @@
   guint   max_size_bytes;
   guint64 max_size_time;
+  GstVaapiDeinterlaceMethod deinterlace_method;

Is it necessary to have this variable?

I guess we could just proxy the get/set to the postproc's get/set (if postproc does exist)
Comment 25 sreerenj 2015-06-22 12:37:36 UTC
(In reply to Víctor Manuel Jáquez Leal from comment #23)
> Review of attachment 305829 [details] [review] [review]:
> 
> ::: gst/vaapi/gstvaapidecodebin.c
> @@ +145,3 @@
> +        gst_object_unref (pad);
> +      }
> +      break;
> 
> An what about when we want to disable the vpp in runtime? In that case, the
> code will be more complex, so I also think we should move it into a function.

Do we really need to support runtime-disabling features?? Any specific use cases?
Allowing runtime disabling might hit more issues i think :)...
Comment 26 Víctor Manuel Jáquez Leal 2015-06-22 15:33:12 UTC
(In reply to sreerenj from comment #25)
> (In reply to Víctor Manuel Jáquez Leal from comment #23)
> > Review of attachment 305829 [details] [review] [review] [review]:
> > 
> > ::: gst/vaapi/gstvaapidecodebin.c
> > @@ +145,3 @@
> > +        gst_object_unref (pad);
> > +      }
> > +      break;
> > 
> > An what about when we want to disable the vpp in runtime? In that case, the
> > code will be more complex, so I also think we should move it into a function.
> 
> Do we really need to support runtime-disabling features?? Any specific use
> cases?

I don't have a use-case in mind. Just the API doesn't refrain the user, neither inform they if their request is ignored.

> Allowing runtime disabling might hit more issues i think :)...

I agree.
Comment 27 Víctor Manuel Jáquez Leal 2015-06-25 15:03:53 UTC
Comment on attachment 302571 [details] [review]
Expose deinterlace-method property from inner vaapipostproc

commit 76060c9542847a93edc6912dc21a4ef8f162dd75
Author: Jacobo Aragunde Pérez <jaragunde@igalia.com>
Date:   Wed Apr 29 16:34:07 2015 +0200

    vaapidecodebin: expose deinterlace-method property from inner vaapipostproc
    
    https://bugzilla.gnome.org/show_bug.cgi?id=745901
Comment 28 sreerenj 2015-06-30 06:38:54 UTC
Pushed.

commit f1bc4f8461cd6e5be9a22092f8c9c5ea042223e5
Author: Sreerenj Balachandran <sreerenj.balachandran@intel.com>
Date:   Tue Jun 30 09:35:37 2015 +0300

    vaapidecodebin: Add property to disable VPP