Commit graph

3436 commits

Author SHA1 Message Date
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
He Junyan
61de88e580 plugin: encode: change the dmabuf caps to all supported formats.
The encode's dmabuf caps definition is obsolete, it can support
more formats now. Re-define it to include all supported formats
in video format map.
2019-12-18 20:34:27 +08: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
b55b0538c9 tests: check return calling of gst_navigation_event_parse.*
This issue was detected by Coverity.

If the function returns an error value, the error value may be mistaken
for a normal value.

In cb_mouse_event: Value returned from a function is not checked for
errors before being used
2019-12-17 17:56:51 +01:00
He Junyan
2cad0e5629 plugin: encode: set sink's raw caps to GST_VAAPI_FORMATS_ALL.
Then encode plugin just supports raw formats declared in vaapi video
format map. This modification makes the template caps more precise.
2019-12-16 16:32:39 +08:00
U. Artie Eoff
b1bab9a317 plugins: base: add GstPad param to internal helper functions
The base plugin public API function implementations determine
which pad should be passed to the internal helper functions.
Currently, only the base plugin static sinkpad and static
srcpad are supported/used.  However, this change enables future
API functions to be added that can accept a pad (i.e. request pad)
from an element subclass (e.g. a GstVideoAggregator subclass).
2019-12-11 21:27:48 +00:00
U. Artie Eoff
ca2942176b plugins: base: manage pad-specific data in a single struct
Define a struct (GstVaapiPadPrivate) to encapsulate the
pad-specific data (i.e. buffer pool, allocator, info,
caps, etc.).

Add an interface to retrieve the data struct for a given
pad.

Finally, update the base plugin to use the data struct
throughout the implementation.

This will enable us to easily extend the base plugin in the
future to allow for N-to-1 pad subclasses (e.g. overlay/
composite).
2019-12-11 21:27:48 +00:00
U. Artie Eoff
b384593d3d plugins: use plugin base macros to access pad specific data
Don't access base struct fields directly since the underlying
definition can change.  Instead, use the accessor macros.
2019-12-11 21:27:48 +00:00
He Junyan
f4fc37ccc5 libs: decoder: Modify decode src's template raw formats
We do not need to maintain a standalone list of decoder's output
template for raw formats and that is easy to make mistake(for
example, the AYVU is wrong in that list, should be VUYA).
Just use GST_VAAPI_FORMATS_ALL to replace the raw formats list for
src template.
2019-12-11 19:44:24 +00:00
He Junyan
9d8467dc60 libs: postproc: Modify src/sink template raw formats
We need to provide more precise template caps for postproc's src
and sink pads. The GST_VIDEO_FORMATS_ALL make all video formats
available which are really superfluous.
2019-12-11 16:39:23 +00:00
Thibault Saunier
506b6c53c5 Do not mix declaration and code 2019-12-10 18:44:11 -03: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
U. Artie Eoff
1c3b02daf2 tests: check: vaapipostproc test_orientation_mouse_events
Test that vaapipostproc properly translates mouse events
when using video-direction (orientation).
2019-10-16 12:53:07 -07:00
U. Artie Eoff
8bcfacdb62 tests: check: vaapipostproc test_crop_mouse_events
Test that vaapipostproc properly translates mouse events
when cropping.
2019-10-16 12:53:07 -07:00
U. Artie Eoff
7ce24e6ff7 tests: check: initial unit test support
Add minimal unit test toolchain files and a simple
vaapipostproc unit test.
2019-10-16 12:49:17 -07:00
U. Artie Eoff
97aabe8784 tests: move examples and tests to subfolders
This makes way for adding unit (check) tests.
2019-10-16 12:48:24 -07:00
Tim-Philipp Müller
8af5ef8a0b Remove autotools build 2019-10-14 01:01:27 +01:00
U. Artie Eoff
40bcefcb3b vaapipostproc: fix off-by-one coord translations
When translating navigation x,y coordinates for
video-direction, it is necessary to subtract 1
when using the video dimensions to compute the
new x,y coordinates.  That is, a 100x200 image
should map coordinates in x=[0-99],y=[0-199].

This issue was found with unit tests provided
in !182.
2019-10-11 16:37:31 +00:00
Víctor Manuel Jáquez Leal
58a512b7c5 libs: window: x11: Avoid usage of deprecated API 2019-10-11 17:59:25 +02:00
Víctor Manuel Jáquez Leal
f80dee40c8 build: halt meson configuration if no renderer API
We should halt meson configuration if there is no render API
installed (either DRM, Wayland or X11).

That behavior was already in autotools but missed in meson. This patch
brings it back.

Fixes: #196
2019-10-11 17:13:34 +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
U. Artie Eoff
8ec5adcae8 add .gitignore 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
73ac0c4e50 gst: encode: h264_fei: remove useless comparison
The expression "len >= 0" is always true since "len"
is an unsigned type.  And it is clear that the writers
intention was not to write "len > 0" since we handle
len == 0 in the ensuing "if (len < 3)" conditional
block.
2019-09-19 12:09:35 -07: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