Commit graph

1586 commits

Author SHA1 Message Date
Víctor Manuel Jáquez Leal
0ca49a10f8 libs: decoder: refactor decoders as gobject
https://bugzilla.gnome.org/show_bug.cgi?id=796308
2018-09-03 17:54:19 +02:00
Víctor Manuel Jáquez Leal
1f0b2fb952 libs: display: lock at extracting available image formates
When running several vaapi elements at the concurrently, at
initialization, there is a race condition when extractin the avaible
formats for images and subpictures.

This patch add a lock when the those arrays are filled.

https://bugzilla.gnome.org/show_bug.cgi?id=797039
2018-08-31 13:41:58 +02:00
Víctor Manuel Jáquez Leal
5f718b4f93 libs: encoder: h265: trivial documentation fix 2018-08-29 14:49:49 +02:00
Wangfei
2fce126cc7 libs: encoder: h265: add low delay B frame support.
Low delay B frame provide the function of transforming
P frame into low delay B frame which frame type is B, but
only reference predictive frames. This can be used when P
frame unsupported. Especially for P and B both unsupported,
in this case, I and low delay B frame can be encoded in a
stream.

https://bugzilla.gnome.org/show_bug.cgi?id=796984
2018-08-29 14:49:41 +02:00
Nicolas Dufresne
2922439bc2 libs: decoder: h264: Avoid using picture after it has been free
In some cases, the found_picture ended up being evicted and freed, which
would lead to a use after free when accessing picture->base.poc. In this
fix, we take a ref on the picture before calling dpb_evict.

https://bugzilla.gnome.org/show_bug.cgi?id=787124
2018-08-28 18:05:12 -04:00
Nicolas Dufresne
7a120c7a72 h264decoder: Fail decoding slice with missing inter-view reference
Similarly to previous patch, we have no error concealment. As a side
effect, it's better to skip slices with missing references then passing
NULL pointers to the accelerator. Passing NULL pointer would lead to
major visual artifact, a behaviour that is likely undefined.

https://bugzilla.gnome.org/show_bug.cgi?id=787124
2018-08-01 19:43:58 -04:00
Hyunjun Ko
038c62011f libs: decoder: h264: reset context when the number of view is increased
Usually in case of MVC decoding, dpb size is increasedi if subset sps.
That's why it resets context without this patch.
But for some media it doesn't increase dpb size. Even in this case we
should reset context to deal with MVC decoding.
Otherwise, it leads to assert.

https://bugzilla.gnome.org/show_bug.cgi?id=787124
2018-08-01 19:43:58 -04:00
Nicolas Dufresne
06aa82f989 vaapidecode: Skip unparsable units from adapter
If the unit could not be parsed, just skip this nal and keep parsing
what is left in the adapter. We need to flush the broken unit in the
decoder specific parser because the generic code does not know about
units boundary. This increases error resilliance.

Before this, the broken unit would stay in the adapter and EOS would be
returned. Which stopped the streaming. Just removing the EOS would have
lead to the adapter size growing indefinitely.

https://bugzilla.gnome.org/show_bug.cgi?id=796863
2018-07-25 15:52:54 -04:00
Nicolas Dufresne
b9ecf3b40d h265decoder: Don't scan empty buffer
Same as what we did for H264 decoder, this is to avoid an assertion
in the adapter.

https://bugzilla.gnome.org/show_bug.cgi?id=796832
2018-07-25 15:49:51 -04:00
Víctor Manuel Jáquez Leal
9eaff17c30 libs: h264: renable the vaapi category for logging
h264 log messages were logged in default category because a regression
in code. This patch renable the usage of vaapi logging category.

This regression was introduced in commit 7c365bdd.
2018-07-25 20:28:03 +02:00
Nicolas Dufresne
7c365bdddc h264decoder: Fail decoding slice if modification process failed
This patch chains up failure to executing the modification process. The
end result is that we now fail decoding the slice if this process fails.
This avoid sending a corrupted state to the accelerator. In some special
cases, this could lead to unrecoverable errors.

https://bugzilla.gnome.org/show_bug.cgi?id=796832
2018-07-19 16:37:39 -04:00
Nicolas Dufresne
927536b791 h264decoder: Don't scan empty buffer
gst_adapter_masked_scan_uint32_peek() asserts if size is 0. Don't
try and scan in that case. This fixes assertion that would some times
happen when the stream is corrupted.

https://bugzilla.gnome.org/show_bug.cgi?id=796832
2018-07-19 16:37:39 -04:00
Tianhao Liu
f5eb4faa59 libs: encoder: jpeg: set component id and Tqi
This change is due a problem encoding JPEGs with Intel's
media-driver: green/black image when playback jpeg

This patch sets component identifier and quantization table
destination selector in frame header to support packing headers
by Intel's media-driver that does not accept packed header
in AP level.

https://bugzilla.gnome.org/show_bug.cgi?id=796705
2018-07-04 12:10:10 +02:00
Nicolas Dufresne
72ea2a5bc3 h264dec: Remove false assumption about parity order
The decoder was trying to detect earlier that a field was lost base
on guessing the parity order. This breaks in streams were the parity
order changes.

This patch reverts the field order prediction code added by commit
8dd93e9c8.

https://bugzilla.gnome.org/show_bug.cgi?id=796169
2018-06-18 11:43:01 -04:00
Nicolas Dufresne
076af84654 h264dec: Properly set sentinel in ref frame list
This ensure that we always have sentinels set in the reference
pictures arrays. The code wasn't unsafe, this simply improve the
tracing, so instead of printing 32 lines of zeros, va tracer
prints proper empty lists.

https://bugzilla.gnome.org/show_bug.cgi?id=796169
2018-06-14 13:32:12 -04:00
Víctor Manuel Jáquez Leal
6ccd5d6fb2 libs: display: remove gst_vaapi_display_ref()
Replace it with gst_object_ref()

https://bugzilla.gnome.org/show_bug.cgi?id=796470
2018-06-14 16:41:00 +02:00
Víctor Manuel Jáquez Leal
fb1c4c52cc libs: display: remove gst_vaapi_display_unref()
Use gst_object_unref() instead.

https://bugzilla.gnome.org/show_bug.cgi?id=796470
2018-06-14 16:41:00 +02:00
Hyunjun Ko
a6881b9b5e libs: display: replace gst_vaapi_display_new() with gst_vaapi_display_config()
Gobjectification for GstVaapiDisplay was almost done by the commit 185da3d1.
But still something breaking GObject code convention remains, which is
calling gst_vaapi_display_new() in each decendants.

This patch replaces it with gst_vaapi_display_config(), defined in private
header.

https://bugzilla.gnome.org/show_bug.cgi?id=796470
2018-06-14 16:41:00 +02:00
Víctor Manuel Jáquez Leal
8de7dcfe3c libs: display: redefine gst_vaapi_display_create()
The function name was gst_vaapi_display_create_unlocked(), nonetheless
it wasn't called unlocked. In order to keep the semantics this patch
renames the gst_vaapi_display_create_unlocked() as
gst_vaapi_display_create(), removing the previous function
gst_vaapi_display_create().

https://bugzilla.gnome.org/show_bug.cgi?id=796470
2018-06-14 16:41:00 +02:00
Víctor Manuel Jáquez Leal
b0bebebc01 libs: display: resurrect parent private member
This is, practically, a revert of commit dcf135e2.

The parent logic is useful for the EGL display, which is a decorator
of the real windowing subsystem (X11 or Wayland). Thus it is avoided
calling vaInitialize() and vaTerminate() twice.

https://bugzilla.gnome.org/show_bug.cgi?id=795391
2018-06-12 12:43:27 +02:00
Víctor Manuel Jáquez Leal
ad974b4c82 libs: display: egl: initialize params structure
Statically initialise the internal params structure.

https://bugzilla.gnome.org/show_bug.cgi?id=795391
2018-06-12 12:43:27 +02:00
Hyunjun Ko
50470ae89f display: egl: create VaapiDisplayEGL with native EGL display
gst_vaapi_display_egl_new_with_native_display() has been broken since
it wasn't used.

Currently it's needed to call this API to create a display providing
the EGL display, so it could avoid duplicated calls to the native
display (eg. eglTerminate).

Signed-off-by: Victor Jaquez <vjaquez@igalia.com>

https://bugzilla.gnome.org/show_bug.cgi?id=795391
2018-06-12 12:35:04 +02:00
Tianhao Liu
bb8894aaf9 libs: decoder: release VA buffers after vaEndPicture
This change is due a problem decoding JPEGs with Intel's media-driver:
no image was generated.

This patch relases the VA buffers after vaEndPicture() is called,
and not before (after vaRenderPicture()).

https://bugzilla.gnome.org/show_bug.cgi?id=796505
2018-06-08 12:39:06 +02:00
Tim-Philipp Müller
e31248dc28 meson: fix build when xrender or xrandr are not available
HAVE_XRENDER are defined to 1 or 0, not defined or undefined.
2018-06-08 00:56:14 +01:00
Hyunjun Ko
aa77862b62 libs: display: remove unnecessary legacy code since gobjectification
https://bugzilla.gnome.org/show_bug.cgi?id=796470
2018-06-06 19:47:18 +02:00
Hyunjun Ko
3056f06e02 libs: display: remove unused code
https://bugzilla.gnome.org/show_bug.cgi?id=796470
2018-06-06 19:47:18 +02:00
Hyunjun Ko
676e558331 libs: encoder: h265: increase log2_max_pic_order_cnt range according to spec
The specification says,
"log2_max_pic_order_cnt_lsb_minus4 shall be in the range of 0 to 12, inclusive."

This patch changes the upper limit from 6 to 12.

https://bugzilla.gnome.org/show_bug.cgi?id=796179
2018-06-04 18:38:54 +02:00
Víctor Manuel Jáquez Leal
e93232bbf4 libs: decoder: h264: use g_clear_pointer() 2018-05-18 18:42:49 +02:00
Víctor Manuel Jáquez Leal
41ab71a4fa libs: decoder: mpeg4, vc1: remove unused header 2018-05-18 18:42:35 +02:00
Víctor Manuel Jáquez Leal
4233987278 libs: decoder: remove unused forward declaration 2018-05-18 18:42:21 +02:00
Víctor Manuel Jáquez Leal
77527d67ab libs: remove gstbitwriter
Since it is deployed in gstreamer-core, there is no need to use
our custom version.

https://bugzilla.gnome.org/show_bug.cgi?id=795848
2018-05-06 17:29:45 +02:00
Hyunjun Ko
4af46f00c2 libs: egl: utils: mark context as wrapped when it is
The returning egl context may be null, so we should check the
return value.

https://bugzilla.gnome.org/show_bug.cgi?id=795391
2018-04-25 18:00:17 +02:00
Víctor Manuel Jáquez Leal
9fde93f80c libs: egl: utils: fix usage of GstGL macros
Include gl.h for the required GstGL symbols.

https://bugzilla.gnome.org/show_bug.cgi?id=795391
2018-04-25 16:29:28 +02:00
Tim-Philipp Müller
3900b4b36f meson: fix miscellaneous meson warnings
WARNING: Passed invalid keyword argument "rqeuired".
gst-libs/gst/base/meson.build:11: WARNING: Passed invalid keyword argument "version".
gst-libs/gst/base/meson.build:11: WARNING: Passed invalid keyword argument "soversion".
gst-libs/gst/vaapi/meson.build:223: WARNING: Passed invalid keyword argument "version".
gst-libs/gst/vaapi/meson.build:223: WARNING: Passed invalid keyword argument "soversion".
2018-04-20 11:50:55 +01:00
Paul Kocialkowski
5ee46f6751 display: drm: Allow finding DRM paths out of the PCI subsystem
This removes hard-coded checks on the parent subsystem of potential DRM
devices. These checks were set to exlude devices that do not originate
from the PCI bus, which is only a valid approach on x86 devices.

Other devices may have a DRM device originating from the platform
subsystem, so the checks that were previously restricted to PCI are
extended to cover platform devices as well.

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

Signed-off-by: Paul Kocialkowski <paul.kocialkowski@bootlin.com>
2018-04-19 17:42:43 +02:00
Hyunjun Ko
1825d939e7 libs: display: wayland: add gst_vaapi_display_wayland_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=705821
2018-04-18 18:01:06 +02:00
Michael Olbrich
1f71b5a57d wayland: don't poll if there are no pending frames
Otherwise the following poll may not return for an arbitrary amount of
time. This can happen if another wayland event queue has flushed and read
our events.

https://bugzilla.gnome.org/show_bug.cgi?id=795224
2018-04-18 13:57:53 +02:00
Hyunjun Ko
e19570a8b6 libs: encoder: h265: 16 bit rounding of picture width and height
pic_width_in_luma_samples/pic_height_in_luma_samples can be 16-bit rounded
instead of 32-bit.

In addition, codedbuf_size must be calculated according to this change.

https://bugzilla.gnome.org/show_bug.cgi?id=753229
2018-04-16 15:57:21 +02:00
Julien Isorce
bfa2fbd39b libs: decoder: h264: ensure num_ref_frames is greater than 0
Even if it is the h264parse fault or bad video file, vaapih264dec
should set a proper value for VAPictureParameterBufferH264.num_ref_frames
as the driver might use it.

Also see "info.ref_frames = dpb_size;" in
gstvaapidecoder_h264.c::ensure_context

https://bugzilla.gnome.org/show_bug.cgi?id=793836
2018-03-16 11:14:48 -06:00
Víctor Manuel Jáquez Leal
c49a17ed15 libs: encoder: reimplement ROI using meta
Check input buffers for ROI metas and pass them to VA. Also added a
new "default-roi-delta-qp" property in order to tell the encoder what
delta QP should be applied to ROI by default.

Enabled it for H264 and H265 encoders.

https://bugzilla.gnome.org/show_bug.cgi?id=768248
2018-02-27 17:51:02 -05:00
Víctor Manuel Jáquez Leal
d3110713b8 Revert "libs: encoder: add api gst_vaapi_encoder_add/del_roi"
This reverts commit 7a6f690340.

https://bugzilla.gnome.org/show_bug.cgi?id=768248
2018-02-27 17:51:02 -05:00
Víctor Manuel Jáquez Leal
863b7fa6e0 libs: surface: cast to uintptr_t pointer
According to Debian package auto-building, uintptr_t is not an
unsigned long in i386 arch, raising an "incompatible pointer type"
error.

This patch adds a casting for compiler's satisfaction in i386.
2018-02-27 10:02:14 -06:00
Matteo Valdina
02c7c1bc17 libs: encoder: add zero as valid value for periodic keyframe.
Enabled zero as valid value for keyframe-period property.

https://bugzilla.gnome.org/show_bug.cgi?id=793829
2018-02-26 10:04:29 -06:00
Víctor Manuel Jáquez Leal
d18d6a8bd0 libs: encoder: code-style fix 2018-02-22 08:24:12 -06:00
Matteo Valdina
83886ced66 libs: encoder: h264,h265: extend max periodic keyframe.
Increased max values of periodic key frame for h26x codecs.
This allow more fine tunning of encoder that in certian scenario
want higher periodic key frame.

For example: it doesn't want a key frame each 10 seconds but
each 120 seconds.

https://bugzilla.gnome.org/show_bug.cgi?id=786320
2018-02-19 22:34:53 +01:00
Víctor Manuel Jáquez Leal
d26dc92021 build: meson: add missing GstGL dependency 2018-01-17 13:00:45 +01:00
Víctor Manuel Jáquez Leal
7418d4e954 libs: utils: egl: add missing guards for GstGL 2018-01-17 12:41:54 +01:00
Víctor Manuel Jáquez Leal
7e05160aaa libs: egl: utils: use eglGetPlatformDisplay()
eglGetDisplay() is currently broken in Mesa for Wayland.  Also using
eglGetDisplay() is rather fragile, and it is recommended to use
eglGetPlatformDisplay() when possible.

In order to do that, this patch uses the helper in GstGL. If
gstreamer-vaapi is not compiled with GstGL support, eglGetDisplay()
will be used.

https://bugzilla.gnome.org/show_bug.cgi?id=790493
2018-01-12 20:19:59 +01:00
Víctor Manuel Jáquez Leal
20b95f0fec libs: window: wayland: remove unused header include
Remove wayland-client.h include since there is no exposed symbols from
it.
2017-11-27 13:04:24 +01:00
Víctor Manuel Jáquez Leal
bfc7f66708 libs: encoder: h264,h265: guard rate control's macroblock
macroblock parameter appear on VA-API 1.0.0. It should be guarded.
2017-11-27 12:18:56 +01:00
Sreerenj Balachandran
6a3f30aab1 libs: encoder: h264: Add Hierarchical-B encode
Frames are encoded as different layers. Frame in a particular
layer will use pictures in lower or same layer as references.
Which means decoder can drop the frames in upper layer but still
decode lower layer frames.

B-frames, except the one in top most layer, are reference frames.
All the base layer frames are I or P.

eg: with 3 temporal layers

    T3:             B1            B3              B5              B7

    T2:                   B2                              B6

    T1:   I0                                P4                        P8

    T1, T2, T3: Temporal Layers
    P1...Pn:   P-Frames:
    B1...Bn:   B-frames:
    T1: I0->P4 , P4->P8 etc..
    T2: I0--> B2 <-- P4
    T3: I0--> B1 <-- B2, B2 --> B3 <-- P4

Signed-off-by: Sreerenj Balachandran <sreerenj.balachandran@intel.com>

https://bugzilla.gnome.org/show_bug.cgi?id=788918
2017-11-08 13:15:03 +01:00
Sreerenj Balachandran
53c83691f3 libs: encoder: h264: Add Hierarchical-P encode
Frames are encoded as different layers. A frame in a particular
layer will use pictures in lower or same layer as references.
Which means decoder can drop the frames in upper layer but still
decode lower layer frames.

eg: with 3 temporal layers

T3:             P1            P3              P5              P7

T2:                   P2                              P6

T1:   P0                                P4                        P8

T1, T2, T3: Temporal Layers
P1...pn:   P-Frames:
P0->P1 , P0->P2, P2->P3, P0->P4......repeat

Signed-off-by: Sreerenj Balachandran <sreerenj.balachandran@intel.com>

https://bugzilla.gnome.org/show_bug.cgi?id=788918
2017-11-08 13:15:03 +01:00
Sreerenj Balachandran
904931d7f3 libs: encoder: h264: Fix frame_num generation
The frame_num generation was not correctly implemented.
According to h264 spec, frame_num should get incremented
for each frame if previous frame is a referece frame.

For eg: IPBPB sequece should have the frame numbers 0,1,2,2,3

Signed-off-by: Sreerenj Balachandran <sreerenj.balachandran@intel.com>

https://bugzilla.gnome.org/show_bug.cgi?id=788918
2017-11-08 13:15:03 +01:00
Sreerenj Balachandran
ff91d62415 libs: encoder: h264: Add new property "prediction-type"
Adds new property "prediction-type" to select different reference
picture selection modes like hierarchical-p, hierarchical-b etc.

Signed-off-by: Sreerenj Balachandran <sreerenj.balachandran@intel.com>

https://bugzilla.gnome.org/show_bug.cgi?id=788918
2017-11-08 13:14:54 +01:00
XuGuangxin
dc583452d8 libs: encoder: h264: Add machinery for implementing hierarchical-prediction
Adds some basic building blocks to ease the implementation
of hierarchical prediction modes.

-- add an utility method to find temporal level of each frame
-- define max_ref_frame count based on temporal level count
-- add temporal_level_div[] for finding temporal level each frame
to be encoded.
-- find ip_period based on temporal level count

Signed-off-by: Sreerenj Balachandran <sreerenj.balachandran@intel.com>

https://bugzilla.gnome.org/show_bug.cgi?id=788918
2017-11-08 12:33:50 +01:00
XuGuangxin
e49859fde0 libs: encoder: h264: Add property "temporal-levels"
Adds new property "temporal-levels" to select the number of
temporal levels to be included in the encoded stream.

Signed-off-by: Sreerenj Balachandran <sreerenj.balachandran@intel.com>

https://bugzilla.gnome.org/show_bug.cgi?id=788918
2017-11-08 12:33:50 +01:00
XuGuangxin
89717a447f libs: encoder: objects: Add a reference flag
We can have p-frame as non-ref and also b-frame as ref
which are not supported yet. Reference flag
is the first machinery needed for more advanced
reference picture selection modes.

Signed-off-by: Sreerenj Balachandran <sreerenj.balachandran@intel.com>

https://bugzilla.gnome.org/show_bug.cgi?id=788918
2017-11-08 12:33:50 +01:00
Daniel van Vugt
e1f9959eb5 libs: surface: egl: add comment
Add a warning comment when using old intel-vaapi-drivers (>1.8.4),
where the creation of surfaces from GEM fd may fail.

https://bugzilla.gnome.org/show_bug.cgi?id=773453
2017-11-06 18:00:14 +01:00
Víctor Manuel Jáquez Leal
429e800204 libs: display: egl: add gst_vaapi_display_egl_set_current_display()
Adds a new function that changes the internal EGL display to the
current one (eglGetCurrentDisplay()) and sets the current context
too (eglGetCurrentContext()).

This new function is called by gst_vaapi_texture_egl_create() updating
the GstVaapiDisplayEGL with the current EGL display.

https://bugzilla.gnome.org/show_bug.cgi?id=773453
2017-11-02 11:18:50 +01:00
Víctor Manuel Jáquez Leal
98a136ae2a libs: texture: egl: update EGL display and context
It is required to use the context of the calling thread when wrapping
a foreign texture. According the documentation of
GstVideoGLTextureUploadMeta:

 "The caller of gst_video_gl_texture_upload_meta_upload() must
  have OpenGL set up and call this from a thread where it is valid
  to upload something to an OpenGL texture."

This patch updates the EGL display and context in GstVaapiDisplay
instance to the one used by te renderer that uploads the texture.

Original-patch-by: Daniel van Vugt <daniel.van.vugt@canonical.com>

https://bugzilla.gnome.org/show_bug.cgi?id=773453
2017-11-01 11:27:36 +01:00
Víctor Manuel Jáquez Leal
ac31160dfc libs: display: egl: free leaked memory
The EGL VAAPI display forgot to release the egl display, context and
proxied VAAPI display.

https://bugzilla.gnome.org/show_bug.cgi?id=773453
2017-11-01 11:27:36 +01:00
Víctor Manuel Jáquez Leal
0840c08cf1 libs: texture: egl: code style
https://bugzilla.gnome.org/show_bug.cgi?id=773453
2017-11-01 11:27:36 +01:00
Víctor Manuel Jáquez Leal
ea503ed085 libs: surface: egl: error message if no extension
Instead of silently fail to export the image if there is not available
the EGL_MESA_drm_image, log an error message. Also a code refactoring
was done.

https://bugzilla.gnome.org/show_bug.cgi?id=773453
2017-11-01 11:27:36 +01:00
Hyunjun Ko
acfabb3561 libs: encoder: allow to set bitrate on runtime
In case of streaming, controlling bitrate dynamically for encoder might be
important to manage quality of the streaming.

This patch is to support such a scenario.

https://bugzilla.gnome.org/show_bug.cgi?id=786321
2017-10-20 13:22:51 +02:00
Víctor Manuel Jáquez Leal
c7d712a932 libs: utils: log warn if display fail
gstreamer-vaapi initializes the display by trial-and-error, thus
logging an error message if the display initialisation fails the user
may be weary of the error message in the screen, if using VA-API 1.0

This commit set the VA error log handler to GStreamer warning level
while calling vaInitialize() and set it to error after that.

https://bugzilla.gnome.org/show_bug.cgi?id=783169
2017-10-03 13:37:23 +02:00
Víctor Manuel Jáquez Leal
63a76c9dd0 libs: display: delay getting screen resolution
Instead of extracting the screen resolution at GstVaapiDisplay
creation, this patch delay it until the screen size is requested for
first time.

https://bugzilla.gnome.org/show_bug.cgi?id=782212
2017-10-03 13:14:55 +02:00
Víctor Manuel Jáquez Leal
66e4593c33 libs: display: egl: avoid two vaDisplay instantiates
GstVaapiDisplayEGL is a wrapper of another GstVaapiDisplay, either X11
or Wayland. Nonetheless it created another vaDisplay for it, instead
of using the wrapped one.

This patch enables the reuse of the wrapped vaDisplay avoiding
instantiating two.

https://bugzilla.gnome.org/show_bug.cgi?id=782212
2017-10-03 13:14:55 +02:00
Víctor Manuel Jáquez Leal
494ac4e3a8 libs: display: remove display_type from display info
Since it's no required to pass the display type in the display info,
the structure member is removed.

https://bugzilla.gnome.org/show_bug.cgi?id=782212
2017-10-03 13:14:55 +02:00
Víctor Manuel Jáquez Leal
4e9de44ba2 libs: display: remove display_type member
It is not used any more since GstVaapiDisplay was ported as a
GstObject-based. This information is part of the class information.

https://bugzilla.gnome.org/show_bug.cgi?id=782212
2017-10-03 13:14:55 +02:00
Víctor Manuel Jáquez Leal
dcf135e2a5 libs: display: remove parent member
Parent was a crumb left from display cache.

https://bugzilla.gnome.org/show_bug.cgi?id=782212
2017-10-03 13:14:55 +02:00
Víctor Manuel Jáquez Leal
b23ccc69b0 libs: display: initialize value if they are not yet
This is a difference between the GObject API and the GstVaapi one: the
GValue passed to get a property value, in GObject has to be
initialized with g_value_init(), but in GstVaapi is has not.

In order to overcome this mismatch, this patch call g_value_init()
internally only in the passed one is not already initialized.

https://bugzilla.gnome.org/show_bug.cgi?id=788058
2017-09-22 20:06:42 +02:00
Víctor Manuel Jáquez Leal
6b35e00a28 libs: display: optimize properties setters and getters
Shuffled some code to avoid to find the properties descriptor in the
array twice, adding the internal functions _set_property() and
_get_property().

https://bugzilla.gnome.org/show_bug.cgi?id=788058
2017-09-22 20:06:42 +02:00
Víctor Manuel Jáquez Leal
0eeef92911 libs: display: install properties in class
Install the properties in the class as a normal GObject. Implement
set_property() and get_property() vmethods.

https://bugzilla.gnome.org/show_bug.cgi?id=788058
2017-09-22 20:06:42 +02:00
Víctor Manuel Jáquez Leal
9dcaa0d09f libs: display: remove gst_vaapi_display_properties_init()
Remove gst_vaapi_display_properties_init() since it can be unrolled in
gst_vaapi_display_class_init()

https://bugzilla.gnome.org/show_bug.cgi?id=788058
2017-09-22 20:06:42 +02:00
Víctor Manuel Jáquez Leal
9116ffb7b7 libs: display: remove libgstvaapi_init_once()
It is not required since it can be unrolled in
gst_vaapi_display_class_init()

https://bugzilla.gnome.org/show_bug.cgi?id=788058
2017-09-22 20:06:42 +02:00
Hyunjun Ko
b107520587 libs: decoder: h264/h265: decode codec data only if opened
Fixes regression introduced by commit 2eb2b26a.

There is a use case when the decoder set the src caps and immediatly
tries to process the media codec_data, this happens before decoder is
even opened, thus priv->parser is not instantiated yet.

https://bugzilla.gnome.org/show_bug.cgi?id=787818
2017-09-19 19:20:42 +02:00
Víctor Manuel Jáquez Leal
e308b452d6 libs: encoder: change mbbrc from uint to enum
Instead of handling the macroblock bitrate control as a integer, this
patch changes it as a enum, which is more self documented in the
GStreamer elements.

https://bugzilla.gnome.org/show_bug.cgi?id=787855
2017-09-18 20:19:20 +02:00
Jan Schmidt
b7c7335238 Fix a typo in the prop string for compliance-mode 2017-09-18 13:55:49 +10:00
Víctor Manuel Jáquez Leal
29cf49d56a libs: encoder: don't unref properties
This patch fixes a regression introduced in commit 148f867c, since the
props variable is set to object's member variable
encoder->properties. And it is set in the instance initialization,
thus it will not be leaked.

https://bugzilla.gnome.org/show_bug.cgi?id=787733
2017-09-15 18:34:49 +02:00
Hyunjun Ko
148f867c12 vaapiencode/libs: encoder: fix leaks of properties
https://bugzilla.gnome.org/show_bug.cgi?id=786321
2017-09-15 11:07:55 +02:00
Víctor Manuel Jáquez Leal
2eb2b26ad8 libs: decoder: at update_caps() decode codec_data
When updating the caps in decoder, if the caps has codec_data (avC
format), it has to be parsed to update the state of the decoder.

https://bugzilla.gnome.org/show_bug.cgi?id=786173
2017-09-14 16:58:17 +02:00
Hyunjun Ko
9875c0d84e libs: context: fix wrong counter of the array of attributes
The counter value passed to vaCreateConfig is always +1.

This is a regression caused by commit e42ec3ad.

The present patch fixes wrong counting of the array of attributes.

https://bugzilla.gnome.org/show_bug.cgi?id=787613
2017-09-13 10:56:16 +02:00
Hyunjun Ko
5333155e27 libs: encoder: h265: support I/P/B QP setting seperatedly
Creates 2 properties, qp-ip and qp-ib for setting different QP for P/B
frames
and set slice_qp_delta for each frame according to the value provided.

https://bugzilla.gnome.org/show_bug.cgi?id=785923
2017-09-13 10:47:22 +02:00
Hyunjun Ko
64a38a16f1 libs: encoder: h264: support I/P/B QP setting seperatedly
Creates 2 properties, qp-ip and qp-ib for setting different QP for P/B
frames
and set slice_qp_delta for each frame according to the value provided.
In addition, remove the limitation of (<= 4) when setting
slice_qp_delta.

https://bugzilla.gnome.org/show_bug.cgi?id=785923
2017-09-13 10:47:22 +02:00
Hyunjun Ko
5796750604 libs: encoder: h264/h265: keep min_qp as is unless it's over init_qp
Creates new variable for QP for I frame and keep it at configuration and
use this for pic_init_qp and slice_qp_delta setting.

Since changing min qp doesn't make sense, keep min qp as is.

https://bugzilla.gnome.org/show_bug.cgi?id=785923
2017-09-13 10:47:22 +02:00
Hyunjun Ko
e7c099b957 libs: encoder: h265: Add mbbrc property
This property supports Macroblock level Bitrate Control as the
following (same as h264 encoder):
0: auto
1: on
2: off

https://bugzilla.gnome.org/show_bug.cgi?id=785917
2017-09-13 10:45:49 +02:00
Hyunjun Ko
6816d7c151 libs: encoder: h264: Add mbbrc property
This property supports Macroblock level Bitrate Control as the
following:
0: auto
1: on
2: off

https://bugzilla.gnome.org/show_bug.cgi?id=785917
2017-09-13 10:45:49 +02:00
Hyunjun Ko
aa6aa996d6 libs: encoder: h265: add multi reference support
This is doing the same as h264 encoder as the following:

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.

Also this patch includes:
- Set num_negative_pics and num_positive_pics according to the number of
refs.
- Set delta_poc according to the number of refs.
- Increase max_dec_pic_buffering according to the number of refs
- Change max_num_reorder_pics according to num of bframes

https://bugzilla.gnome.org/show_bug.cgi?id=783804
2017-09-13 10:36:34 +02:00
Hyunjun Ko
3dbf440373 libs: encoder: h265: add refs property
Users can provide the number of reference frame by this property,
which is exaclty same as h264.

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.

The maximum value is aligned to the value of the driver supported now.

https://bugzilla.gnome.org/show_bug.cgi?id=783804
2017-09-13 10:36:34 +02:00
Hyunjun Ko
f14563759a libs: encoder: h264/5: determine num_ref_idx_active_override_flag according to reference list
Follows the specification as below:

7.4.7.1 in Rec. ITU-T H.265 v4 (12/2016)
num_ref_idx_active_override_flag equal to 1 specifies that the syntax
element num_ref_idx_l0_active_minus1 is present for P and B slices and
that the syntax element num_ref_idx_l1_active_minus1 is present for B
slices.
num_ref_idx_active_override_flag equal to 0 specifies that the syntax
elements num_ref_idx_l0_active_minus1 and num_ref_idx_l1_active_minus1
are not present.

https://bugzilla.gnome.org/show_bug.cgi?id=783804
2017-09-13 10:36:34 +02:00
Hyunjun Ko
f7886008e3 libs: encoder: h265: keep idr_period equal to keyframe period
Remove FIXME code, which makes previous assignation spurious.
This also means to make idr_period equal to keyframe period,
which is same as h264 encoder.

https://bugzilla.gnome.org/show_bug.cgi?id=783804
2017-09-13 10:36:34 +02:00
U. Artie Eoff
6e3bfbc014 libs: encoder: h264_fei: VA-API 1.0 compat
Use VA_ENC_PACKED_HEADER_H264_SEI compat macro for VA-API 1.0
compatibility.

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

Signed-off-by: U. Artie Eoff <ullysses.a.eoff@intel.com>
2017-09-05 10:58:57 -07:00
Sreerenj Balachandran
7e0d5b934b FEI: libs: Add FEI encoder
Adding FEI encoder to core lib.

The code is splitted into three session:

1: gstvaapiencoder_h264_fei.{h,c}
This is the replica of gstvaapiencoder_h264.{c,h} but with FEI.
All the modes ENC, PAK and ENC_PAK are running based
the code in these files.

2: gstvaapifeienc_h264.{h,c}
Abstract implementation intended for ENC (only VME) operation.

3: gstvaapifeipak_h264.{h,c}
Abstrct implementation intended for PAK (only the PAK module)

Right now ENC_PAK, ENC and PAK are running based on code
in gstvaapiencoder_h264_fei.{h,c}. The abstract implementations
in gstvaapifeienc_h264.{h,c} and gstvaapifeipak_h264.{h,c} are
needed if user request for ENC+PAK mode operation.

ENC+PAK: Here we need to invoke two sequence of
vaBeginPicture/vaRenderPicutre/vaEndPicture for each frame,
first for the ENC only and the second for PAK only.
Each mode associated with separate context ,but same pool of surfaces are
shared between the modes.
This is more useful once we have custom BRC algorithms.

Other Contributors:
                   Wang, Yi <yi.a.wang@intel.com>
                   Leilei <leilei.shang@intel.com>
                   Zhong, Xiaoxia <xiaoxia.zhong@intel.com>
                   xiaominc <xiaomin.chen@intel.com>
                   Li, Jing B <jing.b.li@intel.com>

https://bugzilla.gnome.org/show_bug.cgi?id=785712
https://bugzilla.gnome.org/show_bug.cgi?id=784667
2017-09-01 11:36:13 +02:00
Sreerenj Balachandran
de2e4cd9bc FEI: libs: Add fei codec objects to GstVaapiEncPicture
All the codec objects(vaapi buffers) supposed to be
submited in vaRenderPicutre are associated with a GstVaapiEncPicture
for each frame, follow the same design for FEI too.

https://bugzilla.gnome.org/show_bug.cgi?id=785712
https://bugzilla.gnome.org/show_bug.cgi?id=784667
2017-09-01 11:32:24 +02:00
Sreerenj Balachandran
132eacde79 FEI: libs: Add fei codec objects in codedbufferproxy
MbCode, MV and Distortion buffers (fei codec objects)
can be treated as output of different fei modes based user request.
For eg: MbCode and MV are the output of ENC only. MbCode, MV and Dist
can be dumped as output in ENC_PAK mode for analysis purpose.
So treating them as a part of CodedBufferProxy too.
Here we avoided Qp, MbControl and MvPredictor codec objects since
there is no practical use case of treating them as "output buffers".

Other contributors:
               Zhong, Xiaoxia <xiaoxia.zhong@intel.com>
               xiaominc <xiaomin.chen@intel.com>
               Leilei <leilei.shang@intel.com>
               Li, Jing B <jing.b.li@intel.com>

https://bugzilla.gnome.org/show_bug.cgi?id=785712
https://bugzilla.gnome.org/show_bug.cgi?id=784667
2017-09-01 11:32:24 +02:00
Sreerenj Balachandran
d5542fa8c0 FEI: libs: Add fei codec objects to surface proxy
Add fei codec objects to surface proxy since handling the
fei buffers(codec objects here) external to gstvaapisurfaceproxy
will make the code complicated. Especially considering the behavior
of encoder where the input frame order from upstream and output
frame order to the downstream are not sequential.

Other contributors:
              Zhong, Xiaoxia <xiaoxia.zhong@intel.com>
              xiaominc <xiaomin.chen@intel.com>
              Leilei <leilei.shang@intel.com>
              Li, Jing B <jing.b.li@intel.com>

https://bugzilla.gnome.org/show_bug.cgi?id=785712
https://bugzilla.gnome.org/show_bug.cgi?id=784667
2017-09-01 11:32:24 +02:00
Sreerenj Balachandran
d0d9f5e274 FEI: Add codec objects for fei usecase
There are 6 new va buffer types, each defined as a specific codec object.
Borrowed the code from gstvaapicodecobject , but made a clear separation
to avoid any possible mess-up. Because unlike the other gstvaaicodecobjects,
feicodecobjects can be shared between elements and also can be accessed
from different thread.

Unlike the other fei codecs object, VAEncMiscParameterTypeFEIFrameControl
object is not shared between elements.So we utilize the already
existing gst_vaapi_enc_misc_param_new(), but still keeping the code
in gstvaapfei_objects_priv.h in order to have a better
code readability.

Fixme:
-- Probably we need _locked_map() and _unlocked_map()
-- Context can be associated with PreEnc(not just Enoder)
once we have the proper support inplace, but for now we don't have
PreEnc support, so should be safe enough to use GstVaapiEncoder.

https://bugzilla.gnome.org/show_bug.cgi?id=785712
https://bugzilla.gnome.org/show_bug.cgi?id=784667
2017-09-01 11:32:24 +02:00
Sreerenj Balachandran
0b91ebeb2c FEI: libs: add H264 fei specific utility functions
Added enum/flag type definitions for a number of FEI
input and output parameters.

Original author of the patch: Wang, Yi <yi.a.wang@intel.com>

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

Signed-off-by: Wang, Yi <yi.a.wang@intel.com>
Signed-off-by: Sreerenj Balachandran <sreerenj.balachandran@intel.com>
2017-09-01 11:32:24 +02:00
Sreerenj Balachandran
94483de40f FEI: libs: Add virtual method for secondary context creation.
Add a new vitrual method ensure_secondary_context to the
base encoder which is only required for the FEI entrypoint, that too
only when user configures the ENC+PAK mode. ENC+PAK mode is not something
supported directly by libva or driver, but this can be enabled
from the middleware.

Original Author of this idea: Leilei Shang <leilei.shang@intel.com>

Signed-off-by: Leilei Shang <leilei.shang@intel.com>
Signed-off-by: xiaominc <xiaomin.chen@intel.com>
Signed-off-by: Sreerenj Balachandran <sreerenj.balachandran@intel.com>

https://bugzilla.gnome.org/show_bug.cgi?id=785712
https://bugzilla.gnome.org/show_bug.cgi?id=784667
2017-09-01 11:32:24 +02:00
Sreerenj Balachandran
ac1de3d39a FEI: libs: make sure the default context creation works as expected.
Current code always guess the entrypoint during init phase in case
if there is no entrypoint already configured in GstVaapiContextInfo.
Make sure FEI Entrypoint is not messing up with this logic.

https://bugzilla.gnome.org/show_bug.cgi?id=785712
https://bugzilla.gnome.org/show_bug.cgi?id=784667
2017-09-01 11:32:24 +02:00