Commit graph

93 commits

Author SHA1 Message Date
Gwenole Beauchesne
8c93c842ef plugins: add support for BGRA textures.
Some frameworks (EFL) expect BGRA textures for storage. However,
adding support for that broadly into GStreamer framework  implies
two kinds of hacks: (i) libgstgl helpers currently do not support
BGRA textures correctly, (ii) we need to better parse downstream
suggested caps and intersect them with what the VA plugin elements
can offer to them for GL texturing.
2015-02-24 15:20:03 +01:00
Gwenole Beauchesne
96ce1bc761 videopool: add optional flags for surface pool allocation.
Reword surface pool allocation helpers so that to allow for a simple
form, e.g. gst_vaapi_surface_pool_new(format, width, height); and a
somewhat more elaborated/flexible form with optional allocation flags
and precise GstVideoInfo specification.

This is an API/ABI change, and SONAME version needs to be bumped.
2015-01-27 18:11:45 +01:00
Michael Olbrich
22d1acb6d2 vaapipostproc: clear state on stop
Otherwise restarting may fail because the state of vaapipluginbase and
vaapipostproc don't match. e.g. gst_vaapipostproc_set_caps() will skip
initailization and not call gst_vaapi_plugin_base_set_caps()
2015-01-27 16:06:02 +02:00
Gwenole Beauchesne
4be370f9ed vaapipostproc: fix out caps for GLMemory.
If the best downstream capsfeature turns out to be GLMemory, then make
sure to propagate RGBA video format in caps to that element. This fixes
the following pipeline: ... ! vaapipostproc ! glimagesink.
2014-11-24 15:28:36 +01:00
Gwenole Beauchesne
0525f56ac5 vaapipostproc: fix check for compatible src pad capsfilters.
When an explicit output video format is selected, from an src pad
capsfilter, make sure that the downstream element actually supports
that format. In particular, fix crash with the following pipelines:
... ! vaapipostproc ! video/x-raw,format=XXX ! xvimagesink ; where
XXX is a format not supported by xvimagesink.

While doing so, also reduce the set of src pad filter caps to the
actual set of allowed src pad caps.
2014-11-24 15:28:20 +01:00
Gwenole Beauchesne
9c888b8b8e plugins: re-indent all video processing related source code. 2014-11-24 14:11:35 +01:00
Gwenole Beauchesne
a4d88db0fd plugins: preserve framerate when updating src caps video format.
In the current implementation, gst_video_info_set_format() would reset
the whole GstVideoInfo structure first, prior to setting video format
and size. So, coleteral information like framerate or pixel-aspect-
ratio are lost.

Provide and use a unique gst_video_info_change_format() for overcome
this issue, i.e. only have it change the format and video size, and
copy over the rest of the fields.

https://bugzilla.gnome.org/show_bug.cgi?id=734665
2014-11-18 18:39:32 +01:00
Sreerenj Balachandran
08bbab889b vaapipostproc: Add string representation of VPP functions to ElementFactoy Klass
Added the same Klass specifications used in other upstream
video postprocessing elements like videoconvert, videoscale,
videobalance and deinterlace.
An example use case is for this is to help the playsink
to autoplug the hardware accelerated deinterlacer.
2014-11-12 09:45:50 +01:00
Sreerenj Balachandran
626e180fef vaapipostproc: Tweak the output video format setting to enable the autoplugging
This is a workaround until auto-plugging is fixed when
format=ENCODED + memory:VASurface caps feature are provided.

Use the downstream negotiated video format as the output video format
if the user didn't ask for the colorspace conversion explicitly.
Usecase: This will help to connect elements like videoscale, videorate etc
to vaapipostproc.

https://bugzilla.gnome.org/show_bug.cgi?id=739443
2014-11-12 09:45:50 +01:00
Gwenole Beauchesne
eeb43989c1 vaapipostproc: allow user defined scaling mode.
Add new "scale-method" property to expose the scaling mode to use during
video processing. Note that this is only a hint, and the actual behaviour
may differ from implementation (VA driver) to implementation.
2014-10-29 17:33:48 +01:00
Gwenole Beauchesne
b61d993e7d vaapipostproc: add support for GLTextureUploadMeta output.
This allows for vaapipostproc to be chained to the glimagesink element
for instance.

https://bugzilla.gnome.org/show_bug.cgi?id=735231
2014-08-22 18:52:23 +02:00
Gwenole Beauchesne
493337c4b1 vaapipostproc: add support for "download" capability.
Allow implicit conversions to raw video formats, while still keeping
VA surfaces underneath. This allows for chaining the vaapipostproc
element to a software-only element that takes care of maps/unmaps.
e.g. xvimagesink.

https://bugzilla.gnome.org/show_bug.cgi?id=720174
2014-08-22 18:20:46 +02:00
Gwenole Beauchesne
9ee46ab32e vaapipostproc: use pooled vaapi video meta.
Use pooled GstVaapiVideoMeta information, i.e. always allocate that on
video buffer allocation. Also optimize copy of additional metadata info
into the resulting video buffer: only copy the video cropping info and
the source surface proxy.

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

Signed-off-by: Sreerenj Balachandran <sreerenj.balachandran@intel.com>
[fixed proxy leak, fixed double free on error, optimized meta copy]
Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
2014-08-22 18:15:31 +02:00
Gwenole Beauchesne
92fcb38ba6 vaapipostproc: fix passthrough mode.
If no explicit output surface format is supplied try to keep the one
supplied through the sink pad caps. This avoids a useless copy, even
if things are kept in GPU memory.

This is a performance regression from git commit dfa70b9.
2014-08-22 15:54:32 +02:00
Sreerenj Balachandran
db111fe72a vaapipostproc: fix output buffer to have a GstVaapiVideoMemory.
https://bugzilla.gnome.org/show_bug.cgi?id=720311

[used new infrastructure through base decide_allocation() impl]
Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
2014-08-22 15:54:32 +02:00
Gwenole Beauchesne
bc8e7a6734 vaapipostproc: enable advanced deinterlacing with same format.
If only advanced deinterlacing is requested, i.e. deinterlacing is
the only active algorithm to apply with source and output surface
formats being the same, then make sure to enable VPP processing.

Otherwise, allow fallback to bob-deinterlacing with simple rendering
flags alteration.
2014-08-22 15:54:32 +02:00
Gwenole Beauchesne
dfa70b9e85 vaapipostproc: fix detection of output surface format changes.
Default to I420 format for output surfaces so that to match the usual
GStreamer pipelines. Though, internally, we could still opt for NV12
surface formats, i.e. default format=ENCODED is a hint for that, thus
delegating the decision to the VA driver.
2014-08-21 09:40:06 +02:00
Gwenole Beauchesne
913f2ef68c vaapipostproc: fix construction of allowed sink pad caps.
Fix construction of the set of caps allowed on the sink pad to filter
out unsupported raw video caps with GStreamer >= 1.2.
2014-08-21 09:39:40 +02:00
Gwenole Beauchesne
d82e6a8866 vaapipostproc: improve heuristics for detecting native VA surfaces.
Use the new gst_caps_has_vaapi_surface() helper function to detect
whether the sink pad caps contain native VA surfaces, or not, i.e.
no raw video caps.

Also rename is_raw_yuv to get_va_surfaces to make the variable more
explicit as we just want a way to differentiate raw video caps from
VA surfaces actually.
2014-08-21 09:39:09 +02:00
Gwenole Beauchesne
6d8c5221b2 vaapipostproc: disable discontinuity detection code.
The "discontinuity" tracking code, whereby lost frames are tentatively
detected, is inoperant if the sink pad buffer timestamps are not right
to begin with.

This is a temporary workaround until the following bug is fixed:
https://bugzilla.gnome.org/show_bug.cgi?id=734386
2014-08-21 09:38:53 +02:00
Gwenole Beauchesne
197001768b vaapipostproc: fix heuristic for detecting discontinuity.
In order to make the discontinuity detection code useful, we need to
detect the lost frames in the history as early as the previous frame.
This is because some VA implementations only support one reference
frame for advanced deinterlacing.

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

This is a regression introduced with commit faefd62.

https://bugzilla.gnome.org/show_bug.cgi?id=734135
2014-08-21 09:38:18 +02:00
Simon Farnsworth
4d2de696a9 vaapipostproc: don't let tmp_rect go out of scope.
A compiler change showed me that tmp_rect went out of scope before
it was used. Move it to the beginning of the function instead.

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

Signed-off-by: Simon Farnsworth <simon.farnsworth@onelan.co.uk>
[added guards for GStreamer 0.10 builds]
Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
2014-07-03 22:59:36 +02:00
Gwenole Beauchesne
9d417815ab vaapipostproc: don't crash with dynamic framerate (0/1).
Avoid reaching an assert if dynamic framerates (0/1) are used. One
way to solve this problem is to just stick field_duration to zero.
However, this means that, in presence of interlaced streams, the
very first field will never be displayed if precise presentation
timestamps are honoured.

https://bugzilla.gnome.org/show_bug.cgi?id=729604
2014-06-19 14:51:01 +02:00
Simon Farnsworth
1a2c06a81c vaapipostproc: create filter surface pool if it does not exist yet.
ensure_srcpad_buffer_pool() tries to avoid unnecessarily deleting and
recreating filter_pool. Unfortunately, this also meant it didn't create
it if it did not exist.

Fix it to always create the buffer pool if it does not exist.

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

Signed-off-by: Simon Farnsworth <simon.farnsworth@onelan.co.uk>
2014-06-18 17:30:12 +02:00
Zhao, Halley
faefd62e9b vaapipostproc: reset deinterlacer state when there is a discontinuity.
Reset deinterlacer state, i.e. past reference frames used for advanced
deinterlacing, when there is some discontinuity detected in the course
of processing source buffers.

This fixes support for advanced deinterlacing when a seek occurred.

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

[fixed type of pts_diff variable, fetch previous buffer PTS from the
 history buffer, reduce heuristic for detecting discontinuity]
Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
2014-06-18 17:24:48 +02:00
Gwenole Beauchesne
b3401dbb29 vaapipostproc: add support for crop regions in VPP mode.
Apply video cropping regions stored in GstVideoCropMeta, or in older
GstVaapiSurfaceProxy representation, to VPP pipelines. In non-VPP modes,
the crop meta are already propagated to the output buffers.

https://bugzilla.gnome.org/show_bug.cgi?id=720730
2014-06-18 16:24:52 +02:00
Simon Farnsworth
927fd2e1a8 vaapipostproc: make deinterlace-mode behave as expected.
deinterlace-mode didn't behave in the way you'd expect if you have
past experience of the deinterlace element. There were two bugs:

 1. "auto" mode wouldn't deinterlace "interleaved" buffers, only "mixed".
 2. "force" mode wouldn't deinterlace "mixed" buffers flagged as progressive.

Fix these up, and add assertions and error messages to detect cases that
aren't handled.

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

Signed-off-by: Simon Farnsworth <simon.farnsworth@onelan.co.uk>
Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
2014-06-18 16:24:23 +02:00
Gwenole Beauchesne
6bf3c1863c legal: update copyright notice dates. 2014-01-22 19:02:35 +01:00
Gwenole Beauchesne
751aa05937 surface: rework render flags.
Pack render flags per category and provide more flags into the color
standard category. In particular, cover for SMPTE-240M.
2014-01-15 13:53:42 +01:00
Zhao, Halley
467bf95c09 vaapipostproc: add support for colorbalance filters.
Add support for hue, saturation, brightness and constrat adjustments.
Also fix cap info local copy to match the really expected cap subtype
of interest.

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

Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
2014-01-15 11:49:49 +01:00
Zhao, Halley
db5465c2d6 vaapipostproc: fix support for "sharpen" filter.
Fix copy/paste error when submitting the "sharpen" value to the
GstVaapiFilter instance.

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

Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
2014-01-15 11:42:15 +01:00
Gwenole Beauchesne
528b5adc5a plugins: factor out construction of GValue from GstVideoFormat.
Add new helper functions to build GValues from GstVideoFormat:
- gst_vaapi_value_set_format():
  build a GValue from the supplied video format
- gst_vaapi_value_set_format_list():
  build a GValue list from the supplied array of video formats
2013-12-21 12:35:24 +01:00
Gwenole Beauchesne
690e85ff8e plugins: fix permissions for certain files.
Drop the execute bit for gstvaapiuploader.c and gstvaapipostproc.[ch]
files.
2013-12-20 17:16:12 +01:00
Gwenole Beauchesne
e3dcd33114 plugins: factor out support for raw YUV buffers on sink pads.
Factor out propose_allocation() hooks, creation of video buffer pool
for the sink pad, conversion from raw YUV buffers to VA surface backed
buffers. Update vaapidecode, vaapiencode and vaapipostproc to cope
with the new GstVaapiPluginBase abilities.
2013-12-18 16:38:57 +01:00
Gwenole Beauchesne
b324fc6add plugins: factor out pad caps. 2013-12-18 16:38:57 +01:00
Gwenole Beauchesne
01a3fc44c0 plugins: factor out video context sharing code. 2013-12-18 16:38:57 +01:00
Gwenole Beauchesne
e5f066b719 plugins: factor out GstImplementsInterface. 2013-12-18 16:38:57 +01:00
Gwenole Beauchesne
6f2dfb71e6 plugins: factor out display creation process.
Move common VA display creation code to GstVaapiPluginBase, with the
default display type remaining "any". Also add a "display-changed"
hook so that subclasses could perform additional tasks when/if the
VA display changed, due to a new display type request for instance.

All plug-ins are updated to cope with the new internal APIs.
2013-12-18 16:38:57 +01:00
Gwenole Beauchesne
7e58d60854 plugins: add new base object, store display in there.
Introduce a new GstVaapiPluginBase object that will contain all common
data structures and perform all common tasks. First step is to have a
single place to hold VA displays.

While we are at it, also make sure to store and subsequently release
the appropriate debug category for the subclasses.
2013-12-18 16:38:57 +01:00
Gwenole Beauchesne
7a33165436 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.
2013-11-29 14:02:52 +01:00
Gwenole Beauchesne
9ab6037847 plugins: use G_PARAM_STATIC_STRINGS.
This avoids a few string copies during initialization.
2013-11-28 17:35:44 +01:00
Gwenole Beauchesne
922a04b734 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.
2013-11-22 11:15:57 +01:00
Gwenole Beauchesne
7a464ba015 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.
2013-11-22 10:27:19 +01:00
Gwenole Beauchesne
1d1f18bcbe 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.
2013-11-22 10:04:45 +01:00
Gwenole Beauchesne
98ac557e87 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().
2013-11-22 09:49:30 +01:00
Gwenole Beauchesne
15519ebe3d 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.
2013-11-22 06:39:15 +01:00
Gwenole Beauchesne
9968661ffd 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.
2013-11-21 23:08:02 +01:00
Halley Zhao
ef8f5defd2 vaapipostproc: add support for denoise and sharpen filters.
Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
2013-11-21 23:08:02 +01:00
Gwenole Beauchesne
c8bea66d33 vaapipostproc: add support for advanced deinterlacing.
Add initial support for advanced deinterlacing. The history buffer
size is arbitrarily set to 3 references for now.
2013-11-21 23:08:02 +01:00
Gwenole Beauchesne
49e2d040fa 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).
2013-11-21 23:08:02 +01:00