Commit graph

1529 commits

Author SHA1 Message Date
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