Commit graph

1507 commits

Author SHA1 Message Date
Gwenole Beauchesne
f361d4a23d 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.
2013-10-09 18:30:06 +02:00
Gwenole Beauchesne
4df68163dc 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?
2013-10-09 18:30:06 +02:00
Gwenole Beauchesne
cc9afca3ed 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.
2013-10-04 19:34:32 +02:00
Gwenole Beauchesne
393e86e3d0 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.
2013-10-04 19:30:36 +02:00
Gwenole Beauchesne
b242c5874b 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.
2013-10-01 18:41:29 +02:00
Zhao Halley
e05e65e349 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>
2013-10-01 18:41:29 +02:00
Zhao Halley
3e4d8d27b3 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>
2013-10-01 18:41:29 +02:00
Víctor Manuel Jáquez Leal
94b554e7a2 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>
2013-10-01 18:41:29 +02:00
Víctor Manuel Jáquez Leal
395260f24b 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
2013-10-01 18:41:16 +02:00
Víctor Manuel Jáquez Leal
b56144e924 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>
2013-10-01 17:55:43 +02:00
Gwenole Beauchesne
6b3c08a729 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.
2013-09-27 14:24:02 +02:00
Víctor Manuel Jáquez Leal
41c4da5571 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>
2013-09-27 14:17:20 +02:00
Sreerenj Balachandran
8fe3bb0b14 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>
2013-09-27 14:17:16 +02:00
Víctor Manuel Jáquez Leal
21aa850eb4 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>
2013-09-27 14:17:12 +02:00
Víctor Manuel Jáquez Leal
9e3d24c669 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>
2013-09-27 14:17:07 +02:00
Víctor Manuel Jáquez Leal
c67b783275 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>
2013-09-27 14:16:52 +02:00
Víctor Manuel Jáquez Leal
f75762d910 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>
2013-09-27 14:15:51 +02:00
Gwenole Beauchesne
d262d36623 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.
2013-09-24 16:24:05 +02:00
Gwenole Beauchesne
008eac1b72 codecparsers: update to gst-vaapi-branch commit b33bd32.
b33bd32 jpeg: fix and optimize scan for next marker code
2013-09-24 16:22:59 +02:00
Gwenole Beauchesne
c171b007ff 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.
2013-09-23 19:17:17 +02:00
Gwenole Beauchesne
5444ab44d2 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.
2013-09-23 17:38:07 +02:00
Gwenole Beauchesne
fd51db279a 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.
2013-09-23 17:25:51 +02:00
Gwenole Beauchesne
22fef09443 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.
2013-09-20 18:32:12 +02:00
Gwenole Beauchesne
f52dfe5797 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.
2013-09-20 18:32:12 +02:00
Junfeng Xu
a4aac6b89e 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>
2013-09-20 18:32:12 +02:00
Gwenole Beauchesne
77298beb15 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
2013-09-20 18:32:12 +02:00
Junfeng Xu
9c29bbde58 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>
2013-09-20 18:32:12 +02:00
Gwenole Beauchesne
a1d91e038c codecparsers: update to gst-vaapi-branch commit 23c7dde.
23c7dde jpeg: fix calculation of segment size
2013-09-20 18:30:18 +02:00
Gwenole Beauchesne
0a4582de6f Bump version for development. 2013-08-31 16:00:05 +02:00
Gwenole Beauchesne
0687224796 0.5.6. 2013-08-31 15:48:24 +02:00
Gwenole Beauchesne
60c8ae0dad NEWS: updates. 2013-08-31 15:48:23 +02:00
Wind Yuan
621d48a5b1 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>
2013-08-29 19:44:48 +02:00
Zhao Halley
45b4ba7df7 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>
2013-08-29 19:36:06 +02:00
Gwenole Beauchesne
6d7b5eef7d 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.
2013-08-29 19:36:06 +02:00
Gwenole Beauchesne
d2648afa32 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
2013-08-29 19:36:06 +02:00
Gwenole Beauchesne
1be80e791c 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
2013-08-29 19:36:06 +02:00
Guangxin.Xu
111d7d4fa4 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>
2013-08-29 14:47:40 +02:00
Gwenole Beauchesne
91736b3a60 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.
2013-08-29 11:55:05 +02:00
Gwenole Beauchesne
1362352825 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.
2013-08-27 18:29:45 +02:00
Gwenole Beauchesne
7759acd2f0 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.
2013-08-27 18:29:45 +02:00
Gwenole Beauchesne
5fdc9a0e95 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.
2013-08-27 18:28:28 +02:00
Gwenole Beauchesne
71e5fd536f 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.
2013-08-27 18:28:10 +02:00
Gwenole Beauchesne
771071a4e5 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.
2013-08-26 17:14:33 +02:00
Gwenole Beauchesne
292b2f51b4 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
2013-08-26 16:19:01 +02:00
Simon Farnsworth
0ef5979d77 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>
2013-08-26 13:10:33 +02:00
Wind Yuan
e5a50af2ae 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
2013-08-26 13:01:26 +02:00
Guangxin.Xu
92a124f306 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>
2013-08-26 12:56:06 +02:00
Gwenole Beauchesne
d16db58968 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
2013-08-26 11:31:06 +02:00
Gwenole Beauchesne
ed9cc7c8d2 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.
2013-08-23 19:00:38 +02:00
Zhao Halley
d48a18c9f2 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>
2013-08-23 19:00:38 +02:00