Commit graph

1740 commits

Author SHA1 Message Date
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