vaapi:kerpzs-gstreamer-vaapi.git
3 years agobuild: fix for Wayland headers not in standard include dirs.
Gwenole Beauchesne [Fri, 22 Nov 2013 10:28:09 +0000 (11:28 +0100)]
build: fix for Wayland headers not in standard include dirs.

Fix build when Wayland headers don't live in plain system include dirs
like /usr/include but rather in /usr/include/wayland for instance.

Original patch written by Dominique Leuenberger <dimstar@opensuse.org>

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

3 years agobuild: link libgstvaapi-wayland against videoutils.
Ross Burton [Thu, 14 Nov 2013 10:58:37 +0000 (10:58 +0000)]
build: link libgstvaapi-wayland against videoutils.

This library is using symbols that don't exist in GStreamer 0.10 so
it needs to link to built-in implementation (libgstvaapi-videoutils).

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

Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
3 years agovaapostproc: fix memory leaks.
Gwenole Beauchesne [Fri, 22 Nov 2013 10:15:57 +0000 (11:15 +0100)]
vaapostproc: fix memory leaks.

Destroy VPP output surface pool on exit. Also avoid a possible crash
in double-free situation caused by insufficiently reference counted
array of formats returned during initialization.

3 years agovaapipostproc: fix and optimize advanced deinterlacing mode.
Gwenole Beauchesne [Fri, 22 Nov 2013 09:19:06 +0000 (10:19 +0100)]
vaapipostproc: fix and optimize advanced deinterlacing mode.

Fix advanced deinterlacing modes with VPP to track only up to 2 past
reference buffers. This used to be 3 past reference buffers but this
doesn't fit with the existing decode pipeline that only has 4 extra
scratch surfaces.

Also optimize references tracking to be only enabled when needed, i.e.
when advanced deinterlacing mode is used. This means that we don't
need to track past references for basic bob or weave deinterlacing.

3 years agovaapipostproc: fix "mixed" mode deinterlacing.
Gwenole Beauchesne [Fri, 22 Nov 2013 09:04:45 +0000 (10:04 +0100)]
vaapipostproc: fix "mixed" mode deinterlacing.

In "mixed" interlaced streams, the buffer contains additional flags that
specify whether the frame contained herein is interlaced or not. This means
that we can alternatively get progressive or interlaced frames. Make sure
to disable deinterlacing at the VPP level when the source buffer is no longer
interlaced.

3 years agovaapipostproc: fix memory leaks with advanced deinterlacing.
Gwenole Beauchesne [Fri, 22 Nov 2013 08:49:30 +0000 (09:49 +0100)]
vaapipostproc: fix memory leaks with advanced deinterlacing.

Fix memory leaks with advanced deinterlacing, i.e. when we keep track
of past buffers. Completely reset the deinterlace state, thus destroying
any buffer currently held, on _start(), _stop() and _destroy().

3 years agoREADME: updates.
Gwenole Beauchesne [Fri, 22 Nov 2013 05:59:51 +0000 (06:59 +0100)]
README: updates.

- GStreamer 1.2 APIs are supported ;
- Video Processing (VA/VPP) features.

3 years agoREADME: update for GStreamer >= 1.0.x and VPP features.
Gwenole Beauchesne [Fri, 22 Nov 2013 05:45:22 +0000 (06:45 +0100)]
README: update for GStreamer >= 1.0.x and VPP features.

3 years agolegal: update copyright notice dates.
Gwenole Beauchesne [Fri, 22 Nov 2013 05:37:12 +0000 (06:37 +0100)]
legal: update copyright notice dates.

3 years agolegal: add per-file authorship information.
Gwenole Beauchesne [Fri, 22 Nov 2013 04:57:18 +0000 (05:57 +0100)]
legal: add per-file authorship information.

Credit original authors on a per-file basis as we cannot expect people
to know all country-specific rules, or bother browsing through the git
history.

3 years ago0.5.7.
Gwenole Beauchesne [Thu, 21 Nov 2013 22:52:43 +0000 (23:52 +0100)]
0.5.7.

3 years agoNEWS: updates.
Gwenole Beauchesne [Thu, 21 Nov 2013 22:51:59 +0000 (23:51 +0100)]
NEWS: updates.

3 years agodecoder: don't include obsolete headers.
Gwenole Beauchesne [Thu, 21 Nov 2013 22:17:59 +0000 (23:17 +0100)]
decoder: don't include obsolete headers.

The <gst/vaapi/gstvaapicontext.h> header was removed from the public
set of APIs. So, don't make public headers (gstvaapidecoder.h) depend
on private files.

3 years agovaapipostproc: add initial support for GStreamer 1.2.
Gwenole Beauchesne [Mon, 18 Nov 2013 15:20:43 +0000 (16:20 +0100)]
vaapipostproc: add initial support for GStreamer 1.2.

Port vaapipostproc element to GStreamer 1.2. Support is quite minimal
right now so that to cope with auto-plugging issues/regressions. e.g.
this happens when the correct set of expected caps are being exposed.
This means that, currently, the proposed caps are not fully accurate.

3 years agovaapipostproc: add support for denoise and sharpen filters.
Halley Zhao [Fri, 1 Nov 2013 02:22:17 +0000 (10:22 +0800)]
vaapipostproc: add support for denoise and sharpen filters.

Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
3 years agovaapipostproc: add support for advanced deinterlacing.
Gwenole Beauchesne [Thu, 21 Nov 2013 18:52:56 +0000 (19:52 +0100)]
vaapipostproc: add support for advanced deinterlacing.

Add initial support for advanced deinterlacing. The history buffer
size is arbitrarily set to 3 references for now.

3 years agovaapipostproc: fix deinterlacing with VPP.
Gwenole Beauchesne [Thu, 21 Nov 2013 21:32:03 +0000 (22:32 +0100)]
vaapipostproc: fix deinterlacing with VPP.

Fix basic deinterlacing flags provided to gst_vaapi_set_deinterlacing()
for the first field. Render flags were supplied instead of the actual
deinterlacing flags (deint_flags).

3 years agovaapipostproc: fix transform caps.
Gwenole Beauchesne [Thu, 21 Nov 2013 14:08:55 +0000 (15:08 +0100)]
vaapipostproc: fix transform caps.

Fix GstBaseTransform::transform_caps() implementation to always return
the complete set of allowed sink pad caps (unfixated) even if the src
pad caps we are getting are fixated. Rationale: there are just so many
possible combinations, and it was wrong to provide a unique set anyway.

As a side effect, this greatly simplifies the ability to derive src pad
caps from fixated sink pad caps.

3 years agofilter: add helper to specify references for deinterlacing.
Halley Zhao [Fri, 1 Nov 2013 02:31:13 +0000 (10:31 +0800)]
filter: add helper to specify references for deinterlacing.

Add gst_vaapi_fitler_set_deinterlacing_references() API to submit the
list of surfaces used for forward or backward reference in advanced
deinterlacing mode, e.g. Motion-Adaptive, Motion-Compensated.

The list of surfaces used as deinterlacing references shall be live
until the next call to gst_vaapi_filter_process().

Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
3 years agofilter: fix semantics of deinterlacing flags.
Gwenole Beauchesne [Thu, 21 Nov 2013 17:44:46 +0000 (18:44 +0100)]
filter: fix semantics of deinterlacing flags.

Fix deinterlacing flags to make more sense. The TFF (top-field-first)
flag is meant to specify the organization of reference frames used in
advanced deinterlacing modes. Introduce the more explicit flag TOPFIELD
to specify that the top-field of the supplied input surface is to be
used for deinterlacing. Conversely, if not set, this means that the
bottom field of the supplied input surface will be used instead.

3 years agofilter: add helpers to check for supported/active operation.
Gwenole Beauchesne [Thu, 21 Nov 2013 16:20:28 +0000 (17:20 +0100)]
filter: add helpers to check for supported/active operation.

Add a couple of helper functions:
- gst_vaapi_filter_has_operation(): checks whether the VA driver
  advertises support for the supplied operation ;
- gst_vaapi_filter_use_operation(): checks whether the supplied
  operation was already enabled to its non-default value.

3 years agolibs: fix GstVaapiSurfaceProxy destroy notify call site.
Gwenole Beauchesne [Wed, 20 Nov 2013 14:10:17 +0000 (15:10 +0100)]
libs: fix GstVaapiSurfaceProxy destroy notify call site.

The user-defined destroy notify function is meant to be called only when
the surface proxy was fully released, i.e. once it actually released the
VA surface back to the underlying pool.

3 years agolibs: make GstVaapiVideoPool thread-safe.
XuGuangxin [Thu, 29 Aug 2013 05:44:22 +0000 (13:44 +0800)]
libs: make GstVaapiVideoPool thread-safe.

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

Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
3 years agolibs: robustify decoder objects and surface proxy initialization.
XuGuangxin [Thu, 29 Aug 2013 06:04:06 +0000 (14:04 +0800)]
libs: robustify decoder objects and surface proxy initialization.

Fix GstVaapiPicture, GstVaapiSlice and GstVaapiSurfaceProxy initialization
sequences to have the expected default values set beforehand in case of an
error raising up further during creation. i.e. make it possible to cleanly
destroy those partially initialized objects.

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

Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
3 years agovaapidecode: fix decoder flush.
Gwenole Beauchesne [Thu, 21 Nov 2013 10:01:41 +0000 (11:01 +0100)]
vaapidecode: fix decoder flush.

There are situations where gst_video_decoder_flush() is called, and
this subsequently produces a gst_video_decoder_reset() that kills the
currently active GstVideoCodecFrame. This means that it no longer
exists by the time we reach GstVideoDecoder::finish() callback, thus
possibly resulting in a crash if we assumed spare data was still
available for decode (current_frame_size > 0).

Try to honour GstVideoDecoder::reset() behaviour from GStreamer 1.0
that means a flush, thus performing the actual operations there like
calling gst_video_decoder_have_frame() if pending data is available.

3 years agovaapidecode: fix dead-locks with decoder task.
Gwenole Beauchesne [Wed, 20 Nov 2013 18:21:05 +0000 (19:21 +0100)]
vaapidecode: fix dead-locks with decoder task.

Review all interactions between the main video decoder stream thread
and the decode task to derive a correct sequence of operations for
decoding. Also avoid extra atomic operations that become implicit under
the GstVideoDecoder stream lock.

3 years agovaapidecode: fix hard reset for seek cases.
XuGuangxin [Thu, 29 Aug 2013 06:12:10 +0000 (14:12 +0800)]
vaapidecode: fix hard reset for seek cases.

Fix hard reset for seek cases by flushing the GstVaapiDecoder queue
and completely purge any decoded output frame that may come out from
it. At this stage, the GstVaapiDecoder shall be in a complete clean
state to start decoding over new buffers.

Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
3 years agovaapidecode: drop decode timeout, always wait for a free surface.
XuGuangxin [Thu, 29 Aug 2013 06:12:10 +0000 (14:12 +0800)]
vaapidecode: drop decode timeout, always wait for a free surface.

vaapidecode used to wait up to one second past the expected time of
presentation for the last decoded frame. This is not realistic in
practice when it comes to video pause/resume. Changed behaviour to
unconditionnally wait for a free VA surface prior to continuing the
decoding. The decode task will continue pushing the output frames to
the downstream element while also reporting errors at the same time
to the main thread.

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

Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
3 years agovaapidecode: fix srcpad caps for GStreamer 1.2.
Gwenole Beauchesne [Wed, 20 Nov 2013 09:56:28 +0000 (10:56 +0100)]
vaapidecode: fix srcpad caps for GStreamer 1.2.

The srcpad caps exposed for GStreamer 1.2 were missing any useful info
like framerate, pixel-aspect-ratio, interlace-mode et al. Not to mention
that it relied on possibly un-initialized data. Fix srcpad caps to be
initialized from a sanitized copy of GstVideoDecoder output state caps.

Note: the correct way to expose the srcpad caps triggers an additional
issue in core GStreamer auto-plugging capabilities as the correct caps
to be exposed should be format=ENCODED with memory:VASurface caps feature
at the minimum. In some situations, we could determine the underlying
VA surface format, but this is not always possible. e.g. cases where it
is not allowed to expose the underlying VA surface data, or when the
VA driver implementation cannot actually provide such information.

3 years agoplugins: streamline VA formats exposed in caps to a realistic set.
Gwenole Beauchesne [Wed, 20 Nov 2013 09:45:23 +0000 (10:45 +0100)]
plugins: streamline VA formats exposed in caps to a realistic set.

Currently, the decoder only supports YUV 4:2:0 output. So, expose the
output formats for GStreamer 1.2 in caps to a realistic subset. This
means NV12, I420 or YV12 but also ENCODED if we cannot determine the
underlying VA surface format, or if it is actually not allowed to get
access to the surface contents.

3 years agoplugins: expose the expected format for GstVideoGLTextureUploadMeta.
Gwenole Beauchesne [Wed, 20 Nov 2013 09:37:36 +0000 (10:37 +0100)]
plugins: expose the expected format for GstVideoGLTextureUploadMeta.

Fix vaapidecode srcpad caps to only expose RGBA video format for the
meta:GstVideoGLTextureUploadMeta feature. That's only what is supported
so far. Besides, drop this meta from the vaapisink sinkpad caps since
we really don't support that for rendering.

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

3 years agoconfigure: automatically detect GStreamer API version.
Gwenole Beauchesne [Mon, 18 Nov 2013 17:25:21 +0000 (18:25 +0100)]
configure: automatically detect GStreamer API version.

Automatically detect GStreamer API version. The --with-gstreamer-api
configure option now defaults to "autodetect" and configure then tries
to derive the GStreamer API version from the highest version based on
what pkg-config --modversion would report.

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

3 years agovaapipostproc: fix support for raw YUV data upload on GStreamer 1.0.
Wind Yuan [Fri, 1 Nov 2013 05:43:11 +0000 (13:43 +0800)]
vaapipostproc: fix support for raw YUV data upload on GStreamer 1.0.

Fix raw YUV data uploaded as in the following pipeline:
$ gst-launch-1.0 filesrc video.yuv ! videoparse ! vaapipostproc ! vaapisink

The main reason why it failed was that the videoparse element simply
allocates GstBuffer with raw data chunk'ed off the sink pad without
any prior knowledge of the actual frame info. i.e. it basically just
calls gst_adapter_take_buffer().

We could avoid the extra copy performed in vaapipostproc if the videoparse
element was aware of the downstream pool and bothers copying line by
line, for each plane. This means that, for a single frame per buffer,
the optimizatin will be to allocate the video buffer downstream, map
it, and copy each line that is coming through until we need to fills
in the successive planes.

Still, optimized raw YUV uploads already worked with the following:
$ gst-launch-1.0 videotestsrc ! vaapipostproc ! vaapisink

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

[clean-ups, fixed error cases to unmap and unref outbuf]
Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
3 years agovaapipostproc: try to downgrade deinterlace-method when needed.
Gwenole Beauchesne [Sat, 16 Nov 2013 06:02:24 +0000 (07:02 +0100)]
vaapipostproc: try to downgrade deinterlace-method when needed.

If the currently selected deinterlacing method is not supported by the
underlying hardware, then try to downgrade the method to a supported one.
At the minimum, basic bob-deinterlacing shall always be supported.

3 years agovaapipostproc: add initial support for deinterlacing with VPP.
Gwenole Beauchesne [Fri, 15 Nov 2013 18:04:07 +0000 (19:04 +0100)]
vaapipostproc: add initial support for deinterlacing with VPP.

Allow basic bob-deinterlacing to work when VPP is enabled. Currently,
this only covers bob-deinterlacing when the output pixel format is
explicitly set.

3 years agovaapipostproc: fix build on 64-bit platforms with GStreamer 0.10.
Gwenole Beauchesne [Fri, 15 Nov 2013 16:14:04 +0000 (17:14 +0100)]
vaapipostproc: fix build on 64-bit platforms with GStreamer 0.10.

The size argument for GstBaseTransform::transform_size() hook is a
guint in GStreamer 0.10 APIs but a gsize in GStreamer >= 1.0.X APIs.

3 years agovaapipostproc: add initial support for scaling.
Gwenole Beauchesne [Fri, 18 Oct 2013 16:08:25 +0000 (18:08 +0200)]
vaapipostproc: add initial support for scaling.

Add initial support for basic scaling with size specified through the
"width" and "height" properties. If either user-provided dimension is
zero and "force-aspect-ratio" is set to true (the default), then the
other dimension is scaled to preserve the aspect ratio.

3 years agovaapipostproc: add initial support for color conversion.
Gwenole Beauchesne [Fri, 18 Oct 2013 16:08:25 +0000 (18:08 +0200)]
vaapipostproc: add initial support for color conversion.

If VPP is available, we always try to implicitly convert the source
buffer to the "native" surface format for the underlying accelerator.
This means that no optimization is performed yet to propagate raw YUV
buffers to the downstream element as is, if VPP is available. i.e. it
will always cause a color conversion.

3 years agovaapipostproc: fix bug when user disabled deinterlacing.
Gwenole Beauchesne [Wed, 16 Oct 2013 09:23:03 +0000 (11:23 +0200)]
vaapipostproc: fix bug when user disabled deinterlacing.

Fix pipeline error / hang when the user disabled deinterlacing through
the deinterlace-mode=disabled property setting.

3 years agovaapipostproc: factor out operations to be applied into flags.
Gwenole Beauchesne [Wed, 16 Oct 2013 09:20:50 +0000 (11:20 +0200)]
vaapipostproc: factor out operations to be applied into flags.

Even if we only support deinterlacing for now, use flags to specify
which filters are to be applied to each frame we receive in transform().
This is preparatory work for integrating new filters.

4 years agovaapipostproc: add support for raw YUV video source buffers.
Gwenole Beauchesne [Fri, 4 Oct 2013 13:37:24 +0000 (15:37 +0200)]
vaapipostproc: add support for raw YUV video source buffers.

Allow video processing from raw YUV buffers coming from the sink pad,
while still producing a VA surface for the downstream elements.

4 years agovaapipostproc: add support for "mixed" interlace mode.
Gwenole Beauchesne [Fri, 4 Oct 2013 14:00:56 +0000 (16:00 +0200)]
vaapipostproc: add support for "mixed" interlace mode.

Add support for "mixed" interlace-mode, whereby the video frame buffer
shall be deinterlaced only if its flags mention that's actually an
interlaced frame buffer.

4 years agovaapipostproc: rework plug-in element.
Gwenole Beauchesne [Thu, 3 Oct 2013 17:04:07 +0000 (19:04 +0200)]
vaapipostproc: rework plug-in element.

Rewrite the vaapipostproc plug-in element so that it derives from
GstBaseTransform, thus simplifying the caps negotiation process.

4 years agoplugins: fix and optimize check for buffer pool allocator params.
Gwenole Beauchesne [Wed, 9 Oct 2013 15:25:10 +0000 (17:25 +0200)]
plugins: fix and optimize check for buffer pool allocator params.

Reset the buffer pool allocator only if the config caps changed in a
sensible way: format or resolution change. i.e. don't bother with
other caps like colorimetry et al. as this doesn't affect the way to
allocate VA surfaces or images.

4 years agoplugins: enable memory maps for read & write with direct-rendering.
Gwenole Beauchesne [Wed, 9 Oct 2013 08:33:55 +0000 (10:33 +0200)]
plugins: enable memory maps for read & write with direct-rendering.

Enable read and write mappings only if direct-rendering is supported.
Otherwise, this means that we may need to download data from the VA
surface first for correctness, even if the VA surface doesn't need to
be read at all. i.e. sometimes, READWRITE mappings are meant for
surfaces that are written to first, and read afterwards for further
processing.

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

4 years agoplugins: fix check for direct-rendering support.
Gwenole Beauchesne [Wed, 9 Oct 2013 08:06:40 +0000 (10:06 +0200)]
plugins: fix check for direct-rendering support.

Fix check for direct-rendering if the creation of VA surfaces with
an explicit pixel format is not support, e.g. VA-API < 0.34.0, and
that we tried to allocate a VA surface based on the corresponding
chroma type. i.e. in that particular case, we have to make sure that
the derived image has actually the expected format.

4 years agoplugins: fix buffer pool reset_buffer() to reset memory resources.
Gwenole Beauchesne [Wed, 9 Oct 2013 07:47:18 +0000 (09:47 +0200)]
plugins: fix buffer pool reset_buffer() to reset memory resources.

Fix GstVaapiVideoBufferPool::reset_buffer() to reset the underlying
memory resources, and more particularly the VA surface proxy. Most
importantly, the GstVaapiVideoMeta is retained. Cached surface in
memory are released, thus triggering a new allocation the next time
we need to map the buffer.

4 years agoplugins: fix GstVaapiVideoMemory to allocate VA surface proxies.
Gwenole Beauchesne [Wed, 9 Oct 2013 07:33:56 +0000 (09:33 +0200)]
plugins: fix GstVaapiVideoMemory to allocate VA surface proxies.

Make sure GstVaapiVideoMemory allocates VA surface proxies from a
pool stored in the parent VA memory allocator.

This fixes the following scenario:
- VA video buffer 1 is allocated from a buffer pool
- Another video buffer is created, and inherits info from buffer 1
- Buffer 1 is released, thus pushing it back to the buffer pool
- New buffer alloc request comes it, this yields buffer 1 back
- At this stage, buffers 1 and 2 still share the same underlying VA
  surface, but buffer 2 was already submitted downstream for further
  processing, thus conflicting with additional processing we were
  about to perform on buffer 1.

Maybe the core GstBufferPool implementation should have been fixed
instead to actually make sure that the returned GstBuffer memory we
found from the pool is writable?

4 years agoplugins: create a proxy for GstVaapiUploader allocated buffers.
Gwenole Beauchesne [Fri, 4 Oct 2013 17:34:32 +0000 (19:34 +0200)]
plugins: create a proxy for GstVaapiUploader allocated buffers.

Always make sure to allocate a VA surface proxy for GstVaapiUploader
allocated buffers, i.e. make gst_vaapi_uploader_get_buffer() allocate
a proxy surface.

This fixes cases where we want to retain the underlying surface longer,
instead of releasing it back to the surface pool right away.

4 years agoplugins: add helper function to disable deinterlacing in caps.
Gwenole Beauchesne [Fri, 4 Oct 2013 17:30:36 +0000 (19:30 +0200)]
plugins: add helper function to disable deinterlacing in caps.

Add gst_caps_set_interlaced() helper function that would reset the
interlace-mode field to "progressive" for GStreamer >= 1.0, or the
interlaced field to "false" for GStreamer 0.10.

4 years agofilter: fix memory leak of VPP operations.
Gwenole Beauchesne [Tue, 1 Oct 2013 16:26:39 +0000 (18:26 +0200)]
filter: fix memory leak of VPP operations.

Fix ensure_operations() to release the VPP operations array if non
NULL, prior to returning to the caller. The former function was also
renamed to a more meaningful get_operations() since the caller owns
the returned array that needs to be released.

4 years agofilter: fix first-time operation lookup.
Zhao Halley [Wed, 4 Sep 2013 05:53:25 +0000 (13:53 +0800)]
filter: fix first-time operation lookup.

Fix first-time operation lookup through find_operation() if the set
of supported operations was not initially determined through the
gst_vaapi_filter_get_operations() helper function.

Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
4 years agofilter: fix colorbalance related subtypes.
Zhao Halley [Wed, 4 Sep 2013 05:53:25 +0000 (13:53 +0800)]
filter: fix colorbalance related subtypes.

Fix intiialization of GstVaapiFilterOpData for colorbalance related
operations. In particular, fill in the va_subtype field accordingly.

Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
4 years agofilter: fix VA-API 0.34.0 symbol guards.
Víctor Manuel Jáquez Leal [Mon, 30 Sep 2013 15:08:12 +0000 (17:08 +0200)]
filter: fix VA-API 0.34.0 symbol guards.

VASurfaceAttrib and VAProcFilterParameterBufferType are symbols
that need to be guarded for libva 0.34 and 0.33, respectively.

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

Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
4 years agoplugins: hanle the context query in any pad.
Víctor Manuel Jáquez Leal [Tue, 1 Oct 2013 15:57:11 +0000 (17:57 +0200)]
plugins: hanle the context query in any pad.

Also this patch simplifies the code, since now the query is common for the
decoder and the sink.

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

4 years agoplugins: query upstream element for a GstContext.
Víctor Manuel Jáquez Leal [Tue, 1 Oct 2013 10:09:44 +0000 (12:09 +0200)]
plugins: query upstream element for a GstContext.

Fix gst_vaapi_video_context_prepare() to also query upstream elements
for a valid GstContext. Improve comments regarding the steps used to
lookup or build that context, thus conforming to the GstContext API
recommendations.

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

Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
4 years agoFix detection and packaging of GStreamer 1.2.x builds.
Gwenole Beauchesne [Thu, 26 Sep 2013 13:21:24 +0000 (15:21 +0200)]
Fix detection and packaging of GStreamer 1.2.x builds.

The GStreamer 1.2.x packages sticked to the naming convention for 1.0.x
packages, i.e. -1.0 suffix. However, for gstreamer-vaapi packaging
purposes, update the versioning to -1.2 suffix instead.

4 years agoplugins: add support for GstVideoGLTextureUploadMeta.
Víctor Manuel Jáquez Leal [Mon, 15 Jul 2013 11:41:00 +0000 (13:41 +0200)]
plugins: add support for GstVideoGLTextureUploadMeta.

If the allocation meta GST_VIDEO_GL_TEXTURE_UPLOAD_META_API_TYPE is
requested, and more specifically under a GLX configuration, then add
the GstVideoGLTextureUploadMeta to the output buffer.

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

Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
4 years agoplugins: add support for GstCaps features.
Sreerenj Balachandran [Thu, 4 Jul 2013 08:03:52 +0000 (11:03 +0300)]
plugins: add support for GstCaps features.

Move VA video buffer memory from "video/x-surface,type=vaapi" format,
as expressed in caps, to the more standard use of caps features. i.e.
add "memory:VASurface" feature attribute to the associated caps.

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

Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
4 years agoplugins: improve ::query() debugging messages.
Víctor Manuel Jáquez Leal [Fri, 12 Jul 2013 16:58:57 +0000 (12:58 -0400)]
plugins: improve ::query() debugging messages.

Fix gst_vaapidecode_query() to correctly display the query type name,
instead of randomly displaying that we shared the underlying display.
Also add debug info for the GstVaapiSink::query() handler, i.e. the
supplied query type name actually.

Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
4 years agoplugins: add support for GstContext API.
Víctor Manuel Jáquez Leal [Fri, 12 Jul 2013 16:58:57 +0000 (12:58 -0400)]
plugins: add support for GstContext API.

Add support for the new GstContext API from GStreamer 1.2.x.
- implement the GstElement::set_context() hook ;
- reply to the `context' query from downstream elements.

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

Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
4 years agoplugins: add compat layer for GstVideoContext.
Víctor Manuel Jáquez Leal [Wed, 22 May 2013 16:07:52 +0000 (12:07 -0400)]
plugins: add compat layer for GstVideoContext.

Add thin compatibility layer for the deprecated GstVideoContext API.
For GStreamer API >= 1.2, this involves the following two functions:
- gst_vaapi_video_context_prepare(): queries if a context is already
  set in the pipeline ;
- gst_vaapi_video_context_propagate(): propagates the newly-created
  context to the rest of the pipeline.

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

Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
4 years agoplugins: initial port to GStreamer 1.2.
Víctor Manuel Jáquez Leal [Tue, 21 May 2013 16:42:39 +0000 (12:42 -0400)]
plugins: initial port to GStreamer 1.2.

Port vaapidecode and vaapisink plugins to GStreamer API >= 1.2. This
is rather minimalistic so that to test the basic functionality.

Disable vaapipostproc plugin for now as further polishing is needed.
Also disable GstVideoContext interface support since this API is now
gone in 1.2.x. This is preparatory work for GstContext support.

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

Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
4 years agotests: simple-decoder: fix for non-X11 backends.
Gwenole Beauchesne [Tue, 24 Sep 2013 14:21:11 +0000 (16:21 +0200)]
tests: simple-decoder: fix for non-X11 backends.

Don't try to create pixmaps if we have not requested that feature. This
fixes execution for non-X11 backends, and most specifically DRM video
output mode.

4 years agocodecparsers: update to gst-vaapi-branch commit b33bd32.
Gwenole Beauchesne [Tue, 24 Sep 2013 14:22:59 +0000 (16:22 +0200)]
codecparsers: update to gst-vaapi-branch commit b33bd32.

b33bd32 jpeg: fix and optimize scan for next marker code

4 years agojpeg: fix calculation of MCU count.
Gwenole Beauchesne [Mon, 23 Sep 2013 17:14:56 +0000 (19:14 +0200)]
jpeg: fix calculation of MCU count.

Fix calculation of MCU count for image sizes that are not a multiple
of 8 pixels in either dimension, but also for non-common sampling
factors like 4:2:2 in non-interleaved mode.

4 years agojpeg: add support for multiscan images.
Gwenole Beauchesne [Mon, 23 Sep 2013 14:49:41 +0000 (16:49 +0200)]
jpeg: add support for multiscan images.

Add support for images with multiple scans per frame. The Huffman table
can be updated before SOS, and thus possibly requiring multiple uploads
of Huffman tables to the VA driver. So, the latter must be able to cope
with multiple VA buffers of type 'huffman-table' and with the correct
sequential order.

4 years agojpeg: improve robustness when packets are missing.
Gwenole Beauchesne [Mon, 23 Sep 2013 09:41:52 +0000 (11:41 +0200)]
jpeg: improve robustness when packets are missing.

Improve robustness when some expected packets where not received yet
or that were not correctly decoded. For example, don't try to decode
a picture if there was no valid frame headers.

4 years agojpeg: minor clean-ups.
Gwenole Beauchesne [Fri, 20 Sep 2013 14:46:43 +0000 (16:46 +0200)]
jpeg: minor clean-ups.

Improve debugging and error messages. Rename a few variables to fit the
existing naming conventions. Change some fatal asserts to non-fatal
error codes.

4 years agojpeg: rework and optimize parser.
Gwenole Beauchesne [Fri, 20 Sep 2013 08:12:08 +0000 (10:12 +0200)]
jpeg: rework and optimize parser.

Split the input buffer data into decoder units that represent a JPEG
segment. Handle scan decoder unit specifically so that it can include
both the scan header (SOS) but also any other ECS or RSTi segment.

That way, we parse the input buffer stream only once at the gst-vaapi
level instead of (i) in gst_vaapi_decoder_jpeg_parse() to split the
stream into frames SOI .. EOI and (ii) in decode_buffer() to further
determine segment boundaries and decode them.

In practice, this is a +15 to +25% performance improvement.

4 years agojpeg: handle comment segments.
Junfeng Xu [Tue, 17 Sep 2013 06:29:54 +0000 (14:29 +0800)]
jpeg: handle comment segments.

Fix decode_buffer() function to gracefully skip comment (COM) segments.
This fixes decoding of streams generated by certain cameras, e.g. like
the Logitech Pro C920.

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

Signed-off-by: Junfeng Xu <jun.feng.xu@intel.com>
4 years agojpeg: fix determination of image bounds.
Gwenole Beauchesne [Wed, 18 Sep 2013 15:59:44 +0000 (17:59 +0200)]
jpeg: fix determination of image bounds.

Look for the exact image bounds characterised by the <SOI> and <EOI>
markers. Use the gst_jpeg_parse() codec parser utility function to
optimize the lookup for the next marker segment.

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

4 years agojpeg: fix calculation of offset to next marker segment.
Junfeng Xu [Tue, 10 Sep 2013 07:46:09 +0000 (15:46 +0800)]
jpeg: fix calculation of offset to next marker segment.

Fix calculation of the offset to the next marker segment since the
correction of the codecparser part to match the API specification.
i.e. the GstJpegMarkerSegment.size field represents the size in bytes
of the segment minus any marker prefix.

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

Signed-off-by: Junfeng Xu <jun.feng.xu@intel.com>
4 years agocodecparsers: update to gst-vaapi-branch commit 23c7dde.
Gwenole Beauchesne [Fri, 20 Sep 2013 16:30:18 +0000 (18:30 +0200)]
codecparsers: update to gst-vaapi-branch commit 23c7dde.

23c7dde jpeg: fix calculation of segment size

4 years agoBump version for development.
Gwenole Beauchesne [Sat, 31 Aug 2013 14:00:05 +0000 (16:00 +0200)]
Bump version for development.

4 years ago0.5.6. 0.5.6
Gwenole Beauchesne [Sat, 31 Aug 2013 13:47:33 +0000 (15:47 +0200)]
0.5.6.

4 years agoNEWS: updates.
Gwenole Beauchesne [Sat, 31 Aug 2013 13:46:25 +0000 (15:46 +0200)]
NEWS: updates.

4 years agoconfigure: fix detection of VA/JPEG decoding API.
Wind Yuan [Thu, 15 Aug 2013 09:59:37 +0000 (17:59 +0800)]
configure: fix detection of VA/JPEG decoding API.

Fix detection of VA/JPEG decoding API with non-standard libva packages.
More precisely, some packages were shipping with a <va/va.h> header that
did not include <va/va_dec_jpeg.h>.

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

Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
4 years agovaapisink: ensure the uploader is setup for upstream allocated buffers.
Zhao Halley [Thu, 18 Apr 2013 11:49:42 +0000 (19:49 +0800)]
vaapisink: ensure the uploader is setup for upstream allocated buffers.

In GStreamer 0.10 builds, make sure that the GstVaapiUploader helper
is setup in case upstream elements allocate buffers themselves without
honouring our GstVaapiSink::bufer_alloc() hook.

In particular, this fixes support for OGG video streams with WebKit.

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

Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
4 years agovaapisink: simplify get_render_buffer() for GStreamer 0.10 builds.
Gwenole Beauchesne [Thu, 29 Aug 2013 17:07:34 +0000 (19:07 +0200)]
vaapisink: simplify get_render_buffer() for GStreamer 0.10 builds.

Implement and use gst_vaapisink_get_render_buffer() for GStreamer 0.10
builds as well.

4 years agovaapisink: handle raw buffers not created from VA video buffer pool.
Gwenole Beauchesne [Thu, 29 Aug 2013 16:34:57 +0000 (18:34 +0200)]
vaapisink: handle raw buffers not created from VA video buffer pool.

Handle raw video buffers that were not created from a VA video buffer
pool. Use the generic GstVideo API to copy buffers in GStreamer 1.0.x
builds instead of the GstVaapiUploader.

https://bugs.freedesktop.org/show_bug.cgi?id=55818

4 years agovaapidecode: remove extraneous size information from allowed caps.
Gwenole Beauchesne [Thu, 29 Aug 2013 17:33:02 +0000 (19:33 +0200)]
vaapidecode: remove extraneous size information from allowed caps.

Fix _getcaps() implementation to not report codecs with size information
filled in the returned caps. That's totally useless nowadays. Ideally,
this is a hint to insert a video parser element, thus allowing future
optimizations, but this is not a strict requirement for gstreamer-vaapi,
which is able to parse the elementary bitstreams itself.

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

4 years agovaapidecode: submit the last frame from output adapter to decoder.
Guangxin.Xu [Tue, 30 Jul 2013 06:05:39 +0000 (14:05 +0800)]
vaapidecode: submit the last frame from output adapter to decoder.

If there is no frame delimiter at the end of the stream, e.g. no
end-of-stream or end-of-sequence marker, and that the current frame
was fully parsed correctly, then assume that last frame is complete
and submit it to the decoder.

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

Signed-off-by: Guangxin.Xu <Guangxin.Xu@intel.com>
Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
4 years agovaapidecode: push all decoded frames from within the task.
Gwenole Beauchesne [Thu, 29 Aug 2013 09:55:05 +0000 (11:55 +0200)]
vaapidecode: push all decoded frames from within the task.

Make sure to push all decoded frames from the task so that the unlying
VA surfaces could all be rendered from the same thread.

4 years agowayland: render the raw surface if VPP failed.
Gwenole Beauchesne [Tue, 27 Aug 2013 16:24:12 +0000 (18:24 +0200)]
wayland: render the raw surface if VPP failed.

As a last resort, if video processing capabilities (VPP) are not available,
or they did not produce anything conclusive enough, then try to fallback to
the original rendering code path whereby the whole VA surface is rendered
as is, no matter of video cropping or deinterlacing requests.

Note: under those conditions, the visual outcome won't be correct but at
least, something gets displayed instead of bailing out.

4 years agowayland: add supporting for video processing.
Gwenole Beauchesne [Tue, 27 Aug 2013 16:20:08 +0000 (18:20 +0200)]
wayland: add supporting for video processing.

Try to use VA/VPP processing capabilities to handle video cropping and
additional rendering flags that may not be directly supported by the
underlying hardware when exposing a suitable Wayland buffer for the
supplied VA surface. e.g. deinterlacing, different color primaries than
BT.601, etc.

4 years agowayland: add new frame redraw infrastructure.
Gwenole Beauchesne [Tue, 27 Aug 2013 14:26:22 +0000 (16:26 +0200)]
wayland: add new frame redraw infrastructure.

Update the frame redraw infrastructure with a new FrameState stucture
holds all the necessary information used to display the next pending
surface.

While we are at it, delay the sync operation down to when it is actually
needed. That way, we keep performing additional tasks meanwhile.

4 years agofilter: allow specification of render target regions.
Gwenole Beauchesne [Tue, 27 Aug 2013 16:06:10 +0000 (18:06 +0200)]
filter: allow specification of render target regions.

Add support for rendering the source surface to a particular region within
the supplied target surface. The default background color is black.

4 years agodecode: fix creation of GLX video buffers for GStreamer 0.10.
Gwenole Beauchesne [Mon, 26 Aug 2013 15:14:33 +0000 (17:14 +0200)]
decode: fix creation of GLX video buffers for GStreamer 0.10.

Fix creation of GstVaapiVideoBuffer objects (i) to have that type for real;
and (ii) to correctly extract the GstSurfaceConverter from the video buffer
object meta.

This fixes support for cluttersink with GStreamer 0.10 builds.

4 years agompeg2: disable video cropping as picture_display_extension() is missing.
Gwenole Beauchesne [Mon, 26 Aug 2013 14:15:49 +0000 (16:15 +0200)]
mpeg2: disable video cropping as picture_display_extension() is missing.

Disable video cropping in MPEG-2 codec because it is partially implemented
and actually because nobody implements it that way, and the standard spec
does not specify the display process either anyway.

Most notably, there are two possible use cases for sequence_display_extension()
horizontal_display_size & vertical_display_size: (i) guesstimating the
pixel-aspect-ratio, or (ii) implement some kind of span & scan process
in conjunction with picture_display_extension() information.

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

4 years agovaapisink: allow scaling to ignore aspect ratio.
Simon Farnsworth [Fri, 16 Aug 2013 15:58:58 +0000 (16:58 +0100)]
vaapisink: allow scaling to ignore aspect ratio.

Other GStreamer sinks, like xvimagesink, have a force-aspect-ratio property,
which allows you to say that you don't want the sink to respect aspect
ratio. Add the same property to vaapisink.

http://lists.freedesktop.org/archives/libva/2012-September/001298.html

Signed-off-by: Simon Farnsworth <simon.farnsworth at onelan.co.uk>
4 years agovaapisink: fix memory leak of GstVaapiUploader instance.
Wind Yuan [Tue, 14 May 2013 07:19:04 +0000 (15:19 +0800)]
vaapisink: fix memory leak of GstVaapiUploader instance.

Make sure gst_vaapisink_ensure_uploader() checks for the existence
of a former GstVaapiUploader instance prior to forcibly creating a
new one.

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

4 years agovaapisink: fix get_caps() implementation for GStreamer 1.0.
Guangxin.Xu [Wed, 31 Jul 2013 08:49:20 +0000 (16:49 +0800)]
vaapisink: fix get_caps() implementation for GStreamer 1.0.

Fix GstBaseSink::get_caps() implementation for GStreamer 1.0.X builds
by honouring the filter caps argument. More precisely, this fixes the
following pipeline: gst-launch-1.0 videotestsrc ! vaapisink

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

Signed-off-by: Guangxin.Xu <Guangxin.Xu@intel.com>
Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
4 years agompeg4: fix double definition of GstVaapiDecoderMpeg4Class.
Gwenole Beauchesne [Mon, 26 Aug 2013 09:31:06 +0000 (11:31 +0200)]
mpeg4: fix double definition of GstVaapiDecoderMpeg4Class.

This fixes the following issue:

  CC     libgstvaapi_0.10_la-gstvaapidecoder_mpeg4.lo
gstvaapidecoder_mpeg4.c:113: error: redefinition of typedef
'GstVaapiDecoderMpeg4Class'
gstvaapidecoder_mpeg4.c:44: note: previous declaration of
'GstVaapiDecoderMpeg4Class' was here
make[5]: *** [libgstvaapi_0.10_la-gstvaapidecoder_mpeg4.lo] Error 1
make[5]: Leaving directory
`/builddir/build/BUILD/gstreamer-vaapi-0.5.5.1/gst-libs/gst/vaapi'

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

4 years agotests: filter: add support for deinterlacing.
Gwenole Beauchesne [Tue, 30 Jul 2013 13:59:40 +0000 (15:59 +0200)]
tests: filter: add support for deinterlacing.

Add --deinterlace option to enable deinterlacing through explicit VA/VPP
deinterlacing filter. However, if --deinterlace option is not set but the
--deinterlace-flags option is set with "top-field-first", then the very
basic bob deinterlacing filter is set through VA/VPP proc pipeline flags.

4 years agotests: filter: add support for denoising and sharpening.
Zhao Halley [Wed, 17 Jul 2013 09:29:41 +0000 (17:29 +0800)]
tests: filter: add support for denoising and sharpening.

Add --denoise option to enable noise reduction with the level specified
as the option value (float). Likewise, add --sharpen option to enable
sharpening.

Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
4 years agotests: filter: add support for frame cropping.
Gwenole Beauchesne [Wed, 24 Jul 2013 12:31:34 +0000 (14:31 +0200)]
tests: filter: add support for frame cropping.

Add support for frame cropping through the --crop-rect|-c argument.
The format used is either <WIDTH> 'x' <HEIGHT>, with origin at (0,0) ;
or full specification with '('? <X> ',' <Y> ')'? <WIDTH> 'x' <HEIGHT>.

4 years agotests: filter: dump supported operations and formats.
Gwenole Beauchesne [Tue, 23 Jul 2013 16:00:26 +0000 (18:00 +0200)]
tests: filter: dump supported operations and formats.

4 years agotests: add initial test for video processing.
Zhao Halley [Mon, 8 Jul 2013 08:54:55 +0000 (16:54 +0800)]
tests: add initial test for video processing.

Add minimal test case for video processing: scaling and color format
conversion.

Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
4 years agofilter: add initial support for deinterlacing.
Zhao Halley [Mon, 29 Jul 2013 01:23:50 +0000 (09:23 +0800)]
filter: add initial support for deinterlacing.

Add basic deinterlacing support, i.e. bob-deinterlacing whereby only
the selected field from the input surface is kept for the target surface.
Setting gst_vaapi_filter_set_deinterlacing() method argument to
GST_VAAPI_DEINTERLACE_METHOD_NONE means to disable deinterlacing.

Also move GstVaapiDeinterlaceMethod definition from vaapipostproc plug-in
to libgstvaapi core library.

Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>