platform/upstream/gstreamer.git
7 years agolibs: decoder: h264: add setter for base-only mode
orestisf [Tue, 25 Jul 2017 19:03:34 +0000 (22:03 +0300)]
libs: decoder: h264: add setter for base-only mode

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

7 years agovaapidecode_props: h264: add base-only property
orestisf [Tue, 25 Jul 2017 19:01:37 +0000 (22:01 +0300)]
vaapidecode_props: h264: add base-only property

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

7 years agolibs: encoder: h264: missing property enum documentation
Víctor Manuel Jáquez Leal [Tue, 1 Aug 2017 09:11:55 +0000 (11:11 +0200)]
libs: encoder: h264: missing property enum documentation

7 years agolibs: encoder: h264: add multi reference support
Hyunjun Ko [Wed, 2 Aug 2017 05:54:53 +0000 (14:54 +0900)]
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

7 years agolibs: encoder: h264: add refs property
Hyunjun Ko [Wed, 2 Aug 2017 05:53:34 +0000 (14:53 +0900)]
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

7 years agolibs: encoder: implements gst_vaapi_encoder_ensure_max_num_ref_frames
Hyunjun Ko [Fri, 28 Jul 2017 06:27:20 +0000 (15:27 +0900)]
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

7 years agovaapiencode: h265: compare an unsigned int if not zero
Víctor Manuel Jáquez Leal [Tue, 1 Aug 2017 16:38:40 +0000 (18:38 +0200)]
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.

7 years agoplugins: check gst_gl_ensure_element_data() return value
Víctor Manuel Jáquez Leal [Tue, 1 Aug 2017 16:10:50 +0000 (18:10 +0200)]
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.

7 years agoplugins: avoid dead code detection
Víctor Manuel Jáquez Leal [Tue, 1 Aug 2017 15:59:38 +0000 (17:59 +0200)]
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.

7 years agovaapivideobufferpool: don't shift by negative since it's undefined
Víctor Manuel Jáquez Leal [Tue, 1 Aug 2017 15:39:04 +0000 (17:39 +0200)]
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.

7 years agovaapisink: fix memory leak
Víctor Manuel Jáquez Leal [Tue, 1 Aug 2017 15:29:40 +0000 (17:29 +0200)]
vaapisink: fix memory leak

7 years agovaapipostproc: fix memory leaks
Víctor Manuel Jáquez Leal [Tue, 1 Aug 2017 15:23:48 +0000 (17:23 +0200)]
vaapipostproc: fix memory leaks

7 years agolibs: display: when appending formats change pointers to indexes
Tomas Rataj [Thu, 27 Jul 2017 10:54:00 +0000 (10:54 +0000)]
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

7 years agolibs: encoder: h264: Add uncompliant mode reducing coded buffer size
Sreerenj Balachandran [Wed, 19 Jul 2017 19:02:40 +0000 (12:02 -0700)]
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

7 years agolibs: utils_h264: Extend LevelLimit table with MinCR field
Sreerenj Balachandran [Thu, 6 Jul 2017 00:13:44 +0000 (17:13 -0700)]
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

7 years agolibs: utils: libva 1.0 changed the logging
Víctor Manuel Jáquez Leal [Tue, 11 Jul 2017 15:29:13 +0000 (17:29 +0200)]
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

7 years agolibs: decoder: h264: libva 1.0 deprecated baseline
Víctor Manuel Jáquez Leal [Tue, 11 Jul 2017 15:27:32 +0000 (17:27 +0200)]
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

7 years agobuild: check for libva-2.0
Víctor Manuel Jáquez Leal [Wed, 26 Jul 2017 18:03:35 +0000 (20:03 +0200)]
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

7 years agobuild: blacklist only libva 0.99.0
Víctor Manuel Jáquez Leal [Tue, 11 Jul 2017 14:55:26 +0000 (16:55 +0200)]
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

7 years agobuild: meson: remove gstvaapidisplaycache.c
Víctor Manuel Jáquez Leal [Wed, 26 Jul 2017 18:30:37 +0000 (20:30 +0200)]
build: meson: remove gstvaapidisplaycache.c

This is a missing bit of commit ec3e10f6

7 years agoconfigure: do not break configure if gtk+-3.0 devel missing
U. Artie Eoff [Wed, 26 Jul 2017 16:53:10 +0000 (09:53 -0700)]
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 85856c29a70d6de4aea5b708e04e9eb418190623
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

7 years agotests: elements: add testsuite of vaapi context
Hyunjun Ko [Wed, 5 Jul 2017 06:59:43 +0000 (15:59 +0900)]
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

7 years agovaapisink: fail if surface display is different
Hyunjun Ko [Wed, 5 Jul 2017 06:32:43 +0000 (15:32 +0900)]
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

7 years agovideocontext: support "gst.vaapi.app.Display" context
Hyunjun Ko [Wed, 5 Jul 2017 06:31:55 +0000 (15:31 +0900)]
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

7 years agolibs: display: x11: add gst_vaapi_display_x11_new_with_va_display()
Hyunjun Ko [Wed, 5 Jul 2017 05:33:38 +0000 (14:33 +0900)]
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

7 years agolibs: display: pass display info when foreign display
Hyunjun Ko [Wed, 5 Jul 2017 05:32:35 +0000 (14:32 +0900)]
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

7 years agolibs: display: remove cache
Víctor Manuel Jáquez Leal [Mon, 26 Jun 2017 19:18:25 +0000 (21:18 +0200)]
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

7 years agotests: elements: add test for vaapipostproc
Hyunjun Ko [Thu, 13 Jul 2017 01:56:18 +0000 (10:56 +0900)]
tests: elements: add test for vaapipostproc

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

7 years agopostproc: reconfigure when width or height changes
Hyunjun Ko [Wed, 12 Jul 2017 09:25:15 +0000 (18:25 +0900)]
postproc: reconfigure when width or height changes

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

7 years agolibs: encoder: vp9: array terminated in zeros
Víctor Manuel Jáquez Leal [Mon, 17 Jul 2017 16:53:57 +0000 (18:53 +0200)]
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

7 years agovaapiencode: h264: add plugin documentation
Víctor Manuel Jáquez Leal [Thu, 13 Jul 2017 14:43:34 +0000 (16:43 +0200)]
vaapiencode: h264: add plugin documentation

Comment how the profile is set and other parameters.

7 years agolibs: decoder: h264: push frames as soon as possible
Matt Staples [Fri, 26 May 2017 15:19:00 +0000 (15:19 +0000)]
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>
7 years agovaapidecode_props: h264: set low-latency in decoder
Víctor Manuel Jáquez Leal [Mon, 10 Jul 2017 17:27:57 +0000 (19:27 +0200)]
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

7 years agovaapidecode: set h264 low latency to decoder
Víctor Manuel Jáquez Leal [Thu, 6 Jul 2017 18:00:15 +0000 (20:00 +0200)]
vaapidecode: set h264 low latency to decoder

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

7 years agolibs: decoder: h264: add getter/setter for low latency mode
Víctor Manuel Jáquez Leal [Wed, 14 Jun 2017 16:30:53 +0000 (18:30 +0200)]
libs: decoder: h264: add getter/setter for low latency mode

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

7 years agovaapidecode_props: h264: add low latency property
Víctor Manuel Jáquez Leal [Wed, 14 Jun 2017 16:31:18 +0000 (18:31 +0200)]
vaapidecode_props: h264: add low latency property

Adding support for private data.

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

7 years agovaapidecode_props: add skeleton for h264 decoder properties
Víctor Manuel Jáquez Leal [Wed, 14 Jun 2017 16:23:34 +0000 (18:23 +0200)]
vaapidecode_props: add skeleton for h264 decoder properties

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

7 years agovaapidecode: properties callback in decoders map
Víctor Manuel Jáquez Leal [Wed, 14 Jun 2017 15:07:30 +0000 (17:07 +0200)]
vaapidecode: properties callback in decoders map

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

7 years agomeson: find python3 via python3 module
Tim-Philipp Müller [Fri, 7 Jul 2017 11:01:59 +0000 (12:01 +0100)]
meson: find python3 via python3 module

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

7 years agolibs: encoder: h264: submit sps in case of IDR picture
Hyunjun Ko [Fri, 9 Jun 2017 05:47:40 +0000 (14:47 +0900)]
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

7 years agolibs: encoder: h264: set the frame as IDR if forced key unit
Hyunjun Ko [Fri, 9 Jun 2017 05:47:16 +0000 (14:47 +0900)]
libs: encoder: h264: set the frame as IDR if forced key unit

GST_VIDEO_CODEC_FRAME_IS_FORCE_KEYFRAME() is a flag usually used to manage
the `frame-lost` event in the case of streaming, such as RTP.

In case of this event, it is needed to start new GOP rather than just
produce an I-frame.

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

7 years agolibs: encoder: h264: insert AU delimiter
Sreerenj Balachandran [Wed, 5 Apr 2017 21:48:46 +0000 (14:48 -0700)]
libs: encoder: h264: insert AU delimiter

Insert an AUD as the first NAL of each encoded frame.

Some applications require Access Unit Delimiter for decoding the
stream.

The AU delimeter insertion is done only when the aud parameter is
TRUE (by default is disabled). The reason of this it is because this
header is only available from Intel Gen9 and the VA intel driver
should be 1.8 or superior. Otherwise, the output will be corrupted.

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

Signed-off-by: Victor Jaquez <vjaquez@igalia.com>
7 years agolibs: encoder: h264: initialize all elements of view_ids
Hyunjun Ko [Thu, 29 Jun 2017 03:50:26 +0000 (12:50 +0900)]
libs: encoder: h264: initialize all elements of view_ids

Currently when num_views is changed by multiview-mode on sink caps, it produces
wrong MVC encoded stream since the array view_ids is not set properly according
to changed num_views.

So this patch initializes all of the array sequentially to handle this case.
Side effect is not going to happen by this patch since this array is being
handled by num_views.

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

7 years agoRevert "encoder: h264: Use high profile by default"
Hyunjun Ko [Tue, 27 Jun 2017 05:30:54 +0000 (14:30 +0900)]
Revert "encoder: h264: Use high profile by default"

This reverts commit 4aec5bdd7207fc0e45813ef14c9c0ad5174a8f75.

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

7 years agolibs: encoder: h264: set profile via capsfilter
Hyunjun Ko [Tue, 27 Jun 2017 07:03:37 +0000 (16:03 +0900)]
libs: encoder: h264: set profile via capsfilter

Until now, the encoder ignored the profile in src caps and chose one
according with the given parameters. But the encoder must honor the
profile specifed in src caps.

This patch do that, and if the encoder needs to choose the profile,
it will do it by following these rules:

1\ If given parameters are not compatible with given profile, the
   encoder will bail out with an error.
2\ The encoder will choose the higher profile indicated in the
   src caps.

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

7 years agovaapiencode: h264: set profile to src caps
Hyunjun Ko [Tue, 27 Jun 2017 04:14:31 +0000 (13:14 +0900)]
vaapiencode: h264: set profile to src caps

So far vaapi encoder does not set profile to src caps. This patch makes it
setting profile to src caps, which is determined by itself.

In addition, if encoder chose different profile, which is not negotiated with
downstream, we should set compatible profile to make negotiation working.

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

7 years agovaapiencode: h264: verify if requested profile is supported
Víctor Manuel Jáquez Leal [Thu, 22 Jun 2017 07:56:49 +0000 (09:56 +0200)]
vaapiencode: h264: verify if requested profile is supported

Check if the requested profile in source caps, is supported by the
VA driver. If it is not, an info log message is send saying that
another (compatible?) profile will be used.

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

7 years agovaapiencode: h264: improve set_config() vmethod
Víctor Manuel Jáquez Leal [Wed, 21 Jun 2017 19:49:27 +0000 (21:49 +0200)]
vaapiencode: h264: improve set_config() vmethod

First check if downstream requests ANY caps. If so, byte-stream is
used and the profile will be choose by the encoder. If dowstream
requests EMPTY caps, the negotiation will fail.

Lately, byte-stream and profile are looked in the allowed caps.

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

7 years agovaapiencode: h264: check for avc in set_config()
Víctor Manuel Jáquez Leal [Wed, 21 Jun 2017 17:30:55 +0000 (19:30 +0200)]
vaapiencode: h264: check for avc in set_config()

The check for avc stream format was done in the vaapi encoder's
vmethod get_caps(), but that is wrong since it has to be check
when encoder set_format().

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

7 years agovaapipostproc: set multivew-mode flags to src caps
Hyunjun Ko [Thu, 29 Jun 2017 03:49:24 +0000 (12:49 +0900)]
vaapipostproc: set multivew-mode flags to src caps

vaapipostproc didn't negotiate the proper multiview caps losing
downstream information.

This patch enables the playing of MVC encoded stream by setting
the proper multiview mode/flags and views to src caps, according
to sink caps.

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

7 years agovaapipostproc: add support for DMABuf caps feature
Julien Isorce [Tue, 22 Nov 2016 15:52:47 +0000 (15:52 +0000)]
vaapipostproc: add support for DMABuf caps feature

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

Signed-off-by: Julien Isorce <j.isorce@samsung.com>
7 years agovaapidecode: add support for DMABuf caps feature
Víctor Manuel Jáquez Leal [Thu, 1 Jun 2017 17:42:20 +0000 (19:42 +0200)]
vaapidecode: add support for DMABuf caps feature

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

Original-patch-by: Julien Isorce <j.isorce@samsung.com>
7 years agovaapipluginbase: force dmabuf allocator if DMABuf caps feature
Víctor Manuel Jáquez Leal [Fri, 23 Jun 2017 10:12:12 +0000 (12:12 +0200)]
vaapipluginbase: force dmabuf allocator if DMABuf caps feature

Instantiate all dmabuf allocator for src pad buffer pool if the
src caps ask for memory:DMABuf feature.

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

7 years agovaapipluginutil: add support for DMABuf caps feature
Julien Isorce [Tue, 22 Nov 2016 23:26:05 +0000 (23:26 +0000)]
vaapipluginutil: add support for DMABuf caps feature

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

Signed-off-by: Julien Isorce <j.isorce@samsung.com>
Signed-off-by: Victor Jaquez <vjaquez@igalia.com>
vaapipluginutil: add support for DMABuf caps feature

7 years agovaapipluginbase: dmabuf memory map trial for raw caps
Víctor Manuel Jáquez Leal [Thu, 1 Jun 2017 17:13:52 +0000 (19:13 +0200)]
vaapipluginbase: dmabuf memory map trial for raw caps

Only push dmabuf-based buffers with raw caps if gst_memory_map()
succeeds. Otherwise, use the the vaapi surfaces allocator.

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

Original-patch-by: Julien Isorce <j.isorce@samsung.com>
7 years agovaapivideomemory: add gst_vaapi_dmabuf_can_map()
Víctor Manuel Jáquez Leal [Wed, 8 Jun 2016 17:11:15 +0000 (19:11 +0200)]
vaapivideomemory: add gst_vaapi_dmabuf_can_map()

This new method checks the specified allocator can create GstMemory that can
be mapped.

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

7 years agovaapivideobufferpool: fix regression with video metas
Víctor Manuel Jáquez Leal [Fri, 23 Jun 2017 15:33:03 +0000 (17:33 +0200)]
vaapivideobufferpool: fix regression with video metas

There is another regression with 7a206923 when setting the video
info for the video meta, it should be the one from the image's
allocator rather from the allocation caps.

Test pipeline:

  gst-launch-1.0 filesrc location=bug766184.flv ! decodebin \
      ! tee ! videoconvert ! videoscale                     \
      ! video/x-raw, width=1920, height=1080 ! xvimagesink

7 years agoplugins: update buffer size with the one reported by allocator
Víctor Manuel Jáquez Leal [Fri, 23 Jun 2017 12:38:10 +0000 (14:38 +0200)]
plugins: update buffer size with the one reported by allocator

There is a regression in 7a206923, since the buffer pool ditches all
the buffers generated by them because the pool config size is
different of the buffer's size.

Test pipeline:

  gst-launch-1.0 filesrc location=big_buck_bunny_1080p_h264.mov \
      ! qtdemux ! vaapih264dec ! vaapipostproc ! xvimagesink    \
      --gst-debug=GST_PERFORMANCE:5

The allocator may update the buffer size according to the VA surface
properties. In order to do this, the video info is modified when the
allocator is created, which reports through the allocation info the
updated size, and set it to the pool config.

7 years agolibs: decoder: h264: initialize active_sps/pps in reset
Hyunjun Ko [Wed, 14 Jun 2017 12:40:33 +0000 (21:40 +0900)]
libs: decoder: h264: initialize active_sps/pps in reset

Since commits in https://bugzilla.gnome.org/show_bug.cgi?id=781142 landed,
they introduced regression in seek.

Formerly, once seek is done, decoder drops P-frames until I-frame arrives.
But since the commits landed, it doesn't drop P-frame and does try to
decode it continuously because active_sps is still alive. See ensure_sps function.
But there are prev_frames and prev_ref_frames reset already, then it
causes assertion.

So it's necessary to reset active_sps/pps also in reset method.

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

7 years agolibs: encoder: fix compilation with old versions of libva
Víctor Manuel Jáquez Leal [Thu, 15 Jun 2017 11:24:56 +0000 (13:24 +0200)]
libs: encoder: fix compilation with old versions of libva

There are some symbols that are not used when compiling with old
version of libva and those generates a compilation error.

Original-patch-by: Matt Staples <staples255@gmail.com>
7 years agolibs: encoder: Fix the quality level clamping
Sreerenj Balachandran [Fri, 9 Jun 2017 21:02:20 +0000 (14:02 -0700)]
libs: encoder: Fix the quality level clamping

Change the hard-coded range of quality-level from {1-8} to {1-7},
since it is the range Intel Open source driver supports.
Also perform the range clamping only if the user provided
quality-level is greater than the max-range suppored by the driver,
because there could be non-intel drivers giving lower value than
the hard-coded max value 7.

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

7 years agolibs: encoder: log out the name of the profile
Víctor Manuel Jáquez Leal [Thu, 6 Apr 2017 17:35:27 +0000 (19:35 +0200)]
libs: encoder: log out the name of the profile

Instead of printing a number, it is more readable to log out, in
case of error, the name of the failing profile.

7 years agolibs: encoder: h264: changes raw number of profile to macro name of its
Hyunjun Ko [Wed, 31 May 2017 03:36:17 +0000 (12:36 +0900)]
libs: encoder: h264: changes raw number of profile to macro name of its

Changes raw number of profile to macro name of its to improve readability.

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

7 years agovaapivideobufferpool: remove allocation_vinfo private attribute
Víctor Manuel Jáquez Leal [Fri, 9 Jun 2017 15:00:40 +0000 (17:00 +0200)]
vaapivideobufferpool: remove allocation_vinfo private attribute

There is no need to keep this attribute internally since it is
already managed by the allocator.

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

7 years agovaapivideobufferpool: refactor set_config()
Víctor Manuel Jáquez Leal [Fri, 9 Jun 2017 13:02:08 +0000 (15:02 +0200)]
vaapivideobufferpool: refactor set_config()

Refactor the set_config() virtual method considering a cleaner
approach to allocator instanciation, if it it not set or if it is
not valid for the pool.

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

7 years agoplugins: distinguish allocation and negotiation caps
Víctor Manuel Jáquez Leal [Fri, 9 Jun 2017 11:05:36 +0000 (13:05 +0200)]
plugins: distinguish allocation and negotiation caps

The vaapi video decoders might have different allocation caps from
the negotiation caps, thus the GstVideoMeta shall use the negotiation
caps, not the allocation caps.

This was done before reusing gst_allocator_get_vaapi_video_info(),
storing there the negotiation caps if they differ from the allocation
ones, but this strategy felt short when the allocator had to be reset
in the vaapi buffer pool, since we need both.

This patch adds gst_allocator_set_vaapi_negotiated_video_info() and
gst_allocator_get_vaapi_negotiated_video_info() to store the
negotiated video info in the allocator, and distinguish it from
the allocation video info.

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

7 years agovaapivideomemory: rename qdata quarks and ids
Víctor Manuel Jáquez Leal [Thu, 8 Jun 2017 17:32:35 +0000 (19:32 +0200)]
vaapivideomemory: rename qdata quarks and ids

Also the parameter names were renamed to reflect their origin
and purpose.

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

7 years agovaapivideobufferpool: rename local variables
Víctor Manuel Jáquez Leal [Thu, 8 Jun 2017 14:05:49 +0000 (16:05 +0200)]
vaapivideobufferpool: rename local variables

Renamed local video info structure names in set_config() vitual
method. The purpose of their renaming is to clarify the origin
of those structures, whether come from passed caps parameter
(new_allocation_vinfo) or from the configured allocator
(allocator_vinfo).

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

7 years agovaapivideobufferpool: rename video info structures
Víctor Manuel Jáquez Leal [Thu, 8 Jun 2017 13:49:05 +0000 (15:49 +0200)]
vaapivideobufferpool: rename video info structures

Renamed private GstVideoInfo structure video_info to allocation_vinfo
and alloc_info to negotiated_vinfo.

The purpose of these renaming is to clarify the origin and purpose of
these private variables:

video_info (now allocation_vinfo) comes from the bufferpool
configuration. It describes the physical video resolution to be
allocated by the allocator, which may be different from the
negotiated one.

alloc_info (now vmeta_vinfo) comes from the negotiated caps in
the pipeline. It represents how the frame is going to be mapped
using the video meta.

In Intel's VA-API backend, the allocation_vinfo resolution is
bigger than the negotiated_info.

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

7 years agolibs: encoder: set framerate if bigger than 0/1
Víctor Manuel Jáquez Leal [Thu, 8 Jun 2017 10:51:50 +0000 (12:51 +0200)]
libs: encoder: set framerate if bigger than 0/1

Just set the framerate parameter if the framerate numerator and
denominator are bigger than zero.

Otherwise, in Intel Gen6 driver, a warning is raised disabling the
bitrate control.

Original-patch-by: Hyunjun Ko <zzoon@igalia.com>
https://bugzilla.gnome.org/show_bug.cgi?id=783532

7 years agolibs: encoder: bitrate target percentage calculation
Víctor Manuel Jáquez Leal [Wed, 7 Jun 2017 10:32:53 +0000 (12:32 +0200)]
libs: encoder: bitrate target percentage calculation

If the rate control is set to Constant Bit Rate (CBR) the target
percentage is 100%, otherwise is 70%

7 years agolibs: encoder: h264,h265,mpeg2,vp8,vp9: refactor ratecontrol param
Víctor Manuel Jáquez Leal [Wed, 7 Jun 2017 10:25:24 +0000 (12:25 +0200)]
libs: encoder: h264,h265,mpeg2,vp8,vp9: refactor ratecontrol param

Centralize the common configuration for the Rate Control parameter,
thus can be overloaded per each specific encoder.

7 years agolibs: encoder: h264,h265,mpeg2,vp8,vp9: refactor framerate param
Víctor Manuel Jáquez Leal [Wed, 7 Jun 2017 09:10:49 +0000 (11:10 +0200)]
libs: encoder: h264,h265,mpeg2,vp8,vp9: refactor framerate param

Since the framerate VA parameter is calculated equally among all the
encoders, it is better to handle it in the base encoder class.

7 years agolibs: encoder: vp9: Adds CBR and VBR Encoding support
Sreerenj Balachandran [Tue, 9 Aug 2016 12:53:47 +0000 (15:53 +0300)]
libs: encoder: vp9: Adds CBR and VBR Encoding support

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

Signed-off-by: Hyunjun Ko <zzoon@igalia.com>
Signed-off-by: Víctor Manuel Jáquez Leal <vjaquez@igalia.com>
7 years agolibs: encoder: vp8: Adds VBR Encoding support
Hyunjun Ko [Thu, 1 Jun 2017 03:12:26 +0000 (12:12 +0900)]
libs: encoder: vp8: Adds VBR Encoding support

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

7 years agolibs: encoder: h265: Adds VBR Encoding support
Hyunjun Ko [Thu, 1 Jun 2017 03:11:12 +0000 (12:11 +0900)]
libs: encoder: h265: Adds VBR Encoding support

Enables Variable BitRate mode, which does set FrameRate and RateControl
parameters.

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

7 years agolibs: encoder: Describes more detail about the bitrate property
Hyunjun Ko [Fri, 2 Jun 2017 04:50:05 +0000 (13:50 +0900)]
libs: encoder: Describes more detail about the bitrate property

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

7 years agolibs: encoder: h265: add rate control parameter
Víctor Manuel Jáquez Leal [Mon, 5 Jun 2017 18:44:22 +0000 (20:44 +0200)]
libs: encoder: h265: add rate control parameter

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

7 years agolibs: encoder: h264,h265,mpeg2: add framerate parameter
Víctor Manuel Jáquez Leal [Mon, 5 Jun 2017 18:33:27 +0000 (20:33 +0200)]
libs: encoder: h264,h265,mpeg2: add framerate parameter

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

7 years agolibs: encoder: vp8,h264,h265,mpeg2: set misc param once
Víctor Manuel Jáquez Leal [Mon, 5 Jun 2017 18:30:07 +0000 (20:30 +0200)]
libs: encoder: vp8,h264,h265,mpeg2: set misc param once

Instead of recalculating the miscellaneous buffer parameters for
every buffer, it is only done once, when the encoder is configured.
And for every buffer, the same structures are just copied.

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

7 years agolibs: encoder: vp8,h264,h265,mpeg2: refactor misc parameters
Víctor Manuel Jáquez Leal [Mon, 5 Jun 2017 15:31:10 +0000 (17:31 +0200)]
libs: encoder: vp8,h264,h265,mpeg2: refactor misc parameters

This is patch pretends to decouple the assignation of the values
in the parameter structures and the VA buffer's parameters setting.

It may lead to some issues since HRD, framerate or controlrate may
not be handled by the specific encoder, but they are set in
the VA buffer's parameters.

I leave as it because this patch is just a transitional patch.

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

7 years agolibs: encoder: vp8: fix frame rate calculation
Víctor Manuel Jáquez Leal [Mon, 5 Jun 2017 14:34:12 +0000 (16:34 +0200)]
libs: encoder: vp8: fix frame rate calculation

According to the VA documentation:

     The framerate is specified as a number of frames per second,
     as a fraction.  The denominator of the fraction is given in
     the top half (the high two bytes) of the framerate field, and
     the numerator is given in the bottom half (the low two bytes).

     For example, if framerate is set to (100 << 16 | 750), this is
     750 / 100, hence 7.5fps.

     If the denominator is zero (the high two bytes are both zero)
     then it takes the value one instead, so the framerate is just
     the integer in the low 2 bytes.

This patch fixes the the framerate calculation in vp8 encoder
according to this.

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

7 years agolibs: encoder: vp8: refactor FrameRate parameter
Víctor Manuel Jáquez Leal [Fri, 2 Jun 2017 17:46:52 +0000 (19:46 +0200)]
libs: encoder: vp8: refactor FrameRate parameter

Move frame-rate parameter from ensure_misc_params() to
ensure_contro_rate_param() since it only has meaning when the
control rate is either VBR or CBR.

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

7 years agolibs: encoder: h264,h265,mpeg2,vp8: refactor HDR
Víctor Manuel Jáquez Leal [Fri, 2 Jun 2017 17:33:36 +0000 (19:33 +0200)]
libs: encoder: h264,h265,mpeg2,vp8: refactor HDR

Move the Hypothetical Reference Decoder (HRD) parameter, from
ensure_misc_params() to ensure_control_rate_params(), since it
only shall be defined when the control rate is either VBR or CBR.

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

7 years agolibs: encoder: h264,vp8,mpeg2: refactor control rate
Víctor Manuel Jáquez Leal [Fri, 2 Jun 2017 15:21:25 +0000 (17:21 +0200)]
libs: encoder: h264,vp8,mpeg2: refactor control rate

Instead of filling the control rate param in ensure_misc_params(),
this patch refactor it out, as a first step to merge the same code
for all the encoders.

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

7 years agolibs: encoder: h264, h265, mpeg2: remove assert
Víctor Manuel Jáquez Leal [Fri, 2 Jun 2017 14:28:30 +0000 (16:28 +0200)]
libs: encoder: h264, h265, mpeg2: remove assert

Remove spurious asserts for misc parameters. If they cannot be
allocated, FALSE is already returned.

7 years agolibs: encoder: use VA quality level structure
Víctor Manuel Jáquez Leal [Mon, 5 Jun 2017 16:19:05 +0000 (18:19 +0200)]
libs: encoder: use VA quality level structure

Instead of using a proxy to story the buffer quality level, the
encoder now uses the native VA structure, which is copied to the
dynamically allocated VAEncMiscParameterBuffer.

This approach is computationally less expensive.

7 years agolibs: standardize the FIXME comment
Víctor Manuel Jáquez Leal [Fri, 26 May 2017 09:10:34 +0000 (11:10 +0200)]
libs: standardize the FIXME comment

This is a trivial patch that makes homogeneous the FIXME tag in
comments.

For more info about these comment style:
http://wiki.c2.com/?FixmeComment

7 years agolibs: encoder: vp8: set quality level regardless of rate control mode
Hyunjun Ko [Mon, 22 May 2017 15:20:45 +0000 (17:20 +0200)]
libs: encoder: vp8: set quality level regardless of rate control mode

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

7 years agolibs: encoder: check for maximum number of slices
Víctor Manuel Jáquez Leal [Mon, 15 May 2017 16:38:29 +0000 (18:38 +0200)]
libs: encoder: check for maximum number of slices

Right now, H264 and HEVC can set as a property the number of slices to
process. But each driver can set a maximum number of slices, depending
on the supported profile & entry point.

This patch verifies the current num_slices to process against the maximum
permitted by the driver and the media size.

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

7 years agolibs: utils: mark functions as internals
Víctor Manuel Jáquez Leal [Mon, 15 May 2017 16:36:21 +0000 (18:36 +0200)]
libs: utils: mark functions as internals

The functions in this header are internal to the library.

7 years agolibs: context: add missing documentation
Víctor Manuel Jáquez Leal [Mon, 15 May 2017 16:35:40 +0000 (18:35 +0200)]
libs: context: add missing documentation

Document the region-of-interest configuration variables.

7 years agotests: elements: vaapisink: handle nav events
Víctor Manuel Jáquez Leal [Fri, 12 May 2017 16:46:50 +0000 (18:46 +0200)]
tests: elements: vaapisink: handle nav events

The test app can now handle navigation events to rotate the
display.

7 years agotests: elements: clean up vaapisink test
Víctor Manuel Jáquez Leal [Fri, 12 May 2017 16:17:55 +0000 (18:17 +0200)]
tests: elements: clean up vaapisink test

- Use gst_element_send_event() instead of gst_pad_push_event()
- don't zero App structure
- check for pipeline parsing error
- only get vaapisink for property set

7 years agovaapisink: keep handle_events flag except that if user want to set
Hyunjun Ko [Fri, 12 May 2017 04:08:30 +0000 (13:08 +0900)]
vaapisink: keep handle_events flag except that if user want to set

When state of vaapisink is changed from PLAYING to NULL, the handle_events
flag is set to FALSE, and never recovered, and then event thread is never
going to run.

So we should allow to set the flag only when users try it.

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

7 years agolibs: window: x11: fix src rect info when using vpp
Hyunjun Ko [Fri, 12 May 2017 04:06:24 +0000 (13:06 +0900)]
libs: window: x11: fix src rect info when using vpp

Since we started using VPP in VaapiWindowX11, we need to care about
the case that src rect and window's size are different.

So, once VPP has converted to other format, we should honor the
size of the VPP's surface as source rect. Otherwise, it is cropped
according the previous size of the source rect.

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

7 years agoplugins: remove par from caps negotiation
Víctor Manuel Jáquez Leal [Fri, 28 Apr 2017 13:20:01 +0000 (15:20 +0200)]
plugins: remove par from caps negotiation

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

7 years agotests: elements: add an example for ROI
Hyunjun Ko [Thu, 30 Mar 2017 08:57:42 +0000 (17:57 +0900)]
tests: elements: add an example for ROI

This implements a pipleint to recognize difference between ROI and non-ROI.
See comments in this code in detail.

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

Signed-off-by: Víctor Manuel Jáquez Leal <vjaquez@igalia.com>
7 years agovaapiencode: handle custom event GstVaapiEncoderRegionOfInterest
Hyunjun Ko [Thu, 30 Mar 2017 08:54:20 +0000 (17:54 +0900)]
vaapiencode: handle custom event GstVaapiEncoderRegionOfInterest

Handles new custom event GstVaapiEncoderRegionOfInterest
to enable/disable a ROI region.

Writes a way to use new event to document.

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

Signed-off-by: Víctor Manuel Jáquez Leal <vjaquez@igalia.com>
7 years agotests: simple-encoder: add an option to set ROI
Hyunjun Ko [Thu, 23 Feb 2017 09:53:18 +0000 (18:53 +0900)]
tests: simple-encoder: add an option to set ROI

$ simple-encoder -r inputfile.y4m

And you'll got an output file in H264 with two regions of interest.

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

Signed-off-by: Víctor Manuel Jáquez Leal <vjaquez@igalia.com>