platform/upstream/gstreamer.git
10 years agovaapipostproc: use pooled vaapi video meta.
Gwenole Beauchesne [Fri, 22 Aug 2014 16:10:54 +0000 (18:10 +0200)]
vaapipostproc: use pooled vaapi video meta.

Use pooled GstVaapiVideoMeta information, i.e. always allocate that on
video buffer allocation. Also optimize copy of additional metadata info
into the resulting video buffer: only copy the video cropping info and
the source surface proxy.

https://bugzilla.gnome.org/show_bug.cgi?id=720311

Signed-off-by: Sreerenj Balachandran <sreerenj.balachandran@intel.com>
[fixed proxy leak, fixed double free on error, optimized meta copy]
Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
10 years agovaapipostproc: fix passthrough mode.
Gwenole Beauchesne [Fri, 22 Aug 2014 13:17:29 +0000 (15:17 +0200)]
vaapipostproc: fix passthrough mode.

If no explicit output surface format is supplied try to keep the one
supplied through the sink pad caps. This avoids a useless copy, even
if things are kept in GPU memory.

This is a performance regression from git commit dfa70b9.

10 years agovaapipostproc: fix output buffer to have a GstVaapiVideoMemory.
Sreerenj Balachandran [Sat, 5 Jul 2014 18:00:34 +0000 (21:00 +0300)]
vaapipostproc: fix output buffer to have a GstVaapiVideoMemory.

https://bugzilla.gnome.org/show_bug.cgi?id=720311

[used new infrastructure through base decide_allocation() impl]
Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
10 years agovaapipostproc: enable advanced deinterlacing with same format.
Gwenole Beauchesne [Fri, 22 Aug 2014 09:13:36 +0000 (11:13 +0200)]
vaapipostproc: enable advanced deinterlacing with same format.

If only advanced deinterlacing is requested, i.e. deinterlacing is
the only active algorithm to apply with source and output surface
formats being the same, then make sure to enable VPP processing.

Otherwise, allow fallback to bob-deinterlacing with simple rendering
flags alteration.

10 years agovaapivideomemory: avoid NULL pointer unref if GstVaapiImage creation failed.
Sreerenj Balachandran [Thu, 21 Aug 2014 12:04:20 +0000 (15:04 +0300)]
vaapivideomemory: avoid NULL pointer unref if GstVaapiImage creation failed.

https://bugzilla.gnome.org/show_bug.cgi?id=735156

10 years agoplugins: fix memory leaks.
Gwenole Beauchesne [Fri, 22 Aug 2014 11:25:03 +0000 (13:25 +0200)]
plugins: fix memory leaks.

10 years agoplugins: factor out decide_allocation() hook.
Gwenole Beauchesne [Thu, 21 Aug 2014 12:10:36 +0000 (14:10 +0200)]
plugins: factor out decide_allocation() hook.

Add a default decide_allocation() hook to GstVaapiPluginBase. The caps
feature argument can be used to force a bufferpool with a specific kind
of memory.

10 years agoplugins: allow bufferpool to not allocate vaapi video meta.
Gwenole Beauchesne [Thu, 21 Aug 2014 09:12:39 +0000 (11:12 +0200)]
plugins: allow bufferpool to not allocate vaapi video meta.

Add GST_VAAPI_VIDEO_BUFFER_POOL_ACQUIRE_FLAG_NO_ALLOC params flag that
can be used to disable early allocations of vaapi video metas on buffers,
thus delagating that to the bufferpool user.

10 years agoplugins: re-indent all GstVaapiVideo* related source code.
Gwenole Beauchesne [Thu, 21 Aug 2014 08:45:31 +0000 (10:45 +0200)]
plugins: re-indent all GstVaapiVideo* related source code.

10 years agosurfaceproxy: fix copy to propagate view_id.
Gwenole Beauchesne [Fri, 22 Aug 2014 13:12:46 +0000 (15:12 +0200)]
surfaceproxy: fix copy to propagate view_id.

Fix gst_vaapi_surface_proxy_copy() to copy the view-id element, thus
fixing random frames skipped when vaapipostproc element is used in
passthrough mode. In that mode, GstMemory is copied, thus including
the underlying GstVaapiVideoMeta and associated GstVaapiSurfaceProxy.

10 years agovaapipostproc: fix detection of output surface format changes.
Gwenole Beauchesne [Wed, 20 Aug 2014 14:38:45 +0000 (16:38 +0200)]
vaapipostproc: fix detection of output surface format changes.

Default to I420 format for output surfaces so that to match the usual
GStreamer pipelines. Though, internally, we could still opt for NV12
surface formats, i.e. default format=ENCODED is a hint for that, thus
delegating the decision to the VA driver.

10 years agovaapipostproc: fix construction of allowed sink pad caps.
Gwenole Beauchesne [Wed, 20 Aug 2014 08:59:53 +0000 (10:59 +0200)]
vaapipostproc: fix construction of allowed sink pad caps.

Fix construction of the set of caps allowed on the sink pad to filter
out unsupported raw video caps with GStreamer >= 1.2.

10 years agovaapipostproc: improve heuristics for detecting native VA surfaces.
Gwenole Beauchesne [Wed, 20 Aug 2014 08:37:02 +0000 (10:37 +0200)]
vaapipostproc: improve heuristics for detecting native VA surfaces.

Use the new gst_caps_has_vaapi_surface() helper function to detect
whether the sink pad caps contain native VA surfaces, or not, i.e.
no raw video caps.

Also rename is_raw_yuv to get_va_surfaces to make the variable more
explicit as we just want a way to differentiate raw video caps from
VA surfaces actually.

10 years agovaapipostproc: disable discontinuity detection code.
Gwenole Beauchesne [Tue, 12 Aug 2014 16:33:25 +0000 (18:33 +0200)]
vaapipostproc: disable discontinuity detection code.

The "discontinuity" tracking code, whereby lost frames are tentatively
detected, is inoperant if the sink pad buffer timestamps are not right
to begin with.

This is a temporary workaround until the following bug is fixed:
https://bugzilla.gnome.org/show_bug.cgi?id=734386

10 years agovaapipostproc: fix heuristic for detecting discontinuity.
Gwenole Beauchesne [Thu, 7 Aug 2014 12:57:26 +0000 (14:57 +0200)]
vaapipostproc: fix heuristic for detecting discontinuity.

In order to make the discontinuity detection code useful, we need to
detect the lost frames in the history as early as the previous frame.
This is because some VA implementations only support one reference
frame for advanced deinterlacing.

In practice, turn the condition for detecting new frame that is beyond
the previous frame from field_duration*2 to field_duration*3, i.e.
nothing received for the past frame and a half because of possible
rounding errors when calculating the field-duration either in this
element (vaapipostproc), or from the upstream element (parser element).

This is a regression introduced with commit faefd62.

https://bugzilla.gnome.org/show_bug.cgi?id=734135

10 years agoplugins: fix detection of raw video caps.
Gwenole Beauchesne [Wed, 20 Aug 2014 09:43:08 +0000 (11:43 +0200)]
plugins: fix detection of raw video caps.

Use the new gst_caps_has_vaapi_surface() helper function to better
detect raw video caps, and in particular those from RGB colorspace.

https://bugzilla.gnome.org/show_bug.cgi?id=734665

10 years agoplugins: add helper for detecting VA surfaces in caps.
Gwenole Beauchesne [Wed, 20 Aug 2014 09:30:41 +0000 (11:30 +0200)]
plugins: add helper for detecting VA surfaces in caps.

Introduce new gst_caps_has_vaapi_surface() helper function to detect
whether the supplied caps has VA surfaces. With GStreamer >= 1.2, this
implies a check for memory:VASurface caps features, and format=ENCODED
for earlier versions of GStreamer.

10 years agovaapidecode: start the decoder task again after finishing
Sebastian Dröge [Tue, 12 Aug 2014 10:01:57 +0000 (13:01 +0300)]
vaapidecode: start the decoder task again after finishing

This allows the element to accept data again after draining without
a hard reset or caps change happening in between.

https://bugzilla.gnome.org/show_bug.cgi?id=734616

10 years agovaapidecode: unlock condition variables before shutting down the element
Sebastian Dröge [Tue, 12 Aug 2014 10:00:03 +0000 (13:00 +0300)]
vaapidecode: unlock condition variables before shutting down the element

Otherwise threads might wait for them, causing the shutdown of the element
to deadlock on the streaming thread.

https://bugzilla.gnome.org/show_bug.cgi?id=734616

10 years agovaapidecode: reset decoder_finish variable after stopping the decoder thread
Sebastian Dröge [Mon, 11 Aug 2014 14:15:24 +0000 (17:15 +0300)]
vaapidecode: reset decoder_finish variable after stopping the decoder thread

Otherwise the element is not usable again after draining/EOS.

https://bugzilla.gnome.org/show_bug.cgi?id=734616

10 years agovaapidecode: don't try flushing the decoder instance if we didn't create one yet
Sebastian Dröge [Mon, 11 Aug 2014 14:14:53 +0000 (17:14 +0300)]
vaapidecode: don't try flushing the decoder instance if we didn't create one yet

This otherwise results in unnecessary error messages.

https://bugzilla.gnome.org/show_bug.cgi?id=734616

10 years agobuild: fix with --no-undefined linker flags.
Gwenole Beauchesne [Fri, 1 Aug 2014 04:32:32 +0000 (06:32 +0200)]
build: fix with --no-undefined linker flags.

https://bugzilla.gnome.org/show_bug.cgi?id=729352

10 years agovaapisink: add support for GstColorBalance interface.
Changzhi Wei [Thu, 23 Jan 2014 15:44:09 +0000 (15:44 +0000)]
vaapisink: add support for GstColorBalance interface.

https://bugzilla.gnome.org/show_bug.cgi?id=722390

[fixed channel names, simplified range factor, fixed memory leak]
Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
10 years agovaapisink: add support for colorbalance adjustment.
Changzhi Wei [Thu, 23 Jan 2014 15:23:00 +0000 (15:23 +0000)]
vaapisink: add support for colorbalance adjustment.

https://bugzilla.gnome.org/show_bug.cgi?id=722390

[fixed and simplified tracking of colorbalance value changes]
Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
10 years agovaapisink: improve installation of properties.
Gwenole Beauchesne [Thu, 31 Jul 2014 11:18:21 +0000 (13:18 +0200)]
vaapisink: improve installation of properties.

Simplify the creation and installation process of properties, by first
accumulating them into a g_properties[] array, and next calling into
g_object_class_install_properties().

Also add missing docs and flags to some properties.

10 years agovaapisink: code clean-ups.
Gwenole Beauchesne [Thu, 31 Jul 2014 08:48:15 +0000 (10:48 +0200)]
vaapisink: code clean-ups.

Move code around in a more logical way. Introduce GST_VAAPISINK_CAST()
helper macro and use it wherever we know the object is a GstBaseSink or
any base class. Drop explicit initializers for values that have defaults
set to zero.

10 years agovaapisink: re-indent all GstVaapiSink related source code.
Gwenole Beauchesne [Thu, 31 Jul 2014 08:37:57 +0000 (10:37 +0200)]
vaapisink: re-indent all GstVaapiSink related source code.

10 years agovaapisink: introduce separate backends.
Gwenole Beauchesne [Wed, 30 Jul 2014 15:27:50 +0000 (17:27 +0200)]
vaapisink: introduce separate backends.

Introduce new backends vtable so that to have clean separation between
display dependent code and common base code. That's a "soft" separation,
we don't really need dedicated objects.

https://bugzilla.gnome.org/show_bug.cgi?id=722248

10 years agovaapisink: drop unused "synchronous" mode.
Gwenole Beauchesne [Wed, 30 Jul 2014 14:47:20 +0000 (16:47 +0200)]
vaapisink: drop unused "synchronous" mode.

Support for X11 "synchronous" mode was never implemented, and was only
to be useful for debugging. Drop that altogether, that's not going to
be useful in practice.

https://bugzilla.gnome.org/show_bug.cgi?id=733985

10 years agovaapisink: drop unused variables.
Gwenole Beauchesne [Wed, 30 Jul 2014 15:32:29 +0000 (17:32 +0200)]
vaapisink: drop unused variables.

Drop obsolete, and now unused, video_buffer_pool and video_buffer_size
variables. They got merged into the GstVaapiPluginBase object.

10 years agovaapisink: drop GLX rendering and fancy effects.
Gwenole Beauchesne [Wed, 30 Jul 2014 14:35:32 +0000 (16:35 +0200)]
vaapisink: drop GLX rendering and fancy effects.

Rendering with GLX in vaapisink is kind of useless nowadays, including
OpenGL related fancy effects. Plain VA/GLX interfaces are also getting
deprecated in favor of EGL, or more direct buffer sharing with actual
GL textures.

Should testing of interop with GLX be needed, one could still be using
the modern cluttersink or glimagesink elements.

https://bugzilla.gnome.org/show_bug.cgi?id=733984

10 years agovaapisink: listen to window size changes on X11.
Holger Kaelberer [Tue, 5 Nov 2013 13:01:11 +0000 (14:01 +0100)]
vaapisink: listen to window size changes on X11.

Allow dynamic changes to the window, e.g. performed by the user, and
make sure to refresh its contents, while preserving aspect ratio.

In practice, Expose and ConfigureNotify events are tracked in X11
display mode by default. This occurs in a separte event thread, and
this is similar to what xvimagesink does. Any of those events will
trigger a reconfiguration of the window "soft" size, subsequently
the render-rect when necessary, and finally _expose() the result.

The default of handle_events=true can be changed programatically via
gst_x_overlay_handle_events().

Thanks to Fabrice Bellet for rebasing the patch.

https://bugzilla.gnome.org/show_bug.cgi?id=711478

[dropped XInitThreads(), cleaned up the code a little]
Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
10 years agovaapidecode: decode and output all pending frames on normal EOS.
Gwenole Beauchesne [Tue, 29 Jul 2014 13:47:46 +0000 (15:47 +0200)]
vaapidecode: decode and output all pending frames on normal EOS.

The gst_vaapidecode_decode_loop() function is called within a separate
task to fetch and output all frames that were decoded so far. So, if
the decoder_loop_status is forcibly set to EOS when _finish() is called,
then we are bound to exist the task without submitting the pending
frames.

If the downstream element error'ed out, then the gst_pad_push() would
propagate up an error and so we will get it right for cutting off
_finish() early in that case.

This is a regression from 6003596.

https://bugzilla.gnome.org/show_bug.cgi?id=733897

10 years agoBump version for development.
Gwenole Beauchesne [Tue, 29 Jul 2014 11:24:52 +0000 (13:24 +0200)]
Bump version for development.

10 years agoAUTHORS: updates.
Gwenole Beauchesne [Tue, 29 Jul 2014 08:31:58 +0000 (10:31 +0200)]
AUTHORS: updates.

10 years agoNEWS: updates.
Gwenole Beauchesne [Tue, 29 Jul 2014 08:31:15 +0000 (10:31 +0200)]
NEWS: updates.

10 years agovaapidecode: properly return from decode loop on downstream errors.
Matthew Waters [Tue, 29 Jul 2014 06:22:01 +0000 (16:22 +1000)]
vaapidecode: properly return from decode loop on downstream errors.

Fixes a hang/race on shutdown where _decode_loop() had already completed
its execution and _finish() was waiting on a GCond for decode_loop()
to complete.  Also fixes the possible race where _finish() is called
but _decode_loop() endlessly returns before signalling completion
iff the decoder instance returns GST_FLOW_OK.

Found with: ... ! vaapidecode ! {glimagesink,cluttersink}

https://bugzilla.gnome.org/show_bug.cgi?id=733897

[factored out GST_VIDEO_DECODER_STREAM_UNLOCK() call]
Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
10 years ago0.5.9.
Gwenole Beauchesne [Mon, 28 Jul 2014 16:45:49 +0000 (18:45 +0200)]
0.5.9.

10 years agovaapisink: fix GstVideoOverlay::expose() implementation.
Gwenole Beauchesne [Mon, 28 Jul 2014 16:31:09 +0000 (18:31 +0200)]
vaapisink: fix GstVideoOverlay::expose() implementation.

Now that we always track the currently active video buffer, it is
not necessary to automatically increase its reference since this is
implicitly performed in ::show_frame() through the get_input_buffer()
helper from GstVaapiPluginBase class.

This is a regression from a26df80.

10 years agovaapidecode: simplify bufferpool configuration.
Gwenole Beauchesne [Mon, 28 Jul 2014 16:00:19 +0000 (18:00 +0200)]
vaapidecode: simplify bufferpool configuration.

Rework the logics behind the configuration of an adequate bufferpool,
especially when OpenGL meta or additional capsfeatures are needed.

Besides, for GStreamer >= 1.4, the first capsfeatures that gets matched,
and that is not system memory, is now selected by default.

10 years agovaapidecode: fix auto-plugging of vaapisink element.
Gwenole Beauchesne [Mon, 28 Jul 2014 14:43:47 +0000 (16:43 +0200)]
vaapidecode: fix auto-plugging of vaapisink element.

Make sure to propagate memory:VASurface capsfeature to srcpad caps
only for GStreamer >= 1.5 as the plug-in elements in GStreamer 1.4
core currently miss additional patches available in 1.5-git (1.6).

This is a temporary workaround.

10 years agoconfigure: allow builds against GStreamer git (1.5.x).
Sreerenj Balachandran [Mon, 28 Jul 2014 12:54:46 +0000 (15:54 +0300)]
configure: allow builds against GStreamer git (1.5.x).

https://bugzilla.gnome.org/show_bug.cgi?id=733688

10 years agoconfigure: fix build with GStreamer 1.4.0 release.
Gwenole Beauchesne [Mon, 28 Jul 2014 12:20:33 +0000 (14:20 +0200)]
configure: fix build with GStreamer 1.4.0 release.

10 years agodebian: fix packaging for new naming scheme.
Gwenole Beauchesne [Tue, 4 Mar 2014 18:40:59 +0000 (19:40 +0100)]
debian: fix packaging for new naming scheme.

10 years agoNEWS: updates.
Gwenole Beauchesne [Mon, 28 Jul 2014 09:52:06 +0000 (11:52 +0200)]
NEWS: updates.

10 years agoconfigure: mark support for GStreamer < 1.2 as deprecated.
Gwenole Beauchesne [Mon, 28 Jul 2014 09:39:11 +0000 (11:39 +0200)]
configure: mark support for GStreamer < 1.2 as deprecated.

Supporting anything thing below GStreamer 1.2 is asking for trouble
for keeping up with the required facilities to make efficient pipelines.
Users are invited to upgrade to the very latest GStreamer 1.2.x release,
at the minimum.

10 years agoconfigure: mark support for GStreamer 0.10 as obsolete.
Gwenole Beauchesne [Mon, 28 Jul 2014 09:35:24 +0000 (11:35 +0200)]
configure: mark support for GStreamer 0.10 as obsolete.

Support for GStreamer 0.10 is obsolete. i.e. it is no longer supported
and may actually be removed altogether for a future release. There is
no real point to maintain a build for such an ancient GStreamer version
that is not even supported upstream.

10 years agovaapisink: allow a specific view component to be displayed.
Gwenole Beauchesne [Mon, 28 Jul 2014 08:25:26 +0000 (10:25 +0200)]
vaapisink: allow a specific view component to be displayed.

If a multiview stream is decoded, multiple view components are submitted
as is downstream. It is the responsibility of the sink element to display
the required view components. By default, always select the frame buffer
that matches the view-id of the very first frame to be displayed.

However, introduce a "view-id" property to allow the selection of a
specific view component of interest to display.

10 years agovaapisink: always keep the last displayed buffer around.
Gwenole Beauchesne [Mon, 28 Jul 2014 08:09:34 +0000 (10:09 +0200)]
vaapisink: always keep the last displayed buffer around.

Always record the VA surface that is currently being rendered, no matter
the fact we are using texturedblit or overlay. That's because in some
occasions, we need to refresh or resize the displayed contents based on
new events. e.g. user-resized window.

Besides, it's simpler to track the last video buffer in GstVaapiSink than
through the base sink "last-sample".

10 years agovaapisink: add support for "display-name" property.
Gwenole Beauchesne [Fri, 25 Jul 2014 09:13:29 +0000 (11:13 +0200)]
vaapisink: add support for "display-name" property.

Add a "display-name" property to vaapisink so that the end user could
select the desired output. Keep "display-name" in-line with the existing
"display" (GstVaapiDisplayXXX type).

So, for X11 or GLX, the "display-name" is the usual display name as we
know for XOpenDisplay(); for Wayland, the "display-name" is the name used
for wl_display_connect(); and for DRM, the "display-name" is actually the
DRI device name.

https://bugzilla.gnome.org/show_bug.cgi?id=722247

10 years agowindow: make gst_vaapi_window_reconfigure() thread-safe.
Gwenole Beauchesne [Fri, 25 Jul 2014 15:29:40 +0000 (17:29 +0200)]
window: make gst_vaapi_window_reconfigure() thread-safe.

Ensure the X11 implementation for GstVaapiWindow::get_geometry() is
thread-safe by default, so that upper layer users don't need to handle
that explicitly.

10 years agowindow: allow for updating size from current geometry.
Holger Kaelberer [Mon, 29 Jul 2013 07:28:28 +0000 (09:28 +0200)]
window: allow for updating size from current geometry.

Add gst_vaapi_window_reconfigure() interface to force an update of
the GstVaapiWindow "soft" size, based on the current geometry of the
underlying native window.

This can be useful for instance to synchronize the window size when
the user changed it.

Thanks to Fabrice Bellet for rebasing the patch.

[changed interface to gst_vaapi_window_reconfigure()]
Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
10 years agowindow: re-indent all GstVaapiWindow related source code.
Gwenole Beauchesne [Fri, 25 Jul 2014 14:53:41 +0000 (16:53 +0200)]
window: re-indent all GstVaapiWindow related source code.

10 years agodisplay: add interface to retrieve the display name.
Gwenole Beauchesne [Fri, 25 Jul 2014 09:24:39 +0000 (11:24 +0200)]
display: add interface to retrieve the display name.

Add gst_vaapi_display_get_display_name() helper function to determine
the name associated with the underlying native display. Note that for
raw DRM backends, the display name is actually the device path.

10 years agodisplay: fix comparison of X11 display names.
Gwenole Beauchesne [Fri, 25 Jul 2014 08:55:53 +0000 (10:55 +0200)]
display: fix comparison of X11 display names.

Make sure to not only compare display host names, but also the actual
display number. The screen number does not need to be checked at this
time.

10 years agovaapidecode: add support for VideoAlignment bufferpool option.
Gwenole Beauchesne [Fri, 25 Jul 2014 13:52:06 +0000 (15:52 +0200)]
vaapidecode: add support for VideoAlignment bufferpool option.

Always add VideoAlignment bufferpool option if the downstream element
expects its own pool to be used but does not offer it through a proper
propose_allocation() implementation for instance, and that the ALLOCATION
query does not expose the availability of the Video Meta API.

This fixes propagation of video buffer stride information to Firefox.

10 years agovaapivideomemory: always prefer native VA surface formats.
Gwenole Beauchesne [Fri, 25 Jul 2014 13:44:58 +0000 (15:44 +0200)]
vaapivideomemory: always prefer native VA surface formats.

Make sure to always prefer native internal formats for the VA surfaces
that get allocated. Also disable "direct-rendering" mode in this case.

This is needed so that to make sure that anything that gets out of the
decoder, or anything that gets into the encoder, is in native format
for the hardware, and thus the driver doesn't need to perform implicit
conversions in there. Interop with SW elements is still available with
fast implementations of VA imaging APIs.

10 years agovaapivideomemory: disallow memory shares across buffers, use a copy.
Gwenole Beauchesne [Thu, 24 Jul 2014 09:58:29 +0000 (11:58 +0200)]
vaapivideomemory: disallow memory shares across buffers, use a copy.

Forbid shares of GstMemory instances, and rather make copy of it. This
effectively copies the GstMemory structure and enclosed metadata, but
this does not copy the VA surface contents itself. It should though.

This fixes preroll and makes sure to not download garbage for the first
frame when a SW rendering sink is used.

10 years agovaapivideomemory: use an image pool to cache objects.
Gwenole Beauchesne [Thu, 24 Jul 2014 04:46:22 +0000 (06:46 +0200)]
vaapivideomemory: use an image pool to cache objects.

Use an image pool to hold VA images to be used for downloads/uploads
of contents for the associated surface.

This is an optmization for size. So, instead of creating as many VA
images as there are buffers (then VA surfaces) allocated, we only
maintain a minimal set of live VA images, thus preserving memory
resources.

10 years agovaapivideomemory: forbid R/W mappings if non direct-rendering mode.
Gwenole Beauchesne [Wed, 23 Jul 2014 22:14:04 +0000 (00:14 +0200)]
vaapivideomemory: forbid R/W mappings if non direct-rendering mode.

Disable read-write mappings if "direct-rendering" is not supported.
Since the ordering of read and write operations is not specified,
this would require to always download the VA surface on _map(), then
commit the temporary VA image back to the VA surface on _unmap().

Some SW decoding plug-in elements still use R/W mappings though.

https://bugzilla.gnome.org/show_bug.cgi?id=733242

10 years agovaapivideomemory: minor code clean-ups.
Gwenole Beauchesne [Wed, 23 Jul 2014 21:49:53 +0000 (23:49 +0200)]
vaapivideomemory: minor code clean-ups.

Fix error messages introduced in the previous commit for the _map()
imaplementation. Also use the new get_image_data() helper function
to determine the base pixels data buffer from a GstVaapiImage when
updating the video info structure from it.

10 years agovaapivideomemory: add support for raw pixels mappings.
Gwenole Beauchesne [Wed, 23 Jul 2014 16:54:13 +0000 (18:54 +0200)]
vaapivideomemory: add support for raw pixels mappings.

Allow raw pixels of the whole frame to be mapped read-only. i.e. in
cases where the buffer pool is allocated without VideoMeta API, thus
individual planes cannot be mapped.

This is initial support for Firefox >= 30.

https://bugzilla.gnome.org/show_bug.cgi?id=731886

10 years agovaapivideomemory: fix determination of the surface pool format.
Sreerenj Balachandran [Thu, 3 Jul 2014 15:41:11 +0000 (18:41 +0300)]
vaapivideomemory: fix determination of the surface pool format.

While creating the vaapi video allocator, make sure the associated
surface pool has correct format instead of defaulting to NV12 video
format even though there is no direct rendering support.

https://bugzilla.gnome.org/show_bug.cgi?id=732691

10 years agovaapivideomemory: fix association of surface to proxy.
Gwenole Beauchesne [Wed, 23 Jul 2014 16:01:21 +0000 (18:01 +0200)]
vaapivideomemory: fix association of surface to proxy.

Make sure to always update the VA surface pointer whenever the proxy
changes. This used to only work when the VA surface is written to, in
interop with SW element ("upload" feature), and this now fixes cases
when the VA surface is needed for reading, in interop with SW element
("download" feature).

10 years agoplugins: expose I420 format for interop with SW elements.
Gwenole Beauchesne [Wed, 23 Jul 2014 08:23:06 +0000 (10:23 +0200)]
plugins: expose I420 format for interop with SW elements.

Always expose I420 format by default when the VA surface could be
mapped for interoperability with non harware accelerated elements.
However, the default behaviour remains the auto-plugging of vaapi
elements, down to the sink.

Side effect: "direct-rendering" mode is also disabled most of the
times as plain memcpy() from uncached speculative write combining
memory is not going to be efficient enough.

10 years agoplugins: allow download capability to vaapidecode element.
Gwenole Beauchesne [Tue, 22 Jul 2014 16:54:29 +0000 (18:54 +0200)]
plugins: allow download capability to vaapidecode element.

Fix support for VA surface download capability in vaapidecode element
for GStreamer >= 1.2. This is a fix to supporting libva-vdpau-driver,
but also the libva-intel-driver while performing hardware accelerated
conversions from the native VA surface format (NV12) to the desired
output VA image format.

For instance, this fixes pipelines involving vaapidecode ! xvimagesink.

https://bugzilla.gnome.org/show_bug.cgi?id=733243

10 years agodecoder: mpeg4: fix picture decoder return value for skipped frames.
Fabrice Bellet [Wed, 16 Jul 2014 23:51:36 +0000 (01:51 +0200)]
decoder: mpeg4: fix picture decoder return value for skipped frames.

The picture decoder should return GST_VAAPI_DECODER_STATUS_DROP_FRAME
when a frame should be skipped, so the stream processing is not stalled.

https://bugzilla.gnome.org/show_bug.cgi?id=733324

10 years agodecoder: mpeg2: respect any input PTS provided for a frame.
Jan Schmidt [Fri, 4 Jul 2014 05:13:32 +0000 (15:13 +1000)]
decoder: mpeg2: respect any input PTS provided for a frame.

The timestamp generator in gstvaapidecoder_mpeg2.c always interpolated
frame timestamps within a GOP, even when it's been fed input PTS for
every frame.

That leads to incorrect output timestamps in some situations - for example
live playback where input timestamps have been scaled based on arrival time
from the network and don't exactly match the framerate.

https://bugzilla.gnome.org/show_bug.cgi?id=732719

10 years agoGstVaapiObject: make gst_vaapi_object_new() more robust.
Sreerenj Balachandran [Wed, 22 Jan 2014 06:20:59 +0000 (08:20 +0200)]
GstVaapiObject: make gst_vaapi_object_new() more robust.

Forbid GstVaapiObject to be created without an associated klass spec.
It is mandatory that the subclass implements an adequate .finalize()
hook, so it shall provide a valid GstVaapiObjectClass.

https://bugzilla.gnome.org/show_bug.cgi?id=722757

[made non-NULL klass argument to gst_vaapi_object_new() a requirement]
Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
10 years agoGstVaapiObject: initialize the derived object data with init() hook.
Sreerenj Balachandran [Tue, 21 Jan 2014 13:43:57 +0000 (15:43 +0200)]
GstVaapiObject: initialize the derived object data with init() hook.

Call the subclass .init() function in gst_vaapi_object_new(), if
needed. The default behaviour is to zero initialize the subclass
object data, then the .init() function can be used to initialize
fields to non-default values, e.g. VA object ids to VA_INVALID_ID.

Also fix the gst_vaapi_object_new() description, which was merely
copied from GstVaapiMiniObject.

https://bugzilla.gnome.org/show_bug.cgi?id=722757

[changed to always zero initialize the subclass]
Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
10 years agovaapidecode: make decoder work with playbin
Lionel Landwerlin [Fri, 13 Jun 2014 20:45:04 +0000 (21:45 +0100)]
vaapidecode: make decoder work with playbin

When playbin/decodebin builds the pipeline, it puts decoders and sinks
into different bins and forwards the queries from bins to bins. So in
the initials steps the pipeline is built iteratively by playbin and
looks like this :

[filesrc]

[filesrc] -> [typefind]

[filesrc] -> [typefind] -> [demuxer]

[filesrc] -> [typefind] -> [demuxer] -> [decoder]

At this point the decoder is asked for its SRC caps and it will make a
choice based on what gst_pad_peer_query_caps() returns. The problem is
that the caps returns at that point includes caps features like ANY,
essentially because playbin can plug in additional elements like
videoscale, videoconv or deinterlace.

This patch adds a another call to
gst_vaapi_find_preferred_caps_feature() when the decoder decides its
allocation, to make sure we asks the downstream elements when the
entire pipeline has been built.

https://bugzilla.gnome.org/show_bug.cgi?id=731645

10 years agovaapipostproc: don't let tmp_rect go out of scope.
Simon Farnsworth [Fri, 27 Jun 2014 10:57:11 +0000 (11:57 +0100)]
vaapipostproc: don't let tmp_rect go out of scope.

A compiler change showed me that tmp_rect went out of scope before
it was used. Move it to the beginning of the function instead.

https://bugzilla.gnome.org/show_bug.cgi?id=726363

Signed-off-by: Simon Farnsworth <simon.farnsworth@onelan.co.uk>
[added guards for GStreamer 0.10 builds]
Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
10 years agoAUTHORS: updates.
Gwenole Beauchesne [Thu, 3 Jul 2014 20:44:40 +0000 (22:44 +0200)]
AUTHORS: updates.

10 years agoREADME: updates.
Gwenole Beauchesne [Thu, 3 Jul 2014 20:34:35 +0000 (22:34 +0200)]
README: updates.

Drop references to deprecated plugins (vaapiupload, vaapidownload),
mention that support for GStreamer 0.10 is deprecated, make overview
more descriptive in certain aspects.

10 years agoNEWS: updates.
Gwenole Beauchesne [Thu, 3 Jul 2014 20:21:39 +0000 (22:21 +0200)]
NEWS: updates.

10 years agobuild: mention that support for GStreamer 0.10 is deprecated.
Gwenole Beauchesne [Thu, 3 Jul 2014 17:42:02 +0000 (19:42 +0200)]
build: mention that support for GStreamer 0.10 is deprecated.

10 years agobuild: fix for GStreamer 0.10.
Gwenole Beauchesne [Thu, 3 Jul 2014 15:17:00 +0000 (17:17 +0200)]
build: fix for GStreamer 0.10.

10 years agobuild: fix for GStreamer 1.0.x.
Gwenole Beauchesne [Thu, 3 Jul 2014 16:01:09 +0000 (18:01 +0200)]
build: fix for GStreamer 1.0.x.

10 years agodecoder: h264: detect incorrectly paired fields in frames.
Gwenole Beauchesne [Thu, 3 Jul 2014 11:48:48 +0000 (13:48 +0200)]
decoder: h264: detect incorrectly paired fields in frames.

When a DPB flush is required, e.g. at a natural and of stream or issued
explicitly through an IDR, try to detect any frame left in the DPB that
is interlaced but does not contain two decoded fields. In that case, mark
the picture as having a single field only.

This avoids a hang while decoding tv_cut.mkv.

10 years agodecoder: h264: simplify the DPB output process.
Gwenole Beauchesne [Thu, 3 Jul 2014 09:13:33 +0000 (11:13 +0200)]
decoder: h264: simplify the DPB output process.

Simplify the dpb_output() function to exclusively rely on the frame store
buffer to output, since this is now always provided. Besides, also fix
cases where split fields would not be displayed.

This is a regression from f48b1e0.

10 years agoh264parse: drop patches merged upstream.
Gwenole Beauchesne [Tue, 1 Jul 2014 15:20:44 +0000 (17:20 +0200)]
h264parse: drop patches merged upstream.

0003-h264parse-fix-and-optimize-NAL-collection-function.patch
0005-h264parse-introduce-new-state-tracking-variables.patch
0006-h264parse-improve-conditions-for-skipping-NAL-units.patch
0007-h264parse-fix-collection-of-access-units-to-preserve.patch

10 years agodecoder: h264: fix memory leak in PPS.
Gwenole Beauchesne [Tue, 1 Jul 2014 15:18:08 +0000 (17:18 +0200)]
decoder: h264: fix memory leak in PPS.

Cope with latest changes from codecparsers/h264. It is now required
to explicitly clear the GstH264PPS structure as it could contain
additional allocations (slice_group_ids).

10 years agocodecparsers: update to gst-vaapi-branch commit 2d53b69.
Gwenole Beauchesne [Tue, 1 Jul 2014 15:13:56 +0000 (17:13 +0200)]
codecparsers: update to gst-vaapi-branch commit 2d53b69.

c4ace00 h264parse: fix collection of access units to preserve config headers
0f9f7c9 h264parse: improve conditions for skipping NAL units
9ffb25c h264parse: introduce new state tracking variables
64955d3 h264parse: fix and optimize NAL collection function
13cd2a3 h264: clarifications and documentation fixes
53e7dd1 h264: fix identification of EOSEQ and EOS NALs
18f0de0 h264: fix memory leak in GstH264PPS
fdcb54c h264: fix typo in GstH264VUIParams description
fd4dae9 vp8: move up built-in range decoder private data

10 years agodecoder: propagate MVC metadata ("view-id", head of multiview set).
Gwenole Beauchesne [Mon, 30 Jun 2014 17:01:35 +0000 (19:01 +0200)]
decoder: propagate MVC metadata ("view-id", head of multiview set).

Add new GstVaapiSurfaceProxy flag FFB, which means "first frame in
bundle", and really expresses the first view component of a multi
view coded frame. e.g. in H.264 MVC, the surface proxy has flag FFB
set if VOIdx = 0.

Likewise, new API is exposed to retrieve the associated "view-id".

10 years agodecoder: propagate "one-field" flags.
Gwenole Beauchesne [Mon, 30 Jun 2014 16:46:45 +0000 (18:46 +0200)]
decoder: propagate "one-field" flags.

Allow decoders to set the "one-field" attribute when the decoded frame
genuinely has a single field, or if the second field was mis-decoded but
we still want to display the first field.

10 years agodecoder: output decoded frames only once.
Gwenole Beauchesne [Mon, 30 Jun 2014 16:34:45 +0000 (18:34 +0200)]
decoder: output decoded frames only once.

Make sure to output the decoded picture, and push the associated
GstVideoCodecFrame, only once. The frame fully represents what needs
to be output, included for interlaced streams. Otherwise, the base
GstVideoDecoder class would release the frame twice.

Anyway, the general process is to output decoded frames only when
they are complete. By complete, we mean a full frame was decoded or
both fields of a frame were decoded.

10 years agodecoder: h264: decode current picture earlier.
Gwenole Beauchesne [Mon, 30 Jun 2014 14:12:52 +0000 (16:12 +0200)]
decoder: h264: decode current picture earlier.

Slightly optimize decoding process by submitting the current VA surface
for decoding earlier to the hardware, and perform the reference picture
marking process and DPB update process afterwards.

This is a minor optimization to let the video decode engine kick in work
earlier, thus improving parallel resources utilization.

10 years agodecoder: h264: fix output of second field when first field is not in DPB.
Gwenole Beauchesne [Mon, 30 Jun 2014 14:09:17 +0000 (16:09 +0200)]
decoder: h264: fix output of second field when first field is not in DPB.

Fix decoding of interlaced streams where a first field (e.g. B-slice)
was immediately output and the current decoded field is to be paired
with that former frame, which is no longer in DPB.

https://bugzilla.gnome.org/show_bug.cgi?id=701340

10 years agodecoder: h264: slightly optimize the process to detect new pictures.
Gwenole Beauchesne [Mon, 30 Jun 2014 09:06:29 +0000 (11:06 +0200)]
decoder: h264: slightly optimize the process to detect new pictures.

Optimize the process to detect new pictures or start of new access
units by checking if the previous NAL unit was the end of a picture,
or the end of the previous access unit.

10 years agodecoder: h264: handle access unit ("au") optimization.
Gwenole Beauchesne [Fri, 13 Jun 2014 13:42:53 +0000 (15:42 +0200)]
decoder: h264: handle access unit ("au") optimization.

Optimize parsing when buffers are supplied with access unit alignment.
This helps determining faster when the end of an access unit is reached.

10 years agodecoder: h264: fix tracking of DPB size changes.
Gwenole Beauchesne [Sat, 28 Jun 2014 05:25:35 +0000 (07:25 +0200)]
decoder: h264: fix tracking of DPB size changes.

Add support for MVC streams with multiple SPS and subset SPS headers
emitted regularly, e.g. at around every I-frame. Track the maximum
number of views in ensure_context() and really reset the DPB size to
the expected value, always. i.e. even if it decreased. dpb_reset()
only cares of ensuring the DPB allocation.

10 years agodecoder: h264: fix the DPB compaction process.
Gwenole Beauchesne [Fri, 27 Jun 2014 18:44:24 +0000 (20:44 +0200)]
decoder: h264: fix the DPB compaction process.

Fix the compaction process when the DPB is cleared for a specific
view, i.e. fix the process of filling in the holes resulting from
removing frame buffers matching the current picture.

10 years agoencoder: h264: generate new SPS only when codec config changed.
Sreerenj Balachandran [Fri, 27 Jun 2014 13:38:03 +0000 (16:38 +0300)]
encoder: h264: generate new SPS only when codec config changed.

It is not necessary to periodically send SPS or subset SPS headers.
This is up to the upper layer (e.g. transport layer) to decide on
if/how to periodically submit those. For now, only generate new SPS
or subset SPS headers when the codec config changed.

Note: the upper layer could readily determine the config headers
(SPS/PPS) through the gst_vaapi_encoder_h264_get_codec_data() function.

https://bugzilla.gnome.org/show_bug.cgi?id=732083

Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
10 years agoencoder: h264: track encoder config changes.
Gwenole Beauchesne [Fri, 27 Jun 2014 16:43:27 +0000 (18:43 +0200)]
encoder: h264: track encoder config changes.

Track and report when encoder configuration changed. For now, this covers
resolution, profile/level and bitrate changes.

10 years agoencoder: h264: add pixel-aspect-ratio to VUI parameters.
Gwenole Beauchesne [Fri, 27 Jun 2014 11:15:13 +0000 (13:15 +0200)]
encoder: h264: add pixel-aspect-ratio to VUI parameters.

Report sample aspect ratio (SAR) as present, and make it match what
we have obtained from the user as pixel-aspect-ratio (PAR). i.e. the
VUI parameter aspect_ratio_info_present_flag now defaults to TRUE.

10 years agoencoder: h264: fix number of anchor and non-anchor reference pictures.
Sreerenj Balachandran [Thu, 26 Jun 2014 21:49:34 +0000 (00:49 +0300)]
encoder: h264: fix number of anchor and non-anchor reference pictures.

Set the value of num_anchor_refs_l0, num_anchor_refs_l1, num_non_anchor_refs_l0,
and num_non_anchor_refs_l1 to zero since the inter-view prediction is not yet
supported.

10 years agoencoder: h264: fix timing_info_present_flag value in subset SPS.
Sreerenj Balachandran [Fri, 27 Jun 2014 07:37:38 +0000 (10:37 +0300)]
encoder: h264: fix timing_info_present_flag value in subset SPS.

When the seq_parameter_set_data() syntax structure is present in a subset
sequence parameter set and vui_parameters_present_flag is equal to 1, then
timing_info_present_flag shall be equal to 0 (H.7.4.2.1.1).

10 years agoencoder: h264: add cpbBrNalFactor values for MVC profiles.
Sreerenj Balachandran [Thu, 26 Jun 2014 11:39:52 +0000 (14:39 +0300)]
encoder: h264: add cpbBrNalFactor values for MVC profiles.

10 years agoh264parse: fix detection of access unit boundaries for MVC.
Gwenole Beauchesne [Thu, 26 Jun 2014 12:51:32 +0000 (14:51 +0200)]
h264parse: fix detection of access unit boundaries for MVC.

The gst_h264_parse_collect_nal() function is a misnomer. In reality,
this function is used to determine access unit boundaries, i.e. that
is the key function for alignment=au output format generation.

10 years agoh264parse: fix collection of access units to preserve config headers.
Gwenole Beauchesne [Thu, 26 Jun 2014 12:49:53 +0000 (14:49 +0200)]
h264parse: fix collection of access units to preserve config headers.

Always use a GstAdapter when collecting access units (alignment="au")
in either byte-stream or avcC format. This is required to properly
preserve config headers like SPS and PPS when invalid or broken NAL
units are subsequently parsed.

More precisely, this fixes scenario like:
<SPS> <PPS> <invalid-NAL> <slice>

where we used to reset the output frame buffer when an invalid or
broken NAL is parsed, i.e. SPS and PPS NAL units were lost, thus
preventing the next slice unit to be decoded, should this also
represent any valid data.

https://bugzilla.gnome.org/show_bug.cgi?id=732203