Commit graph

489 commits

Author SHA1 Message Date
Seungha Yang 6a59dd95e8 d3d11convert: Use single GstD3D11Converter object
... and don't use GstD3D11VideoProcessor. Now GstD3D11Converter will
be able to convert using videoprocessor, and texture upload is also supported by
GstD3D11Converter. All the noisy code can be removed therefore.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2697>
2022-07-02 05:37:55 +09:00
Seungha Yang 91a732fe90 d3d11converter: Add support conversion using videoprocessor
* Add videoprocessor feature to d3d11converter, in order to unifiy
  conversion flow.
* Add convert_buffer() method to support automatic shader/videoprocessor
  selection. The method also supports texture upload if input memory
  cannot be used for conversion (e.g., system memory or so)

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2697>
2022-07-02 05:37:55 +09:00
Seungha Yang fdbb9041a2 d3d11overlaycompositor: Objectify overlay render implementation
Be consistent with other implementations

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2697>
2022-07-02 05:37:27 +09:00
Seungha Yang b2d09de899 d3d11: Don't use const pointer to GstDxgiColorSpace
Instead, fill values of passed GstDxgiColorSpace struct

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2697>
2022-07-01 19:34:16 +00:00
Sebastian Dröge 2aae64edb9 decklinkvideosink: Pass video frames directly to the Decklink SDK without copying
If the video frame is stored in PBO memory then we need to copy anyway as
it might be stored in CPU-accessible GPU memory that can't be accessed
from the Decklink driver.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2674>
2022-07-01 08:46:48 +00:00
Vincent Cheah Beng Keat 5ffaf2aa09 msdkmjpegdec: Add support for error report
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2401>
2022-07-01 06:29:30 +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 ce82c0570e cuda: Add YUY2 and UYVY formats for GL interop
Those formats are not supported conversion formats by CUDA convert/scale elements
but would be useful for GL <-> CUDA interop use case.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2691>
2022-06-30 11:17:15 +00:00
Seungha Yang d9f08e17f1 cudadownload: Passthrough in case of CUDA -> SYSTEM
GstCudaMemory supports CPU access via CUDA pinned host memory already
and it would show faster memory transfer performance between
GPU and CPU than copying from/to normal system memory.
If downstream supports video meta, we can passthrough CUDA memory.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2690>
2022-06-30 10:45:45 +00:00
Corentin Damman ae781610c8 cudaformat: add support for planar 4:2:2 YUV formats in CUDA D3D11 interop
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2269>
2022-06-30 07:30:09 +00:00
Corentin Damman 8678fc999a cudamemory: add support for planar 4:2:2 YUV formats
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2269>
2022-06-30 07:30:09 +00:00
Benjamin Gaignard d3a01eccae v4l2codecs: enumerate all possible formats
Some decoder may also allow to (down) scale the decoded video.
Use VIDIOC_ENUM_FRAMESIZES iotcl to enumerate the possible output
formats resolutions.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2589>
2022-06-29 19:18:16 +00:00
Seungha Yang 85fe9fb61d nvcodec: Add cuda-device-id read-only property to stateless decoders
... and remove unnecessary intermediate subclass from class hierarchy

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2665>
2022-06-30 01:54:17 +09:00
Seungha Yang 1e11c05591 nvcodec: Add cuda-device-id read-only property to CUVID decoders
Similar to the other hardware decoder plugins, provides assigned
device id via property

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2665>
2022-06-30 01:45:20 +09:00
Seungha Yang 38e142db9a d3d11convert: Add support for GstVideoCropMeta
Performs crop, scale, and color space conversion all in
a single render pipeline. Note that cropping related property is not
added in this element (which will make negotiation very complicated),
but user can configure videocrop element for crop meta to be attached
on each buffer.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2678>
2022-06-29 09:43:10 +00:00
Seungha Yang 1043481247 d3d11videosink: Fix for force-aspect-ratio setting when rendering on shared texture
Set specified force-aspect-ratio value on window object
in case of shared texture rendering as well

Fixes: https://gitlab.freedesktop.org/gstreamer/gstreamer/-/issues/1304
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2671>
2022-06-29 09:04:33 +00:00
Seungha Yang 236378c9d5 mfvideoenc: Fix broken encoding when resolution is not an even number
Width and height values of 4:2:0 subsampled YUV format should be even number,
and if it's not the case, there should be padding which is not a contiguous memory layout.
Do copy input frames to MediaFoundation's memory in that case for now.

Fixes: https://gitlab.freedesktop.org/gstreamer/gstreamer/-/issues/1165
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2661>
2022-06-29 08:26:45 +00:00
Seungha Yang b09ae1d635 d3d11: Enumerate devices via native DXGI API
D3D11CreateDevice() can fail for some reason (e.g., buggy GPU driver)
and then gst_d3d11_device_new() will return nullptr.
Use DXGI API directly instead of relying on the gst_d3d11_device_new()

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2663>
2022-06-27 20:30:13 +00:00
Seungha Yang aca71fd692 d3d11: Update gst_d3d11_allocation_params_new() interface
Define GST_D3D11_ALLOCATION_FLAG_DEFAULT (0) value instead of
casting enum type everywhere. And pass D3D11_RESOURCE_MISC_FLAG value

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2646>
2022-06-27 19:33:57 +00:00
U. Artie Eoff c4a9a96a15 va: postproc: add scale-method property
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2654>
2022-06-27 12:17:54 -04:00
U. Artie Eoff 211ba46369 va: filter/postproc: move unconditional props to vavpp
Only conditional/dynamic properties should be installed/handled
by vafilter.  Thus, move and install the unconditional/static
properties in vavpp.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2654>
2022-06-27 12:17:53 -04:00
U. Artie Eoff 178f4fcd20 va: compositor/filter: use scale method setter
Use the filter's scale method member instead of the sample's member.

Removes the filter_flags member from the composite sample.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2654>
2022-06-27 10:53:11 -04:00
U. Artie Eoff 280678fe42 va: filter: add scale method field and setter
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2654>
2022-06-27 10:52:03 -04:00
Víctor Manuel Jáquez Leal 63a8fc505e va: Add vajpegdec element.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1575>
2022-06-27 13:43:14 +00:00
Víctor Manuel Jáquez Leal ec55017a83 va: allocator: Add hack for no fourcc when surface creation.
This patch adds general mechanism for handling specific hacks. In this
case for jpeg decoder in i965 driver, which cannot create surfaces
with fourcc specified.

From jpeg decoder to the allocator, which creates the surfaces,
there's a non-simple path: basedec pseudo-class adds a hacks guint32
which will be set by actual elements (vajpegdec, in this case) and
basedec will always set the hack to the allocator when the allocator
is instantiated.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1575>
2022-06-27 13:43:14 +00:00
Víctor Manuel Jáquez Leal 5b28509564 va: caps: Add jpeg fields in coded caps.
Given the supported rt formats in a profile/entrypoint config it's
possible to know the supported JPEG colorspace and subsampling. This
patch adds this information in coded caps to a safer autoplugging
after jpegparser.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1575>
2022-06-27 13:43:14 +00:00
Víctor Manuel Jáquez Leal cc30854893 va: Add jpegdecoder base class.
This base class is intented for hardware accelerated decoders, but since
only VA uses it, it will be kept internally in va plugin.

It follows the same logic as the others video decoders in the library but.
as JPEG are independet images, there's no need to handle a DBP so no need
of a picture object. Instead a scan object is added with all the structures
required to decode the image (huffman and quant tables, mcus, etc.).

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1575>
2022-06-27 13:43:14 +00:00
Víctor Manuel Jáquez Leal f36d2671e4 va: build: Remove duplicated source.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1575>
2022-06-27 13:43:14 +00:00
Seungha Yang 16955ba672 cudamemorycopy: Make sure writable caps before removing fields
The caps to be modified may not be writable when D3D11/GL/NVMM
are all disabled.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2664>
2022-06-27 20:28:31 +09:00
Seungha Yang 170271b86f d3d11: Revert staging buffer pool implementation
The staging buffer pool implementation was added to improve
throughput performance since we can avoid per-frame
CPU copy operation via staging texture but it turned out that
we can not make it thread safe. See
https://gitlab.freedesktop.org/gstreamer/gstreamer/-/issues/1182

Reverting the staging texture implementation as it does not show
any visible value.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2651>
2022-06-23 22:03:52 +09:00
Seungha Yang abd60b6b1e qsvdecoder: Fix system memory alignment
Do right padding, not left

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2651>
2022-06-23 21:43:25 +09:00
Seungha Yang 513a1cbbb3 d3d11decoder: Fix texture download
Stride applied to src/dst was reversed

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2651>
2022-06-23 21:41:24 +09:00
Víctor Manuel Jáquez Leal 685a611812 va: Use driver implementation macro rather than function.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2642>
2022-06-21 18:21:46 +00:00
Seungha Yang 1dc24d23d2 d3d11: Fix some typos
Fix up spelling and d3d11testsrc class meta.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2644>
2022-06-21 20:12:06 +09:00
Seungha Yang a040450685 d3d11compositor: Performance optimization
Removing glvideomixer-like nuance (it was initially referenced)
and rewriting element since it's not an optimal design at all
from performance point of view.

* Remove wrapper bin (and internal conversion/upload/download elements)
  which will waste CPU/GPU resources. Conversion/blending can be done by the
  d3d11compositor element at once.
* Add support YUV blending without RGB conversion.
  The RGB <-> YUV conversion is completely unnecessary since YUV textures
  support blending as well.
* Remove complicated blending operation properties since it's hard
  to use from application point of view. Instead, adding "operator" property
  like what compositor element does.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2631>
2022-06-20 19:18:53 +00:00
Seungha Yang adcb3ec1f2 d3d11converter: Fix alpha factor update
converter should set entire constant buffer values since it's mapped
with write-discard flag

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2631>
2022-06-20 19:18:53 +00:00
Seungha Yang eaa9943b98 d3d11decoder: Check 16K resolution support
16K decoding is supported by some GPUs

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2629>
2022-06-18 18:02:44 +00:00
Seungha Yang e1fd0f620f d3d11decoder: Add support for non-zero crop-{x,y} position
AVC and HEVC define crop rectangle and the x/y coordinates might
not be zero. This commit will address the non-zero x/y offset coordinates
via GstVideoCropMeta if downstream supports the meta and d3d11 memory.
Otherwise decoder will copy decoded texture into output frame.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2624>
2022-06-17 20:15:02 +00:00
Seungha Yang 461416b5f1 d3d11converter: Implement filling border color
Equivalent to GST_VIDEO_CONVERTER_OPT_BORDER_ARGB and
GST_VIDEO_CONVERTER_OPT_FILL_BORDER options of GstVideoConverter

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2622>
2022-06-17 19:40:48 +00:00
Seungha Yang 59f39724b7 d3d11converter: Objectify converter
... and set conversion options via property

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2622>
2022-06-17 19:40:48 +00:00
Seungha Yang 3ed94c2dde d3d11shader: Remove GstD3D11Quad helper object
It's not very generic to be used for various scenario. Use native D3D11
APIs directly instead.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2622>
2022-06-17 19:40:48 +00:00
Seungha Yang ec6384947b d3d11compositor: Don't use GstD3D11Quad
The helper object will be removed

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2622>
2022-06-17 19:40:48 +00:00
Seungha Yang 93662da3d1 d3d11overlaycompositor: Fix HLSL compiler warning
warning X3206: 'Sample': implicit truncation of vector type

And don't use GstD3D11Quad since it will result in redundant API calls

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2622>
2022-06-17 19:40:48 +00:00
Seungha Yang 8e5a4246b9 qsvh264dec: Use newly added avcC data parsing API
Use gst_h264_parser_parse_decoder_config_record() method to parse
codec_data.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2449>
2022-06-15 19:58:59 +00:00
Sebastian Dröge 87230db55c decklinkvideosink: Fix selection of > PAL widescreen modes
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2601>
2022-06-15 13:23:51 +00:00
Víctor Manuel Jáquez Leal bb84a533bf va: basedec: Select output format with the used chroma in decoder.
Currently, video format is decided with downstream caps intersection,
but that's not correct since chroma is not considered. The video
decoders have to decide the output format given the used chroma, not
by the downstream caps negotiation.

This patch changes that. Still, caps feature is selected by caps
negotiation, then, with the preferred caps feature, the output format
is search within that caps feature.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2569>
2022-06-15 00:00:53 +00:00
Seungha Yang 7b39a09f9d d3d11converter: Add support for colorimetry conversion
Handle color primaries and gamma functions.
HDR <-> SDR conversion (tone mapping) should be implemented as well
but not a part of this patch.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2581>
2022-06-14 05:04:53 +09:00
Seungha Yang 3a44d14ac8 d3d11convert: Don't passthrough if colorimetry conversion is required
Different input/output colorimetry requires conversion

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2581>
2022-06-14 04:41:40 +09:00
Seungha Yang f3f905b491 d3d11window: Use SDR colorspace whenever possible
PQ uses completely different light level scale
and it should not be used for SDR bt2020.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2581>
2022-06-14 04:39:31 +09:00
Seungha Yang ac26860a80 d3d11converter: Rewrite conversion object
Rewriting GstD3D11Converter (equivalent to GstVideoConverter)
to optimize some conversion path and clean up.

* Extract YUV <-> RGB conversion matrix building method to
  utils. It will be used by other implementation
* Use calculated offset values for YCbCr <-> YPbPr conversion
  instead of hardcoded values
* Handle color range adjustment
* Move transform matrix building helper function to utils.
  The method will be used by other elements
* Use single constant buffer. Multiple constatne buffer for
  conversion pipeline is almost pointless
* Remove lots of duplicated HLSL code and split pixel shader
  code path into sampling -> colorspace conversion ->
  shader output packing
* Avoid floating point precision error around UV coordinates
* Optimize RGB -> YUV conversion path

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2581>
2022-06-14 04:37:30 +09:00