Commit graph

17 commits

Author SHA1 Message Date
Seungha Yang 6dc902a962 nvcodec: Add JPEG encoder
Adding nvJPEG library based JPEG encoder element

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6021>
2024-01-31 12:51:28 +00:00
Seungha Yang fc4b136ac8 nvcodec: Move runtime compiler check to plugin init function
Required information for other elements

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6021>
2024-01-31 12:51:28 +00:00
Seungha Yang 51162acc31 cuda: Report device open error
Call gst_cuda_result() with CUDA_ERROR_NO_DEVICE error code if
we could not open device, so that application can catch the error

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6006>
2024-01-30 14:30:41 +00:00
Seungha Yang 42560c24df nvdecoder: Add support for D3D11 output
Since DXVA does not support some profiles such as HEVC RExt,
vendor specific decoding API is still required.
When decoder is negotiated with d3d11 caps, decoder will convert
semi-planar frame to planar since semi-planar format (e.g.,
DXGI_FORMAT_NV12) is not supported by CUDA/D3D11 interop.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5409>
2023-09-29 12:36:01 +00:00
Seungha Yang 7b6023d9cf nvcodec: Add support for CUDA IPC
Adding cudaipc{src,sink} element for CUDA IPC support.

Implementation note:
* For the communication between end points, Win32 named-pipe
and unix domain socket will be used on Windows and Linux respectively.

* cudaipcsink behaves as a server, and all GPU resources will be owned by
the server process and exported for other processes, then cudaipcsrc
(client) will import each exported handle.

* User can select IPC mode via "ipc-mode" property of cudaipcsink.
There are two IPC mode, one is "legacy" which uses legacy CUDA IPC
method and the other is "mmap" which uses CUDA virtual memory API
with OS's resource handle sharing method such as DuplicateHandle()
on Windows. The "mmap" mode might be better than "legacy" in terms
of stability since it relies on OS's resource management but
it would consume more GPU memory than "legacy" mode.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4510>
2023-08-14 13:41:01 +00:00
Seungha Yang 8d7cab1f0d nvcodec: Remove stateful decoders
Use H.264, H.265, VP8, and VP9 stateless decoders unconditionally
and don't register its stateful counterpart

Fixes: https://gitlab.freedesktop.org/gstreamer/gstreamer/-/issues/1768
Fixes: https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/issues/1621
Fixes: https://gitlab.freedesktop.org/gstreamer/gstreamer/-/issues/1432
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4015>
2023-02-28 18:42:17 +00:00
Seungha Yang 992406cf4f cuda, nvcodec: Make GstD3D11 dependency mandatory
GstD3D11 build-time dependencies should be always available on Windows already
and runtime dependencies as well, since required external
(non-GStreamer) depends are all system DLLs

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3884>
2023-02-16 17:49:54 +00:00
Nirbheek Chauhan eff9455ada nvcodec: Log readable errors when initializing CUDA
It is really difficult for people to figure out why nvcodec has
0 features. Even the debug log is cryptic. Also make sure the errors
go to the ERROR log level, which is more likely to be enabled by
default.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3776>
2023-01-25 10:08:10 +00:00
Nirbheek Chauhan 43ae6b421b nvcodec: Fix reporting of CuDeviceGetCount error
cuda_ret is was always going to be CUDA_SUCCESS in the error log.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3776>
2023-01-25 10:08:10 +00:00
Seungha Yang 30c8dbe032 nvencoder: Add support for dynamic GPU device selection
Adding nvautogpu{h264,h265}enc class which will accept upstream logical
GPU device object (GstCudaContext or GstD3D11Device) instead of
using pre-assigned GPU instance.

If upstream logical GPU device object is not NVENC compatible
(e.g., D3D11 device of non-NVIDIA GPU) or it's system memory,
then user specified "cuda-device-id" or "adapter-luid" property
will be used for GPU device selection.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2666>
2022-06-30 12:38:08 +00: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
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
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
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
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
Thibault Saunier 019971a3c7 Move files from gst-plugins-bad into the "subprojects/gst-plugins-bad/" subdir 2021-09-24 16:14:36 -03:00
Renamed from sys/nvcodec/plugin.c (Browse further)