Commit graph

1367 commits

Author SHA1 Message Date
Víctor Manuel Jáquez Leal
3532dca16a libs: encoder: h265: chroma and luma with format
If the profile is main-10 the bit_depth_luma_minus8, in the sequence
parameter buffer, shall be the color format bit depth minus 8, 10-8
which is 2. Also for bit_depth_chroma_minus8.

This patch gets the negotiated sink caps format and queries its
luma's depth and uses that value to fill the mentioned parameters.

https://bugzilla.gnome.org/show_bug.cgi?id=771291
2017-04-07 12:04:51 +02:00
Víctor Manuel Jáquez Leal
d744aeb5fa libs: encoder: admit YUV420_10BPP as valid chroma
Accepts as supported the GST_VAAPI_CHROMA_TYPE_YUV420_10BPP chroma
type.

https://bugzilla.gnome.org/show_bug.cgi?id=771291
2017-04-06 22:00:05 +02:00
Víctor Manuel Jáquez Leal
48e21d6ba8 libs: encoder: h265: ensures profile given format
Set the VA profile as GST_VAAPI_PROFILE_H265_MAIN10 if the
configured color format is P010_10LE.

Otherwise, keep GST_VAAPI_PROFILE_H265_MAIN

https://bugzilla.gnome.org/show_bug.cgi?id=771291
2017-04-06 22:00:05 +02:00
Víctor Manuel Jáquez Leal
e534ff5609 libs: encode: merge all possible surface formats
When the function gst_vaapi_encoder_get_surface_formats() was added
it was under the assumption that any VA profile of the specific codec
supported the same format colors. But it is not, for example the
profiles that support 10bit formats.

In other words, different VA profiles of a same codec may support
different color formats in their upload surfaces.

In order to expose all the possible color formats, if no profile is
specified via source caps, or if the encoder doesn't have yet a
context, all the possible VA profiles for the specific codec are
iterated and their color formats are merged.

https://bugzilla.gnome.org/show_bug.cgi?id=771291
2017-04-06 22:00:05 +02:00
Víctor Manuel Jáquez Leal
7153b4597d libs: encoder: pass profile to get_surface_formats()
In order to get the supported surface formats within a specific
profile this patch adds the GstVaapiProfile as property to
gst_vaapi_encoder_get_surface_formats().

Currently the extracted formats are only those related with the
default profile of the element's codec.

https://bugzilla.gnome.org/show_bug.cgi?id=771291
2017-04-06 22:00:05 +02:00
Víctor Manuel Jáquez Leal
9aa63e4595 libs: encoder: dummy context for get_surface_formats()
Instead of creating (if it doesn't exist, yet) the encoder's context
the method gst_vaapi_encoder_get_surface_formats() now it creates
dummy contexts, unless the encoder has it already created.

The purpose of this is to avoid setting a encoder's context with a
wrong profile.

https://bugzilla.gnome.org/show_bug.cgi?id=771291
2017-04-06 22:00:05 +02:00
Víctor Manuel Jáquez Leal
31d326c9ee libs: encoder: refactor init_context_info()
In order to generate vaapi contexts iterative, the function
init_context_info() is refactored to pass, as parameters the
GstVaapiContextInfo and the GstVaapiProfile.

https://bugzilla.gnome.org/show_bug.cgi?id=771291
2017-04-06 22:00:05 +02:00
Víctor Manuel Jáquez Leal
db7268117d libs: encoder: initialize chroma_type
Instead of initialize the chroma_type with a undefined value, which
will be converted to GST_VAAPI_CHROMA_TYPE_YUV420 by GstVaapiContext,
this patch queries the VA config, given the received
GstVaapiContextInfo's parameters, and gets the first response.

In order to get the GstVaapiChromaType value, also it was needed to
add a new utility function: to_GstVaapiChromaType(), which, given a
VA_RT_FORMAT_* will return the associated GstVaapiChromaType.

https://bugzilla.gnome.org/show_bug.cgi?id=771291
2017-04-06 22:00:05 +02:00
Scott D Phillips
123672a9bd libs: encoder: vp9: Fix initialization of ref_list
gcc 7.0.1 gives a memset-elt-size warning in gst_vaapi_encoder_vp9_init:

 'memset' used with length equal to number of elements without
 multiplication by element size [-Werror=memset-elt-size]

https://bugzilla.gnome.org/show_bug.cgi?id=780947
2017-04-06 11:03:12 +02:00
Sreerenj Balachandran
be990f5ed4 encoder: h264: Fix Backward ReferencePicture flag setting
This is a regression introduced by e829b62 which
override the reference flags and caused issues with
latest intel-vaapi-driver.
2017-03-31 14:14:08 -07:00
Víctor Manuel Jáquez Leal
834557d5b6 libs: encoder: h265: fix code style
Trivial patch to remove a double ';' as end of instruction.
2017-03-29 13:24:41 +02:00
Sreerenj Balachandran
dbbe340906 encoder: h264: Fix B frame encoding artifacts
The current implementation is updating the POC values only
in Slice parameter Buffer.But we are not filling the
picture order count and reference flags in VAPictureH264
while populating VA Picture/Slice structures.The latest
intel-vaapi-driver is directly accessing the above fields
from VAPicutreH264 provided as RefPicLists, which resulted
some wrong maths and prediction errors in driver.

https://bugzilla.gnome.org/show_bug.cgi?id=780620
2017-03-28 10:53:20 -07:00
Víctor Manuel Jáquez Leal
7f8b325450 libs: encoder: h265: remove unused macro definition
Since the h265 encoder doesn't use GValueArray, there is no need to
disable the Glib deprecation warnings, thus removing the macro
definition.
2017-03-21 16:13:56 +01:00
Hyunjun Ko
9ed6ac1f76 libs: h26x: adds gst_vaapi_utils_h26x_write_nal_unit()
Implements gst_vaapi_utils_h26x_write_nal_unit(), which writes NAL
unit length and data to a bitwriter.

Note that this helper function applies EPB (Emulation Prevention
Bytes), since otherwise produced codec_data might be broken when
decoder/parser considering EPB, starts parsing.

See sections 7.3 and 7.4 of the H264 and H264 specifications, which
describes the emulation_prevention_three_byte.

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

Signed-off-by: Víctor Manuel Jáquez Leal <victorx.jaquez@intel.com>
2017-03-20 19:02:04 +01:00
Hyunjun Ko
49b370ed60 libs: utils: h26x: create vaapiutils_h26x
Since there is duplicated code in h264/265 encoder, we could
refactor it to avoid duplicated code.

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

Signed-off-by: Víctor Manuel Jáquez Leal <victorx.jaquez@intel.com>
2017-03-20 18:11:00 +01:00
Hyunjun Ko
257cfb61fe libs: encoder: h264/5: fix wrong return value
https://bugzilla.gnome.org/show_bug.cgi?id=778750
2017-03-17 12:54:27 +01:00
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