platform/upstream/gstreamer-vaapi.git
10 years agoutils: h264: add more profiles.
Gwenole Beauchesne [Tue, 10 Dec 2013 10:13:01 +0000 (11:13 +0100)]
utils: h264: add more profiles.

Add extended profile (A.2.3), high 4:2:2 profile (A.2.6), high 4:2:2
profiles (A.2.7, A.2.10), scalable profiles (G.10.1.1, G.10.1.2) and
multiview profiles (H.10.1.1, H.10.1.2).

Document "Constrained Baseline" and "High 10" profiles.

10 years agocodecparsers: update to gst-vaapi-branch commit e7d0e18.
Gwenole Beauchesne [Tue, 10 Dec 2013 14:21:51 +0000 (15:21 +0100)]
codecparsers: update to gst-vaapi-branch commit e7d0e18.

e7d0e18 h264: complete set of NAL unit types

10 years agodecoder: h264: add support for constrained baseline profile.
Wind Yuan [Fri, 6 Dec 2013 07:08:26 +0000 (15:08 +0800)]
decoder: h264: add support for constrained baseline profile.

Recognize streams marked as conforming to the "Constrained Baseline
Profile". If VA driver supports that as is, fine. Otherwise, fallback
to baseline, main or high profile.

Constrained Baseline Profile conveys coding tools that are common
to baseline profile and main profile.

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

[Added fallbacks to main and high profiles]
Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
10 years agodecoder: h264: fix decoding of scaling lists.
Gwenole Beauchesne [Mon, 9 Dec 2013 11:46:45 +0000 (12:46 +0100)]
decoder: h264: fix decoding of scaling lists.

The GStreamer codecparser layer now parses the scaling lists in zigzag
scan order, as expected, so that to match the original bitstream layout
and specification. However, further convert the scaling lists into
raster scan order to fit the existing practice in most VA drivers.

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

10 years agocodecparsers: update to gst-vaapi-branch commit 177c73b.
Gwenole Beauchesne [Mon, 9 Dec 2013 11:07:28 +0000 (12:07 +0100)]
codecparsers: update to gst-vaapi-branch commit 177c73b.

a7e3255 add H.265 (HEVC) bitstream parser
177c73b h264: fix picture level scaling lists derivation (rule B)
14733f1 h264: fix parsing of VCL HRD parameters
59a0b47 h264: store quantization matrices in zig-zag order
ffb6e26 h264: add helpers to convert quantization matrices
c78a504 mpeg2: also initialize debug category in parse_sequence_header()
719d1b0 mpeg2: turn internal consistency check into a g_assert()
5241d8e all: remove some unused functions
18eb312 all: fix for GST_DISABLE_GST_DEBUG
963c04a all: make warnings more meaningful

10 years agoutils: add helpers for H.264 levels.
Gwenole Beauchesne [Fri, 6 Dec 2013 18:05:52 +0000 (19:05 +0100)]
utils: add helpers for H.264 levels.

- gst_vaapi_utils_h264_get_level():
  Returns GstVaapiLevelH264 from H.264 level_idc value
- gst_vaapi_utils_h264_get_level_idc():
  Returns H.264 level_idc value from GstVaapiLevelH264
- gst_vaapi_utils_h264_get_level_limits():
  Returns level limits as specified in Table A-1 of the H.264 standard
- gst_vaapi_utils_h264_get_level_limits_table():
  Returns the Table A-1 specification

10 years agoutils: add new H.264 profiles.
Gwenole Beauchesne [Fri, 6 Dec 2013 16:34:52 +0000 (17:34 +0100)]
utils: add new H.264 profiles.

Add "Constrained Baseline Profile" and "High 10 Profile" definitions
and helper functiions.

10 years agoutils: add new H.264 helper functions.
Gwenole Beauchesne [Fri, 6 Dec 2013 16:21:52 +0000 (17:21 +0100)]
utils: add new H.264 helper functions.

* Profiles:
- gst_vaapi_utils_h264_get_profile():
  Returns GstVaapiProfile from H.264 profile_idc value
- gst_vaapi_utils_h264_get_profile_idc():
  Returns H.264 profile_idc value from GstVaapiProfile

* Chroma formats:
- gst_vaapi_utils_h264_get_chroma_type():
  Returns GstVaapiChromaType from H.264 chroma_format_idc value
- gst_vaapi_utils_h264_get_chroma_format_idc():
  Returns H.264 chroma_format_idc value from GstVaapiChromaType

10 years agoFix missing files in distribution tarball.
Matthieu Bouron [Tue, 3 Dec 2013 11:05:17 +0000 (11:05 +0000)]
Fix missing files in distribution tarball.

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

[Additional fixes and clean-ups]
Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
10 years agoencoder: fix computation of max coded buffer size (again).
Gwenole Beauchesne [Thu, 5 Dec 2013 17:13:54 +0000 (18:13 +0100)]
encoder: fix computation of max coded buffer size (again).

The previous fix was only valid to express the maximum size of the
macroblock layer, i.e. without any headers. Now, also account for
the slice headers and top picture header, but also any other header
we might stuff into the VA coded buffer, e.g. sequence headers.

10 years agoencoder: fix computation of max coded buffer size.
Gwenole Beauchesne [Wed, 4 Dec 2013 18:10:13 +0000 (19:10 +0100)]
encoder: fix computation of max coded buffer size.

Fix coded buffer size for each codec. A generic issue was that the
number of macroblocks was incorrectly computed. The second issue was
specific to MPEG-2 were the max number of bits per macroblock, and
as defined by the standard, was incorrectly mapped to the (lower)
H.264 requirement. i.e. 4608 bits vs. 3200 bits limit.

10 years agoencoder: simplify VA context initialization process.
Gwenole Beauchesne [Wed, 4 Dec 2013 17:48:35 +0000 (18:48 +0100)]
encoder: simplify VA context initialization process.

Change get_context_info() into a set_context_info() function that
initializes common defaults into the base class, thus allowing the
subclasses to specialize the context info further on.

The set_context_info() hook is also the location where additional
context specific data could be initialized. At this point, we are
guaranteed to have valid video resolution size and framerate. i.e.
gst_vaapi_encoder_set_format() was called beforehand.

10 years agoencoder: fix mpeg2 compilation error.
Wind Yuan [Tue, 26 Nov 2013 06:38:23 +0000 (14:38 +0800)]
encoder: fix mpeg2 compilation error.

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

Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
10 years agoencoder: clean-ups and document public APIs.
Gwenole Beauchesne [Wed, 4 Dec 2013 16:55:18 +0000 (17:55 +0100)]
encoder: clean-ups and document public APIs.

Clean public APIs up so that to better align with the decoder APIs.
Most importantly, gst_vaapi_encoder_get_buffer() is changed to only
return the VA coded buffer proxy. Also provide useful documentation
for the public APIs.

10 years agoencoder: avoid extra allocations of GstVaapiEncoderSyncPic objects.
Gwenole Beauchesne [Wed, 4 Dec 2013 16:05:17 +0000 (17:05 +0100)]
encoder: avoid extra allocations of GstVaapiEncoderSyncPic objects.

Kill GstVaapiEncoderSyncPic objects that are internally and temporarily
allocated. Rather, associate a GstVaapiEncPicture to a coded buffer
through GstVaapiCodedBufferProxy user-data facility.

Besides, use a GAsyncQueue to maintain a thread-safe queue object of
coded buffers.

Partial fix for the following report:
https://bugzilla.gnome.org/show_bug.cgi?id=719530

10 years agoencoder: refactor status codes.
Gwenole Beauchesne [Tue, 3 Dec 2013 16:04:43 +0000 (17:04 +0100)]
encoder: refactor status codes.

Drop obsolete or unused status codes. Align some status codes with the
decoder counterparts.

10 years agoencoder: fix subclassing process.
Gwenole Beauchesne [Wed, 4 Dec 2013 10:54:40 +0000 (11:54 +0100)]
encoder: fix subclassing process.

Fix the GstVaapiEncoderClass parent class type. Make sure to validate
subclass hooks as early as possible, i.e. in gst_vaapi_encoder_init(),
thus avoiding useless run-time checks. Also simplify the subclass
initialization process to be less error prone.

10 years agoencoder: rework GstVaapiCodedBuffer and related proxy.
Gwenole Beauchesne [Tue, 3 Dec 2013 15:11:46 +0000 (16:11 +0100)]
encoder: rework GstVaapiCodedBuffer and related proxy.

Refactor the GstVaapiCodedBuffer APIs so that to more clearly separate
public and private interfaces. Besides, the map/unmap APIs should not
be exposed as is but appropriate accessors should be provided instead.

* GstVaapiCodedBuffer: VA coded buffer abstraction
- gst_vaapi_coded_buffer_get_size(): get coded buffer size.
- gst_vaapi_coded_buffer_copy_into(): copy coded buffer into GstBuffer

* GstVaapiCodedBufferPool: pool of VA coded buffer objects
- gst_vaapi_coded_buffer_pool_new(): create a pool of coded buffers of
  the specified max size, and bound to the supplied encoder

* GstVaapiCodedBufferProxy: pool-allocated VA coded buffer object proxy
- gst_vaapi_coded_buffer_proxy_new_from_pool(): create coded buf from pool
- gst_vaapi_coded_buffer_proxy_get_buffer(): get underlying coded buffer
- gst_vaapi_coded_buffer_proxy_get_buffer_size(): get coded buffer size

Rationale: more optimized transfer functions might be provided in the
future, thus rendering the map/unmap mechanism obsolete or sub-optimal.

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

10 years agoplugins: fix reference leaks of VA display objects.
Gwenole Beauchesne [Fri, 29 Nov 2013 13:02:52 +0000 (14:02 +0100)]
plugins: fix reference leaks of VA display objects.

Fix GstElement::set_context() implementation for all plug-in elements
to avoid leaking an extra reference to the VA display, thus preventing
correct cleanup of VA resources in GStreamer 1.2 builds.

10 years agoplugins: simplify gst_vaapi_ensure_display().
Gwenole Beauchesne [Fri, 29 Nov 2013 12:56:12 +0000 (13:56 +0100)]
plugins: simplify gst_vaapi_ensure_display().

Return earlier if the creation of a VA display failed. Likewise, simplify
gst_vaapi_video_context_propagate() now that we are guaranteed to have a
valid VA display.

10 years agoplugins: fix memory leaks through GstVideoMeta maps.
Gwenole Beauchesne [Thu, 28 Nov 2013 18:08:28 +0000 (19:08 +0100)]
plugins: fix memory leaks through GstVideoMeta maps.

When GstVideoMeta maps were used, the supporting functions incorrectly
used gst_buffer_get_memory() instead of gst_buffer_peek_memory(), thus
always increasing the associated GstMemory reference count and giving
zero chance to actually release that, and subsequently the VA display.

10 years agoplugins: use G_PARAM_STATIC_STRINGS.
Gwenole Beauchesne [Thu, 28 Nov 2013 13:15:44 +0000 (14:15 +0100)]
plugins: use G_PARAM_STATIC_STRINGS.

This avoids a few string copies during initialization.

10 years agoplugins: simplify VA video meta to only reference surface proxies.
Gwenole Beauchesne [Thu, 28 Nov 2013 16:28:11 +0000 (17:28 +0100)]
plugins: simplify VA video meta to only reference surface proxies.

Simplify GstVaapiVideoMeta to only hold a surface proxy, which is
now allocated from a surface pool. This also means that the local
reference to the VA surface is also gone, as it could be extracted
from the associated surface proxy.

10 years agoplugins: drop obsolete functions.
Gwenole Beauchesne [Thu, 28 Nov 2013 15:51:37 +0000 (16:51 +0100)]
plugins: drop obsolete functions.

Drop the following functions that are not longer used:
- gst_vaapi_video_buffer_new_with_surface()
- gst_vaapi_video_meta_new_with_surface()
- gst_vaapi_video_meta_set_surface()
- gst_vaapi_video_meta_set_surface_from_pool()

10 years agoplugins: allow VA video meta to be allocated from surface proxy pools.
Gwenole Beauchesne [Thu, 28 Nov 2013 15:37:31 +0000 (16:37 +0100)]
plugins: allow VA video meta to be allocated from surface proxy pools.

Fix gst_vaapi_video_meta_new_from_pool() to allocate VA surface proxies
from surface pools instead of plain VA surfaces. This is to simplify
allocations now that surface proxies are created from a surface pool.

10 years agosurfaceproxy: add copy function.
Gwenole Beauchesne [Thu, 28 Nov 2013 16:25:05 +0000 (17:25 +0100)]
surfaceproxy: add copy function.

Add gst_vaapi_surface_proxy_copy() function that creates a new surface
proxy with the same information from the parent proxy, except that the
user-defined destroy notify function is not copied over.

The underlying VA surface is pushed back to the video pool only when
the last reference to the parent surface proxy is released.

10 years agovaapiencode: optimize _handle_frame() to avoid extra allocation.
Gwenole Beauchesne [Thu, 28 Nov 2013 14:56:53 +0000 (15:56 +0100)]
vaapiencode: optimize _handle_frame() to avoid extra allocation.

Optimize gst_vaapiencode_handle_frame() to avoid extra memory allocation,
and in particular the GstVaapiEncObjUserData object. i.e. directly use
the VA surface proxy from the source buffer. This also makes the user
data attached to the GstVideoCodecFrame more consistent between both
the decoder and encoder plug-in elements.

10 years agovaapiencode: fix memory leaks in _push_frame() on error.
Gwenole Beauchesne [Thu, 28 Nov 2013 14:14:43 +0000 (15:14 +0100)]
vaapiencode: fix memory leaks in _push_frame() on error.

Simplify gst_vaapiencode_push_frame(), while also removing the call
to gst_video_encoder_negotiate() since this is implicit in _finish()
if caps changed. Also fixed memory leaks that occured on error.

10 years agovaapiencode: additional clean-ups.
Gwenole Beauchesne [Thu, 28 Nov 2013 12:57:54 +0000 (13:57 +0100)]
vaapiencode: additional clean-ups.

Constify pointers wherever possible. Drop unused variables, and use
consistent variable names. Fix gst_vaapiencode_h264_allocate_buffer()
to correctly report errors, especially when in-place conversion from
bytestream to avcC format failed.

10 years agovaapiencode: move common properties to base class.
Gwenole Beauchesne [Thu, 28 Nov 2013 12:26:40 +0000 (13:26 +0100)]
vaapiencode: move common properties to base class.

Move "rate-control" mode and "bitrate" properties to the GstVaapiEncode
base class. The actual range of supported rate control modes is currently
implemented as a plug-in element hook. This ought to be determined from
the GstVaapiEncoder object instead, i.e. from libgstvaapi.

10 years agovaapiencode: fix plugin description and debug name.
Gwenole Beauchesne [Thu, 28 Nov 2013 09:54:36 +0000 (10:54 +0100)]
vaapiencode: fix plugin description and debug name.

Align the plug-in debug category to its actual name. i.e. enable debug
logs through vaapiencode_<CODEC> where <CODEC> is mpeg2, h264, etc. Fix
the plug-in element description to make it more consistent with other
VA-API plug-ins.

10 years agovaapiencode: add initial support for GStreamer 0.10.
Gwenole Beauchesne [Wed, 27 Nov 2013 15:27:31 +0000 (16:27 +0100)]
vaapiencode: add initial support for GStreamer 0.10.

10 years agolibs: add more GstBuffer compat glue for GStreamer 0.10.
Gwenole Beauchesne [Wed, 27 Nov 2013 15:25:59 +0000 (16:25 +0100)]
libs: add more GstBuffer compat glue for GStreamer 0.10.

Add gst_buffer_new_allocate() and gst_buffer_fill() implementations.
Fix gst_buffer_new_wrapped_full() implementation to handle the destroy
notify function.

10 years agolibs: always use built-in videoutils for GStreamer 0.10.
Gwenole Beauchesne [Wed, 27 Nov 2013 14:56:51 +0000 (15:56 +0100)]
libs: always use built-in videoutils for GStreamer 0.10.

GStreamer 0.10.36 is the latest and ultimate version to be released
from the GStreamer 0.10 branch. i.e. no further releases are to be
made. So, we can safely enable the built-in videoutils replacement
now that they are in sync with the 0.10 branch.

10 years agovideoutils: update to master commit d4a15a5.
Gwenole Beauchesne [Wed, 27 Nov 2013 14:47:38 +0000 (15:47 +0100)]
videoutils: update to master commit d4a15a5.

d4a15a5 video: fix compiler warning in header with C++11 / clang-3.1
86096cc videodecoder: minor cosmetic changes to align a bit more with master
b4b8b52 videodecoder: allow parse function to not use all data on adapter
2145495 videodecoder: warn if frame list gets long
36c3753 videodecoder: Also use the object lock to protect the output_state
518c93d videodecoder: fix seeking again
185fb63 video: Correct usage of the base class stream lock
170e944 videodecoder: Expose _negotiate function

10 years agoFix build with GStreamer >= 1.3.
Matthieu Bouron [Tue, 26 Nov 2013 12:06:07 +0000 (12:06 +0000)]
Fix build with GStreamer >= 1.3.

http://bugzilla.gnome.org/show_bug.cgi?id=715183

Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
10 years agoconfigure: disable encoders with GStreamer 0.10.
Gwenole Beauchesne [Tue, 26 Nov 2013 16:56:59 +0000 (17:56 +0100)]
configure: disable encoders with GStreamer 0.10.

Don't try to build video encoders for GStreamer 0.10. Support code is
not there yet, and probably will never for such an ancient version.

10 years agovaapiencode: fix error handling while allocating output buffers.
Gwenole Beauchesne [Tue, 26 Nov 2013 16:26:44 +0000 (17:26 +0100)]
vaapiencode: fix error handling while allocating output buffers.

Fix default GstVideoEncoder::allocate_buffer() implementation to properly
unmap the coded buffer prior to returning an error.

10 years agovaapiencode: fix error handling in _finish() hook.
Gwenole Beauchesne [Tue, 26 Nov 2013 16:11:22 +0000 (17:11 +0100)]
vaapiencode: fix error handling in _finish() hook.

Fix GstVideoEncoder::finish() implementation to really return possible
errors instead of GST_FLOW_OK. That is, fix check for timeout status.

10 years agovaapiencode: minor clean-ups.
Gwenole Beauchesne [Tue, 26 Nov 2013 15:34:14 +0000 (16:34 +0100)]
vaapiencode: minor clean-ups.

Add a GST_VAAPIENCODE_CAST() helper to avoid run-time checks against
the GObject type system. We are guaranteed to only deal with the same
plug-in element object.

10 years agovaapiencode: fix support for raw YUV sink buffers.
Gwenole Beauchesne [Tue, 26 Nov 2013 14:31:03 +0000 (15:31 +0100)]
vaapiencode: fix support for raw YUV sink buffers.

Allow vaapiencode plug-in elements to encode from raw YUV buffers.
The most efficient way to do so is to let the vaapiencode elements
allocate a buffer pool, and subsequently buffers from it. This means
that upstream elements are expected to honour downstream pools.

If upstream elements insist on providing their own allocated buffers
to the vaapiencode elements, then it possibly would be more efficient
to insert a vaapipostproc element before the vaapiencode element.
This is because vaapipostproc currently has better support than other
elements for "foreign" raw YUV buffers.

10 years agovaapiencode: fix support for GStreamer 1.2.
Gwenole Beauchesne [Tue, 26 Nov 2013 14:12:59 +0000 (15:12 +0100)]
vaapiencode: fix support for GStreamer 1.2.

10 years agovaapiencode: initial port to GStreamer 1.2.
Wind Yuan [Thu, 7 Nov 2013 09:42:21 +0000 (17:42 +0800)]
vaapiencode: initial port to GStreamer 1.2.

Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
10 years agoplugins: add mpeg2 encoder element.
XuGuangxin [Wed, 20 Nov 2013 08:21:32 +0000 (16:21 +0800)]
plugins: add mpeg2 encoder element.

Add GstVaapiEncodeMPEG2 element object. The actual plug-in element
is called "vaapiencode_mpeg2".

Valid properties:
- rate-control: rate control mode (default: cqp - constant QP)
- bitrate: desired bitrate in kbps (default: auto-calculated)
- key-period: maximal distance between two key frames (default: 30)
- max-bframes: number of B-frames between I and P (default: 2)
- quantizer: constant quantizer (default: 8)

Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
10 years agoplugins: add h264 encoder element.
Wind Yuan [Mon, 29 Jul 2013 08:02:56 +0000 (16:02 +0800)]
plugins: add h264 encoder element.

Add GstVaapiEncodeH264 element object. The actual plug-in element
is called "vaapiencode_h264".

Valid properties:
- rate-control: rate control mode (default: none)
- bitrate: desired bitrate in kbps (default: auto-calculated)
- key-period: maximal distance between two key frames (default: 30)
- num-slices: number of slices per frame (default: 1)
- max-bframes: number of B-frames between I and P (default: 0)
- min-qp: minimal quantizer (default: 1)
- init-qp: initial quantizer (default: 26)

Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
10 years agoplugins: add base encoder element.
Wind Yuan [Mon, 29 Jul 2013 05:44:48 +0000 (13:44 +0800)]
plugins: add base encoder element.

vaapiencode element is based on GstVideoEncoder APIs.

Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
10 years agoencoder: add mpeg2 encoder.
XuGuangxin [Wed, 20 Nov 2013 08:20:15 +0000 (16:20 +0800)]
encoder: add mpeg2 encoder.

Add initial support for MPEG-2 encoding. I/P/B frames are supported.

Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
10 years agoencoder: add h264 encoder.
Wind Yuan [Mon, 29 Jul 2013 07:46:11 +0000 (15:46 +0800)]
encoder: add h264 encoder.

Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
10 years agoAdd initial infrastructure for video encoding.
Wind Yuan [Mon, 29 Jul 2013 05:34:06 +0000 (13:34 +0800)]
Add initial infrastructure for video encoding.

Add initial API for video encoding: only basic interfaces and small
encoder objects are implemented so far.

Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
10 years agolibs: add generic bitstream writer.
Wind Yuan [Mon, 29 Jul 2013 07:41:23 +0000 (15:41 +0800)]
libs: add generic bitstream writer.

GstBitWriter provides a bit writer that can write any number of bits
to a pre-allocated memory buffer. Helper functions are also provided
to write any number of bits from 8, 16, 32 and 64 bit variables.

Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
10 years agolibs: add support for rate-control to GstVaapiContext.
Wind Yuan [Fri, 12 Jul 2013 14:07:59 +0000 (22:07 +0800)]
libs: add support for rate-control to GstVaapiContext.

Extend GstVaapiContextInfo structure to hold the desired rate control
mode for encoding purposes. For decoding purposes, this field is not
used and it is initialized to GST_VAAPI_RATECONTROL_NONE.

Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
10 years agolibs: add rate-control attributes.
Wind Yuan [Fri, 12 Jul 2013 13:33:32 +0000 (21:33 +0800)]
libs: add rate-control attributes.

Add GstVaapiRateControl types and GType values in view to supporting
rate controls for encoding. This is meant to be used for instance in
GstVaapiContext.

Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
10 years agoBump version for development.
Gwenole Beauchesne [Fri, 22 Nov 2013 10:56:51 +0000 (11:56 +0100)]
Bump version for development.

10 years agobuild: fix for Wayland headers not in standard include dirs. 0.5.7
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

10 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>
10 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.

10 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.

10 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.

10 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().

10 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.

10 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.

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

10 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.

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

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

10 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.

10 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.

10 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>
10 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.

10 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).

10 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.

10 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>
10 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.

10 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.

10 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.

10 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>
10 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>
10 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.

10 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.

10 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>
10 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>
10 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.

10 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.

10 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

10 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

10 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>
10 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.

10 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.

10 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.

10 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.

10 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.

10 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.

10 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.

10 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.

10 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.

10 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.

10 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.

10 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

10 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.

10 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.