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
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>
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.
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.
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.
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>
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.
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
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.
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.
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
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.
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.
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.
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.
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.
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()
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.
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.
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.
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.
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.
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.
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.
Gwenole Beauchesne [Wed, 27 Nov 2013 15:27:31 +0000 (16:27 +0100)]
vaapiencode: add initial support 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.
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.
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
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>
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.
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.
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.
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.
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.
Gwenole Beauchesne [Tue, 26 Nov 2013 14:12:59 +0000 (15:12 +0100)]
vaapiencode: fix support for 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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
Gwenole Beauchesne [Fri, 22 Nov 2013 10:56:51 +0000 (11:56 +0100)]
Bump version for development.
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
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>
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.
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.
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.
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().
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.
Gwenole Beauchesne [Fri, 22 Nov 2013 05:45:22 +0000 (06:45 +0100)]
README: update for GStreamer >= 1.0.x and VPP features.
Gwenole Beauchesne [Fri, 22 Nov 2013 05:37:12 +0000 (06:37 +0100)]
legal: update copyright notice dates.
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.
Gwenole Beauchesne [Thu, 21 Nov 2013 22:52:43 +0000 (23:52 +0100)]
0.5.7.
Gwenole Beauchesne [Thu, 21 Nov 2013 22:51:59 +0000 (23:51 +0100)]
NEWS: updates.
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.
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.
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>
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.
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).
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.
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>
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.
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.
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.
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>
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>
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.
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.
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>
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>
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.
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.
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
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
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>
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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
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.
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.
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?
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.
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.
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.
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>
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>
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>