Commit graph

1652 commits

Author SHA1 Message Date
He Junyan
b6457e4ce5 libs: encoder: Add a missing comment for DEFAULT_ROI_VALUE property. 2019-05-09 05:54:09 +00:00
He Junyan
a1ae75b500 libs: encoder: Enable trellis quantization method.
The advanced trellis algorithm is supported in VA driver. We add
its support as a property named "trellis" of encoder.
It only works for H264 now, should be more in future.
2019-05-09 05:54:09 +00:00
Wangfei
a4e2db4c0b libs: decoder: vp9: support 422/444 8bit/10bit chroma type.
According to the vp9 sepc, profile 1/3 support 422/440/444 chroma
type, so we need to add subsampling_x&subsampling_y to fix it.

Here is the relationship between chroma type and profile and
subsampling_x&subsampling_y according to vp9 spec:
------------------------------------------
Profile | Bit depth | Chroma subsampling |
------------------------------------------
 0      | 8         | 420                |
------------------------------------------
 1      | 8         | 422,440,444        |
------------------------------------------
 2      | 10, 12    | 420                |
------------------------------------------
 3      | 10, 12    | 422,440,444        |
------------------------------------------

-----------------------------------------------
Subsampling_x | Subsampling_y | Chroma format |
-----------------------------------------------
 0            | 0             | 444           |
-----------------------------------------------
 0            | 1             | 440           |
-----------------------------------------------
 1            | 0             | 422           |
-----------------------------------------------
 1            | 1             | 420           |
-----------------------------------------------
2019-05-08 10:08:55 +00:00
He Junyan
d38f0bbb1d libs: Add packed 24 RGB format support.
Can not find a suitable chrome_type for this GST_VIDEO_FORMAT_RGB
packed 24 format. Just use GST_VAAPI_CHROMA_TYPE_RGB32 as its chrome
type. This kind of surface will just be created by new API with fourcc
and no old style chrome based creation is available.

fixes: #151
2019-05-06 19:28:43 +00:00
Víctor Manuel Jáquez Leal
2541a33d6c libs: encoder: continue if roi meta is NULL
Coverity scan bug:

If the function actually returns a null value, a null pointer
dereference will occur.

In gst_vaapi_encoder_ensure_param_roi_regions(): Return value of
function which returns null is dereferenced without checking
2019-05-03 08:39:03 +00:00
He Junyan
9c1f3ad172 lib: decoder: vp9: Set chroma_type by VP9 bit_depth
The decoder's surface chroma type should depend on the bit depth
of VP9's parser. For 10bits VP9 stream, we need to use P10LE kind
10 bits surface as the decoder result.

Fixes #155
2019-05-03 06:57:11 +00:00
Julien Isorce
aa37f31d54 libs: surface: fix double free when dmabuf export fails
Happens if vaAcquireBufferHandle fails.
2019-05-01 17:40:32 +00:00
He Junyan
a3ce4446c1 libs: h264encoder: fix a typo of GstVaapiEncoderH264PredictionType 2019-04-29 20:10:39 +08:00
Víctor Manuel Jáquez Leal
029bb3e504 libs: encoder: h264,h265: guard VA version for max_qp property
This patch fixes a regression from commit 5b1fe9c6.

max_qp, in rate control configuration, appeared in libva release
2.1 (API 1.1), thus it is required to guard the VA API version.

Fixes: #150
2019-04-15 19:38:01 +02:00
He Junyan
c048594370 libs: Add RGB565 image format support. 2019-04-15 15:24:10 +00:00
He Junyan
3c86fd12cb libs: utils: avoid macro evaluation when stringify
string_of_va_chroma_format() gets a wrong string format description.
For example, the YUV420_10BPP get a string of 0x00000100 as output.

It's because VA_RT_FORMAT_xxx values are macro definitions. And
STRINGIFY(VA_RT_FORMAT_xxx) will expand to its real value
0x00000XXX.

To avoid the macro evaluation, it is changed to show only the color
format without VA_RT_FORMAT_ prefix.
2019-04-15 15:36:28 +02:00
Víctor Manuel Jáquez Leal
7c0ec687cd libs: utils: use glib's macros
Don't reinvent the wheel.
2019-04-15 15:36:28 +02:00
U. Artie Eoff
39e2fe11ed libs: encoder: h265: fill tier in va seq param buf
Now that tier is calculated in commit 58e74f9440 (!68),
ensure we fill in the general_tier_flag in the
VAEncSequenceParameterBufferHEVC.
2019-04-11 08:07:27 +00:00
He Junyan
58e74f9440 libs: encoder: h265: Recognize the correct level and tier.
The current manner can not recognize the correct level and always
set the tier to main. Need to add frame rate check to recognize
levels such as 4.1, 6.2, etc. We also add a logic to check main
and high tier based on bitrate.

Fixes: #145
2019-04-10 15:28:46 +00:00
He Junyan
5b1fe9c68a libs: encoder: h264,h265: Set max_qp if min_qp is non-zero.
media-driver currently fails to set a correct value of max_qp when
min_qp is different to zero, in CBR and VBR mode, generating full
quality frames, thus unexpected huge output.

This patch sets max_qp to an arbitrary value to avoid this output
temporary.

Fixes: #144
2019-04-10 14:59:23 +02:00
Víctor Manuel Jáquez Leal
d4bc0cb6da libs: encoder: h264,h265: initial and minimal QP can be zero
Currently the minimal value for either min_qp and init_qp are 1,
but VA documentation specifiy that zero is also valid and means
to ignore the quantiser.

The default value is not changed though to avoid behaivor changes
to users.
2019-04-09 13:14:18 +02:00
He Junyan
539c39fbe1 libs: encoder: h264_fei: Use gst_param_spec_array for view-ids
GValueArray is deprecated. Use GstValueArray instead.
2019-04-01 13:08:27 +08:00
Víctor Manuel Jáquez Leal
7dc77ebf60 libs: encoder: h264: simplify the view-ids setting 2019-03-29 18:29:51 +01:00
He Junyan
6404bd399d libs: encoder: h264: Use gst_param_spec_array for view-ids
GValueArray is deprecated. Use GstValueArray instead.

gst_param_spec_array can be deserialized from command line using:

vaapih264enc view-ids="<(uint)40,(uint)100>" num-views=2

While the g_param_spec_value_array() can not, and always get
error: "gst_value_deserialize_g_value_array: unimplemented"

Also fixed an out-of-range bug.
2019-03-29 18:18:03 +01:00
He Junyan
6669a7fc57 libs: Change the parameter setting order when encode picture.
The order in gst_vaapi_enc_picture_encode when encoding one
picture is not very correct. The misc parameters are set before
the picture parameters. Some of the misc parameters such as
ROI may change the current picture parameters. But the later
setting of picture parameter will re-init all picture related
parameters and clear the previous setting. The right order
should be picture parameter first and then misc parameters.

Signed-off-by: He Junyan <junyan.he@hotmail.com>
2019-03-29 13:33:41 +08:00
Wangfei
871aecb0d4 libs: decoder: jpeg: support dynamic resolution change decode.
Add size_changed flag to watch out resolution. if change, reset
jpeg decoder's context.
2019-03-28 10:29:57 +00:00
Wangfei
49f363bca2 libs: encoder: h265: add low power mode encode.
By now, this feature only support by media-driver on Ice Lake
platform, more information you can reference:
https://github.com/intel/media-driver
2019-03-26 12:37:46 +00:00
He Junyan
a90bf00906 libs: Fix a typo in comments.
Fix a typo in function description of
gst_vaapi_surface_pool_new_with_chroma_type.

Signed-off-by: He Junyan <junyan.he@hotmail.com>
2019-03-01 12:35:00 +08:00
He Junyan
fd6291cc3c libs: Delete the duplicated ARGB video format.
Two ARGB formats with the same format information.
Should be verbose and delete one.

Signed-off-by: He Junyan <junyan.he@hotmail.com>
2019-02-17 14:35:33 +00:00
Adam Jackson
3d9555a86d glx: Stop specifying GLX_DEPTH_SIZE
This code is just confused. It's asking for at least as many bits of
(z-axis) depth as the root window has bits of (color) depth. For rgb565
or rgb888 this is harmless, but at 10 bits per channel this demands a
30-bit or deeper Z buffer. While some hardware could in principle do a
32-bit Z buffer, Mesa does not expose such fbconfigs (at least on Intel
and AMD).

We're not actually using the Z buffer, so just stop asking for one.
2019-02-17 09:26:55 +00:00
Niels De Graef
f84394fa49 libs: wayland: add support for XDG-shell protocol
[wl_shell] is officially [deprecated], so provide support for the
XDG-shell protocol should be provided by all desktop-like compositors.
(In case they don't, we can of course fall back to wl_shell).

Note that the XML file is directly provided by the `wayland-protocols`
dependency and generates the protocol marshalling code.

[wl_shell]: https://people.freedesktop.org/~whot/wayland-doxygen/wayland/Client/group__iface__wl__shell.html
[deprecated]: 698dde1958
2019-02-16 23:55:42 +01:00
Niels De Graef
8e695c8fdb libs: window: wayland: Prefix wl_shell_surface field with wl_
It will help us to distinguish from other Wayland shell surface
(such as XDG-shell) later on.
2019-02-16 19:14:26 +01:00
Niels De Graef
e980fbf83d libs: wayland: Prefix wl_shell field with wl_
It will help us to distinguish from other Wayland shells (such as
XDG-shell) later on.
2019-02-16 18:45:03 +01:00
Denis Nagorny
4aae03d3c1 libs: display: lock ensure_profile()
Thread safety patch for ensure_profile() function

Fixes #133
2019-02-11 16:14:27 +01:00
Víctor Manuel Jáquez Leal
7afe5311cc vaapisink: x11: trap WM_DELETE_WINDOW message
Register the WM_DELETE_WINDOW message from window manager and
trap it to stop the pipeline cleanly.

Fixes: https://gitlab.freedesktop.org/gstreamer/gstreamer-vaapi/issues/130
2019-01-24 21:11:54 +01:00
Víctor Manuel Jáquez Leal
8bdd1bf5f6 libs: window: remove native-id property
native-id property is problematic since the variable that stores it is
gsize, which is platform specific, and in some is bigger than unsigned
long, and there are not way to handle gsize properties.

Also, GST_VAAPI_ID_INVALID is defined in gsize terms, and we would
like to keep using it for this scope.

This patch removes the native-id property and set it manually in
gst_vaapi_window_new_internal().
2019-01-22 09:46:57 +00:00
Víctor Manuel Jáquez Leal
92af6b82fa libs: window: use G_GSIZE_MODIFIER for window id
gsize type is not equal in all platforms, then the 'l' print modifier
shall not be used always.

This issue was found in Debian builds.
2019-01-22 09:46:57 +00:00
Wangfei
e6943d668a encoder: h264/h265: set SPS cbr_flag with correct value.
The flag only set as 1 when the rate-control mode is CBR.
2019-01-22 08:50:46 +00:00
Víctor Manuel Jáquez Leal
f1877628bb libs: encoder: refactor to avoid code duplication
gst_vaapi_encoder_put_frame() and gst_vaapi_encoder_flush() duplicates
the same code segment where the coded buffer is created, the picture
encoded on it and pushed to the async queue.

The function gst_vaapi_encoder_encode_and_queue() refactor this.
2019-01-14 20:09:57 +01:00
Víctor Manuel Jáquez Leal
220016aa6c libs: encoder: h264/h265: flush pending ordered pictures
In order to flush the pending pictures, a new internal encoder vmethod
is used: get_pending_reordered()

This method follows an iterator pattern which will return the next
picture to encode and push.

The base encoder will call this function in a loop when flush() is called.

For now, only H.264 and H.265 encoders implement this flushing mechanism.
2019-01-14 20:09:57 +01:00
Wangfei
f50fb8748f libs: encoder: h264/h265: fix encode lose frame issue.
Instead of dropping all remain frames in reorder_frame_list during
flush, keep encoding.

https://gitlab.freedesktop.org/gstreamer/gstreamer-vaapi/issues/97
2019-01-14 19:08:29 +00:00
Wangfei
14587eb8e8 vaapipostproc: clean up USE_VA_VPP macro since it already removed from
configure file.
2019-01-11 13:50:22 +08:00
Haihao Xiang
5b447753da meson: build h264 fei encoder if possible 2019-01-07 17:46:42 +00:00
Haihao Xiang
920b1ec7a8 vaapi: bump the minimum vaapi version requirement to 0.39.0
And reduce unnecessary API version and structures check as well.

https://gitlab.freedesktop.org/gstreamer/gstreamer-vaapi/issues/108
2019-01-07 17:46:42 +00:00
Víctor Manuel Jáquez Leal
e4ae7d9879 libs: window: remove custom ref() and unref()
Use gst_object_ref() and gst_object_unref() instead.
2018-12-24 12:20:00 +00:00
Víctor Manuel Jáquez Leal
8ef95a7dc2 libs: window: use its own debug category 2018-12-24 12:20:00 +00:00
Víctor Manuel Jáquez Leal
6c364cb9a7 libs: window: refactor as gobject
This is another step in the gobjectification of the internal library
of gstreamer-vaapi. Now it is the turn of GstVaapiWindow and its
derivates.

The idea is to minimize the changeset keeping the same design as
much as possible.

GstVaapiWindow is defined as an abstract class with two properties:
the GstVaapiDisplay and the native ID. Thus, many of the
GstVaapiObject macros were copied as GstVaapiWindow macros.

The function gst_vaapi_window_new_internal() is kept as a decorator
of for calling gst_vaapi_window_create() and the possibility of
failure.

The descendant classes, such as glx, still use the private
structures, but through the gobject mechanism.
2018-12-24 12:20:00 +00:00
Víctor Manuel Jáquez Leal
7b782be5dd libs: filter: use its own debug category 2018-12-24 12:20:00 +00:00
Niels De Graef
e73e69a480 Use G_DEFINE_TYPE_WITH_PRIVATE if applicable
This gets rid of the strange `do_init` macro and makes the intent a bit
more clear.
2018-12-10 10:54:53 +01:00
Wangfei
5e7988b2d8 libs: dec: h265: support decode for main-444 10bit streams.
Add 444 10bit yuv format Y410, which can be used to decode
main-444 10bit streams. Currently, this feature is only
supported by media-driver in Icelake.
2018-12-04 13:25:59 +08:00
Wangfei
5d0878b48a libs: dec: h265: support decode for main-444 8bit streams.
Add 444 8bit yuv format AYUV, which can be used to decode
main-444 8bit streams. Currently, this feature is only
supported by media-driver in Icelake.

https://gitlab.freedesktop.org/gstreamer/gstreamer-vaapi/issues/119
2018-11-14 02:29:54 +00:00
He Junyan
90d8350820 libs: Sync the GstVaapiChromaType to VA header file.
Add more kinds of chrometype which will be used to describe
new video formats. Sync it with 1.4.0 version header file.
Alse delete useless GST_VAAPI_CHROMA_TYPE_YUV410 chrome type.

Signed-off-by: He Junyan <junyan.he@hotmail.com>
2018-11-10 19:57:40 +01:00
Tim-Philipp Müller
de6883f6d0 meson: link with -lm
Fixes #117 hopefully.
2018-11-09 23:55:05 +00:00
Junyan He
14c283f891 libs: Modify the video format of endianness.
We lack some video format because endianness declare.
The video format should not directly relate to endianness. For example,
ARGB on big endian should not be simplely seen as BGRA on little endian
machine. We should provide endianess convert or format convert help
functions if endianness does not match.

https://gitlab.freedesktop.org/gstreamer/gstreamer-vaapi/issues/112

Signed-off-by: Junyan He <junyan.he@intel.com>
2018-11-07 13:29:15 +01:00
Wangfei
b26f3d989d libs: encoder: h264/h264fei: remove unuseless code.
The variable are set twice, remove previous one.

https://bugzilla.gnome.org/show_bug.cgi?id=797365
2018-11-05 14:11:27 +01:00