Commit graph

3411 commits

Author SHA1 Message Date
Wangfei bc1ca96e67 libs: enc: h265: reset num_ref_idx_l1_active_minus1 when low delay B.
When enable low delay B, the reference list 1 will be same with
reference list 0, so need reset the num_ref_idx_l1_active_minus1
to num_ref_idx_l0_active_minus1.

Fixes: #160
2019-05-17 10:01:18 +08:00
Thibault Saunier 4fe9c0535f meson: Fix call to wrong function 2019-05-13 19:05:58 -04:00
Thibault Saunier b0f5a59760 docs: Port to hotdoc 2019-05-13 17:00:00 -04:00
He Junyan 0af3e36068 libs: encoder: not call ensure_num_slices inside g_assert
g_assert will take no effect when glib's G_DISABLE_ASSERT macro is
defined. The function inside the g_assert will take no effect and
we will fail to set the correct slice number.
2019-05-10 18:29:13 +08:00
Wangfei 47d256b24c libs: h265: dec: Add extension flags setting.
Use VAPictureParameterBufferHEVCExtension&
VASliceParameterBufferHEVCExtension to pass extension setting from
some extension profile clips which may include these information.
The hevc extension setting only supported after libva release 2.2.0
(API 1.2.0).
2019-05-09 06:27:42 +00:00
U. Artie Eoff be496a66c5 libs: encoder: add target-percentage property
Allow users to set the target-percentage for
variable rate controls.  The default value is
70 (as hard-coded prior).

v2: minimum allowed value changed from 0 to 1
v3: target-percentage unchanged if CBR used

Resolves #129
2019-05-09 06:15:35 +00:00
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
Wangfei 2ee518a988 vaapiencode: handle DMABuf caps feature in sink pad
Add DMABuff caps features in all encoders' sink pad.
2019-05-06 16:54:00 +02: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
Víctor Manuel Jáquez Leal 838045b9e2 vaapipostproc: don't do any color conversion when GL_TEXTURE_UPLOAD
https://bugzilla.gnome.org/show_bug.cgi?id=748184 has resurrected
with commit 3e992d8a

Since gst_vaapi_find_preferred_caps_feature() returns a color format
from caps negotiation, different from the default one (NV12), the
postproc enables the color transformation. But when GL_TEXTURE_UPLOAD
feature is negotiated, no color transformation shall be done.

Nonetheless, with commit 3e992d8a the requested format changes
firstly, because there's no video sink yet, so ANY caps are
negotiated; but later, when there's a video sink and a caps
renegotiation, the GL_TEXTURE_UPLOAD is negotiated though the color
format conversion still ongoing. It is required to reset that
conversion.

This patch force default color format when GL_TEXTURE_UPLOAD is
selected as preferred, thus avoiding the color conversion.

Fixes: #157
2019-05-02 16:47:28 +02: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
Tim-Philipp Müller 0e83a2ae57 Back to development 2019-04-19 11:00:07 +01:00
Tim-Philipp Müller 2c3480796a Release 1.16.0 2019-04-19 00:38:13 +01:00
Tim-Philipp Müller a9c4a4b9ce Update docs 2019-04-19 00:38:12 +01: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
Víctor Manuel Jáquez Leal d506dacc6b build: configure: delay USE_GTK conditional until check libva-x11
libva-x11 is used for X11 applications, so it is required to build
any GTK application.

Later, when Wayland test is added, we should change this.
2019-04-15 15:42:02 +02:00
Víctor Manuel Jáquez Leal 43542a50ab build: configure: disable GLX if libva-x11 is not found 2019-04-15 15:42:02 +02: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
Wangfei e88f349c6f plugins: find the preferred format from right caps.
When the downstream has any caps, then raw video feature will
be used. At this situation, the preferred format should be chose
from caps which contains "vide/x-raw" feature instead of from
the fist allowed caps.

Fixes #142
2019-04-11 08:40:38 +00: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
Tim-Philipp Müller 07d43f75ba Release 1.15.90 2019-04-11 00:40:04 +01:00
Tim-Philipp Müller bdfba172d1 Update docs 2019-04-11 00:40:03 +01: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
Haihao Xiang 81203a6098 meson: build test-vaapicontext when using X11
x11_dep and libva_x11_dep are optional and meson ignores these
dependencies even if they are added into the dependency list.

This fixes the error below when libva-x11 is not avaiblabe:

cc -Itests/elements/tests@elements@@test-vaapicontext@exe
-Itests/elements -I../../gstreamer-vaapi/tests/elements -I.
-I../../gstreamer-vaapi/ -Igst-libs -I../../gstreamer-vaapi/gst-libs
-I/usr/include/gstreamer-1.0 -I/usr/include/glib-2.0
-I/usr/lib/x86_64-linux-gnu/glib-2.0/include -I/usr/include/orc-0.4
-I/usr/include/at-spi2-atk/2.0 -I/usr/include/at-spi-2.0
-I/usr/include/dbus-1.0 -I/usr/lib/x86_64-linux-gnu/dbus-1.0/include
-I/usr/include/gtk-3.0 -I/usr/include/gio-unix-2.0/
-I/usr/include/libdrm -I/usr/include/harfbuzz -I/usr/include/pango-1.0
-I/usr/include/fribidi -I/usr/include/atk-1.0 -I/usr/include/cairo
-I/usr/include/pixman-1 -I/usr/include/uuid -I/usr/include/freetype2
-I/usr/include/libpng16 -I/usr/include/gdk-pixbuf-2.0
-fdiagnostics-color=always -pipe -D_FILE_OFFSET_BITS=64 -Wall
-Winvalid-pch -O2 -g -fvisibility=hidden -fno-strict-aliasing -pthread
-DHAVE_CONFIG_H  -MD -MQ
'tests/elements/tests@elements@@test-vaapicontext@exe/test-vaapicontext.c.o'
-MF
'tests/elements/tests@elements@@test-vaapicontext@exe/test-vaapicontext.c.o.d'
-o
'tests/elements/tests@elements@@test-vaapicontext@exe/test-vaapicontext.c.o'
-c ../../gstreamer-vaapi/tests/elements/test-vaapicontext.c
../../gstreamer-vaapi/tests/elements/test-vaapicontext.c:29:10: fatal
error: va/va_x11.h: No such file or directory
 #include <va/va_x11.h>
2019-04-09 11:39:32 +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
Danilo Spinella f91046bad3 vaapipluginutil: Fix #endif for USE_X11 2019-03-30 18:29:31 +01: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 acf10ce164 vaapiencode: gobject's prop_id differ from vaapi encoder
The vaapi internal encoder's property id are negative, thus they are
different from GObject's property ids.

gst_vaapi_encoder_set_property() should map to the internal encoder
property id, assigned in gst_vaapiencode_default_set_property().
2019-03-25 19:15:38 +01:00
Tim-Philipp Müller 29d42e1600 meson: disable compiler warnings for unused vars and args if gst debug system is disabled 2019-03-21 16:56:34 +00:00
Tim-Philipp Müller 9cbdb7b504 meson: use new 'python' module instead of deprecated 'python3' one 2019-03-21 14:21:10 +00:00
Thibault Saunier bc8ddef96c Update common submodule back to 59cb678164719ff59dcf6c8b93df4617a1075d11
It was wrongly changed in 3d9555a86d
2019-03-11 18:39:57 -03:00
Tim-Philipp Müller e20e48f966 Back to development 2019-03-04 09:16:17 +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
Víctor Manuel Jáquez Leal 3e992d8adb plugin: if any caps in downstream, negotiate raw video
When downstream has any caps, vaapi should not shovel vaapi featured
buffers, but rather plain raw video, assuming always the worst case
scenario (downstream cannot handle featured video memory but raw
system memory buffers).

This patch query the peer caps without any filter, to know if
donwstream just ask for any caps, if so jump to the color space
checking, otherwise do the caps intersection and continue with the
feature selection algorithm.

Fixes: #139
2019-02-27 13:13:14 +01:00
Tim-Philipp Müller 3fa74d7838 Release 1.15.2 2019-02-26 12:01:54 +00:00
Tim-Philipp Müller 00af7732f1 Update docs 2019-02-26 12:01:53 +00:00
He Junyan ee21fd9053 vaapivideomemory: Prefer same format for surface and image
We prefer to use the same format between image and surface for gst
vaapi allocator. The old way may choose different formats between
image and surface. For example, the RGBA image may have a NV12 surface.

So we need to do format conversion when we put/get image to surface.

Some drivers such as iHD can not support such conversion and always
cause a data flow error. There may also have some performance cost
for format conversion when put/get images.

So we prefer to use the same format for image and surface in the
allocator. If the surface can not support that format, we then
fallback to find a best one as the surface format.

Co-authored-by: Víctor Jáquez <vjaquez@igalia.com>
2019-02-21 13:41:46 +01:00