Commit graph

22 commits

Author SHA1 Message Date
U. Artie Eoff
4573d3eefe vaapipostproc: do not compensate for crop/direction if no VPP
If we do not have functional VPP, then cropping and video
direction is non-functional and we should avoid calling
any of the gst_vaapi_filter* APIs.
2020-02-21 08:49:06 -08:00
U. Artie Eoff
2b6fa19665 vaapipostproc: use sink resolution to calculate src colorimetry
The default output colorimetry is persuaded by the output
resolution, which is too naive when doing VPP cropping
and/or scaling.  For example, scaling 4K(sink)->1080P(src)
resolution (i.e. both YUV) results in bt2020(sink)->bt709(src)
colorimetry selection and some drivers don't support that
mode in vpp.

Thus, if output (i.e. downstream) does not specify a
colorimetry then we use the input resolution instead of the
output resolution to create the default colorimetry.  Also,
note that we still use the output format since it may be a
different color space than the input.  As in the example
above, this will result in bt2020(sink)->bt2020(src)
colorimetry selection and all drivers (afaik) should support
that in vpp.
2020-02-05 10:33:23 -08:00
U. Artie Eoff
c6d8ee737f vaapipostproc: set srcpad colorimetry unconditionally
We always need a srcpad colorimetry for VAAPI VPP
operations.

Also, check the return value of _set_colorimetry.
2020-02-05 10:16:16 -08:00
U. Artie Eoff
654e824555 vaapipostproc: do not override explicit srcpad colorimetry
If colorimetry has been set by a capsfilter (e.g.
vaapipostproc ! video/x-raw,colorimetry=bt709) then
don't try to override it.  Previously, the aforementioned
capsfilter will fail to negotiate if default colorimetry
is not the same as the capsfilter (e.g. 4K resolutions).
2020-02-05 10:16:16 -08:00
U. Artie Eoff
2f0f5e1ef9 vaapipostproc: allow cropping via properties
Add crop-left, crop-right, crop-top and crop-bottom
properties to vaapipostproc.
2019-09-05 10:42:28 -07: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
U. Artie Eoff
4e4ca03bc1 vaapipostproc: update PAR when rotating
When rotating, swap pixel-aspect-ratio during
negotiation.

Fixes #181
2019-07-15 15:33:15 -07: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
Víctor Manuel Jáquez Leal
838045b9e2 vaapipostproc: don't do any color conversion when GL_TEXTURE_UPLOAD
https://bugzilla.gnome.org/show_bug.cgi?id=748184 has resurrected
with commit 3e992d8a

Since gst_vaapi_find_preferred_caps_feature() returns a color format
from caps negotiation, different from the default one (NV12), the
postproc enables the color transformation. But when GL_TEXTURE_UPLOAD
feature is negotiated, no color transformation shall be done.

Nonetheless, with commit 3e992d8a the requested format changes
firstly, because there's no video sink yet, so ANY caps are
negotiated; but later, when there's a video sink and a caps
renegotiation, the GL_TEXTURE_UPLOAD is negotiated though the color
format conversion still ongoing. It is required to reset that
conversion.

This patch force default color format when GL_TEXTURE_UPLOAD is
selected as preferred, thus avoiding the color conversion.

Fixes: #157
2019-05-02 16:47:28 +02:00
Víctor Manuel Jáquez Leal
da77fd5e2e vaapipostproc: remove spurious code
This assignation is dead code, since gst_video_info_from_caps() set
to 1 by default.

https://bugzilla.gnome.org/show_bug.cgi?id=790149
2018-01-18 20:46:22 +01:00
Víctor Manuel Jáquez Leal
ea9c52ea8f vaapipostproc: if no p-a-r in out caps define a range
Instead of copying the pixel-aspect-ratio from the sink caps, define
an open range for the src caps pixel-aspect-ratio. Later it will be
defined.

https://bugzilla.gnome.org/show_bug.cgi?id=790149
2018-01-18 20:46:22 +01:00
Víctor Manuel Jáquez Leal
ce03fa8ed0 vaapipostproc: fix memory leaks 2017-08-01 17:23:48 +02:00
Hyunjun Ko
e7bba345de vaapipostproc: set multivew-mode flags to src caps
vaapipostproc didn't negotiate the proper multiview caps losing
downstream information.

This patch enables the playing of MVC encoded stream by setting
the proper multiview mode/flags and views to src caps, according
to sink caps.

https://bugzilla.gnome.org/show_bug.cgi?id=784320
2017-07-03 13:37:21 +02:00
Víctor Manuel Jáquez Leal
4820d2d09d plugins: handle pixel-aspect-ratio with value 0/1
When downstream negotiates a pixel-aspect-ratio of 0/1, the
calculations for resizing and formatting in vaapipostproc and
vaapisink, respectively, failed, and thus the pipeline.

This patch handles this situation by converting p-a-r of 0/1 to
1/1. This is how other sinks, such as glimagesink, work.

https://bugzilla.gnome.org/show_bug.cgi?id=781759
2017-04-27 11:17:12 +02:00
Víctor Manuel Jáquez Leal
5c3318227b vaapipostproc: fixes for memory leaks
The use of gst_vaapi_value_set_format() and gst_structure_*_value()
requires to clear the used GValue to avoid a memory leak.
2017-04-20 18:48:22 +02:00
Víctor Manuel Jáquez Leal
26fa4df958 vaapipostproc: use sink caps par if not requested
Use the sink caps pixel-aspect-ratio to fixate the src caps, if it
is not already set.

https://bugzilla.gnome.org/show_bug.cgi?id=777395
2017-01-20 19:59:37 +01:00
Víctor Manuel Jáquez Leal
d8abbd7652 vaapipostproc: set interlace mode
if the vaapipostproc is configured to not do deinterlacing, the
interlace-mode in the src caps should be the same as the input caps.

https://bugzilla.gnome.org/show_bug.cgi?id=777395
2017-01-20 19:22:39 +01:00
Hyunjun Ko
08ee0f9e78 vaapipostproc: Add colorimetry attributes to src caps
https://bugzilla.gnome.org/show_bug.cgi?id=766596
2016-06-08 10:17:02 +02:00
Víctor Manuel Jáquez Leal
7baacda91c vaapipostproc: negotiate frame size fixation
Refactor _fixate_frame_size(). Now, instead of fixating the frame size only
using the sink caps, also it use the next capsfilter.

This code is a shameless copy of gst_video_scale_fixate_caps() from
https://cgit.freedesktop.org/gstreamer/gst-plugins-base/tree/gst/videoscale/gstvideoscale.c?id=1.8.1#n634

https://bugzilla.gnome.org/show_bug.cgi?id=758548
2016-05-09 16:57:17 +02:00
Scott D Phillips
4d1b11ed03 vaapipostproc: don't use GstVideoInfo for src caps
Instead of using gst_video_info_to_caps () to generated the fixed src caps,
this patch enables the first step for caps negotiation with a possible
following caps filter.

_get_preferred_caps() will traverse the possible src caps looking for the one
wit the preferred feature and the preferred color format. Then the color
format, the frame size and the frame rate are fixated.

https://bugzilla.gnome.org/show_bug.cgi?id=758548
2016-05-09 16:57:02 +02:00
Víctor Manuel Jáquez Leal
1901e2231b vaapipostproc: move gst_vaapipostproc_fixate_srccaps()
Move gst_vaapipostproc_fixate_srccaps() to gstvaapiposptprocutil.

No functional changes.

https://bugzilla.gnome.org/show_bug.cgi?id=758548
2016-05-09 16:56:10 +02:00
Víctor Manuel Jáquez Leal
606d166b56 vaapipostproc: set early properties restrictions
When running transform_caps() vmethod, returning the srcpad caps, the caps are
early restricted to the element properties set: width, height, format and
force keep aspect.

A new file was added gstvaapipostprocutil.{c,h} where the utilities functions
are stored.

https://bugzilla.gnome.org/show_bug.cgi?id=758548
2016-05-09 14:56:03 +02:00