Commit graph

2928 commits

Author SHA1 Message Date
Víctor Manuel Jáquez Leal
f197749343 libs: encoder: h264: fix copy & paste error
Coverity scan bug:

The copied code will not have its intended effect.

This is a bug from commit cdaf15b2, where the intention is to
initialize RefPicList1 while setting RefPicList0.
2017-08-08 16:57:12 +02:00
Víctor Manuel Jáquez Leal
bd7716a739 libs: encoder: h265: fix possible integer overflow
Coverity scan bug:

Unintentional integer overflow. The expression's value may not be what
the programmer intended, because the expression is evaluated using a
narrow (i.e. few bits) integer type.

Cast operator to guint64 before computation to avoid narrowing.

merge with 3c5a6add
2017-08-08 16:56:58 +02:00
Víctor Manuel Jáquez Leal
4e27245f28 libs: decoder: mpeg4: fail if return value is not OK
Coverity scan bug:

An assigned value that is never used may represent unnecessary
computation, an incorrect algorithm, or possibly the need for cleanup
or refactoring.

In the return value of decode_slice() or
gst_mpeg4_parse_video_packet_header() are not success, thus fail
decode_packet() function.
2017-08-08 16:15:46 +02:00
Víctor Manuel Jáquez Leal
067968ae74 libs: decoder: h265: check for null
Coverity scan bug:

Dereference after null check: Either the check against null is
unnecessary, or there may be a null pointer dereference.

While looking for hte lowest poc, according to rest of the code, the
picture in the dbp (decoded picture buffer) might be NULL, thus we
could check for a NULL picture before assigned as found.

Also, split a comma operator because it is considered as a bad
practice because it possible side effects.
2017-08-08 16:15:45 +02:00
Víctor Manuel Jáquez Leal
d879664a0a libs: decoder: h265: untaint loop control variable
Coverity scan bug:

Scalars (for example, integers) are not properly
bounds-checked (sanitized) before being used as array or pointer
indexes, loop boundaries, or function arguments are considered as
tainted.

In this case, num_nals were not checked before used as loop control.
2017-08-08 15:38:16 +02:00
Víctor Manuel Jáquez Leal
9eddf6c004 libs: decoder: h264: remove unrequired NULL check
Coverity scan bug:

Dereference after null check: Either the check against null is
unnecessary, or there may be a null pointer dereference.

In the original commit for fill_picture_gaps() (commit 5abd2b90) the
prev_picture could be NULL, that's why the code did a null check. But,
since commit 52adebe7, the previous reference frames are tracked, thus
there is no need to check null anymore.
2017-08-08 13:46:56 +02:00
orestisf
3bb96eff14 vaapidecode: fix gst_caps_new_simple call
https://bugzilla.gnome.org/show_bug.cgi?id=732265
2017-08-03 23:28:59 +02:00
orestisf
d4b6459bb2 vaapidecode: force add h264 MVC profiles in caps
When vaapih264dec's base-only profile is set to TRUE, fake MVC profile
support in caps.

https://bugzilla.gnome.org/show_bug.cgi?id=732265
2017-08-03 17:07:22 +02:00
orestisf
ac9ddc5e8d libs: decoder: h264: decode MVC base view only
If processed SPS has mvc profile and the configuration is set to
base-only, the frame is drop.

https://bugzilla.gnome.org/show_bug.cgi?id=732265
2017-08-03 17:07:14 +02:00
orestisf
66703a7835 vaapidecode: set h264 base-only to decoder
Set the base-only value when property is set and the internal
decoder is already instantiated or when the internal decoder
is created.

https://bugzilla.gnome.org/show_bug.cgi?id=732265
2017-08-03 17:07:14 +02:00
orestisf
1dd03ac2fd libs: decoder: h264: add setter for base-only mode
https://bugzilla.gnome.org/show_bug.cgi?id=732265
2017-08-03 17:07:09 +02:00
orestisf
bd040adb9c vaapidecode_props: h264: add base-only property
https://bugzilla.gnome.org/show_bug.cgi?id=732265
2017-08-03 17:07:01 +02:00
Víctor Manuel Jáquez Leal
a1fc1e9822 libs: encoder: h264: missing property enum documentation 2017-08-02 11:40:17 +02:00
Hyunjun Ko
cdaf15b24d libs: encoder: h264: add multi reference support
Using num_ref_frames provided and the result of the Query
VAConfigAttribEncMaxRefFrames, it determines the size of reference list
and perform encoding with multi reference frames as the following:

1\ The num_ref_frames is being considered as the number of
reference picture list0
2\ Encoder adds 1 reference frame more to the reference picture list1
internally if b-frame encoding.
3\ If num_ref_frames is bigger than the number of refrence frames
supported in the driver, it will be lowered.

https://bugzilla.gnome.org/show_bug.cgi?id=783803
2017-08-02 11:21:02 +02:00
Hyunjun Ko
cd6a9736bd libs: encoder: h264: add refs property
Users can provide the number of reference frame by this property.

The value of the property will be considered as the number of
reference picture list0 and will add 1 reference frame more to the
reference picture list1 internally if b-frame encoding.

If the value provided is bigger than the number of refrence frames
supported in the driver, it will be lowered.

https://bugzilla.gnome.org/show_bug.cgi?id=783803
2017-08-02 11:20:35 +02:00
Hyunjun Ko
ec76a9a7e3 libs: encoder: implements gst_vaapi_encoder_ensure_max_num_ref_frames
This function will query VAConfigAttribEncMaxRefFrames to get the
maximum number of reference frames supported in the driver.
This will be used for h264/h265 encoding.

https://bugzilla.gnome.org/show_bug.cgi?id=783803
2017-08-02 11:17:39 +02:00
Víctor Manuel Jáquez Leal
7d6a80e13d vaapiencode: h265: compare an unsigned int if not zero
An unsigned value can never be negative, so this test (greater than
zero) will always evaluate the same way. Thus change it to just if
it's not zero.
2017-08-01 18:38:40 +02:00
Víctor Manuel Jáquez Leal
5f64d6df6c plugins: check gst_gl_ensure_element_data() return value
Refactor gst_vaapi_plugin_base_create_gl_context() in order to check
the return value of gst_gl_ensure_element_data(). The result is a code
bit cleaner.
2017-08-01 18:10:50 +02:00
Víctor Manuel Jáquez Leal
02e48ad8dc plugins: avoid dead code detection
By using #elif macro, the static code analysis would stop to detect
these lines as dead code. Also it is inforced the mutually exclusive
environments.
2017-08-01 17:59:38 +02:00
Víctor Manuel Jáquez Leal
de0f8936f8 vaapivideobufferpool: don't shift by negative since it's undefined
The function g_bit_nth_lsf() may return -1 if the request bit position
is not avaible. Thus, this patch check if the return value is not -1
in order to continue.
2017-08-01 17:39:04 +02:00
Víctor Manuel Jáquez Leal
19444ce184 vaapisink: fix memory leak 2017-08-01 17:29:40 +02:00
Víctor Manuel Jáquez Leal
ce03fa8ed0 vaapipostproc: fix memory leaks 2017-08-01 17:23:48 +02:00
Tomas Rataj
c181308904 libs: display: when appending formats change pointers to indexes
Thus, it fixes an invalid read when YV12 or I420 are not supported by
the driver.

https://bugzilla.gnome.org/show_bug.cgi?id=785085
2017-08-01 16:23:22 +02:00
Sreerenj Balachandran
aa3543929b libs: encoder: h264: Add uncompliant mode reducing coded buffer size
Added a new property "compliance-mode", which default is the normal
strict compliant mode.

The second mode, "restrict-buf-alloc", is to limit the coded buffer
allocation size to improve performance in some specific Intel
platforms (there is asignificant performance improvement in parallel
encodings). Under this new mode, we use the MinCR field in A.3.1 for
pre-calculating the coded-buffer size.

https://bugzilla.gnome.org/show_bug.cgi?id=784590
2017-08-01 14:37:44 +02:00
Sreerenj Balachandran
f775bbfe07 libs: utils_h264: Extend LevelLimit table with MinCR field
Add MinCR(Minimum Compression Ratio) field to GstVaapiH264LevelLimits
based on Annex A.3

https://bugzilla.gnome.org/show_bug.cgi?id=784590
2017-08-01 14:32:30 +02:00
Víctor Manuel Jáquez Leal
777bba473e libs: utils: libva 1.0 changed the logging
The logging mechanism in libva has changed it's functions
signatures. This patch updates that for libva versions >= 1.0

https://bugzilla.gnome.org/show_bug.cgi?id=784398
2017-07-31 18:17:06 +02:00
Víctor Manuel Jáquez Leal
e0e0a47476 libs: decoder: h264: libva 1.0 deprecated baseline
libva 1.0 deprecated H.264 baseline profile and FMO support
(commit b4f332b3).

https://bugzilla.gnome.org/show_bug.cgi?id=784398
2017-07-31 18:17:06 +02:00
Víctor Manuel Jáquez Leal
8f2eb70803 build: check for libva-2.0
Check for libva-2.0 since libva's developers decided to increase the
library's version number.

https://bugzilla.gnome.org/show_bug.cgi?id=784398
2017-07-31 18:17:06 +02:00
Víctor Manuel Jáquez Leal
d8de185355 build: blacklist only libva 0.99.0
Intel's MSDK uses libva 0.99.0, meanwhile open source libva bumped
its API version to 1.0.0. Thus we have to blacklist only the MSDK's
libva (0.99.0)

https://bugzilla.gnome.org/show_bug.cgi?id=784398
2017-07-31 17:38:20 +02:00
Víctor Manuel Jáquez Leal
8a7354380c build: meson: remove gstvaapidisplaycache.c
This is a missing bit of commit ec3e10f6
2017-07-26 20:32:09 +02:00
U. Artie Eoff
a77209ad54 configure: do not break configure if gtk+-3.0 devel missing
Fix PKG_CHECK_MODULES rule for with_gtk=check condition to
set USE_GTK=0 if gtk+-3.0 is not available.

Since commit 85856c29a7
Author: Hyunjun Ko <zzoon@igalia.com>
Date:   Wed Jul 5 15:59:43 2017 +0900

    tests: elements: add testsuite of vaapi context

...configure fails if gtk+-3.0 development files are missing.

The "with_gtk" option defaults to "check" in configure.ac
which implies that if it is not explicitly requested then
configure will only enable it if it's available on the system.

However, the PKG_CHECK_MODULES rule that get's activated on
"check" condition did not provide default when gtk+-3.0 devel
packages are not found on the system.  Thus, it resulted in
configure failure.

Signed-off-by: U. Artie Eoff <ullysses.a.eoff@intel.com>

https://bugzilla.gnome.org/show_bug.cgi?id=785452
2017-07-26 19:18:05 +02:00
Hyunjun Ko
85856c29a7 tests: elements: add testsuite of vaapi context
Signed-off-by: Víctor Manuel Jáquez Leal <vjaquez@igalia.com>

https://bugzilla.gnome.org/show_bug.cgi?id=766704
2017-07-26 14:22:02 +02:00
Hyunjun Ko
736478d2a7 vaapisink: fail if surface display is different
Replacing GstVaapiDisplay during rendering might be hiding problems
at some cases, even though it's safe currently since we use cache
of GstVaapidisplay.

Play safe by failing if this happens.

https://bugzilla.gnome.org/show_bug.cgi?id=766704
2017-07-26 14:21:54 +02:00
Hyunjun Ko
b8265db260 videocontext: support "gst.vaapi.app.Display" context
Through "gst.vaapi.app.Display" context, users can set their own VADisplay
and native display of their backend.

Attributes:
- display : pointer of VADisplay
- x11-display : pointer of X11 display (Display *), if they're using.

This patch creates GstVaapidisplayX11 if information provided through
"gst.vaapi.app.Display"

https://bugzilla.gnome.org/show_bug.cgi?id=766704
2017-07-18 18:51:41 +02:00
Hyunjun Ko
d78e094fd4 libs: display: x11: add gst_vaapi_display_x11_new_with_va_display()
Implements new API function so that users could create GstVaapiDisplay
with their own VADisplay within a native display as backend.

https://bugzilla.gnome.org/show_bug.cgi?id=766704
2017-07-18 18:50:39 +02:00
Hyunjun Ko
356212214b libs: display: pass display info when foreign display
When creating a GstVaapiDisplay using a foreign VADisplay, and render
with that display, it also requires native display of the backend.

https://bugzilla.gnome.org/show_bug.cgi?id=766704
2017-07-18 18:43:06 +02:00
Víctor Manuel Jáquez Leal
ec3e10f666 libs: display: remove cache
Remove a bunch of code that handles the VADisplay cache, since the
context sharing should be doing this correctly.

https://bugzilla.gnome.org/show_bug.cgi?id=747946
2017-07-18 18:20:21 +02:00
Hyunjun Ko
dd78e03859 tests: elements: add test for vaapipostproc
https://bugzilla.gnome.org/show_bug.cgi?id=754885
2017-07-18 17:19:36 +02:00
Hyunjun Ko
8a04f390c8 postproc: reconfigure when width or height changes
https://bugzilla.gnome.org/show_bug.cgi?id=754885
2017-07-18 17:17:11 +02:00
Víctor Manuel Jáquez Leal
a9c13a0934 libs: encoder: vp9: array terminated in zeros
There is a crash when setting ref-pic-mode since the #GEnumValue
array is not terminated with a structured with all memvers being
zero.

https://bugzilla.gnome.org/show_bug.cgi?id=785032
2017-07-17 18:59:13 +02:00
Víctor Manuel Jáquez Leal
e9fd571214 vaapiencode: h264: add plugin documentation
Comment how the profile is set and other parameters.
2017-07-13 16:43:34 +02:00
Matt Staples
66d26da39f libs: decoder: h264: push frames as soon as possible
Push frames downstream as soon as possible instead of waiting until
they are ejected from the DPB.

This patch makes the decoder not comply with the H.264 specification,
but it is required for some video cameras.

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

Signed-off-by: Víctor Manuel Jáquez Leal <vjaquez@igalia.com>
2017-07-10 19:30:46 +02:00
Víctor Manuel Jáquez Leal
11f461fb10 vaapidecode_props: h264: set low-latency in decoder
Set the low-latency property if the H264 decoder is already
instantiated, thus you could change the behavior in run-time.

https://bugzilla.gnome.org/show_bug.cgi?id=783588
2017-07-10 19:30:46 +02:00
Víctor Manuel Jáquez Leal
551ae940a7 vaapidecode: set h264 low latency to decoder
https://bugzilla.gnome.org/show_bug.cgi?id=783588
2017-07-07 19:32:11 +02:00
Víctor Manuel Jáquez Leal
28d1d048a6 libs: decoder: h264: add getter/setter for low latency mode
https://bugzilla.gnome.org/show_bug.cgi?id=783588
2017-07-07 19:32:11 +02:00
Víctor Manuel Jáquez Leal
f39b7e97ce vaapidecode_props: h264: add low latency property
Adding support for private data.

https://bugzilla.gnome.org/show_bug.cgi?id=783588
2017-07-07 19:32:11 +02:00
Víctor Manuel Jáquez Leal
484033d039 vaapidecode_props: add skeleton for h264 decoder properties
https://bugzilla.gnome.org/show_bug.cgi?id=783588
2017-07-07 19:32:11 +02:00
Víctor Manuel Jáquez Leal
207486aa1f vaapidecode: properties callback in decoders map
https://bugzilla.gnome.org/show_bug.cgi?id=783588
2017-07-07 19:32:11 +02:00
Tim-Philipp Müller
da5024ca80 meson: find python3 via python3 module
https://bugzilla.gnome.org/show_bug.cgi?id=783198
2017-07-07 12:01:59 +01:00
Hyunjun Ko
6ebf7b10ae libs: encoder: h264: submit sps in case of IDR picture
If the picture is IDR, also submit a SPS header.

This means when frame number reaches to keyframe-period or an force
key unit event arrives, we insert SPS/PPS again.

https://bugzilla.gnome.org/show_bug.cgi?id=776712
2017-07-04 14:25:39 +02:00