Commit graph

1866 commits

Author SHA1 Message Date
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
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
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
db338f1316 libs: blend: update to new mini-object API 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
He Junyan
1b7f737ecd libs: image: init all image fields correctly. 2020-01-06 17:55:09 +00: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
He Junyan
c05ce44815 libs: pixmap: Fix a pixmap creation crash.
We use GST_VAAPI_OBJECT_NATIVE_DISPLAY with wrong parameter for x11
pixmap creation, which causes crash if we run the internal test case
of:

test-decode --pixmap
2019-12-29 02:00:51 +08:00
He Junyan
5ad67ea666 libs: encoder: Add NULL pointer check for context when finalize.
Context may be NULL if pipeline fail in early stage, and the
ensure_context will not be called. Need to add a pointer protection
for it.
2019-12-22 15:22:57 +08:00
Víctor Manuel Jáquez Leal
4da8dc2550 libs: display: code clean up 2019-12-20 08:40:54 +01:00
He Junyan
b2cabe2f5b libs: display: refine the profile/entrypoint map.
The old way make the one config for each profile/entrypoint pair,
which is not very convenient for description the relationship
between them. One profile may contain more than one entrypoints
to within it, so a set like data structure should be more suitable.
2019-12-20 07:39:43 +00:00
He Junyan
608ce681e5 libs: surface: port to GstMiniObject
GstVaapiMiniObject and GstVaapiObject are deprecated.

This is the first step to remove them by porting GstVaapiSurface as
a GstMiniBuffer descendant.

Signed-off-by: Víctor Manuel Jáquez Leal <vjaquez@igalia.com>
2019-12-20 05:01:08 +00:00
Víctor Manuel Jáquez Leal
e398f2c245 libs: surface: rename create function names to init
There are several internal functions with 'create' name, but they
don't create any new structure, but rather it initializes that
structure. Renaming those function to reflect better their purpose.
2019-12-20 05:01:07 +00:00
Víctor Manuel Jáquez Leal
84cc6f31a5 libs: surface: use macro accessors 2019-12-20 05:01:07 +00:00
Víctor Manuel Jáquez Leal
af4ff803ff libs: surface: fix internal documentation 2019-12-20 05:01:07 +00:00
He Junyan
6bf33ada4f libs: codedbuffer: port to GstMiniObject
GstVaapiMiniObject and GstVaapiObject are deprecated.

This is the first step to remove them by porting GstVaapiCodedBuffer
as a GstMiniBuffer descendant.

Signed-off-by: Víctor Manuel Jáquez Leal <vjaquez@igalia.com>
2019-12-20 05:01:07 +00:00
He Junyan
d56824c05c libs: image: port to GstMiniObject base class
GstVaapiMiniObject and GstVaapiObject are deprecrated. This is the
first step to remove them, by porting GstVaapiImage as a
GstMiniObject.

Signed-off-by: Víctor Manuel Jáquez Leal <vjaquez@igalia.com>
2019-12-20 05:01:07 +00:00
He Junyan
a6289308ee libs: context: port to a plain C structure
The GstVaapiMiniObject is obsolete and we need to replace it. This
patch turns GstVaapiContext into a plain C structure with its own
reference counting mechanism.

Also this patch removes unused overlays attributes.

Signed-off-by: Víctor Manuel Jáquez Leal <vjaquez@igalia.com>
2019-12-20 05:01:07 +00:00
Víctor Manuel Jáquez Leal
4bb41e6ca3 libs: encoder: h264fei: remove unnecessary check
Issue detected by Coverity

`info_to_pack.h264_slice_header` is always allocated by
gst_vaapi_feipak_h264_encode(), thus checking it to free it afterwards
in doesn't make much sense.  But it requires to be free on the error
path.

There may be a null pointer dereference, or else the comparison
against null is unnecessary.

In gst_vaapi_encoder_h264_fei_encode: All paths that lead to this null
pointer comparison already dereference the pointer earlier
2019-12-17 18:31:36 +01:00
Víctor Manuel Jáquez Leal
f82cec2ce3 libs: encoder: h264fei: remove unnecessary assert
Issue detected by Coverity

An unsigned value can never be negative, so this test will always
evaluate the same way.

In add_slice_headers: An unsigned value can never be less than 0
2019-12-17 18:31:36 +01:00
Víctor Manuel Jáquez Leal
d69a4b8c05 libs: encoder: h264fei: remove unnecessary check
Issue detected by Coverity

There may be a null pointer dereference, or else the comparison
against null is unnecessary.

In gst_vaapi_encoder_h264_fei_encode: All paths that lead to this null
pointer comparison already dereference the pointer earlier
2019-12-17 18:31:36 +01:00
Víctor Manuel Jáquez Leal
47b0932911 libs: encoder: h264fei: don't free memory on stack
Issue detected by Coverity

`info_to_pak` variable in gst_vaapi_encoder_h264_fei_encode() is
declared in the stack, but it is free in
gst_vaapi_feienc_h264_encode() as if declared on the heap.

This patch initializes the structure and removes the free.

A non-heap pointer is placed on the free list, likely causing a crash
later.

In gst_vaapi_encoder_h264_fei_encode: Free of an address-of
expression, which can never be heap allocated.
2019-12-17 18:31:29 +01:00
Víctor Manuel Jáquez Leal
6ecbb8d100 libs: encoder: h264fei: fix surface leak
Issue detected by Coverity

If the FEI mode is not handled the created resources should be
released and return and error code.

The system resource will not be reclaimed and reused, reducing the
future availability of the resource.

In gst_vaapi_encoder_h264_fei_encode: Leak of memory or pointers to
system resources
2019-12-17 17:57:09 +01:00
Víctor Manuel Jáquez Leal
1168d6d548 libs: decoder: h265: skip all pictures prior the first I-frame
Don't try to decode until the first I-frame is received within the
currently active sequence. i965 H265 decoder don't show any artifact
but it crashes.

Fixes: #98
2019-11-29 15:34:05 +00:00
Víctor Manuel Jáquez Leal
6fb5387d5b libs: video-format: remove dead code 2019-11-27 01:45:29 +01:00
He Junyan
f16c93a187 libs: video-format: add GST_VAAPI_FORMATS_ALL
GST_VAAPI_FORMATS_ALL collects all declared formats in video-format
as a caps template string, and make them available in caps with
memory:VASurface feature.

Fixes: #199
2019-11-27 01:44:49 +01:00
He Junyan
a8be369840 libs: video-format: change GST_VIDEO_FORMAT_AYUV to VUYA.
We only support VUYA format in gst vaapi now, need to correct
the mapping.
2019-11-06 22:38:57 +08:00
Tim-Philipp Müller
8af5ef8a0b Remove autotools build 2019-10-14 01:01:27 +01:00
Víctor Manuel Jáquez Leal
58a512b7c5 libs: window: x11: Avoid usage of deprecated API 2019-10-11 17:59:25 +02:00
U. Artie Eoff
600aba57cf libs: filter: fix default orientation regression
Fix regression introduced in f232f87f70
2019-10-09 12:12:23 -07:00
U. Artie Eoff
038b608cde libs: filter: use OP_DATA_DEFAULT_VALUE macro 2019-10-08 10:16:18 -07:00
U. Artie Eoff
f232f87f70 libs: filter: use macro for returning op default value
The code is essentially the same for getting all op default
values.  Thus, use a macro to help minimize code duplication
and [hopefully] encourage using the same mechanism for all
default getters.
2019-10-07 11:39:19 -07:00
U. Artie Eoff
6690031b2b libs: filter: query param spec for default scale method
Related: #159
2019-10-07 11:19:00 -07:00
U. Artie Eoff
3d39143825 libs: filter: query param spec for default skin-tone values
Related: #159
2019-10-07 11:18:59 -07:00
U. Artie Eoff
85ff86e90d libs: filter: query param spec for default video-direction
Related: #159
2019-10-07 11:18:59 -07:00
Yan Wang
4c87644914 vaapipostproc: Use level value for skin-tone-enhancement filter.
Currently the parameter of skin-tone-enhancement filter is forced
to zero. In fact it could be set different value by the user.
So create a new property named as "skin-tone-enhancement-level"
for accepting the used defined parameter value.
At the same time, skin-tone-enhancement is marked as deprecated.
When skin-tone-enhancement-level is set, skin-tone-enhancement
will be ignored.
2019-09-30 18:14:53 +00:00
Víctor Manuel Jáquez Leal
f67ec886a3 libs: decoder: h264, h266: fix g_return_val_if_fail() missuse
g_return_val_fail() documentations says:

  If expr evaluates to FALSE, the current function should be
  considered to have undefined behaviour (a programmer error).
  The only correct solution to such an error is to change the
  module that is calling the current function, so that it avoids
  this incorrect call.

So it was missused in a couple parts of the H264 and H265 internal
decoders. This patch changes that to plain conditionals.

Also, it was included a couple code-style fixes.
2019-09-27 10:53:14 +02:00
Víctor Manuel Jáquez Leal
7fb17b1a34 libs: encoder: remove gst_vaapi_encoder_{ref,unref}()
Since GstVaapiEncoder is a descendant of of GstObject, there is no
need to keep a custom ref()/unref() methods. This patch deletes them.
2019-09-23 19:52:20 +02:00
He Junyan
ea35de9914 libs: encoder: correct encoder's ref/unref function.
GstVaapiEncoder now is a standard gstobject and need to use
gst_object_ref/unref functions.
2019-09-24 01:03:02 +08:00
U. Artie Eoff
1ce66e2ed5 libs: encoder: h264_fei: fix potential overflow before widen
Found by static analysis. encoder->mb_width * encoder->mb_height
is evaluated using 32-bit arithmetic before widen.  Thus, cast
at least one of these to guint64 to avoid overflow.
2019-09-19 11:17:27 -07:00
U. Artie Eoff
2bfef5a454 libs: encoder: h264_fei: remove dead error condition
Found by static analysis.  The feipak is always null
when we reach the error target.
2019-09-19 10:56:57 -07:00
U. Artie Eoff
9c46c15e51 libs: utils: add missing break in switch 2019-09-19 10:56:46 -07:00
He Junyan
f5e1946036 libs: video-format: Make all YUV format available
The YUV formats have no ambiguity for drivers, so we can add them all.
Some old driver(i965) does not implement full get/put image functions
but can use derive image funtions for the YUV format. It does not
report that kind of formats correctly in image query, but will derive
that YUV format image from surface. The dynamic mapping of YUV format
will block that manner.
Adding more YUV format mapping has no side effect. So considering the
legacy driver conformance, we add all YUV formats mapping statically
and dynamic mapping RBG formats

Fix: #189
Fix: #190
2019-09-18 09:05:02 +00:00
Matthew Waters
499e248d4c egl: Fix racyness in display thread creation
Multiple different scenarios could break the display thread creation and
end up blocking waiting for thread o be created.  Fix them all by
correctly waiting for a new boolean to become valid.
2019-09-18 05:36:52 +00:00
Matthew Waters
2e8cdac059 egl: don't advertise a wrapped EGLContext as actually wrapped
It's not actually wrapped as we create a new EGLContext from the passed
in EGLContext.  As a result, the created EGLContext was never destroyed.
2019-09-18 05:36:52 +00:00
He Junyan
6693be476c libs: h264decoder: do not return error for unhandled NAL unit.
Some streams have error data introducing unknown NAL type. There are
also kinds of NAL types we do not want to handle. The old manner will
set a decoder error when encounter this, which cause a latent crash bug.
The decoder may successfully decode the picture and insert it into DPB.
But there are error NAL units after the AU which cause the post unit error
and make that frame dropped. The later output of the picture still want
to ref that frame and crash.
No need to set decoder error when can not recognize or handle the NAL
unit, just skip it and continue.

Fix: #191
2019-09-17 10:54:37 +08:00
Víctor Manuel Jáquez Leal
f0d6263318 libs: encoders: use GST_PARAM_USER_SHIFT to define internal params
This patch makes use of GST_PARAM_USER_SHIFT to define the internal
param in encoders to decide which parameters to expose. Thus
gstreamer-vaapi will not interfere with any change in GStreamer in the
future.

Also, the internal symbol was change to
GST_VAAPI_PARAM_ENCODER_EXPOSURE to keep the namespacing.
2019-09-11 14:32:22 +02:00
He Junyan
b5dd169420 libs: Add BGR10A2_LE support for color space conversion.
Fix: #179
2019-09-10 12:49:39 +00:00
He Junyan
5168611f55 libs: surface: add pointer check for surface_new_from_formats.
The command line:
  gst-launch-1.0 filesrc location=some_name.mjpeg ! jpegparse !
  vaapijpegdec !  videoconvert ! video/x-raw,format=I420 ! vaapisink
will crash on i965 driver because of no pointer check.

We now generate the video format map between GST format and VA format
dynamically based on the image format returned by vaQueryImageFormats.
i965 driver does to report image format of 444P and Y800 forcc, while
the jpeg decoder context VASurfaceAttribPixelFormat use them. We can
not recognize these format and pass a NULL pointer to
gst_vaapi_surface_new_from_formats.
We need to add a pointer check here and let the fallback logic handle
this case correctly.
Other drivers work well.
2019-09-10 12:32:58 +00:00
Víctor Manuel Jáquez Leal
8d8743a494 libs: utils: guard the VAEntrypointFEI symbol
VAEntrypointFEI appeared in libva 2.0.0 (API version 1.0.0)
2019-09-07 13:35:49 +02:00
He Junyan
32bf6f1e09 libs: video-format: Refine the video format mapping.
Improve the mapping between va format and gst format. The new map
will be generated dynamically, based on the query result of image
format in VA driver. Also consider the ambiguity of RGB color
format in LSB mode.
2019-09-06 16:43:14 +00:00
He Junyan
f52d545fd0 libs: encoder: clean two virtual func in encoder class
set_property and get_default_properties functions are no longer
needed for encoder class.
2019-08-30 21:21:04 +08:00
He Junyan
6a590052fc libs: encoder: delete old set_property and property enum feienc264 2019-08-30 21:21:04 +08:00
He Junyan
64f8f62021 libs: encoder: delete old set_property and property enum in h264 fei 2019-08-30 21:21:04 +08:00
He Junyan
617ffd8156 libs: encoder: delete old set_property and property enum in vp9 2019-08-30 21:21:04 +08:00
He Junyan
c92b4f1bb7 libs: encoder: delete old set_property and property enum in vp8 2019-08-30 21:21:04 +08:00
He Junyan
3dcd79e439 libs: encoder: delete old set_property and property enum in mpeg2 2019-08-30 21:21:04 +08:00
He Junyan
1b85ce4882 libs: encoder: delete old set_property and property enum in jpeg 2019-08-30 21:21:04 +08:00
He Junyan
c70dbb0b79 libs: encoder: delete old set_property and property enum in h265 2019-08-30 21:21:04 +08:00
He Junyan
c028d7a413 libs: encoder: delete old set_property and property enum in h264 2019-08-30 21:21:04 +08:00
He Junyan
adcb448276 libs: encoder: delete EncoderPropInfo related functions 2019-08-30 21:21:04 +08:00
He Junyan
25b6be1780 libs: encoder: delete encoder_set_property
We no longer need this obsolete set_property function now after
switch to standard gobject's property manner.
Also delete the old encoder's property enum in the header file.
2019-08-30 21:21:04 +08:00
He Junyan
69f7c95a29 libs: encoder: delete properties_get_default for base class 2019-08-30 21:21:04 +08:00
He Junyan
8ce90bca1e libs: encoder: delete 3 useless init macro 2019-08-30 21:21:04 +08:00
He Junyan
80992191a3 libs: encoder: delete get_default_properties of feienc 2019-08-30 21:21:04 +08:00
He Junyan
8ac7dd556b libs: encoder: delete get_default_properties of H264 Fei 2019-08-30 21:21:04 +08:00
He Junyan
f65647ec25 libs: encoder: delete get_default_properties of VP9 2019-08-30 21:21:04 +08:00
He Junyan
c5cf07631d libs: encoder: delete get_default_properties of VP8 2019-08-30 21:21:04 +08:00
He Junyan
1ca6a42e27 libs: encoder: delete get_default_properties of MPEG2 2019-08-30 21:21:04 +08:00
He Junyan
665a121b51 libs: encoder: delete get_default_properties of JPEG 2019-08-30 21:21:04 +08:00
He Junyan
0ce9f6e637 libs: encoder: delete get_default_properties of H265 2019-08-30 21:21:04 +08:00
He Junyan
fe369fb523 libs: encoder: delete get_default_properties of H264 2019-08-30 21:21:04 +08:00
He Junyan
511a48da56 libs: encoder: delete the useless constructed func for encoder. 2019-08-30 21:21:04 +08:00
He Junyan
eb17703d43 libs: encoder: implement get_view_ids for h264 encoder. 2019-08-30 21:21:04 +08:00
He Junyan
1256680486 gst: encode: enable new type of property mechanism. 2019-08-30 21:19:14 +08:00
He Junyan
bc2f8fd19e libs: encoder: add flags to all encoder properties.
G_PARAM_CONSTRUCT make all properties init correctly, we do not
need to init the properties manually.
G_PARAM_FLAG_VAAPI_ENCODER_EXPOSURE is a vaapi encoder specific
flag, means need to expose the property to according encode class.
2019-08-30 18:39:32 +08:00
He Junyan
46c8b425dd libs: encoder: Add properties for h264 encoder fei.
Install properties for h264 encoder fei 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 18:03:43 +08:00
He Junyan
a65847b2ad libs: encoder: Add properties for h264 fei encoder.
Install properties for h264 fei 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 16:59:23 +08:00
He Junyan
30e79a0940 libs: encoder: Add properties for vp9 encoder.
Install properties for vp9 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 16:17:35 +08:00
He Junyan
ba41bcddc6 libs: encoder: Add properties for vp8 encoder.
Install properties for vp8 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 16:13:24 +08:00
He Junyan
8212c0552e libs: encoder: Add properties for mpeg2 encoder.
Install properties for mpeg2 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 14:06:09 +08:00
He Junyan
8641c27a13 libs: encoder: Add properties for jpeg encoder.
Install properties for jpeg 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 14:01:23 +08:00
He Junyan
9348ed9e1c libs: encoder: Add properties for h265 encoder.
Install properties for h265 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:54:52 +08:00
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
He Junyan
51963b1a74 libs: util: Fix a memory leak in config_surface_attributes_get 2019-08-27 01:30:36 +08: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
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
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
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
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
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
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
U. Artie Eoff
f1aa0cc5e0 vaapipostproc: add rotation support
Adds vpp rotation support to vaapipostproc.  Uses
property video-direction. Default is identity (no
rotation).

Closes #104
2019-07-09 12:26:46 -07:00
Wangfei
e592f6b415 libs: encoder: h265: pass diff_cu_qp_delta_depth flag to driver
Intel media-driver requires enablement of diff_cu_qp_delta_depth when
cu_qp_delta_enabled_flag enabled.

Fixes: #177
2019-07-07 16:46:25 +02:00
Wangfei
b8739a89b0 libs: encoder: Add MB ratecontrol mode to get its string 2019-07-05 16:56:12 +00:00
Wangfei
66d6754fce libs: encoder: refine guard of bitrate control mode
Remove useless guard of all bitrate control mode's guard except MB
which is define in VA-API version 0.39.1.
2019-07-05 16:56:12 +00:00
Jan Schmidt
1e36478b0f h264: Update for parse_vui_params parameter removal.
Update calls to the h264 parser lib for removal of the
parse_vui_params parameter.
2019-07-04 16:52:18 -04:00
Wang Zhanjun
958ea067cb libs: dec: vp9: do not use display size as decoded size
If display size is smaller than current frame size, then the crop size
will be set as display size, which either crashes the pipeline or the
output MD5 does not match. Rather it should use the actual decoded size.

This patch removes the cropping set. For rendering we can use aspect
ratio to set display size.

Fixes #175

Signed-off-by: Wang Zhanjun <zhanjunx.wang@intel.com>
Signed-off-by: Xu Guangxin <guangxin.xu@intel.com>
2019-06-28 18:42:42 +02:00
He Junyan
9b0f041ded libs: dec: h265: Consider chroma_bit_depth to choose chrome type
For some main-10 stream, sometime the luma is 8 bits while chrome is more
than 8 bits, which cause using the wrong NV12 surface as the render target
and decoding error.

Fix #176
2019-06-28 16:49:51 +02:00
Wangfei
67ed67515b libs: decoder: jpeg: add support 400/411/422/444 chroma type
When create vaapi surface, it is better to use the chroma type get
from jpeg file instead of using fixed 420 format. And the correct
chroma type can be determined by horizontal_factor/vertical_factor
flags that get from jpegparse.
2019-06-26 10:36:56 +00:00
He Junyan
3b5c7aa688 libs: dec: h265: Fix profile_idc mapping.
The old mapping values return by gst_vaapi_utils_h265_get_profile_idc is
wrong, though GST_H265_PROFILE_IDC_MAIN and GST_H265_PROFILE_IDC_MAIN_10
happened to be the correct value.

We only support Annex A profile_idc (1-4).
2019-06-25 17:41:24 +02:00
Freyr
1f5ad9c7e5 libs: encoder: vp8,vp9: reset frame_counter when input frame's format changes
When input frame's formate changes, vp{8,9} encoders don't reset their frame
counter, hence the newly created frame could become a P-frame, leading to some
major troubles (sigabrt in libdrm in case of vp9). This patch adds some frame
prediction-related reset logic to the `flush' methods of GstVaapiEncoderVP8 and
GstVaapiEncoderVP9 implementations.
2019-06-06 17:24:30 +03:00
U. Artie Eoff
ed7277a1b7 libs: encoder: increase bitrate prop max value
There are many profile levels that can support
more than 102400 kbps.  Thus, increase the max
allowed bitrate property value from 102400 kbps
to 2048000 kbps (same as msdk encoder plugins).
2019-06-05 08:30:10 +00:00
He Junyan
de51eb0059 libs: mpeg2 encoder: No packed header for SPS and PPS
Dislable passing down packed PPS and PPS to driver if driver does
not want it.

Fix: #168
2019-06-04 11:27:34 +00:00
Víctor Manuel Jáquez Leal
e62b321efe libs: dec: vp9: clear parser pointer after release
Fix an use-after-release of the parser pointer in VP9 decoder.
2019-05-31 13:21:31 +02:00
Mathieu Duponchelle
df3989865e doc: remove xml from comments 2019-05-29 23:08:22 +02:00
U. Artie Eoff
3ccf3f3334 vaapipostproc: add mirror support
Adds vpp mirroring support to vaapipostproc.  Use
property video-direction.  Valid values are identity,
horiz or vert.  Default is identity (no mirror).

Closes #89

v2: Use GstVideoOrientationMethod enum
v3: Don't warn for VA_MIRROR_NONE.
    Use GST_TYPE_VIDEO_ORIENTATION_METHOD type.
v4: Query VAAPI caps when setting mirror value
    instead of during per-frame processing.
v5: Return TRUE in warning cases when setting mirror value.
2019-05-29 09:06:27 +00:00
Mathieu Duponchelle
38d25c65c3 doc: fix some incorrect gtk-doc links 2019-05-29 01:41:37 +02:00
Víctor Manuel Jáquez Leal
bd549246d4 libs: surface: fix documentation format 2019-05-16 16:47:02 +02:00
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
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