Commit graph

115 commits

Author SHA1 Message Date
Seungha Yang
d692350fc3 nvdec: Specify supported profiles of h264/h265 codec
See more details about supported formats at
nvidia codec sdk document "NVDEC_VideoDecoder_API_ProgGuide.pdf"
Table 1. Hardware Video Decoder Capabilities.

Fixes: https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/issues/926
2019-07-25 08:06:26 +00:00
Seungha Yang
c8640e23f4 nvdec: Skip draining before creating internal parser
GstVideoDecoder::drain/flush can be called at very initial state
with stream-start and flush-stop event, respectively.
Draning with NULL CUvideoparser seems to unsafe and that eventually
failed to handle it.
2019-07-25 07:11:04 +00:00
Seungha Yang
367e742e5d nvcodec: Drop system installed cuda.h dependency
... and add our stub cuda header.

Newly introduced stub cuda.h file is defining minimal types in order to
build nvcodec plugin without system installed CUDA toolkit dependency.
This will make cross-compile possible.
2019-07-23 16:32:31 +09:00
Seungha Yang
a2ada54265 nvcodec: Keep requested rank for default device
Fix for default encoder and decoder element factory to make them have
higher rank than the others.
2019-07-23 10:28:52 +09:00
Seungha Yang
92afa74939 nvenc: Register elements per GPU device with capability check
* By this commit, if there are more than one device,
nvenc element factory will be created per
device like nvh264device{device-id}enc and nvh265device{device-id}enc
in addition to nvh264enc and nvh265enc, so that the element factory
can expose the exact capability of the device for the codec.

* Each element factory will have fixed cuda-device-id
which is determined during plugin initialization
depending on the capability of corresponding device.
(e.g., when only the second device can encode h265 among two GPU,
then nvh265enc will choose "1" (zero-based numbering)
as it's target cuda-device-id. As we have element factory
per GPU device, "cuda-device-id" property is changed to read-only.

* nvh265enc gains ability to encoding
4:4:4 8bits, 4:2:0 10 bits formats and up to 8K resolution
depending on device capability.
Additionally, I420 GLMemory input is supported by nvenc.
2019-07-22 21:01:41 +00:00
Seungha Yang
0239152bca nvdec: Create CUDA context with registered device id
Only the default device has been used by NVDEC so far.
This commit make it possible to use registered device id.
To simplify device id selection, GstNvDecCudaContext usage is removed.
2019-07-22 17:39:45 +00:00
Seungha Yang
1df2f13d0c nvdec: Register elements per device/codec with capability check
By this commit, each codec has its own element factory so the
nvdec element factory is removed. Also, if there are more than one device,
additional nvdec element factory will be created per
device like nvh264device{device-id}dec, so that the element factory
can expose the exact capability of the device for the codec.
2019-07-22 17:39:45 +00:00
Seungha Yang
afe3c7e3ef nvcodec: Drop cudaGL.h dependency
nvcodec does not use any type/define/enum in cudaGL.h.
2019-07-22 23:11:14 +09:00
Seungha Yang
48a6641717 nvdec: Fix video stuttering issue with VP9
Address nvidia driver specific behavior to avoid unexpected frame mismatch
between GStreamer and NVDEC.
2019-07-19 18:44:32 +09:00
Seungha Yang
8018fa2526 nvdec: Drop async queue and handle data on callback of CUvideoparser
Callbacks of CUvideoparser is called on the streaming thread.
So the use of async queue has no benefit.

Make control flow straightforward instead of long while/switch loop.
2019-07-19 18:44:32 +09:00
Seungha Yang
8753561015 nvdec: Port to color_{primaries,transfer,matrix}_to_iso
... and update the color information only when upstream was not provided
the information.
2019-07-17 06:34:21 +00:00
Seungha Yang
e01c68524f nvenc: Specify colorimetry related VUI parameters
Set the colorimetry config for the information to be embedded in encodec bitstream.
2019-07-17 14:45:05 +09:00
Seungha Yang
8862abd7c6 nvdec: Fix possible frame drop on EOS
On eos, baseclass videoencoder call finish() vfunc instead of drain()
2019-07-09 20:52:23 +09:00
Marc Leeman
489ff8604f nvcodec: do a generic cuda tests before going into version specifics 2019-07-08 10:37:46 +00:00
Seungha Yang
c18fda03d9 nvdec,nvenc: Port to dynamic library loading
... and put them into new nvcodec plugin.

* nvcodec plugin
Now each nvenc and nvdec element is moved to be a part of nvcodec plugin
for better interoperability.
Additionally, cuda runtime API header dependencies
(i.e., cuda_runtime_api.h and cuda_gl_interop.h) are removed.
Note that cuda runtime APIs have prefix "cuda". Since 1.16 release with
Windows support, only "cuda.h" and "cudaGL.h" dependent symbols have
been used except for some defined types. However, those types could be
replaced with other types which were defined by "cuda.h".

* dynamic library loading
CUDA library will be opened with g_module_open() instead of build-time linking.
On Windows, nvcuda.dll is installed to system path by CUDA Toolkit
installer, and on *nix, user should ensure that libcuda.so.1 can be
loadable (i.e., via LD_LIBRARY_PATH or default dlopen path)
Therefore, NVIDIA_VIDEO_CODEC_SDK_PATH env build time dependency for Windows
is removed.
2019-07-08 10:37:46 +00:00