Commit graph

606 commits

Author SHA1 Message Date
Mengkejiergeli Ba 9c8cb97db9 msdkh264enc: Add intra refresh parameters
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2308>
2022-05-27 02:15:42 +00:00
Jan Schmidt 6c0423b861 amc: Don't map input buffer with write mode
When copying data out of a GStreamer buffer, we don't
need to map it writable.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2492>
2022-05-26 12:44:03 +00:00
He Junyan 2042c2d4f0 va: H264enc: Add encoder for VAEntrypointEncSliceLP.
We name vah264lpenc to support H264's VAEntrypointEncSliceLP encoder.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2472>
2022-05-25 20:40:48 +00:00
He Junyan d47416d3a2 va: encoder: Do not reset the frame count when reconfig().
We should not reset the input/output_frame_count when some configure
changes. For example, the if resolution changes, the current way just
resets the frame count and make the PTS of the output buffer restart
from the original PTS of the first frame. That causes a lot of QOS
event and drop all the new frames.
We should only reset them when encoder start().

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2489>
2022-05-25 18:56:34 +00:00
He Junyan 994f2c56e2 va: encoder: change reset_state() to a virtual function of base class.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2489>
2022-05-25 18:56:34 +00:00
U. Artie Eoff 8a161880fc vacompositor: check caps and info return values
Check return values for get caps and video info from caps.

This was flagged by static analysis.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2480>
2022-05-25 10:16:00 +00:00
Seungha Yang 9b128f1841 d3d11decoder: Don't print error log on negotiation failure
It may not be a critical error and even expected when shutting down
pipeline or flushing.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2483>
2022-05-25 05:46:40 +09:00
Erwann Gouesbet 09a45c37ca d3d11screencapture: Fix missing/outdated cursor shape
d3d11screencapture can miss a cursor shape to draw or draw an outdated cursor shape.
 - AcquireNextFrame only provides cursor shape when there is one update
 - current d3d11screencapture skips cursor shape when mouse is not drawn

So, if a gstreamer application uses d3d11screencapture with cursor initially not drawn
"show-cursor"=false and then switches this property to true, the cursor will not be
actually drawn until AcquireNextFrame provides a new cursor shape.
This commit makes d3d11screencapture always update the cursor shape information, even
if the mouse is not drawn. d3d11screencapture will always have the latest cursor shape
when requested to draw it.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2485>
2022-05-24 20:10:00 +00:00
Víctor Manuel Jáquez Leal 8433bab0b5 va: Avoid unused variable if logging is disabled.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2478>
2022-05-24 19:07:47 +00:00
Víctor Manuel Jáquez Leal 84c0d02755 va: Keep include's code style
Headers are in alphabetical order.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2465>
2022-05-24 13:41:50 +00:00
Víctor Manuel Jáquez Leal 46e536898f vafilter: Fix logging of unsupported alpha blending.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2477>
2022-05-24 12:30:49 +00:00
Seungha Yang 4c384f8356 qsv: Add AV1 encoder element
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2467>
2022-05-23 13:28:11 +00:00
Seungha Yang 8e665fa435 qsvencoder: Move common property to baseclass
adapter-luid and device-path are common for all codecs

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2467>
2022-05-23 13:28:11 +00:00
He Junyan fc75e38496 va: baseenc: No need to check the frame pointer in handle_frame().
No need to check the NULL pointer of "frame" in error handling, it
is assured non-NULL by base class and we already use it everywhere
in this function.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2471>
2022-05-23 15:03:03 +08:00
He Junyan de5952bc83 va: baseenc: include the "vacompat.h" for old version glib.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2463>
2022-05-22 15:03:54 +08:00
U. Artie Eoff d2651a1e0b va: vpp: enable compositor
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2332>
2022-05-21 21:18:15 +02:00
U. Artie Eoff afe8723196 va: vpp: add compositor
New implementation of a VA-API compositor with blend feature.

Various chunks of code was taken from vavpp.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2332>
2022-05-21 21:18:15 +02:00
He Junyan a2920411d3 va: Apply the va base encoder to the vah264enc.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2330>
2022-05-20 22:58:58 +02:00
He Junyan 21a9ba7e7e va: Add the GstVaBaseEnc common object for all va encoders.
Just like the GstVaBaseDec and GstVaBaseTransform, this base encoder
will handle all common logic for all va encoders.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2330>
2022-05-20 22:58:58 +02:00
Seungha Yang 909154a989 qsv: Disable non-MSVC build on Windows
... and remove pointless UWP consideration that will never work.

Cross-compiled binary has an issue which causes deadlock.
Although cerbero will not build this plugin for non-MSVC build,
people can still build this plugin and may complain its brokenness.

See also
https://gitlab.freedesktop.org/gstreamer/cerbero/-/merge_requests/854

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2431>
2022-05-17 03:32:10 +09:00
Diogo Goncalves acfc9ae216 avfvideosrc: fix wrong framerate selected for caps
This fix solves an issue where a format that doesn't support the
requested framerate would be selected. It ensures that we use the first
format and framerate pair that supports the requested caps.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2331>
2022-05-13 19:38:45 +00:00
Seungha Yang 858520932c d3d11decoder: Add hardcoded minimum resolution values to caps for NVIDIA
NVIDIA GPUs have undocumented limitation regarding minimum resolution
and it can be queried via a NVDEC API. However, since we don't want to
bring CUDA/NVDEC API into D3D11, use hardcoded values for now
until we find a nice way for capability check.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2406>
2022-05-12 18:20:26 +00:00
Víctor Manuel Jáquez Leal 4c97ffeafb va: basedec: Always select first available format.
If the stream chroma doesn't match with any video format in the source
caps template (generated from va config surface formats) instead of
return unknown, return the first available format in the template,
assuming that the driver would be capable to do color conversions.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2404>
2022-05-11 15:03:54 +02:00
Víctor Manuel Jáquez Leal c47255d148 va: basedec: Select format from template or negotiated caps.
Instead of using a hard-coded list of preferred formats according the
chroma type, now if now caps are pre-negotiated, from template caps
will choose the first format with the same chroma type. If
pre-negotiated, then it will choose the first format, with same chroma
type, from the first caps structure.

Also all the decoders will check if GST_VIDEO_FORMAT_UNKNOWN is
returned, failing the negotiation.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2351>
2022-05-09 08:50:58 +00:00
Dmitry Osipenko fd694d840a v4l2codecs: h264: Set frame type flags
V4L spec now requires decode_params flags to be set in accordance to the
frame's type. In particular this is required by H.264 decoder of NVIDIA
Tegra SoC to operate properly. Set the flags based on type of parsed
slices.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1757>
2022-05-06 13:35:59 +00:00
Seungha Yang e0a9a73adf d3d11screencapturesrc: Fix crash when d3d11 device is different from owned one
GstD3D11ScreenCapture object is pipeline-independent global object
and the object can be shared by multiple src elements,
in order to overcome a limitation of DXGI Desktop Duplication API.
Note that the API allows only single capture session in a process for
a monitor.

Therefore GstD3D11ScreenCapture object must be able to handle a case
where a src element holds different GstD3D11Device object. Which can
happen when GstD3D11Device context is not shared by pipelines.

What's changed:
* Allocates capture texture with D3D11_RESOURCE_MISC_SHARED for the
  texture to be able to copied into other device's texture
* Holds additional shader objects per src element and use it when drawing
  mouse

Fixes: https://gitlab.freedesktop.org/gstreamer/gstreamer/-/issues/1197
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2366>
2022-05-05 18:18:57 +00:00
Seungha Yang 58c94eed84 nvh264dec,nvh265dec: Don't realloc bitstream buffer per slice
Allocated memory size has not been updated which results in
realloc per slice. Fixing it and also release bitstream buffer
on ::close(), not finalize.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2361>
2022-05-05 12:15:27 +00:00
Jakub Adam 03b6dab006 d3d11screencapture: Set viewport when drawing mouse cursor
If there weren't any moved/dirty regions in the captured frame, the
viewport of the ID3D11DeviceContext would be left at whatever previous
value it had, which could lead to the cursor being drawn in a wrong
position and/or in an incorrect size.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2362>
2022-05-04 17:18:32 +02:00
Seungha Yang 33e77782c6 nvcodec: Add AV1 decoder
Adding GstCodecs based AV1 decoder element

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1453>
2022-05-04 01:23:25 +09:00
Seungha Yang 1444dd91c5 meson: nvcodec: Remove unnecessary override option and fix build with non-MSVC
cpp_std=c++11 was hack for macOS build but we don't build this plugin
for Apple device anymore. And add "-Wno-deprecated-declarations"
compile option for gcc/clang

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1453>
2022-05-04 01:10:07 +09:00
Seungha Yang fe4d6bb469 nvcodec: Bump SDK header version to 11.1
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1453>
2022-05-03 23:56:34 +09:00
Seungha Yang 29aab904a8 nvdecoder: Handle DPB size margin in a single place
... instead of each subclass

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2343>
2022-05-03 14:17:49 +00:00
Seungha Yang a8b2fbf77f d3d11decoder: Handle DPB size margin in a single place
... instead of each subclass

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2343>
2022-05-03 14:17:49 +00:00
Seungha Yang 6a4c42c03f codecs: Signal required DPB size for AV1,MPEG2,VP8, and VP9 via new_sequence()
Make all codecs consistent so that subclass can know additional DPB
size requirement depending on render-delay configuration regardless
of codec. Note that render-delay feature is not implemented for AV1
yet but it's planned.

Also, consider new_sequence() is mandatory requirement, not optional

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2343>
2022-05-03 14:17:49 +00:00
Nicolas Dufresne ab839f3642 v4l2codecs: Port to the new tile size helper
This will complete the scaling of width/height shift scaling
as only a partial implementation was made.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2190>
2022-05-02 19:10:43 +00:00
Seungha Yang 4047653275 d3d11h265dec: Assign PRIMARY + 1 rank
Promote d3d11h265dec to be default one if available

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2314>
2022-04-27 20:06:53 +00:00
Seungha Yang dce45586e8 nvvp9sldec: Increase DPB size to cover render delay
This should've included in the previous MR
https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/987
already, but missed.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2313>
2022-04-27 18:35:07 +00:00
Thibault Saunier 3c959ff53e cudaconvert: Enhance debugging when setting video info fails
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2300>
2022-04-26 19:04:06 +00:00
He Junyan 264e577e7e va: dec: Use gst_buffer_pool_config_set_va_alignment() to set alignment.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2282>
2022-04-26 20:26:09 +08:00
Seungha Yang 81ee2a9f2a qsvencoder: Workaround for invalid DTS with VP9
SDK runtime seems to report zero DTS for all frames in case of VP9 but
we don't need to use DTS for the codec.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2291>
2022-04-26 04:51:54 +09:00
Seungha Yang 205a23f456 nvcodec: Stop building for non-{Windows,Linux} target
The other platforms, specifically macOS have not been supported already
because this plugin loads so or dll. Moreover, NVIDIA dropped
support for macOS as of CUDA 11.0. See also
https://developer.nvidia.com/nvidia-cuda-toolkit-11_0_0-developer-tools-mac-hosts

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2283>
2022-04-25 15:50:52 +00:00
Seungha Yang 9f19ca68b3 d3d11videosink: Fix for unhandled mouse double click events
Only window created with CS_DBLCLKS style can receive those mouse
double click events, so we need to use the style for internal/external
windows can get double click events.

Also, passthrough mouse events to parent window in the same message pumping
threads instead of manually forwarding each mouse event.

Fixes: https://gitlab.freedesktop.org/gstreamer/gstreamer/-/issues/1172
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2277>
2022-04-23 13:20:54 +00:00
Xavier Claessens 1a0eea3299 Meson: Fix deprecation warnings
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1876>
2022-04-23 00:33:00 +00:00
Corentin Damman df64280874 cuda-converter: fix nvrtc compilation on non-English locale systems
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2268>
2022-04-22 18:57:22 +00:00
He Junyan 277aa12b86 va: h264enc: Do not let L0 number surplus the HW limitation.
The algorithm to calculate the L0/L1 number may let the L0 number
surplus the HW limitation. We should ensure that limitation after
that calculation.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2202>
2022-04-22 13:32:21 +00:00
He Junyan 43dfe021da va: vpp: Update the colorimetry and HDR fields when fixup src caps.
When we fixup src caps, the current way of handling the HDR fields is not
correct.
1. We trim the HDR fields only when the input caps is not a subset of the
fixup src caps. But in fact, the input caps with HDR fields such as the
"mastering-display-info" can possibly be the subset of the fixup src caps,
if they have all same other fields.
2. We always copy the colorimetry from input caps to src caps if it is
absent. But when hdr-tone-mapping is enabled, the HDR->SDR conversion makes
the colorimetry change. We should use downstream's setting, or just use the
default colorimetry of SDR.

We changes to:
1. If hdr-tone-mapping is enabled, we trim all HDR fields and add a correct
colorimetry.
2. Copy colorimetry from input if it is still absent.
3. Consider the subset replacement.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2244>
2022-04-22 06:53:37 +00:00
Seungha Yang 6a3776c527 qsv: Add GPU description to element long-name on Windows
Would be useful for a multi-Intel-GPU system

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2249>
2022-04-20 18:49:18 +00:00
Víctor Manuel Jáquez Leal 722a6c7708 vapostproc: Notify if hdr-tone-mapping property changes.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2247>
2022-04-20 17:01:52 +00:00
Víctor Manuel Jáquez Leal e207ff905b va: Expose a couple va surface/buffer methods.
And use them in va plugin.

Also, set as default logging category the vadisplay one.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2077>
2022-04-20 15:15:56 +00:00
Xavier Claessens b99ecc78ca Replace gst-i18n-*.h with gi18n-lib.h
GLib guarantees libintl is always present, using proxy-libintl as
last resort. There is no need to mock gettex API any more.

This fix static build on Windows because G_INTL_STATIC_COMPILATION must
be defined before including libintl.h, and glib does it for us as part
as including glib.h.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2028>
2022-04-19 18:01:06 +00:00
Thibault Saunier dcd2ccad59 cuda: Fix typo in gst_cuda_buffery_copy_type_to_string
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1472>
2022-04-19 16:39:43 +00:00
Thibault Saunier c033f8fad2 cuda: Factor out a public GstCUDA library
So applications and elements implemented outside GStreamer can reuse
our infrastructure

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1472>
2022-04-19 16:39:43 +00:00
Thibault Saunier 3549d59725 nvenc: Give more details about errors
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1472>
2022-04-19 16:39:43 +00:00
Seungha Yang c38869212c d3dvideosink: Remove outdated comment
d3dvideosink is not a primary video sink element

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2223>
2022-04-18 20:27:34 +00:00
Seungha Yang dd32e2efbc d3d11decoder: Do not preallocate texture using downstream d3d11 buffer pool
Our decoder implementation does not use downstream d3d11 pool for
decoding because of special requirement of D3D11/DXVA. So preallocation
using the downstream buffer pool will waste GPU memory in most cases.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2211>
2022-04-18 18:31:02 +00:00
He Junyan 4c5d34648c va: h264enc: Fix the forgotten unlock() when getting device path property.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2215>
2022-04-18 12:44:19 +08:00
Seungha Yang 23e280f05b qsvdecoder: Use system memory for non-d3d11 downstream
QSV's memory download implementation seems to be more faster
than our implementation

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2206>
2022-04-17 22:59:48 +09:00
Seungha Yang 9543998aa3 qsv: Add H.265 decoder
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2206>
2022-04-17 20:57:31 +09:00
Seungha Yang d136c98770 qsv: Include single gstva.h
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2206>
2022-04-17 20:57:31 +09:00
Seungha Yang fba44e8a01 qsvh264dec: Don't register element if it's not supported by device
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2206>
2022-04-17 20:57:31 +09:00
Seungha Yang 0692a5dde9 qsvh264dec: Add support for packetized format
Handle avc/avc3 packetized formats

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2206>
2022-04-17 20:57:26 +09:00
Seungha Yang 3c3274a8da qsv: Move debug init into each source file
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2206>
2022-04-17 04:15:13 +09:00
Seungha Yang a9a49c235d qsvdecoder: Reset next_task_index per init_session()
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2206>
2022-04-17 04:15:13 +09:00
Seungha Yang b5a8bef5a7 d3d11decoder: Copy HDR10 related caps field manually
If negotiate() is called from the set_format() chain, sinkpad may not
hold caps yet, so baseclass cannot copy it over to srcpad caps.
Copy them manually.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2203>
2022-04-16 18:36:41 +00:00
Seungha Yang 86cf307a6c qsvencoder: Rename property name i-frames to idr-interval
... and clarify the meaning of the value for each h264 and h265
encoder since the usage of mfxInfoMFX::IdrInterval is different
per codec.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2204>
2022-04-16 23:34:41 +09:00
Seungha Yang f848619ff4 qsvh265enc: Write HDR10 metadata SEI
If device supports HDR10 metadata API, write the information
into bitstream per IDR.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2204>
2022-04-16 23:34:41 +09:00
Víctor Manuel Jáquez Leal a2a6ece487 vah264enc: Use GstVaFeature enum for enabling MBBRC.
GstVaFeature is a common enumeration for auto/disabled/enabled kind of
property setting.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2169>
2022-04-16 11:11:51 +00:00
Víctor Manuel Jáquez Leal 3a7c1ddb3c vah264enc: Move rate-control enum to encoder class helper.
Since it's a common enumeration used, as user setting property, for
most of codecs.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2169>
2022-04-16 11:11:51 +00:00
Víctor Manuel Jáquez Leal 81951c59ef vah264enc: Add device-path property.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2169>
2022-04-16 11:11:51 +00:00
Corentin Damman c68c40a6bc cudautils: fix critical typo in gst_cuda_buffer_fallback_copy
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2194>
2022-04-16 02:16:22 +00:00
He Junyan c5546d476a va: h264enc: Correct the hierarchical level name for pyramid-b frames.
The current way names the level by the number of B frames it contains, the
less it contains, the higher level it is. So the non ref B frames are in the
lowest layer and the B frames in the highest level refer to I/P frames.
But the widely used way is just the opposite, the ref B frames are in the
lower level and non ref B frames are at the highest level.
The is just a terminology change, and does not have any effect for compression
result and quality.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2149>
2022-04-13 08:22:32 +00:00
Seungha Yang 83ba83924a amfh265enc: Handle preset option
Add missing preset option handling

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2165>
2022-04-13 01:46:34 +09:00
Seungha Yang 097919f79b amfencoder: Do shared resource copy only if texture belongs to other device
Staging texture from the same d3d11device can be copied without
shared resource handling

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2165>
2022-04-13 01:42:34 +09:00
Seungha Yang 2548014dfc win32: Enable high-resolution timer for MinGW build
timeapi.h is missing in our MinGW toolchain. Include mmsystem.h
header instead, which defines struct and APIs in case of our MinGW
toolchain. Note that in case of native Windows10 SDK (MSVC build),
mmsystem.h will include timeapi.h

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2153>
2022-04-12 15:09:16 +00:00
Andoni Morales Alastruey 2df32360b2 amfcodec: fix setting quality presets
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2159>
2022-04-12 12:14:04 +02:00
Seungha Yang ad9c435647 amfcodec: Fix for MinGW build
timeapi.h header might not be missing depending on toolchain.
Also do hard meson error if winmm dep is not available but
amfcodec is explicitly enabled.
And fixing various GCC build warning errors.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2155>
2022-04-11 18:44:40 +00:00
Seungha Yang ad434759a9 qsv: Add JPEG encoder
Note that YUY2 is not supported yet, since the format support is not
implemented now.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2142>
2022-04-10 23:38:07 +09:00
Seungha Yang 89293656e4 amfcodec: Update plugin cache
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2143>
2022-04-10 03:15:02 +09:00
Seungha Yang a0d8133d60 nvencoder: Update property names and default values
Update properties of newly written D3D11/CUDA mode encoders
to be consistent with Intel QSV plugin. And rename "zerolatency"
to "zero-reorder-delay" because previous "zerolatency" may
misleading

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2140>
2022-04-09 14:00:35 +00:00
Seungha Yang 7b89cdbefe qsvencoder: Update property names and default values
Stop using MSDK plugins property naming, instead use unified names
and default values to be consistent with newly written NVIDIA encoders.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2140>
2022-04-09 14:00:35 +00:00
Seungha Yang f413449a28 amfcodec: Add support for h264/h265 encoding
New encoder implementations for AMD GPU using AMF API

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2109>
2022-04-08 17:59:12 +00:00
Seungha Yang c41a72a1ff amfcodec: Import AMF SDK headers
SDK version v1.4.24 at the commit of
fbf12cd39f

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2109>
2022-04-08 17:59:12 +00:00
Seungha Yang 6e4ffaee1e msdk: Fix Windows build
Headers of gstva should not be included on Windows

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2141>
2022-04-09 02:13:57 +09:00
Seungha Yang 2291781087 d3d11window: Use ANSI version WIN32 API explicitly
We were using ANSI version APIs implicitly because UNICODE is not
defined by ourselves. But potentially it can be broken if user
defines UNICODE.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2131>
2022-04-08 11:51:37 +00:00
Seungha Yang fb226f4733 d3d11: Run indent
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2131>
2022-04-08 11:51:37 +00:00
Seungha Yang 26fa35dcdf qsvencoder: Don't use USAGE_HINT_ENCODER and enable derived image support
Peformance issue by disabled derived image support was reported

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2111>
2022-04-04 21:18:13 +00:00
Seungha Yang b74da32b5c Revert "vah264enc: Disable derived image support"
This reverts commit 0011feb0d6.

The commit caused performance-wise regression for some platforms

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2111>
2022-04-04 21:18:13 +00:00
Tong Wu 4e97cc24a7 msdk: use mfxU32 instead of uint32_t
Msdk should use mfx variables defined in mfxdefs.h. Replace uint32_t
with mfxU32.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2091>
2022-04-04 20:28:25 +00:00
Seungha Yang 5ed8e416fe nvcodec: Fix typos
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2107>
2022-04-03 22:12:33 +09:00
Seungha Yang 9b5fe81d01 nvencoder: Fix operator overloading
GUID equality check was inverted

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2107>
2022-04-03 22:09:19 +09:00
Seungha Yang 0011feb0d6 vah264enc: Disable derived image support
Behavior of derived image seems to be platform dependent and
it's buggy in some cases.

Fixes: https://gitlab.freedesktop.org/gstreamer/gstreamer/-/issues/1110
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2086>
2022-04-02 07:04:03 +00:00
He Junyan 976356e159 va: h264enc: Do not use USAGE_HINT_ENCODER for input pool.
It seems that the VA_SURFACE_ATTRIB_USAGE_HINT_ENCODER is used only
for the recon surfaces, if we set this flags for input raw surfaces,
the alignment is wrong and we get broken result.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2100>
2022-04-02 06:23:03 +00:00
Xavier Claessens b004464ac6 Remove glib and gobject dependencies everywhere
They are part of gst_dep already and we have to make sure to always have
gst_dep. The order in dependencies matters, because it is also the order
in which Meson will set -I args. We want gstreamer's config.h to take
precedence over glib's private config.h when it's a subproject.

While at it, remove useless fallback args for gmodule/gio dependencies,
only gstreamer core needs it.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2031>
2022-04-01 16:32:17 +00:00
Seungha Yang b5ed0eb4b0 qsvencoder: Add support for VA memory
Use VA allocator and buffer pool implementation for zero-copy
encoding with upstream VA elements

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2030>
2022-03-31 20:48:24 +00:00
Seungha Yang 9c44b32c21 qsv: Use pipeline's VA context
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2030>
2022-03-31 20:48:24 +00:00
Víctor Manuel Jáquez Leal 6d2f57b6c7 libs: va: add VA allocator parameter for derived images usage.
Added GstVaFeature enum type, and new parameter for VA allocator's
set_format() and get_format(). Also added a new parameter in VA pool
gst_va_pool_new_with_config() and
gst_buffer_pool_config_set_va_allocation_params().

This new parameter will define if derived images will by used for
buffer mapping.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2057>
2022-03-31 14:14:45 +00:00
Víctor Manuel Jáquez Leal 8759014f4c va: encoder: Remove unused allocation config.
Since it's also done inside of gst_va_pool_new_with_config().

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2072>
2022-03-30 22:18:06 +00:00
Víctor Manuel Jáquez Leal 599257bf10 vapostproc: Build classification dynamically.
By default, the classification is
"Converter/Filter/Colorspace/Scaler/Video/Hardware", but if VA
post-processor driver supports either color balance, skin tone
enhancement, sharpening or noise reduction, "Effect" is added.

Thus, if vapostproc ranking is raised, it can be chosen by
autovideosink.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2066>
2022-03-30 04:24:35 +00:00
Víctor Manuel Jáquez Leal 400faf7361 va: Set <gst/va/gstva.h> as library single point entry header.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2048>
2022-03-29 19:48:30 +00:00
He Junyan 990fbb3b52 va: Move allocators and pool objects into gstva library.
In order to other plugins use gstva objects, such as allocators and buffer
pools, this merge request move them from the va plugin to the gstva library.

This objects are not exposed in <gst/va/gstva.h> since they are not expected
to be used by users, only by plugin implementators.

Because of the surface copy design, which is used to implement allocator's
mem_copy() virtual function, depends on the vafilter, which is kept inside
the plugin, memory copy through VAPosproc is disabled and removed temporarly.

Also added some missing parameter validation.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2048>
2022-03-29 19:48:30 +00:00
He Junyan 53783eab6c va: Move the video format functions into gstlibva.
Untabifying header file.

The logging category was moved from the plugin generic category to
the display category. It can argue that video formats hacks are
display dependant.

Added validations for input parameters.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2048>
2022-03-29 19:48:30 +00:00
Seungha Yang 886cfecd36 qsvencoder: Add support for dynamic bitrate update
... and add more encoding options.

QSV API supports dynamic bitrate change without IDR insertion.
That's more efficient way of runtime encoding option update
than starting from new sequence with IDR per bitrate option change.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2039>
2022-03-29 15:52:58 +00:00
Seungha Yang a8d7b10cc4 qsvh265enc: Add missing gop-size property
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2039>
2022-03-29 15:52:58 +00:00
Seungha Yang 1a7b23dc02 qsv: Fix mfxFrameAllocator::Lock for encoder
Only read map is possible for encoder input system memory

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2039>
2022-03-29 15:52:58 +00:00
Matthew Waters b8a5e7a4e4 applemeida/texturecache: remove unused variable
Fixes:

../sys/applemedia/videotexturecache.m:71:20: error: variable 'features' set but not used [-Werror,-Wunused-but-set-variable]
  GstCapsFeatures *features;
                   ^

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2046>
2022-03-28 10:30:23 +00:00
Matthew Waters 3ffbb66593 applemedia/corevideobuffer: remove unused variable
Fixes:

../sys/applemedia/corevideobuffer.c:209:19: error: variable 'video_meta' set but not used [-Werror,-Wunused-but-set-variable]
    GstVideoMeta *video_meta;
                  ^

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2046>
2022-03-28 10:30:23 +00:00
Matthew Waters b8f83c9d14 applemedia/iosgl: remove unused variable
Fixes:

../sys/applemedia/iosurfaceglmemory.c:219:41: error: variable 'texfmt' set but not used [-Werror,-Wunused-but-set-variable]
    GLuint tex_id, tex_target, texifmt, texfmt;
                                        ^

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2046>
2022-03-28 10:30:23 +00:00
Matthew Waters 49e452525d vtdec: remove unused variable
Fixes:

../sys/applemedia/vtdec.c:611:35: error: variable 'output_flags' set but not used [-Werror,-Wunused-but-set-variable]
  VTDecodeFrameFlags input_flags, output_flags;
                                  ^

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2046>
2022-03-28 10:30:23 +00:00
Matthew Waters edd9ec0456 avsamplevideosink: remove unused variable
Fixes

../sys/applemedia/avsamplevideosink.m:80:20: error: variable 'gstelement_class' set but not used [-Werror,-Wunused-but-set-variable]
  GstElementClass *gstelement_class;
                   ^

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2046>
2022-03-28 10:30:23 +00:00
Matthew Waters 651cd8e0bb avfassetsrc: fix unused-but-set warning
../sys/applemedia/avfassetsrc.m:1014:12: error: variable 'caps' set but not used [-Werror,-Wunused-but-set-variable]
  GstCaps *caps;
           ^

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2046>
2022-03-28 10:30:23 +00:00
Andrew Pritchard 432354e6d4 Fix GstAmcSurfaceTexture segfault
Check that `self` and `self->callback` are defined. `self` can be set to
`NULL` in `remove_listener`, and `self->callback` can be set to `NULL`
inside `gst_amc_surface_texture_jni_set_on_frame_available_callback`.
This can cause a segfault since the Java object can outlive the C
object, and call the callback after `remove_listener` is called.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2024>
2022-03-28 04:44:21 +00:00
Nicolas Dufresne c9d8b8a972 v4l2codecs: Detect missing M2M_HOLD_CAPTURE_BUF
Produce an error if we try to use the feature of holding capture buffer
but it is not supported by the driver. Ingoring this can lead to stalls
as the driver will run-out of capture buffer to decode into. This
affects slice decoders but also split-field interlaced decoding.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2009>
2022-03-25 21:40:28 +00:00
Nicolas Dufresne efa360ce82 v4l2codecs: h264: Set other field poc if available
Whenever the other field POC is available, pass it back to the
driver. This should not be strictly required, but it makes things
easier to debug and more forgiven.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2009>
2022-03-25 21:40:28 +00:00
Nicolas Dufresne dcd62c35f0 v4l2codecs: Trace request by it FD
This helps when crossing the debug logs with the kernel logs.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2009>
2022-03-25 21:40:28 +00:00
Nicolas Dufresne d24dc74170 v4l2codecs: h264: Fix dpb entry flag FLAG_FIELD
The logic to guess back this value was broken. Use the value
now saved into the picture instead. This was tested using
LibreELEC patched 5.15 kernel, and fixed the interlaced decode
issues.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2009>
2022-03-25 21:40:28 +00:00
Thibault Saunier 25819c41fb navigation: Add support for key Modifiers in all relevant events
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2010>
2022-03-25 15:16:03 +00:00
He Junyan b2a00dff07 va: h265dec: Fix a crash because of missing reference frame.
Some problematic H265 stream may miss the reference frame in the DPB,
and get some message like: "No short term reference picture for xxx".
So there may be empty entries in ref_pic_list0/1 when passing to
decode_slice() function of sub class. We need to check the NULL pointer.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2018>
2022-03-25 13:12:46 +00:00
Seungha Yang 769800ad5f qsvencoder: Clear caps after debug print
Otherwise debug function will print (null) for alread cleared pointer

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2012>
2022-03-24 02:55:49 +09:00
Seungha Yang 188382ca9a qsvh264enc: Fix profile and level setting in codec data
The profile field in SPS is located after header byte

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2012>
2022-03-24 02:55:31 +09:00
Seungha Yang 60735deded nvcodec: Add new Direct3D11/CUDA mode encoder implementation
Adding new encoder elements nvd3d11{h264,h265}enc for Direct3D11
input support and re-written nvcuda{h264,h265}enc elements.
Newly writeen elements have some differences compared with old
nv{h264,h265}enc including non-backward compatible changes.

* RGBA is not a supported input format any more:
  New elements will support only YUV formats to avoid implicit conversion
  done by hardware. Ideally it should be done by upstream element
  in order to have more control on it. Moreover, RGBA support can cause
  redundant RGBA -> YUV conversion if multiple encoders are
  used for the same RGBA input
* Subsampled planar format support is dropped:
  I420 and YV12 format are not supported formats for Direct3D11.
  Although it's supported in CUDA mode, it's not a hardware friendly
  memory layout and it will waste GPU memory since UV planes
  will have large padding due to the memory layout requirement of NVENC.
* GL support is dropped: Similar to the RGBA case,
  GL support in encoder would be suboptimal if GL input is
  used by multiple encoders, because each encoder will copy GL memory
  into CUDA memory.
  Upstream cudaupload element can be used for GL <-> CUDA
  interop instead.
* No more pre-allocation of encoder input surfaces. New implementation
  will use input CUDA memory without copy (zero-copy) or
  will copy into a NVENC's input buffer struct in case of
  system memory input.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1997>
2022-03-23 13:48:53 +00:00
Vivienne Watermeier 6c2f6c3bd4 all: Use new navigation interface and API
Use and implement the new navigation interface in all relevant sink elements,
and use API functions everywhere instead of directy accessing the event structure.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1633>
2022-03-23 13:14:52 +00:00
Tong Wu 2a703678c0 msdkenc: add macro definitions to avoid the gst-inspect error
Since the strings are empty for GST_MSDK_CAPS_MAKE_WITH_DMABUF_FEATURE
and GST_MSDK_CAPS_MAKE_WITH_VA_FEATURE, when excuting
gst-inspect-1.0.exe msdkh265enc, there will be convert static caps error
because of the extra semicolon between two empty strings. Now macro
definitions are added to avoid this issue.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2004>
2022-03-23 04:34:06 +00:00
Mengkejiergeli Ba d8ab85c3ef msdkdec: Check width and height of mfxVideoParam before allocation
DecodeHeader must be called to fill the mfxVideoParam before allocation,
and thus the check for width and height in mfxVideoParam is necessary.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1817>
2022-03-22 05:22:09 +00:00
Benjamin Gaignard 98cb44ffc6 v4l2codecs: Fix memory leak
Free pending_requests array when releasing decoder to avoid memory leak

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2000>
2022-03-21 16:06:05 +00:00
Daniel Almeida 9a364464f0 av1decoder: Sync duplicate_picture with VP9 one
Pass the current frame to the duplicate_picture callback. This makes it easier
to set the frame's output_buffer if we already have one available. Also
documented that unlike VP9, it is not optional to implement this as the
picture will populate the DPB if it is a key-frame. To ensure this, remove the
default implementation.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1992>
2022-03-21 15:10:01 +00:00
Seungha Yang 0c6125bad6 meson: va: Define GST_USE_UNSTABLE_API
Remove extra_c_args which is not defined in this meson file at all,
and define GST_USE_UNSTABLE_API to avoid build warnings

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1999>
2022-03-21 22:17:00 +09:00
Jakub Adam 90eadae350 d3d11: Fix some typos
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1985>
2022-03-19 00:19:41 +00:00
Jakub Adam df55700f44 d3d11screencapturesrc: Allow capturing screen sub-area
Adds crop-x, crop-y, crop-width, crop-height properties specifying the
screen area to capture.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1932>
2022-03-18 13:56:51 +01:00
Seungha Yang c08ce58753 nvcodec: Move CUDA <-> GL, D3D11, NVMM copy function to utils
This method can be used in other elements as well.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1945>
2022-03-15 21:51:50 +00:00
Seungha Yang b3df58add1 nvh265sldec: Add support for delayed output
Delay 4 frames in case of non-live to improve throughput

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1937>
2022-03-15 21:08:06 +00:00
Seungha Yang e270e2967f nvenc: Fix deadlock because of too strict buffer pool size
The pool size might need to be larger than encoding surface pool size.
Also, because we always copy input frame into internal CUDA memory,
there's no reason to restrict max size of buffer pool.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1939>
2022-03-12 16:44:44 +00:00
He Junyan 50a481939d va: Fix a regression because of "Invert video codec frame dependency".
1. Always set the according GstVaH264EncFrame pointer when GstVideoCodecFrame
   pointer is assigned, which can make the logic safe.
2. Fix the forgotten change in _sort_by_frame_num. Its input pointer now is
   GstVideoCodecFrame type.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1935>
2022-03-12 15:20:19 +00:00
Seungha Yang aa476452fb codecs: Rename picture clear functions
Our convention for clear method is gst_clear_foo_bar().

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1897>
2022-03-11 20:20:17 +00:00
Seungha Yang 423111480c nvh265sldec: Always fill SPS/PPS related parameters
Address compare was not a valid approach since it works
only if SPS/PPS id are changed. Otherwise it will always point to
the same address of member variables of h265parser.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1931>
2022-03-11 16:14:14 +00:00
Corentin Damman 1fb3e35708 cudamemorycopy: add D3D11 resource support
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1807>
2022-03-10 18:08:10 +00:00
Corentin Damman 1568db2c3e cudacontext: find associated DXGI Adapter LUID
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1807>
2022-03-10 18:08:10 +00:00
Corentin Damman 895f11401d cudautils: add support of D3D11 resource as Cuda graphics resource type
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1807>
2022-03-10 18:08:10 +00:00
Corentin Damman f76ecf1e63 cudaloader: add D3D11 API
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1807>
2022-03-10 18:08:10 +00:00
Seungha Yang 5d298b98da nvh264dec,nvh265dec: Fix broken key-unit trick and reverse playback
On GstVideoDecoder::{drain,flush}, we send null packet with
CUVID_PKT_ENDOFSTREAM flag to drain out decoder. Which will
reset CUVID parser as well.
To continue decoding after the drain, the next input buffer
should include sequence headers otherwise CUVID parser will
not report any decodeable frame.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1911>
2022-03-10 12:40:05 +00:00
Víctor Manuel Jáquez Leal 838fe24e78 vah264enc: Invert video codec frame dependency.
Instead of using GstMiniObject to hold H264 frame, now it uses a plain
structure. Besides, instead of holding a reference to
GstVideoCodecFrame, the H264 frame structure is set as a
GstVideoCodecFrame user data.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1856>
2022-03-09 12:57:30 +00:00
Seungha Yang 496b77e6aa cudamemorycopy: Fix GL resource leak
Clear GL resources on stop()

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1896>
2022-03-08 18:02:25 +00:00
Seungha Yang 34c6063769 decklink: Update SDK version to 12.2.2
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1883>
2022-03-08 10:16:29 +00:00
Seungha Yang 4aa516f305 cudamemorycopy: Remove texture-target caps field
It's GL specific field, and we can remove it unconditionally

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1865>
2022-03-07 19:05:29 +00:00
Seungha Yang e5132a8508 cudaupload,cudadownload: Add support for dGPU NVMM
Implement NVMM <-> CUDA, GL, SYSTEM memory conversion. Jetson is
not supported yet. Note that NVMM <-> GL interop on Jetson platform
is supported by GstGL

Some example pipelines are:
- Convert NVMM to GstGL memory
  nvv4l2decoder ! "video/x-raw(memory:NVMM)" ! cudadownload ! "video/x-raw(memory:GLMemory)" ! glimagesink

- Upload system memory to NVMM and encode
  video/x-raw,format=NV12 ! cudaupload ! "video/x-raw(memory:NVMM)" ! nvv4l2h264enc

- Convert NVMM to GstCUDA memory and encode
  nvvideoconvert ! "video/x-raw(memory:NVMM)" ! cudaupload ! "video/x-raw(memory:CUDAMemory)" ! nvh264enc

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1865>
2022-03-07 19:05:29 +00:00
Víctor Manuel Jáquez Leal 0c7fe80387 va: encoder: Don't preallocate reconstruct buffers.
It's not required by VA to register the reconstruct buffers at context
creation, just as in decoders.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1857>
2022-03-07 16:31:41 +00:00
Seungha Yang a63d1cf4c4 cudamemorycopy: Fix build when gl is disabled
Fixes: https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/issues/1707
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1868>
2022-03-07 10:22:21 +00:00
Mengkejiergeli Ba c9aa529484 msdkdec: Fix to not trigger SFC scaling when vpp at downstream
When there is vpp scaling downstream, we need to make sure SFC is not
triggered because vpp may fall into passthrough mode which causes
the decoder negotiation to create src caps with vpp scaled width/height.

This patch includes bitstream's original size in first query with
downstream in gst_msdkdec_src_caps, which is the same for what we do for
color format in this query. This is to ensure SFC scaling starts to
work only when downstream directly asks for a different size instead of
through vpp.

Note that here SFC scaling follows the same behavior as msdkvpp:
if user only changes width or height, e.g. dec ! video/x-raw,width=xx !,
the height will be modified to the value which fits the original DAR.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1838>
2022-03-07 07:26:40 +00:00
Seungha Yang 30ddb0cd97 nvcodec: Add missing null check in context sharing code
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1834>
2022-03-06 15:39:04 +00:00
Seungha Yang c31bf2db4d nvcodec: Refactor cudaupload/download and add support for GL memory
* Implement new baseclass GstCudaMemoryCopy to remove duplicated
  cudaupload/download code
* Add support for CUDA <-> GL memory conversion via cudaupload/download

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1834>
2022-03-06 15:39:04 +00:00
Seungha Yang 111b2c3f53 nvcodec: Refactor GstCudaMemory abstraction
* Hide GstCudaMemory member variables
* Make GstCudaAllocator object GstCudaContext independent
* Set offset/stride of memory correctly via video meta
* Drop GST_BUFFER_POOL_OPTION_VIDEO_ALIGNMENT support.
  This implementation actually does not support custom alignment
  because we allocate device memory via cuMemAllocPitch
  of which alignment is almost uncontrollable

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1834>
2022-03-06 15:39:04 +00:00
Seungha Yang ad0e7fca14 nvcodec: Refactor basetransform subclasses
* cudaupload/download
  - Specify only formats actually we can deal with
    nvcodec elements, not all video formats
  - Supports CUDA output for download and input for upload in order
    to make passthrough possible, like other upload/download elements.
* cudabasetransform
  - Reset conversion element if upstream CUDA memory
    holds different CUDA context and the element can accept it.
    This is the same behavior as corresponding d3d11 filter elements.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1834>
2022-03-06 15:39:04 +00:00
Seungha Yang 89bbcf0061 cudabufferpool: Move GstCudaContext object to public member
... so that plugins can understand assosicated cuda context with the
pool.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1834>
2022-03-06 15:39:04 +00:00
Seungha Yang c8a1c953d8 cudacontext: Require explicit gpu id instead of auto (-1)
Sync up with GstD3D11Device implementation. The auto stuff should
be handled in context sharing step, not device creation.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1834>
2022-03-06 15:39:04 +00:00
Seungha Yang 1b9274307a nvcodec: Indent update
... to prevent gnu indent version dependent diffs.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1834>
2022-03-06 15:39:04 +00:00
Seungha Yang cec7ac2a1b cudacontext: Remove unnecessary cuInit() call
It's already called at plugin init time

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1834>
2022-03-06 15:39:04 +00:00
Víctor Manuel Jáquez Leal e42d10431d va: basetransform: Add device-path read-only property.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1844>
2022-03-04 14:34:32 +00:00
Víctor Manuel Jáquez Leal 47a95dfd65 va: basedec: Add device-path read-only property.
And elements will notify the used device-path if display is DRM.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1844>
2022-03-04 14:34:32 +00:00
Víctor Manuel Jáquez Leal 72c6a3b95a vah264enc: Remove GST_PARAM_CONDITIONALLY_AVAILABLE.
Since it's used only when the property is conditionally installed, and
these parameters are always installed.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1845>
2022-03-04 12:41:37 +00:00
He Junyan be24cdb150 va: encoder: Clean dead code.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1845>
2022-03-04 12:41:37 +00:00
Víctor Manuel Jáquez Leal 7aa597d6df va: encoder: Fix error code path when open.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1845>
2022-03-04 12:41:37 +00:00
Víctor Manuel Jáquez Leal 81c00664a2 vah264enc: Remove preferred_output_delay.
In the current state of the encoder it's just dead code.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1845>
2022-03-04 12:41:37 +00:00
Víctor Manuel Jáquez Leal 1a19a835a9 vah264enc: Avoid mapping coded buffer twice.
Currently for copying the coded buffer onto a GStreamer buffer, the
coded buffer is mapped two times: one for getting the size, and later
for do the actual copy. We can avoid this by doing directly in the
element rather than in the general encoder object.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1845>
2022-03-04 12:41:37 +00:00
Víctor Manuel Jáquez Leal 81b99c37d8 vah264enc: Single parameter array per picture.
There's no need, at least in H.264, to hold a global parameter array,
since there's no need to submit SPS, trellis, hdr or quality in every
buffer, but only on IDR ones.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1845>
2022-03-04 12:41:37 +00:00
Víctor Manuel Jáquez Leal 72b0f8ab17 va: Fix log message
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1845>
2022-03-04 12:41:37 +00:00
Mengkejiergeli Ba 8a598deef2 msdkenc: Change default ref frames number as 0
When user does not set ref-frames in pipeline, we should let MediaSDK
decide the reference frame number via setting default value as 0 at
gstreamer side.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1839>
2022-03-04 01:05:30 +00:00
Seungha Yang 8e0ce6b125 meson: wic: Fix typo
Should check WIC build option, not MediaFoundation

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1847>
2022-03-04 04:18:06 +09:00
Seungha Yang 00f773bd10 qsv: Remove strcpy for DRM device path
Simplify code. It's just one-time allocation, so don't need to worry
about leaking.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1835>
2022-03-03 11:29:33 +00:00
Seungha Yang 799616aea9 msdk: Don't print error log for missing DRM device path
It's expected in case that such DRM device is unavailable for some reasons,
specifically non-Intel platform or so

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1836>
2022-03-03 06:29:11 +00:00
Seungha Yang f8016687a4 wic: Add support for JPEG and PNG decoding
Adding Windows Imaging Component (WIC) plugin with JPEG/PNG decoding
support.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1605>
2022-03-03 00:00:54 +00:00
Seungha Yang df6624bf1c directshow: Fix for division by zero
The AvgTimePerFrame value may be unknown. Use arbitrary
value (30 fps) instead of crashing.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1828>
2022-03-02 19:35:49 +00:00
Seungha Yang c4ac657364 qsv: Add H.264 decoder
Initial decoder implementation with baseclass

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1786>
2022-03-01 21:24:07 +00:00
He Junyan 1f2f135cdb va: enable the H264 encoder.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1051>
2022-03-01 10:53:50 +01:00
He Junyan f17357f759 va: Add H264 encoder.
This a new VA-API implementation of a H264 encoder.

It can control the GOP and parameter settings, while the MV searching,
VCL and the rate control algorithm are implemented by VA drivers and HW.
It supports most of the common usage options in H264, but still lacks
of look ahead, field, B frame weighted prediction, etc.

Co-authored-by: Victor Jaquez <vjaquez@igalia.com>
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1051>
2022-03-01 10:53:50 +01:00
He Junyan 736a0ac9b0 va: Add a common encoder object.
As the counterpart of the va decoder, this class handles all the
common logic for the encoding routine and miscellaneous queries about
encoding.

Co-authored-by: Victor Jaquez <vjaquez@igalia.com>
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1051>
2022-03-01 10:53:50 +01:00
He Junyan fb644e84fa va: Add vacompat.h to wrap glib functions.
The g_queue_clear_full() and g_array_copy() functions in the glib
may not be available for the current glib version check, so we add
helper functions to wrap it.
This should be deleted after the glib version bumps.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1051>
2022-03-01 10:53:50 +01:00
He Junyan 57d50a941f va: Add the profile string name into the profile_map.
We also add a helper function of gst_va_profile_from_name to get
the VA profile value by its profile string name.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1051>
2022-03-01 10:53:50 +01:00
He Junyan e0b6c6678b va: Change the H264 profile string order in the profile_map.
The first one should be the one that matches the VA profile's name
most precisely.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1051>
2022-03-01 10:53:50 +01:00
He Junyan 83408cfdc8 va: caps: Expose gst_va_create_coded_caps as helper function.
And allow free indentation for array declaration.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1051>
2022-03-01 10:53:50 +01:00
jinsl00000 ef4cc9e637 ipcpipeline: fix crash and error on windows with SOCKET or _pipe()
The fd was in different meanings on windows:
POSIX read and write use the fd as a file descriptor.
The gst_poll use the fd as a WSASocket.

This patch use WSASocket as default on windows. This is a temporary measure, because IPC has many different implement. There may be a better way in the future.

See #1044

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1791>
2022-03-01 06:31:51 +00:00
Wu Tong c60ac7a04b MSDK: Add _context_query() and avoid compile error on Windows
To avoid compile error on Windows, macro definitions are added to suppress va
variables. In the meantime, add function _context_query() to query
context on Windows.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1693>
2022-02-28 12:54:23 +00:00
Mengkejiergeli Ba b41c70aed5 msdkdec: Fix uninitialized variables
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1731>
2022-02-25 03:11:29 +00:00
Mengkejiergeli Ba e1090c152c msdk: Fix unchecked return values
There are several calls of gst_video_info_from_caps and gst_video_frame_copy
without checks for the returned values. This patch adds all necessary
function return checks.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1738>
2022-02-25 02:04:20 +00:00
Seungha Yang ad73f73356 qsvencoder: Fix caps leak in Linux build
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1769>
2022-02-22 12:55:26 +00:00
Seungha Yang 20328914dc qsv: Fix debug category name of qsvallocator
Remove gst prefix to make $env:GST_DEBUG="qsv*:6" work for qsvallocator
as well

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1769>
2022-02-22 12:55:26 +00:00
Dmitry Osipenko 248f143fa3 v4l2codecs: Support YUV420M format
YUV420M format of V4L essentially is I420 with separate memory planes.
It's used by NVIDIA Tegra V4L decoder. Support this format by v4l2codecs.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1727>
2022-02-21 21:58:19 +03:00
Seungha Yang 8ff5f10a40 d3d11screencapturesrc: Use staging buffer pool for performance
By using staging pool/buffer, we can avoid per frame
staging texture -> system memory copy.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1756>
2022-02-20 23:43:18 +00:00
Nicolas Dufresne 8883809ef9 v4l2codecs: Enable MediaTek MM21 (NV12_16L32S)
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1567>
2022-02-20 22:32:55 +00:00
Nicolas Dufresne 3005dbc55a v4l2codecs: Add support for multi planar buffers
V4L2 have some pixel formats that produces 2 dmabuf, this add
support for these format.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1567>
2022-02-20 22:32:55 +00:00
Nicolas Dufresne bab9041c4b Port plugins to gst_video_format_info_extrapolate_stride()
This reduces code duplication and simplify addition of new
pixel formats into related plugins.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1567>
2022-02-20 22:32:55 +00:00
Seungha Yang d49454123e winscreencap: Remove dxgiscreencapsrc element
We have the d3d11screencapturesrc element in d3d11 plugin
which is obviously better than this element in terms of performance
and design, so we don't need to make people be confused by two separate elements.

Let's pick the better implementation and remove unnecessary one.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1750>
2022-02-20 20:04:05 +00:00
Seungha Yang c19d0db454 directshow: Fix build warnings
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1744>
2022-02-19 19:54:52 +00:00
Seungha Yang 7eedd52510 directshow: Merge plugins into single directshow plugin
... and lower rank of dshowvideosink and dshowdeviceprovider
to GST_RANK_MARGINAL since we don't prefer this plugin
by default

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1744>
2022-02-19 19:54:52 +00:00
Seungha Yang d94d338bd5 directshow: Remove white spaces
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1744>
2022-02-19 19:54:52 +00:00
Nicolas Dufresne cf3d64129b v4l2codecs: vp9: Fix reset_frame_context parameter
It was assumed that the kernel parameters would match with the bitstream value
but instead the author when with another set of value. Surprisingly, this
makes no difference with the resulting fluster score.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1748>
2022-02-18 23:55:59 +00:00
Nicolas Dufresne 5a9df9e850 v4l2codecs: vp9: Only fill compressed headers if needed
Fixes: 13944cf3ee ("v4l2codecs: vp9: Make compressed hdr control optional")
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1748>
2022-02-18 23:55:59 +00:00
Tim Mooney 54a1f60077 v4l2: include <sys/ioccom.h> on Illumos
Needed for _IOR/_IORW

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1524>
2022-02-18 21:34:49 +00:00
Loic Le Page e1c0628bb9 Add build files and fix build for gst-plugins-bad dshowsinkwrapper plugin
dshowsinkwrapper plugin is the old dshowvideosink plugin that has been
renamed to be compliant with the actuel plugin name in the source code.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1577>
2022-02-18 14:59:25 +01:00
Loic Le Page b355345ef5 Add build files and fix build for gst-plugins-bad dshowsrcwrapper plugin
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1577>
2022-02-18 14:59:25 +01:00
Loic Le Page 587b2e6bcb Add build files and fix build for gst-plugins-bad dshowdecwrapper plugin
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1577>
2022-02-18 14:59:25 +01:00
Loic Le Page 42bdeaf52c Add directshow strmbase library source code from Microsoft repo
Original repo is here:
https://github.com/microsoft/Windows-classic-samples

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1577>
2022-02-18 14:59:25 +01:00
Loïc Le Page 42c6a26aea Move all directshow plugins to the same sub-folder
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1577>
2022-02-18 14:59:24 +01:00
Tim Mooney 97720dabe0 meson: check for libsocket and libnsl
If present, add '-lsocket' and '-lnsl' to network_deps.

ext/curl/meson.build: add network_deps to dependencies
gst/festival/meson.build: same
sys/shm/meson.build: same

Fixes linking issues on Illumos distros.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1525>
2022-02-17 18:44:49 +00:00
Seungha Yang 04b8dfa391 d3d11: Add support for AYUV, AYUV64, and RGBA64_LE formats
Note that AYUV and AYUV64 formats will be used to expand format
support, especially some packed YUV formats (e.g., Y410, YUY2)
are common DXGI formats used for hardware decoder/encoder on Windows
but those formats cannot be used as a render target. We need to handle
them differently without pixel shader help, using compute shader
for example.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1699>
2022-02-16 18:41:05 +00:00
Seungha Yang dd906f9610 d3d11: Store device format in struct
Holding pointer to struct was unsafe approach because
the pointer to d3d11 format will be invalidated once d3d11 device
object is released

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1699>
2022-02-16 18:41:05 +00:00
Seungha Yang e1f0687b09 meson: Do hard build error for some MSVC warnings
Handle various MSVC warnings as errors for development version.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1006>
2022-02-16 17:03:29 +00:00
Dmitry Osipenko b757d12cff v4l2codecs: h264: Correct scaling matrix ABI check
Scaling matrix V4L UAPI control not presents on NVIDIA Tegra, the default
matrix should be used in this case. Mark scaling matrix presence optional.

Fixes: 47bfa71530 ("v4l2codecs: h264: Improve ABI check ")
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1726>
2022-02-16 13:16:17 +00:00
Mengkejiergeli Ba 586dfab9bd msdkdec: Enable SFC scaling for AVC and HEVC
Decoder SFC only supports down-scaling at most to 1/8.
For example, given a 4K bistream, SFC can scale it to 1080p via:
"msdkh265dec ! video/x-raw,width=1920,height=1080 ! glimagesink"

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1444>
2022-02-16 08:26:46 +00:00
Mengkejiergeli Ba c5f0e075e2 msdkdec: Enable SFC csc for AVC and HEVC
Decoder SFC will be triggered when default output format is not accept at
downstream. One use case below can work without using msdkvpp:
"! msdkh265dec ! "video/x-raw,format=BGRA" ! glimagesink",

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1444>
2022-02-16 08:26:46 +00:00
Mengkejiergeli Ba eb742c8ed0 msdkdec: Add SFC codes
SFC refers to Scaler Format Converter, more details here:
https://01.org/sites/default/files/documentation/intel-gfx-prm-osrc-kbl-vol15-sfc.pdf
By attaching mfxExtDecVideoProcessing buffer to mfxVideoParam, decoder
can do SFC for csc and scaling.

MSDK will check if surface bitdepth equals to input when no SFC is
triggered, which means in the case of SFC, there is no need to update
surface bitdepth via gst_msdk_update_mfx_frame_info_from_mfx_video_param.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1444>
2022-02-16 08:26:46 +00:00
Seungha Yang dbda4cf409 d3d11converter: Fix for missing GRAY conversion
Add missing Y410 -> GRAY and GRAY -> semi-planar conversion

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1724>
2022-02-16 02:30:01 +09:00
Seungha Yang 98345a141a d3d11converter: Don't use FIXME_OBJECT for non-GstObject
... and print ERROR messages for unexpected input/output formats

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1724>
2022-02-16 02:27:53 +09:00
He Junyan 24c3e0fcfa va: Delete the display lock/unlock when we call VA-API.
According to the VA-API's description, they are MT-safe, we do not
need to care about that in our middleware layer. The lock/unlock
operations have overhead and make the performance lower.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1333>
2022-02-15 10:02:08 +00:00
Seungha Yang e3e23a2c84 d3d11converter: Fix RGB to GRAY conversion
Fix typo in shader code

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1697>
2022-02-14 17:49:54 +00:00
Seungha Yang 27246ebeb0 d3d11download: Fix decide_allocation
Caps should be parsed in any cases.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1691>
2022-02-14 10:48:31 +00:00
He Junyan fa4dc3470f meson: va: Add va option check into plugin's build.
Because the liblibgstva is built unconditionally, we now move the
va option check into va plugin's build.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1685>
2022-02-14 06:30:56 +00:00
He Junyan 1eed9de0bb vavpp: Fix the caps leak in the transform_caps() function.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1689>
2022-02-12 20:11:46 +08:00
Seungha Yang e96687d88d d3d11: Update build-time dependency
Remove all the d3d11 and dxgi header version dependent ifdef
and bump the minimum requirement to d3d11_4.h and dxgi1_6.h.
We are already failing support old Visual Studio (Windows SDK actually)
such as Visual Studio 2015. Note that our MinGW toolchain satisfies
the requirement.

From runtime point of view, this change should be fine since
we are checking OS version with IUnknown::QueryInterface()
everywhere in order to check API availability

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1684>
2022-02-11 20:01:52 +00:00
He Junyan 248baef400 MSDK: Import VA surface as encoder's input.
We make all MSDK encoders declare "memory:VAMemory" feature. Then
the pipeline such as:
  gst-launch-1.0 -vf filesrc location=xxx.h264 ! h264parse ! \
       vah264dec ! msdkh265enc ! fakesink
will choose VA memory caps between the VA decoder and MSDK encoder.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1087>
2022-02-11 07:13:45 +00:00
He Junyan ef5f6ab5d9 MSDK: Add helper function to peek VA surface of VA kind gstbuffer.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1087>
2022-02-11 07:13:45 +00:00
He Junyan 26172123e5 MSDK: Handle context query into the encoder's query function.
The MSDK encoder's query function is not set and it just forwards
all query to its base class. We now need to answer the context
query correctly. Other VA plugins need to query the VA display.

By the way, the current query of "gst.msdk.Context" is also missing.
The other MSDK elements must depend on the bin's context message(
sent in context_propagate()) to set their MsdkContext correctly.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1087>
2022-02-11 07:13:45 +00:00
He Junyan 2928b14b69 MSDK: Handle context query into the VPP's query function.
The MSDK VPP's query function is not set and it just forwards
all query to its base class. We now need to answer the context
query correctly. Other VA plugins need to query the VA display.

By the way, the current query of "gst.msdk.Context" is also missing.
The other MSDK elements must depend on the bin's context message(
sent in context_propagate()) to set their MsdkContext correctly.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1087>
2022-02-11 07:13:45 +00:00
He Junyan db5be289c7 MSDK: Handle context query into the decoder's query function.
The MSDK decoder's query function is not set and it just forwards
all query to its base class. We now need to answer the context
query correctly. Other VA plugins need to query the VA display.

By the way, the current query of "gst.msdk.Context" is also missing.
The other MSDK elements must depend on the bin's context message(
sent in context_propagate()) to set their MsdkContext correctly.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1087>
2022-02-11 07:13:45 +00:00
He Junyan 6635852c40 MSDK: Add a handle_context_query() helper function.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1087>
2022-02-11 07:13:45 +00:00
He Junyan 85664b5af6 MSDK: Improve the GstContext setting logic.
We now can use the gst va lib's display to create our MSDK context,
and use its helper functions to simplify our code. The improved logic
is like this:
1. Every MSDK element should use gst_msdk_context_find() to find a MSDK
context from neighbour. If valid, reuse it.
2. Use gst_msdk_ensure_new_context(). It will first query neighbours
about the GstVaDisplay, if found(e.g. some VA element is connected),
use gst_msdk_context_from_external_display() to create a MSDK context.
3. Then, creating the MSDK context from scratch. It creates both the
display and MSDK context.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1087>
2022-02-11 07:13:45 +00:00
He Junyan a905e7474b MSDK: Add new_with_va_display() helper function to create context.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1087>
2022-02-11 07:13:45 +00:00
He Junyan a9aa522e26 MSDK: Use the VA display object to replace the raw display handle.
The VA display object from VA lib is a common defined object. which
contain the whole display things. It is easier to use, and more important,
we can share it with the other VA plugins and keep all the VA related
plugins working on the same GPU device.
We also delete the useless gst_msdk_context_get_fd() API.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1087>
2022-02-11 07:13:45 +00:00
He Junyan c7e3c8e9f6 MSDK: Add the gst va lib into MSDK's dependency.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1087>
2022-02-11 07:13:45 +00:00
Seungha Yang 2c93afd8bb mediafoundation: Add support for MP3 decoding
See also
https://docs.microsoft.com/en-us/windows/win32/medfound/windows-media-mp3-decoder

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1596>
2022-02-11 04:16:23 +09:00
Seungha Yang be957f6c61 mediafoundation: Add support for AAC decoding
See also
https://docs.microsoft.com/en-us/windows/win32/medfound/aac-decoder

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1596>
2022-02-11 04:16:22 +09:00
Seungha Yang 0b26254a6a mediafoundation: Cosmetic changes
Rename baseclass to be consistent with other Windows plugins

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1596>
2022-02-11 04:16:22 +09:00
Seungha Yang ce4875ccde mediafoundation: Use & operator instead of GetAddressOf()
Use shorter expression

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1596>
2022-02-11 04:16:22 +09:00
Seungha Yang 36020c7549 mediafoundation: Port to C++
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1596>
2022-02-11 04:16:15 +09:00
Seungha Yang c7a9b5c458 d3d11decoder: Promote rank to primary except for mpeg2
Our D3D11/DXVA codecs implementation has been verified
during 1.18 and 1.20 development cycle and also via the Fluster
test framework. Similar to the case of nvdec and vtdec,
we can prefer hardware over software in most cases

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1672>
2022-02-10 17:16:18 +00:00
Nicolas Dufresne 7a9e11ae1b v4l2codecs: vp9: Fix duplicating a duplicated picture
Duplicating a picture what was already a dup was leading to a crash. Rename
the custom picture flags as HOLDS_BUFFER to make its meaning clear. Then save
then ref and store the picture as userdata, so it can be obtained when
duplicating. Finally, mark the doplicated as HOLDS_BUFFER to avoid thinking it
holds a request.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1681>
2022-02-09 22:37:55 +00:00
Seungha Yang 090b50e549 mfaudioenc: Handle empty IMFMediaBuffer
IMFMediaBuffer may not hold encoded data, which seems to happen
while draining.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1679>
2022-02-10 01:49:55 +09:00
Víctor Manuel Jáquez Leal b3c71584e0 va: decoder: Log profile name.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1675>
2022-02-09 12:25:24 +01:00
Víctor Manuel Jáquez Leal df6c985474 va: filter: Log the added filter name.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1675>
2022-02-09 11:07:47 +00:00
Víctor Manuel Jáquez Leal 4be3413fec vapostproc: Process HDR caps
This patch adds a new parameter: hdr-tone-mapping (same as
vaapipostproc), if the HDR capabilites are availabe in driver, and
it's disabled by default.

If hdr-tone-mapping is enabled then HDR fields in sink caps are
processed in frames from HDR to SDR, removing those hdr fields in
source pad caps too.

hdr-tone-mapping is not enabled if a color conversion is also
requested, since it fails to process in the iHD driver, so far.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1258>
2022-02-09 10:26:02 +00:00
Víctor Manuel Jáquez Leal 0e7dade55a build: Add libva dependency fallback.
Then libva can be subproject and used by either gstreamer-vaapi,
va and msdk in gst-plugins-bad.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1397>
2022-02-09 09:45:04 +00:00
Nicolas Dufresne 13944cf3ee v4l2codecs: vp9: Make compressed hdr control optional
This is to supported by Mediatek VP9 driver. Mediatek handles
the forward probabilities in hardware hence does not need and
does not implement support for
V4L2_CID_STATELESS_VP9_COMPRESSED_HDR.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1600>
2022-02-08 16:46:09 -05:00
Víctor Manuel Jáquez Leal 5e4c152de4 va: Remove libgudev crumbs in library.
In commit e699aaeb we moved linking of libgudev to the plugin rather
the library, because it's only used in the plugin. But the dependency
check is still done in library.

This patch removes the dependency check in library, and updates the
dependency check in plugin.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1650>
2022-02-08 16:22:42 +00:00
Seungha Yang 8773ba1104 msdk: Fix for MFXUnload symbol re-definition build error
Fix for libgstreamer-full build

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1408>
2022-02-08 10:05:35 +00:00
Seungha Yang 278908ce96 qsv: Add support for HEVC encoding
main and main-10 profiles are supported for now

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1408>
2022-02-08 10:05:35 +00:00
Seungha Yang 3a7e4635bb qsv: Add support for VP9 encoding and more video formats
Add VP9 encoder with 4:2:0 8 bits and 4:4:4 8/10 bits formats support

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1408>
2022-02-08 10:05:35 +00:00
Seungha Yang 64ed6075b7 qsv: Introduce H.264 Intel Quick Sync Video Encoder
A new implementation of Intel Quick Sync Video plugin.
This plugin supports both Windows and Linux but optimization for
VA/DMABuf is not implemented yet.

This new plugin has some notable differences compared with existing
MSDK plugin.

* Encoder will expose formats which can be natively supported
without internal conversion. This will make encoder
control/negotiation flow much simpler and cleaner than
that of MSDK plugin.

* This plugin includes QSV specific library loading helper,
called dispatcher, with QSV SDK headers as a part of this plugin.
So, there will be no more SDK version dependent #ifdef in the code
and also there will be no more build-time MSDK/oneVPL SDK
dependency.

* Memory allocator interop between GStreamer and QSV is re-designed
and decoupled. Instead of implementing QSV specific allocator/bufferpool,
this plugin will make use of generic GStreamer memory
allocator/bufferpool (e.g., GstD3D11Allocator and GstD3D11BufferPool).
Specifically, GstQsvAllocator object will help interop between
GstMemory and mfxFrameAllocator memory abstraction layers.

Note that because of the design decision, VA/DMABuf support is not made
as a part of this initial commit. We can add the optimization for Linux
later once GstVA library exposes allocator/bufferpool implementation as
an API like GstD3D11.

* Initial encoder implementation supports interop with GstD3D11
infrastructure, including zero-copy encoding with upstream D3D11 element.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1408>
2022-02-08 10:05:35 +00:00
Seungha Yang c80132e4a3 qsv: Remove unnecessary pargma message
We know what we are doing, just remove noisy build warnings

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1408>
2022-02-08 10:05:35 +00:00
Seungha Yang 81d63948d1 qsv: Import libmfx API and dispatch code from oneVPL project
Copied from oneVPL project (https://github.com/oneapi-src/oneVPL)
v2022.0.3 tag at the commit of efc259f8b7ee5c334bca1a904a503186038bbbdd

This is corresponding to MFX API version 2.6

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1408>
2022-02-08 10:05:35 +00:00
Seungha Yang a37da515f4 d3d11memory: Add support for ID3D11Buffer
Allow wrap ID3D11Buffer via GstD3D11Memory object
At the moment, only staging ID3D11Buffer is supported.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1408>
2022-02-08 10:05:35 +00:00
Seungha Yang 28eeba3e18 nvh265sldec: Fix for decoding 12bits stream
We've been exposing main-444-12 profile as a supported profile
in its sinkpad template but not actaully. Adding code to
covert 12 and 16 bits as well.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1612>
2022-02-07 18:27:48 +00:00
Seungha Yang 80bbc71ec0 nvdecoder: Fix for HEVC 4:4:4 format decoding
Map chroma_format_idc == 3 (which means 4:4:4 subsampling) correctly,
also pass coded bitdepth for decoder initialization instead of
inferring it from output format since they can be different.

Fixes: https://gitlab.freedesktop.org/gstreamer/gstreamer/-/issues/949
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1612>
2022-02-07 18:27:48 +00:00