Commit graph

3436 commits

Author SHA1 Message Date
He Junyan
3468edc20b libs: encoder: Add properties for h264 encoder.
Install properties for h264 encoder class. Also set the new get/set
property functions for gobject class. Still use the old properties
way now and this new feature will be enabled later.
2019-08-30 13:42:54 +08:00
He Junyan
beaf45cc6f libs: encoder: add properties and prop help functions
Add all common properties to encoder base class. rate-control and
tune are moved to sub class.
2019-08-30 13:30:04 +08:00
He Junyan
6978eae21a libs: encoder: delete useless gst_vaapi_encoder_new func.
GstVaapiEncoder is a abstract gobject and never be created directly.
2019-08-30 13:06:50 +08:00
He Junyan
c4a47f91ba lib: encoder: gstobjectfy all vaapi encoders.
Replace all gstvaapiobject in vaapi encoders with standard gstobject.
Let the gstobject common logic to handle all the init and finalize
works. But the property install/set/get still use the old way, need
to be improved later.
2019-08-30 13:05:50 +08:00
Víctor Manuel Jáquez Leal
d671197684 vaapipostproc: check for filter before appending caps
While ensuring the allowed sink pad caps, the filter attributes set
the frame size restriction, but it is not ensured, at that moment,
that the filter is already instantiaded.

In order to silence the glib logs, this patch add only calls
gst_vaapi_filter_append_caps() if the filter is instantiated.
2019-08-29 11:03:30 +00:00
Thibault Saunier
9fe6b621a2 Classify vaapidecodebin as a hardware decoder 2019-08-28 12:49:03 -04:00
He Junyan
70cefdd272 libs: postproc: fix a memory leak point.
filter_ops and filter_formats should already have valid value when
the function gst_vaapipostproc_ensure_filter_caps re-enter
2019-08-27 16:33:34 +00:00
He Junyan
51963b1a74 libs: util: Fix a memory leak in config_surface_attributes_get 2019-08-27 01:30:36 +08:00
Wangfei
6f8ea02b61 vaapidecode: support transform ROI meta
This will benefit the use case like:

src --->   encode    ---> decode ---> circle ROI ---> sink
     |                |
     --> analyse to -->
         get ROI
2019-08-26 09:36:54 +00:00
Mathieu Duponchelle
0592731715 docstrings: port ulinks to markdown links 2019-08-23 19:10:15 +02:00
Víctor Manuel Jáquez Leal
b36eea201f libs: remove context's overlay
The context overlay was an optimization to apply a video composition
to all the surfaces bound to a context.

But since commit 18031dc6 this optimization was disabled, so it is
better just get rid of it.
2019-08-20 17:12:32 +02:00
Víctor Manuel Jáquez Leal
dae057588b libs: remove surface's parent context
In commit 18031dc6 surface's parent context is not assigned because of
circular references. Since then (2013), there's has no issue with
subpictures attached to a context, the current only users of this API.

This patch cleans up all of related code with the unused surface's
parent context.
2019-08-20 17:11:23 +02:00
Víctor Manuel Jáquez Leal
e8b52f59f5 vaapidecode: guard if no structure is available in caps 2019-08-19 17:26:55 +00:00
Víctor Manuel Jáquez Leal
f88d18bebe vaapipostproc: append frame size restrictions in caps 2019-08-19 17:26:55 +00:00
Víctor Manuel Jáquez Leal
13e369aad6 libs: profilecaps: refactor common code 2019-08-19 17:26:55 +00:00
Víctor Manuel Jáquez Leal
6f61252f9d vaapiencode: set frame size restrictions in caps
Fixes: #12
2019-08-19 17:26:55 +00:00
Víctor Manuel Jáquez Leal
3ba3966fc3 vaapiencode: enhance how the profile is defined
This code doesn't define the profile used by the internal encoder, but
it used to "predict" which is going to be used and to get the caps
restrictions.

Before the profile was predicted by checking the donwstream caps, but
sometimes they are not defined, setting an unknown profile. In order
to enhances this situation, the encoder asks to internal encoder if it
has one. If so, it is used.

To ask the internal encoder's profile a new accessor function was
added: gst_vaapi_encoder_get_profile()
2019-08-19 17:26:55 +00:00
Víctor Manuel Jáquez Leal
bd3d347fd7 libs: profilecaps: defines gst_vaapi_profile_caps_append_encoder()
Previously it was just a boilerplate. Now it is real implementation.
2019-08-19 17:26:55 +00:00
Víctor Manuel Jáquez Leal
ab4ba47bbf libs: utils: treat va_rt_format as bitwise flag
The return value of vaGetConfigAttributes() of VAConfigAttribRTFormat
is a bitwise flag with *all* the supported chroma types.

Previously it was assumed that the return value was a single value,
thus when returning the GST_VAAPI_CHROMA_TYPE_XXX the code was a
simple case. But it is wrong.

This patch changes the case block with a sequence of ifs testing the
bitwise. For now we assume a "priority" list in the testing sequence.
2019-08-19 17:26:55 +00:00
Víctor Manuel Jáquez Leal
1c73dc969c libs: profile: add gst_vaapi_profile_get_va_name()
gst_vaapi_profile_get_name() returns a proper name for
GstCaps. Nonetheless, there are many profiles which don't have a name
representation for that realm.

gst_vaapi_profile_get_va_name() returns the name of the profile
according to its VAProfile name.

This new funtion is used in the encoder error message.
2019-08-19 17:26:55 +00:00
Víctor Manuel Jáquez Leal
f7c1ac036d libs: profilecaps: move caps config into a new file
Implement all the appending of frame size restrictions in caps, for
encoders and decoders, in a new source file.
2019-08-19 17:26:55 +00:00
Víctor Manuel Jáquez Leal
4b5459b1b1 libs: decoder: ref the caps as property 2019-08-19 17:26:55 +00:00
Víctor Manuel Jáquez Leal
b1e7f974b2 libs: context: add gst_vaapi_context_get_surface_attributes()
This function copies the surface attributes from the context's object
to the caller.
2019-08-19 17:26:55 +00:00
Víctor Manuel Jáquez Leal
738be524b1 libs: move memory types conversions to gstvaapiutils
And add more supported memory types by current VA.
2019-08-19 17:26:55 +00:00
Víctor Manuel Jáquez Leal
4851959da8 libs: utils: remove unused function gst_vaapi_get_surface_formats() 2019-08-19 17:26:55 +00:00
Víctor Manuel Jáquez Leal
6376e7e2bd libs: context, filter: use new surface attributes API 2019-08-19 17:26:55 +00:00
Víctor Manuel Jáquez Leal
4ba7c9cae0 libs: utils: add gst_vaapi_config_surface_attributes_get()
To extract the surface restrictions per config using a new structure:
GstVaapiConfigSurfaceAttributes
2019-08-19 17:26:55 +00:00
Víctor Manuel Jáquez Leal
1a5e98fcd2 Split the surface attribute retrieval 2019-08-19 17:26:55 +00:00
Víctor Manuel Jáquez Leal
6cb3e741fd vaapipostproc: handle navigation downstream event
When navigation events contains coordiantes those have to be mapped
to the new size and/or orientation.
2019-08-19 16:48:50 +00:00
Víctor Manuel Jáquez Leal
a6aba119b4 test-vaapisink: also use vaapipostproc to change orientation 2019-08-19 16:48:50 +00:00
Víctor Manuel Jáquez Leal
bcb29e8399 vaapipostproc: handle image-orientation upstream event
Now that vaapipostproc can possible handle video-direction, it
should also handle the image-orientation event from upstream if
video-direction property is set to auto.
2019-08-19 16:48:50 +00:00
Víctor Manuel Jáquez Leal
b8a333e0c3 vaapipostproc: add missing locks when adding flags 2019-08-19 16:48:49 +00:00
Víctor Manuel Jáquez Leal
bd175f9956 vaapipostproc: update filter before fixate caps
It is requiered to know if postproc is capable to change the video
direction before fixating the source caps.

In order to do it, it'ss required to know if there's a functional VPP,
but that's checked at create() vmethod, which occurs after caps
fixating.

This patch checks for a functional VPP at fixate caps and, if so,
checks for the enabled filtes and later do the caps fixations.
2019-08-19 16:48:49 +00:00
Víctor Manuel Jáquez Leal
c06b587819 vaapipostproc: element warning if video direction is unsupported
If the video direction is unsupported by the driver, an element
warning is posted in the bus to notify the application.

gst_vaapi_enum_type_get_nick() was added in the library thus it can
be used elsewhere. It retrives the nick from an enum gtype.
2019-08-19 16:48:49 +00:00
Víctor Manuel Jáquez Leal
47ff72a6d4 libs: filter: check mirror and rotation caps only once
This patch locks the display before querying the pipeline caps and
stores the mirror and rotation capabilities, thus they are not queried
every time the video direction is set.
2019-08-19 16:48:49 +00:00
Víctor Manuel Jáquez Leal
e4bb8f5895 libs: encoder: vp9: set VP9_0 profile as default
Commit 0afc8131 introduced a regression and only NV12 format were
admitted, failing in any other valid color format.

This patch sets the profile to GST_VAAPI_PROFILE_VP9_0 by default.
2019-08-16 19:53:55 +02:00
Víctor Manuel Jáquez Leal
d060582798 libs: filter: fail if first color balance value is invalid 2019-08-16 13:25:06 +02:00
Yan Wang
a48625d7ff libs: filter: set all color balance values
When set multiple settings of color balance like hue, saturation,
brightness and contrast for vaapipostproc, they should be set as
parameters of color balance filter, at the same color balance
filter calling.

Otherwise, multiple color balance filter calling will cause
previous setting get reset by the last calling with default value.

Fixes #182.

Signed-off-by: Yan Wang <yan.wang@linux.intel.com>
2019-08-16 13:10:36 +02:00
Wangfei
b9a6dcd7f2 libs: h265dec: remove limitation of get iq matrix
According hevc spec, scaling_list_data is not related
to chroma_format_idc.
2019-08-16 11:44:00 +08:00
He Junyan
e96a435756 libs: videopool: fix undocumented behavior and counting
gst_vaapi_video_pool_reserve_unlocked() hit an undocumented behavoir
because it locks twice the same mutex.

Also, n had different meanings in the current code: as an increase
value and as a new total of allocated surfaces.

This patche removes the undocumented behavoir (usually a deadlock) and
fixes the meaning of n as the new total of allocated surfaces.

Signed-off-by: Víctor Manuel Jáquez Leal <vjaquez@igalia.com>
2019-08-15 16:08:24 +00:00
He Junyan
5939bf4d81 libs: utils: Add missing entries for string_of_VAEntrypoint. 2019-08-15 17:33:13 +02:00
He Junyan
0afc813123 libs: encoder: Consider vp9 profiles based on input format.
Only support GST_VAAPI_PROFILE_VP9_0 and GST_VAAPI_PROFILE_VP9_2 now.

Fix: #184
2019-08-15 14:54:29 +00:00
Víctor Manuel Jáquez Leal
e48b0a90f1 vaapivideomemory: demote error message to info
The main reason to demote the message's level is because it is not an
error, it's a possible output of the trial and there's a code path
that handles it.

Secondly, it's very annoying when using gallium driver for radeon.
2019-08-15 12:58:44 +02:00
Wangfei
9e0c133a24 libs: encoder: h264: support ICQ/QVBR bitrate control mode
ICQ is Intelligent Constant Quality. It will use the initial QP
vaule of icq-quality-factor to adjust QP at MB level intelligently
to improve subjective quality.

QVBR is Quality defined VBR. It will use qvbr-quality-factor to
adjust QP for each MB to get enough quality picture without waste
of bits.
2019-08-05 11:01:19 +08:00
Wangfei
f5c9d86f9c libs: Let GST_VAAPI_RATECONTROL_MASK return unsigned int
The value return from GST_VAAPI_RATECONTROL_MASK will be used by
GST_VAAPI_POPCOUNT32 as its inpput. GST_VAAPI_POPCOUNT32 can only
deal with unsigned int. Otherwise there may be an error of out of
range of integer if we define few more rate-control mode.
2019-08-05 10:51:24 +08:00
Víctor Manuel Jáquez Leal
14ea838512 vaapidecodebin: set queue's max size buffers to 1
Otherwise the queue will swallow all the available decoder's surfaces
reaching a dead-lock.

This setting might impact the bin's peformance, but it's a trade-off.
2019-07-26 12:43:17 +02:00
Víctor Manuel Jáquez Leal
1fa172f032 vaapidecodebin: set properties default values 2019-07-26 12:40:01 +02:00
Víctor Manuel Jáquez Leal
ec9a2a4b4e vaapidecode: don't error if can't push buffers downtream
When the code path goes to push buffers downstream when no surface
available in decoder context, and it fails the code bails out with a
fatal error.

That behavior is wrong, since it shouldn't be fatal. The use case is
when the video stream is disabled.

This patch just ignores the errors in this situation and demotes the
level of a log message.
2019-07-26 12:40:01 +02:00
Wangfei
8b8dfb127a libs: encoder: h264,h265: add new property "max-qp"
Add new property "max-qp" to allow set the maximum quantisation
parameter values.
2019-07-24 17:07:28 +00:00
Wangfei
daab4c80a3 libs: encoder: vp9: 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-07-16 17:58:33 +00:00