Commit graph

1318 commits

Author SHA1 Message Date
Hyunjun Ko
7f38b3b9f2 libs: encoder: h265: fix reserved length of bits
Fix reserved length of bits for bit_depth_luma_minus8 and bit_depth_chroma_minus8

https://bugzilla.gnome.org/show_bug.cgi?id=778749
2017-03-14 16:54:39 +01:00
Thomas Petazzoni
159e3c3f08 O_CLOEXEC needs _GNU_SOURCE defined
From man open(2):

    The O_CLOEXEC, O_DIRECTORY, and O_NOFOLLOW flags are not specified
    in POSIX.1-2001, but are specified in POSIX.1-2008.  Since glibc
    2.12, one can obtain their definitions by defining either
    _POSIX_C_SOURCE with a value greater than or equal to 200809L or
    _XOPEN_SOURCE with a value greater than or equal to 700.  In glibc
    2.11 and earlier, one obtains the definitions by defining
    _GNU_SOURCE.

And indeed, with the uClibc C library, O_CLOEXEC is not exposed if
_GNU_SOURCE is not defined. Therefore, this commit fixes the build of
gstreamer-vaapi with the uClibc C library.

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>

https://bugzilla.gnome.org/show_bug.cgi?id=779953
2017-03-14 16:12:27 +01:00
Hyunjun Ko
c4ef779931 libs: window: wayland: handle more VAStatus to use vpp
Since the commit landed https://github.com/01org/intel-vaapi-driver/pull/55,
we should consider more returned VAStatus to use vpp.

https://bugzilla.gnome.org/show_bug.cgi?id=779400
2017-03-02 02:22:26 +01:00
Hyunjun Ko
6468bf2ddf libs: encoder: ensure profile when context initialization
We can't be sure that encoder's profile is assgined already or not
at context initialization.

https://bugzilla.gnome.org/show_bug.cgi?id=779120
2017-02-28 18:26:44 +01:00
Hyunjun Ko
04a844ced0 libs: encoder: set rate control info only when query succeed
Currently, it set rate control information even when query fails.
In addition, it doesn't update any more since the flag
got_rate_control_mask is set to TRUE.

https://bugzilla.gnome.org/show_bug.cgi?id=779120
2017-02-28 18:26:44 +01:00
Víctor Manuel Jáquez Leal
a0a2f7bfe8 libs: encoder: caps can change at any time
The encoder should be able to change its caps even it is already
processing a stream.

This is suppose to happen after a flush so the codedbuf_queue should
be empty.

https://bugzilla.gnome.org/show_bug.cgi?id=775490
2017-02-22 05:19:06 +01:00
Víctor Manuel Jáquez Leal
7b3a51f145 libs: encoder: h265: bail if nal unit type fails
Bail out if the NAL unit type is not recognized.

https://bugzilla.gnome.org/show_bug.cgi?id=778782
2017-02-22 05:19:06 +01:00
Víctor Manuel Jáquez Leal
d6738f3f93 libs: decoder: h264,h265 avoid uninitialized variable
Configuring GCC to verify possible usage of uninitialized variables,
shows that found_index might be used without previous assignation.

This patch assigns a initial value to found_index, also avoid a
branching when returning the result value.

https://bugzilla.gnome.org/show_bug.cgi?id=778782
2017-02-16 18:46:35 +01:00
Scott D Phillips
884e0bece2 build: rename USE_HEVC_DECODER to USE_H265_DECODER
Rename to be consistent with H.264 and also H.265 encoder. The
meson build assumed this was already consistently named, and so
previously was not able to actually build the H.265 decoder.

https://bugzilla.gnome.org/show_bug.cgi?id=778576
2017-02-16 17:27:50 +01:00
Hyunjun Ko
b6a3e88059 libs: encoder: vp8: add CBR encoding mode
This patch enables the Constant BitRate encoding mode in VP8 encoder.
Basically it adds the configuration parameters required by libva to
CBR enconding.

Original-Patch-By: Víctor Manuel Jáquez Leal <victorx.jaquez@intel.com>

https://bugzilla.gnome.org/show_bug.cgi?id=749950
2017-02-10 13:11:21 +01:00
Hyunjun Ko
ffc5b43da7 libs: encoder: vp8: fix bitrate calculation
Base encoder's unit of bitrate is in Kbps. We should honor it so
we use the value of bitrate in VA, in which is expressed in bps.

https://bugzilla.gnome.org/show_bug.cgi?id=749950
2017-02-10 13:10:10 +01:00
Scott D Phillips
412dd13e86 vaapi: add meson build
https://bugzilla.gnome.org/show_bug.cgi?id=778250
2017-02-09 11:27:44 +01:00
Scott D Phillips
3cc4eb7b81 make: remove gstvaapiversion.h generation
https://bugzilla.gnome.org/show_bug.cgi?id=778250
2017-02-09 11:27:44 +01:00
Hyunjun Ko
2d463f79f2 libs: utils: add HEVC profiles representation
https://bugzilla.gnome.org/show_bug.cgi?id=778318
2017-02-08 10:42:28 +01:00
Hyunjun Ko
d89a3bd258 libs: decoder: h264: reduce frame number of gaps
Reduce frame num gaps so that we don't have to create unnecessary
dummy pictures, just throw them away.

Signed-off-by: Víctor Manuel Jáquez Leal <victorx.jaquez@intel.com>

https://bugzilla.gnome.org/show_bug.cgi?id=777506
2017-02-07 11:30:02 +01:00
Julien Isorce
4f037a036b libs: surface: add gst_vaapi_surface_{set,peek}_buffer_proxy()
These functions are useful when a dmabuf-based memory is instantiated in
order to relate the generated buffer @proxy with the processed @surface.

https://bugzilla.gnome.org/show_bug.cgi?id=755072
2017-02-02 20:33:36 +01:00
Julien Isorce
7fc1b70ff6 libs: bufferproxy: gst_vaapi_buffer_proxy_{set,peek}_mem()
This patch adds a GstMemory as a variable member of the buffer proxy,
because we will need to associate the buffer proxy with the memory
which exposes it. Later, we will know which memory, in the video buffer
pool, is attached to the processed surface.

https://bugzilla.gnome.org/show_bug.cgi?id=755072
2017-02-02 20:33:36 +01:00
Julien Isorce
69a2406a20 libs: bufferproxy: add gst_vaapi_buffer_proxy_release_data()
Adds an API to request the user's data release in the buffer proxy.

https://bugzilla.gnome.org/show_bug.cgi?id=755072
2017-02-02 20:33:36 +01:00
Hyunjun Ko
a5650e8dc3 libs: utils: return NULL if failed to get surface formats
Thus, when generating the allowed caps, the element will throw a
warning and it will use its caps template.

This behavior might be a bug in the VA driver.

https://bugzilla.gnome.org/show_bug.cgi?id=775490
2017-02-01 20:01:11 +01:00
Víctor Manuel Jáquez Leal
65c16145a5 Revert "vaapidisplay: mark X11 display as compatible with EGL"
This reverts commit 200b1baabc.
2017-02-01 16:20:08 +01:00
Víctor Manuel Jáquez Leal
8654829628 vaapidecode: update internal decoder sink caps
When a new sink caps arrive the internal decoder state is updated
and, if it is, request a downstream renegotiation.

Previously, when new caps arrived the whole decoder where destroyed
and recreated. Now, if the caps are compatible or has the same codec,
the internal decoder is kept, but a downstream renegotiation is
requested.

https://bugzilla.gnome.org/show_bug.cgi?id=776979
2017-01-18 11:30:49 +01:00
Víctor Manuel Jáquez Leal
da7500de3f vaapi: bump ifdef to API 0.40.0 for log redirect
vaSetInfoCallback() is not released yet. It is going to appear in
VA-API 0.40.0
2017-01-12 12:54:34 +01:00
Sebastian Dröge
08dea01bf4 vaapiutils: Fix compilation with latest and previous libva releases
vaSetInfoCallback() was defined after 0.39.4 / 1.7.3, so check for
0.39.5 instead.
2017-01-12 13:45:29 +02:00
Víctor Manuel Jáquez Leal
1e0b3c2f74 libs: display: redirect logging at initialize
Redirect libva's logs to GStreamer logging mechanism. This is
particularly useful when VA is initialized, because it always logs
out the drivers details.

In order to achieve this a new helper function was added as a wrapper
for the vaInitialize() function.

https://bugzilla.gnome.org/show_bug.cgi?id=777115
2017-01-11 16:11:30 +01:00
Hyunjun Ko
58e7b575bb libs: decoder: h264: don't update cloned attributes
If the frame is a cloned picture, its PTS comes from its parent
picture.  In addition, the base decoder doesn't set a valid PTS to
the frame corresponding to the cloned picture.

https://bugzilla.gnome.org/show_bug.cgi?id=774254
2017-01-10 12:54:39 +01:00
Víctor Manuel Jáquez Leal
dde4db3b3e libs: surface: fix error handling code style 2016-12-14 17:25:44 +01:00
Hyunjun Ko
4e2049d108 libs: encoder: add gst_vaapi_encoder_get_surface_formats()
This method will return the valid surface formats in the current
config. If the are no VAConfig it is created with the information
available.

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

Signed-off-by: Víctor Manuel Jáquez Leal <victorx.jaquez@intel.com>
2016-12-07 16:47:18 +01:00
Hyunjun Ko
72e26ed30b libs: encoder: split set_context_info()
Split set_context_info() adding init_context_info() which only
initialises the GstVaapiContextInfo structure inside GstVaapiEncoder
required for VAConfig.

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

Signed-off-by: Víctor Manuel Jáquez Leal <victorx.jaquez@intel.com>
2016-12-07 16:47:18 +01:00
Hyunjun Ko
41d27b5e2e libs: context: skip VAContext if no frame size
If GstVaapiContextInfo has just initial information, without frame's
width and height, skip the creation of the VAContext, just keep the
VAConfig.

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

Signed-off-by: Víctor Manuel Jáquez Leal <victorx.jaquez@intel.com>
2016-12-07 16:47:01 +01:00
Hyunjun Ko
059cc59a29 libs: context: split context_create()
Split the funcion context_create() into context_create() and
config_create().

Decoupling VAConfig and VAContext during context creation, we could
query the VAConfig for the supported surface's formats without creating
a VAContext.

https://bugzilla.gnome.org/show_bug.cgi?id=769266
2016-12-07 10:21:46 +01:00
Víctor Manuel Jáquez Leal
7aeefb0990 libs: drm: find render node in hybrid system
Originally the drm backend only tried to open the first render node
found. But in hybrid system this first render node might not support
VA-API (propietary Nvidia driver, for example).

This patch tries all the available nodes until a finding one with a
VA-API supported driver.

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

Original-patch-by: Stirling Westrup <swestrup@gmail.com> and
                   Reza Razavi <reza@userful.com>
2016-12-06 17:33:42 +01:00
Dominique Leuenberger
8effd68975 build: add LIBVA_WAYLAND_CFLAGS to libgstvaapiegl
In case libva-wayland has its headers not installed in default
locations (like /usr/include), the build fails to include "wayland-client.h":

   CC       libgstvaapi_egl_la-gstvaapiutils_egl.lo
 In file included from gstvaapidisplay_wayland.h:27:0,
                  from gstvaapidisplay_egl.c:35:
 /usr/include/va/va_wayland.h:31:28: fatal error: wayland-client.h: No such file or directory
  #include <wayland-client.h>

As we already passed VA_CLAGS, /usr/include/va/va_wayland.h could be found, but it is
our fault not to instruct the system that we ALSO care for va_wayland. We correctly query
for libva-wayland.pc in configure and use this in other places as well. It is thus only
correct and consequent, to do it also at this spot.

https://bugzilla.gnome.org/show_bug.cgi?id=773946
2016-11-25 09:54:22 +01:00
Víctor Manuel Jáquez Leal
b09f592a4c libs: decoder: add _get_surface_formats()
This function exposes the available formats of the surfaces in the the current
context to the plugins.
2016-11-03 13:04:09 +01:00
Víctor Manuel Jáquez Leal
71264ede6f libs: context: ensure context formats
This patch ensures to get the formats, as filter does, available in the
decoder / encoder context.

The context fills up the array as soon it is created, otherwise the pipeline
could get stalled (perhaps this is a bug in my HSW backend).

https://bugzilla.gnome.org/show_bug.cgi?id=752958
2016-11-03 13:04:09 +01:00
Víctor Manuel Jáquez Leal
d1581ba557 libs: move get_surface_formats to utils_core
The query of all the supported formats for a VA config were only used by the
postprocessor (vaapifilter). But, in order to enable the vaapidecoder to
negotiate a suitable raw format with downstream, we need to query these
formats against the decoder's config.

This patch is the first step: moves the code in filter's ensure_image() to a
generic gst_vaapi_get_surface_formats() in vaapiutils_core, so it can be
shared later by the decoder.

https://bugzilla.gnome.org/show_bug.cgi?id=752958
2016-11-03 13:04:09 +01:00
Víctor Manuel Jáquez Leal
b1f6da98de libs: fix code style for errors 2016-11-03 12:51:44 +01:00
Víctor Manuel Jáquez Leal
5ff513ec27 libs: vaapitexturemap: trivial code-style fix 2016-11-03 08:31:16 +01:00
Víctor Manuel Jáquez Leal
be65508753 libs: display: egl: avoid recreate native display
Instead of passing the native descriptor of the display, just pass the received
GstVaapiDisplay and reuse it.
2016-11-03 08:27:57 +01:00
Hyunjun Ko
313860dea4 libs: window: egl: pass native va display
When creating a GstVaapiWindowEGL, it also creates native window by its own
native display. It should pass the native display, either X11 or Wayland.

https://bugzilla.gnome.org/show_bug.cgi?id=768266
2016-11-03 08:27:40 +01:00
Hyunjun Ko
185da3d1a4 libs: display: GstVaapiDisplay as GstObject descendant
This patch is to change the inheritance of GstVaapiDisplay to GstObject,
instead of GstVaapiMiniObject. In this way we can use all the available
infrastructure for GObject/GstObject such as GstTracer, GIR, etc.

In addition, a new debug category for GstVaapiDisplay is created to make it
easier to trace debug messages. It is named "vaapidisplay" and it transverse
all the VA display backends (DRM, GLX, EGL, Wayland, ...)

This patch is a step forward to expose GstVaapiDisplay for users in a future
library.

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

Signed-off-by: Víctor Manuel Jáquez Leal <victorx.jaquez@intel.com>
2016-11-03 08:24:59 +01:00
Hyunjun Ko
abc2480b10 libs: minor correction for logical consistency
GstVaapiDecode is a descendant of GstVaapiMiniObject, so, thought we should
use its methods, even though it doesn't change functionality.

GstVaapiPixmap, GstVaapiTexture and GstVaapiWindow are descendant of
GstVaapiObject, hence its methods shall be used.

https://bugzilla.gnome.org/show_bug.cgi?id=772554
2016-10-25 11:35:22 +02:00
Víctor Manuel Jáquez Leal
fb95a79818 build: clean up the dlopen usage 2016-10-19 16:14:34 +02:00
Víctor Manuel Jáquez Leal
ef3ee8b7bb encoder: h264,h265: fix regression in offset count
In commit dc35dafa a bug was introduced because I assumed that
GST_CLOCK_TIME_NONE is zero when is -1. This patch fixes that mistake.

https://bugzilla.gnome.org/show_bug.cgi?id=772259
2016-10-19 16:14:34 +02:00
Víctor Manuel Jáquez Leal
9414815383 libs: display: egl: remove unused header include
The header gmodule.h is not used since the library dynamic loading for EGL
display was removed.

https://bugzilla.gnome.org/show_bug.cgi?id=772599
2016-10-08 13:08:29 +02:00
Hyunjun Ko
a80e10ac5c libs: display{egl,glx}: cache GstVaapiTextures
instances when created and reuse

This patch improves performance when glimagesink uploads a GL texture.

It caches the GStVaapiTexture instances in GstVaapiDisplay{GLX,EGL}, using an
instance of GstVaapiTextureMap, so our internal texture structure can be found
by matching the GL texture id for each frame upload process, avoiding the
internal texture structure creation and its following destruction.

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

Signed-off-by: Víctor Manuel Jáquez Leal <victorx.jaquez@intel.com>
2016-09-22 17:01:59 +02:00
Hyunjun Ko
f974c91d73 libs: vaapitexturemap: implement GstVaapiTextureMap
Implement GstVaapiTextureMap object, which caches VAAPI textures, so them can be
reused. Internally it is a hash table.

Note that it is GstObject based rather than GstVaapiObject, as part of the future
converstion to GstObject of most of the code.

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

Signed-off-by: Víctor Manuel Jáquez Leal <victorx.jaquez@intel.com>
2016-09-22 14:19:05 +02:00
Sreerenj Balachandran
0fae277d34 encoder: vp8: Increase the allocation size for coded buffer
We are not getting enough compression for some streams and
encoded frame end up with more size than allocated.
Assuming a compression ratio of 4, which should be good enough
for holding the frames.

https://bugzilla.gnome.org/show_bug.cgi?id=771528
2016-09-21 09:55:53 +03:00
Sreerenj Balachandran
44a90c196d encoder: vp9: Fix refresh frame flag setting
While doing the mode-1 referece picture selection,
the circular buffer logic was not correctly setting the
refresh frame flags as per VP9 spec.
Make sure refresh_flag[0] get updated correclty after
each cycle of GST_VP9_REF_FRAMES.

https://bugzilla.gnome.org/show_bug.cgi?id=771507
2016-09-21 09:52:21 +03:00
Víctor Manuel Jáquez Leal
9afa0ce471 vaapidecode: codec_data minimal size is 7
When the format of a H.264 stream is AVC3, the SPS and PPS are inside the
stream, not in the codec_data, so the size of codec_data might be 7.

This patch reduces the minimal size of the codec_data buffer from 8 to 7.

https://bugzilla.gnome.org/show_bug.cgi?id=771441
2016-09-15 10:38:08 +02:00
Víctor Manuel Jáquez Leal
574ff693a5 libs: surface: ensure composite overlay is not bigger
Ensure the composition overlay rectangle (subtitles) is not bigger than
the surface where it is going to be composited and rendered.

https://bugzilla.gnome.org/show_bug.cgi?id=766978
2016-09-08 17:06:57 +02:00