Commit graph

3492 commits

Author SHA1 Message Date
Nicolas Dufresne
866a9f069d vaapih264dec: Add a property to assume constrained-baseline
When baseline-as-constrained is set, the decoder will expose support
for baseline decoding and assume that the baseline content is
constrained-baseline. This can be handy to decode streams in hardware
that would otherwise not be possible to decode. A lot of baseline
content is in fact constrained.
2020-01-19 15:55:47 +00:00
Víctor Manuel Jáquez Leal
73159cdc5d vaapih264enc: accept baseline as constrained baseline compatible 2020-01-19 15:14:14 +00:00
Víctor Manuel Jáquez Leal
9f627ef234 vaapih264enc: update level in src caps
And, if downstream requests a specific level, the caps are not
negotiated, because there is no mechanism right now to specify a
custom level in the internal encoder.
2020-01-19 14:26:18 +00:00
Víctor Manuel Jáquez Leal
3df5bfc06d libs: encoder: h264: document gst_vaapi_encoder_h264_supports_avc() 2020-01-19 14:57:38 +01:00
Víctor Manuel Jáquez Leal
5e26efbcf2 vaapih264enc: force byte-stream if avc isn't supported
Removing the validation in gst_vaapiencode_h264_get_caps() since that
ought be handled in gst_vaapiencode_h264_set_config()
2020-01-19 14:57:04 +01:00
Philipp Zabel
d576963979 vaaph264enc: suppress avc if the driver does not support packed headers
Do not negotiate AVC output if the driver does not support it.
2020-01-19 14:57:04 +01:00
Philipp Zabel
209e1b5bf0 libs: encoder: h264: Add gst_vaapi_encoder_h264_supports_avc()
AVC output requires packed header support in the driver.
2020-01-19 14:57:04 +01:00
Víctor Manuel Jáquez Leal
38d7297bb6 vaapih264enc: intersect the new proposed caps
Instead of just leave to keep the proposed caps, with the best profile
in the allowed caps, is its intersected again.
2020-01-19 12:54:02 +00:00
Víctor Manuel Jáquez Leal
8b4d18da0a vaapih264enc: propose new profile caps and fixate it
When the available caps doesn't intersect with the allowed caps in the
pipeline, a new caps is proposed rather than just expecting to
iterate.

Later, the intersected caps (profile_caps) is fixated in order to
extract the configuration.
2020-01-19 12:54:02 +00:00
Víctor Manuel Jáquez Leal
a56ac3bffe vaapih264enc: common fail for gst_vaapiencode_h264_set_config()
Add a common fail code path for gst_vaapiencode_h264_set_config().
2020-01-19 12:54:02 +00:00
Víctor Manuel Jáquez Leal
eda173b3b0 libs: encoder: unref formats array if none
The formats array is always created, in order to keep the logic and
to avoid broken caps, if this formats array doesn't contain any
elements, it has to be unref and the function should return NULL.
2020-01-19 10:37:02 +00:00
Víctor Manuel Jáquez Leal
6eafebc804 vaapih264enc: fix log message
Before the log wasn't processed because wrong instance pointer.
2020-01-19 10:46:13 +01:00
He Junyan
25422b6766 plugin: encode: Add H265 main-444 profile.
Expose the main-444 profile to h265enc caps, when the upstream
chooses to use VUYA as input, we choose main 4:4:4 profile to encode
the frames.
2020-01-17 11:02:44 +00:00
He Junyan
633ec98349 libs: encoder: h265: Consider main-444 profile when encoding.
Add support of main-444 profile for parameter setting and packed header
generation.
2020-01-17 11:02:44 +00:00
Víctor Manuel Jáquez Leal
1db3ce56a0 vaapiencode: DMABuf only if PRIME is available
Add DMABuf capsfeature in encoders' allowed sinkcaps only if PRIME
memory type is available in the VA surface attributes of codec
context.
2020-01-17 11:31:57 +01:00
Haihao Xiang
c864e20d2c Add hooks/pre-commit.hook
meson.build in gstreamer-vaapi requires hooks/pre-commit.hook

Copied and pasted pre-commit.hook from other gstreamer modules to make
sure gstreamer-vaapi follows the same code style
2020-01-16 09:25:02 +08:00
He Junyan
6c7d445010 libs: encoder: h265: Set encoder paramters base on entrypoint.
When the tune is NONE, we now can choose entrypoint freely. So the
GST_VAAPI_ENCODER_TUNE macro may not return the correct current
entrypoint.
We also delay CTU size calculation after entrypoint has been decided.
2020-01-15 09:22:52 +00:00
Víctor Manuel Jáquez Leal
9da5196b5a Remove all FEI related
FEI encoders are not actively mantained neither tested, and it is
using infrastructure that is changing and FEI is stopping this
effort.

Also it is required to rethink how FEI can be used in GStreamer.
2020-01-15 07:30:15 +00:00
U. Artie Eoff
1364070eca vaapioverlay: ensure sinkpad has current buffer
Use the gst_video_aggregator_pad_has_current_buffer API
to check if the current sinkpad has a queued buffer before
attempting to obtain a input buffer from the base plugin.
If the sinkpad does not have a current buffer, then it is
either not producing them yet (e.g. current time < sinkpad
start time) or it has reached EOS.

Previously, we only handled EOS case.

Example:

 gst-launch-1.0 videotestsrc num-buffers=100 \
  ! vaapipostproc ! vaapioverlay name=overlay \
  ! vaapisink videotestsrc timestamp-offset=1000000000 \
  num-buffers=100 ! video/x-raw,width=160,height=120 \
  ! overlay.
2020-01-14 11:37:22 -08:00
Víctor Manuel Jáquez Leal
889fac3823 vaapioverlay: unroll the recursive call
Recursive functions are elegant but dangerous since they might
overflow the stack. It is better to turn them into a list tranversal
if possible, as this case.
2020-01-14 19:52:18 +01:00
Víctor Manuel Jáquez Leal
d0e14ec308 vaapioverlay: add minimal documentation 2020-01-14 19:52:18 +01:00
Víctor Manuel Jáquez Leal
81f3a7f02b libs: blend: simplify generator API
Instead of using a parent structure that has to be derived by API
consumers, this change propse a simplification by using the common
pattern of GTK of passing a function pointer and user data which will
be passed as its parameter. That user data contains the state and the
function will be called to update that state.
2020-01-14 19:52:18 +01:00
U. Artie Eoff
f97d858237 libs: blend: remove begin/render/end API
This API was risky and is superseded by the surface
generator (process) API.

Resolves #219
2020-01-14 19:01:46 +01:00
U. Artie Eoff
edca6efede vaapioverlay: use blend surface generator API
See #219
2020-01-14 19:01:41 +01:00
U. Artie Eoff
1363b53a9f libs: blend: add surface generator API
This new API allows the user to call a single method (process)
which handles the [display] lock/unlock logic internally for
them.

This API supersedes the risky begin, render, end API.
It eliminates the need for the user to call a lock method
(process_begin) before processing the input buffers
(process_render) and calling an unlock method (process_end)
afterwards.

See #219
2020-01-14 15:07:32 +00:00
He Junyan
36fd4d5d8a plugin: encode: List all possible profiles to detect input formats.
The current get_profile just return one possible profile for the encode,
which is not enough.  For example, if we want to support HEVC 4:4:4
profile, the input of encode should be VYUA rather than NV12 in HEVC
main profile. So the command line:

gst-launch-1.0 videotestsrc num-buffers=200 ! capsfilter \
caps=video/x-raw,format=VUYA,width=800,height=600 ! vaapih265enc \
tune=low-power init-qp=30 ! fakesink

can not work because vaapih265enc just report NV12 in sink caps, we need
to specify the profile obviously like:

gst-launch-1.0 videotestsrc num-buffers=200 ! capsfilter \
caps=video/x-raw,format=VUYA,width=800,height=600 ! vaapih265enc \
tune=low-power init-qp=30 ! capsfilter caps=video/x-h265, \
profile=main-444 ! fakesink

The encode should have the ability to choose the profile based on input
format automatically. If the input video format is VUYA, the main-444
profile should be auto choosed.

We modify to let get_allowed_profiles of each encode sub class to return
an array of all supported profiles based on downstream's allowed caps, or
return NULL if no valid profiles specified by downstream.
If no allowed profiles found, all profiles which belong to the current
encoder's codec will be the candidates.
The function gst_vaapi_encoder_get_surface_attributes collects the surface's
attributes for that profile list we just get.

So for this case, both NV12 and VUYA should be returned.

TODO: some codec like VP9, need to implement the get_profile() function.
2020-01-14 11:36:18 +00:00
He Junyan
67e7e15408 plugin: util: add helper function to detect profiles in caps. 2020-01-14 11:36:18 +00:00
He Junyan
0a2a25981c libs: encoder: add a helper function to get all supported profiles 2020-01-14 11:36:17 +00:00
Seungha Yang
3737692dd4 libs: decoder: Don't unref null object
** (gst-launch-1.0:9789): CRITICAL **: 15:29:09.330:
  gst_vaapi_context_unref: assertion 'context != NULL' failed
2020-01-13 09:03:47 +01:00
U. Artie Eoff
ad31d5bb81 plugins: overlay: use proper NULL check on double pointer
Check the address of the variable is not NULL,
not the address of the pointer.
2020-01-10 17:40:56 +00:00
He Junyan
40eceaf64a libs: codedbuf: delete a useless field.
The context field in GstVaapiCodedBuffer is not inited correctly
and is never used, just delete it.
2020-01-08 23:42:21 +08:00
Víctor Manuel Jáquez Leal
11a8175fff plugins: add iHD driver in whitelist 2020-01-08 12:07:57 +00:00
He Junyan
9bfc8240b4 libs: encoder: modify 265 SPS header's profile compatibility flag.
Make the SPS profile compatibility flags more precisely conform to
the HEVC Spec.
2020-01-08 17:48:22 +08:00
Víctor Manuel Jáquez Leal
742d7e17e6 test: vaapioverlay: bail test if not available
vaapioverlay is only registered if the VA driver support the blend
operation.

This patch only executes the test if vaapioverlay is available,
otherwise the test is bail out without raising an error.
2020-01-06 20:58:17 +01:00
Víctor Manuel Jáquez Leal
e4b4836170 tests: vaapioverlay: force drm backend 2020-01-06 20:58:17 +01:00
Víctor Manuel Jáquez Leal
db338f1316 libs: blend: update to new mini-object API 2020-01-06 19:56:10 +00:00
U. Artie Eoff
a3c2c93216 tests: check: add basic vaapioverlay test
Add test_overlay_position test to verify sink_1 input
is overlayed onto sink_0 input at the appropriate
position.
2020-01-06 19:56:10 +00:00
U. Artie Eoff
d28ffd73c3 plugins: add vaapioverlay plugin
A plugin similar to the base compositor element but
uses VA-API VPP blend functions to accelerate the
overlay/compositing.

Simple example:

 gst-launch-1.0 -vf videotestsrc ! vaapipostproc \
  ! tee name=testsrc ! queue \
  ! vaapioverlay sink_1::xpos=300 sink_1::alpha=0.75 \
  name=overlay ! vaapisink testsrc. ! queue ! overlay.
2020-01-06 19:56:10 +00:00
U. Artie Eoff
b76c0a0caf libs: add a vaapi blend class
Support for the VA-API VPP blend functions.
2020-01-06 19:56:10 +00:00
U. Artie Eoff
894c1da6c7 plugins: base: add GstVideoAggregator subclass support 2020-01-06 19:56:10 +00:00
He Junyan
1b7f737ecd libs: image: init all image fields correctly. 2020-01-06 17:55:09 +00:00
Stéphane Cerveau
3cde7db1d3 doc: fix pipeline typo in vaapipostproc 2020-01-06 17:41:53 +01:00
He Junyan
d687e2cb78 libs: encoder: modify 265 VPS header fields.
vps_base_layer_internal_flag and vps_base_layer_available_flag
have been clearly defined now.
2020-01-03 15:29:14 +00:00
He Junyan
196fef9392 libs: display: fix a resource leak in X11 pixmap format. 2020-01-03 06:49:07 +00:00
Víctor Manuel Jáquez Leal
b3570febf7 libs: utils: delete useless gst_vaapi_profile_caps_append_encoder. 2020-01-02 18:01:52 +01:00
He Junyan
a6cf75e8c6 libs: encoder: get surfaces resolution the same time with formats.
We can get all the information about the video format at one shot
when we create the test context for getting the supported formats.

The current way to get the width and height ranges are inefficient,
since it calls the function gst_vaapi_profile_caps_append_encoder()
and it creates another temporal context to detect the resolution
information.

Signed-off-by: Víctor Manuel Jáquez Leal <vjaquez@igalia.com>
2020-01-02 18:01:45 +01:00
Víctor Manuel Jáquez Leal
b4d73433c3 libs: encoder: vp9: fix code style 2019-12-29 17:58:36 +01:00
He Junyan
3398c64036 libs: encoder: set entrypoint based on tune automatically
Some profile, such as H265_MAIN_444 on new Intel platform, may only
support ENTRYPOINT_SLICE_ENCODE_LP entrypoint. This leads two
problems:

1. We need to specify the tune mode like `vaapih265enc tune=low-power`
   every time when we need to use this kind of profile. Or we can not
   create the encoder context successfully.

2. More seriously, we set the entrypoint to a fixed value in
   init_context_info() and so the create_test_context_config() can not
   create the test context for these profile and can not get the
   supported video formats, either.

We now change the entrypoint setting based on the tune option of the
encoder. If no tune property provided, we just choose the first
available entrypoint.
2019-12-29 17:58:36 +01:00
He Junyan
b50f06309a libs: encoder: set context info profile by encoder
Instead of init_context_info() setting the passed profile, it is
assumed that it has to be set by each encoder.

Signed-off-by: Víctor Manuel Jáquez Leal <vjaquez@igalia.com>
2019-12-29 17:58:36 +01:00
He Junyan
4f43d28beb libs: context: add invalid entrypoint symbol
The symbol GST_VAAPI_ENTRYPOINT_INVALID is just a representation of
zero, which was already used as an invalid value tacitly. This patch
only makes it explicit.

Signed-off-by: Víctor Manuel Jáquez Leal <vjaquez@igalia.com>
2019-12-29 17:58:36 +01:00