Commit graph

26786 commits

Author SHA1 Message Date
Seungha Yang
9d810bbd81 d3d11memory: Protect view object with lock
Make resource allocation more thread-safe

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1718>
2020-10-25 00:38:52 +09:00
Seungha Yang
969ab3e664 d3d11convert: Add support for conversion using ID3D11VideoProcessor
Output texture of d3d11 decoder cannot have the bind flag
D3D11_BIND_SHADER_RESOURCE (meaning that it cannot be used for shader
input resource). So d3d11convert (and it's subclasses) was copying
texture into another internal texture to use d3d11 shader.
It's obviously overhead and we can avoid texture copy for
colorspace conversion or resizing via ID3D11VideoProcessor
as it supports decoder output texture.
This commit would be a visible optimization for d3d11 decoder with
d3d11compositor use case because we can avoid texture copy per frame.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1718>
2020-10-25 00:38:44 +09:00
Seungha Yang
484d510558 d3d11memory: Store ID3D11VideoProcessorOutputView object
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1718>
2020-10-25 00:38:39 +09:00
He Junyan
002cddf131 codecs: h265decoder: Fix picture leaks because of reference set.
The last frame's reference set has no one to cleanup. We need to
clean all pictures in the stop() func.
We also add a helper function to cleanup all the pictures in the
reference picture set.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1717>
2020-10-23 16:21:15 +00:00
He Junyan
4d296a07e4 codecs: h265decoder: Fix 3 ref array leaks in finalize.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1717>
2020-10-23 16:21:15 +00:00
Seungha Yang
35ed7c7811 d3d11window: Reuse ID3D11VideoProcessorInputView if possible
GstMemory object could be disposed if GstBuffer is not allocated
by GstD3D11BufferPool such as via gst_buffer_copy() and/or
gst_buffer_make_writable(). So attaching qdata on GstMemory
object would cause unnecessary view alloc/free.
By using view pool which is implemented in GstD3D11Allocator,
we can avoid redundant view alloc/free.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1716>
2020-10-23 15:44:10 +00:00
Seungha Yang
6c09cdd32b d3d11memory: Implement ID3D11VideoProcessorInputView pool
Similar to ID3D11VideoDecoderOutputView pool implementation

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1716>
2020-10-23 15:44:10 +00:00
Xavier Claessens
2efb4a7adb Meson: Use pkg-config generator 2020-10-23 11:14:18 -04:00
Nicolas Dufresne
f22fc190e7 h265decoder: Add support for l0/l1
Add support for reference list needed for VA-API and some V4L2 decoders.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1713>
2020-10-21 09:05:57 -04:00
Nicolas Dufresne
f330b5ae62 h265decoder: Sync with the H264 implementation
This ensures that we get the last reference to picture being outputed,
avoiding GstBuffer structure copies and simplifying the buffer management.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1713>
2020-10-21 09:05:57 -04:00
Seungha Yang
f615677051 d3d11decoder: Directly access ID3D11VideoDecoderOutputView for decoding
Decoder output view is stored in GstD3D11Memory object instead of
wrapper struct now. So qdata is no more required.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1712>
2020-10-20 17:56:57 +09:00
Seungha Yang
a4f324d668 d3d11memory: Implement ID3D11VideoDecoderOutputView pool
Similar to texture-array pool, we can reuse decoder output view
since the life time of output view is identical to that of texture-array.
In this way, we can avoid frequent output view alloc/free.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1712>
2020-10-20 17:56:52 +09:00
Seungha Yang
04376397eb d3d11memory: Move to GArray to store texture-array status
The size D3D11_REQ_TEXTURE2D_ARRAY_AXIS_DIMENSION is 2048
which is too large in practice especially for a texture
of dpb

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1712>
2020-10-20 01:14:27 +09:00
Víctor Manuel Jáquez Leal
bcd43acd42 va: Add VP9 decoder
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1702>
2020-10-19 13:15:06 +02:00
Philippe Normand
37b7809d18 wpe: Convert launch lines to markdown and move since tag
Seems like the examples don't appear in the generated docs because the Since tag
was badly positioned in the doc blurb.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1706>
2020-10-18 15:17:25 +00:00
Víctor Manuel Jáquez Leal
113867766e codecs: vp9decoder: Add segmentation to picture.
VA-API needs AC and DC quant scales for both luma and chroma, and the loop
filter level for current frame, but these values are not available outside
the private GstVp9Parser structure. And these values may change from frame
to frame, so they are picture specific.

This patch add GstVp9Segmentation structure array to GstVp9Picture to expose
it to derived classes. This approach is safer than passing the parser at
picture handling flow.

Also, this patch, in order to solve Documentation CI, mark as private the
GstVp9Picture structure.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1700>
2020-10-16 17:50:42 +00:00
Víctor Manuel Jáquez Leal
5e3c7f2092 codecs: vp9decoder: Pass parser as new_sequence() parameter.
In order to know the chroma format, besides profile, subsampling_x and
subsampling_y are needed (Spec 7.2.2 Color config semantics). These values are
in GstVp9Parser but not in  GstVp9Framehdr.

Also, bit_depth is available in parser but not frame header. Evenmore, those
values are copied to picture structure later.

In case of VA-API, to configure the pipeline, it is require to know the chroma
format and depth.

It is possible to know chroma and depth through caps coming from vp9parser, but
it requires string parsing. It would be less error prone to get these values
through the parser structure at new_sequence() virtual method.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1700>
2020-10-16 17:50:42 +00:00
Nicolas Dufresne
dcb3044478 rtpsrc: Cleanup on BYE, timeout or when pad is reused
In this patch, we enabled 'autoremove' feature of rtpbin and also call
'clear-ssrc' on the rtpssrcdemux element when a pad is being reused. This
ensure that the jitterbuffer is removed and no threads accumulates.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1575>
2020-10-16 17:23:46 +00:00
George Kiagiadakis
2fcbb4386b rtpsrc: re-use the same src pad for streams that have the same payload type
Also use payload type when naming pads, this will make it easier to identify
pads and simplify the code.

Fixes #1395

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1575>
2020-10-16 17:23:46 +00:00
Seungha Yang
6e30cbb3fc d3d11: Introduce d3d11compositor element
Add new video composition element which is equivalent to compositor
and glvideomixer elements. When d3d11 decoder elements are used,
d3d11compositor can do efficient graphics memory handling
(zero copying or at least copying memory on GPU memory space).

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1323>
2020-10-16 17:02:15 +00:00
Seungha Yang
36f7966a5e d3d11shader: Allow drawing without shader resource view
... for the case that we are rendering on target without input texture.
For example, we might want to draw arbitrary shape on render target view
without shader resource view.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1323>
2020-10-16 17:02:15 +00:00
Seungha Yang
eecb130bd9 d3d11convert: Add new subclasses for only color convert or resize
New d3d11colorconvert and d3d11scale elements will perform only
colorspace conversion and rescale, respectively. Those new elements
would be useful when only colorspace conversion or rescale is required
and the other part should be done by another elements.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1323>
2020-10-16 17:02:15 +00:00
Seungha Yang
4c19962997 d3d11colorconverter: Allow setting alpha value to use
... used for reordering case for now. In other words, non-alpha formats
such as NV12 is not supported case yet.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1323>
2020-10-16 17:02:15 +00:00
Seungha Yang
ca87289e56 d3d11colorconverter: Add support conversion with blending
This is pre-work for d3d11compositor support

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1323>
2020-10-16 17:02:15 +00:00
Seungha Yang
94ac3cc94d d3d11colorconverter: Add method to support updating destination rect
It's equivalent to GST_VIDEO_CONVERTER_OPT_DEST_* options of GstVideoConverter

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1323>
2020-10-16 17:02:15 +00:00
Seungha Yang
5c7caf70e1 d3d11: Clarify target rect to be updated
Rename internal methods to clarify which rect (i.e., input or output)
should be updated

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1323>
2020-10-16 17:02:15 +00:00
Julian Bouzas
32b0afb608 nvcodec: Report latency in decoder based on max-display-delay
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1633>
2020-10-16 15:56:49 +00:00
Julian Bouzas
1d4b6299dc nvcodec: Add max-display-delay decoder property
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1633>
2020-10-16 15:56:49 +00:00
Julian Bouzas
8cf1b7a154 nvcodec: Fix compiler error if OpenGL is not enabled
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1633>
2020-10-16 15:56:49 +00:00
Julian Bouzas
36030158c4 nvcodec: Add missing CUDAMemory src caps in h264 decoder
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1633>
2020-10-16 15:56:49 +00:00
Julian Bouzas
45cc831efd nvcodec: Add missing CUDAMemory sink caps in h264 and h265 encoders
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1633>
2020-10-16 15:56:49 +00:00
Julian Bouzas
07c349768a nvcodec: Fix description of cudadownload element
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1633>
2020-10-16 15:56:49 +00:00
Seungha Yang
f62ecc1625 tests: Add CUDA filter unit tests
Adding a test for buffer meta and colorspace conversion

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1633>
2020-10-16 15:56:49 +00:00
Seungha Yang
6e1c1178c2 nvcodec: Add CUDA video scale element
Add new element for video resizing using CUDA

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1633>
2020-10-16 15:56:49 +00:00
Seungha Yang
fe83a12b10 nvcodec: Add CUDA video convert element
Add new element for colorspace conversion using CUDA.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1633>
2020-10-16 15:56:49 +00:00
Seungha Yang
592a8d5400 nvcodec: Add generic CUDA video convert object
Introducing generic video convert object similar to video-converter
but using CUDA.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1633>
2020-10-16 15:56:49 +00:00
Seungha Yang
4cc73ff9d6 nvcodec: Add support runtime CUDA kernel source compilation
Add util functions for runtime CUDA kernel source compilation
using NVRTC library. Like other nvcodec dependent libraries,
NVRTC library will be loaded via g_module_open.

Note that the NVRTC library naming is not g_module_open friendly
on Windows.
(i.e., nvrtc64_{CUDA major version}{CUDA minor version}.dll).
So users can specify the dll name using GST_NVCODEC_NVRTC_LIBNAME
environment.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1633>
2020-10-16 15:56:49 +00:00
Seungha Yang
dd995bd9d4 nvcodec: Add CUDA upload/download elements with base class for CUDA filters
Similar to glupload/gldownload elements but for CUDA memory.
It will help transfer memory between system and nvidia GPU

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1633>
2020-10-16 15:56:49 +00:00
Seungha Yang
b1ac8bafc9 nvcodec: Peer direct access support
If support direct access each other, use device to device memory copy
without staging host memory

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1633>
2020-10-16 15:56:49 +00:00
Seungha Yang
d16a9237c3 cudacontext: Enable direct CUDA memory access over multiple GPUs
If each device context can access each other, enable peer access
for better interoperability.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1633>
2020-10-16 15:56:49 +00:00
Seungha Yang
a8e9d616d6 nvenc: Support CUDA buffer pool
When upstream support CUDA memory (only nvdec for now), we will create
CUDA buffer pool.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1633>
2020-10-16 15:56:49 +00:00
Seungha Yang
8635d12929 nvdec: Support CUDA buffer pool
If downstream can accept CUDA memory caps feature (currently nvenc only),
always CUDA memory is preferred.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1633>
2020-10-16 15:56:49 +00:00
Seungha Yang
cf5ef5635f nvcodec: Add CUDA specific memory and bufferpool
Introducing CUDA buffer pool with generic CUDA memory support.
Likewise GL memory, any elements which are able to access CUDA device
memory directly can map this CUDA memory without upload/download
overhead via the "GST_MAP_CUDA" map flag.
Also usual GstMemory map/unmap is also possible with internal staging memory.

For staging, CUDA Host allocated memory is used (see CuMemAllocHost API).
The memory is allowing system access but has lower overhead
during GPU upload/download than normal system memory.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1633>
2020-10-16 15:56:49 +00:00
Andrew Wesie
11353b3f6e codecparsers: h264parser: guard against ref_pic_markings overflow
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1703>
2020-10-16 15:11:26 +00:00
Tim-Philipp Müller
3f8d33abed hlssink2: fix and flesh out docs
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1699>
2020-10-16 13:37:18 +00:00
Stéphane Cerveau
cbd61e28b2 meson: update glib minimum version to 2.56
In order to support the symbol g_enum_to_string in various
project using GStreamer ( gst-validate etc.), the glib minimum
version should be 2.56.0.

Remove compat code as glib requirement
is now > 2.56

Version used by Ubuntu 18.04 LTS

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1695>
2020-10-16 09:16:34 +00:00
He Junyan
edc6e0fa1d d3d11: vp8dec: No need to check show_frame flag when output_picture.
The VP8 base class has already handled it for us.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1670>
2020-10-15 19:01:54 +00:00
He Junyan
6b3ff669ee codecs: vp8decoder: handle the show_frame check in base class.
Move the show_frame check from sub class to vp8 decoder's base class.
Calling the sub class' output_picture() function only when the frame
is displayed and marking the other automatically as decode only.

This is done to avoid logic and code repetition in subclasses.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1670>
2020-10-15 19:01:54 +00:00
Seungha Yang
a31a6608fe codecs: vp9decoder: handle the show_frame check in base class
Same as vp8 decoder update https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1670

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1697>
2020-10-15 18:36:54 +00:00
Nicolas Dufresne
0f5fc9646e v4l2codecs: vp8: Allow baseclass from skipping frames
In preparation for !1670, this will allow the base class from skipping frames
that should not be displayed. Previously it would complain about unordered
decoding taking place in the driver.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1696>
2020-10-15 13:15:02 -04:00