Commit graph

230 commits

Author SHA1 Message Date
Seungha Yang
2f5257fd69 Revert "d3d11decoder: Use D3D11/DXGI standard colorimetry"
This reverts commit a52fc6deed.

The change breaks H264/HEVC conformance bitstream tests

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1753>
2020-11-02 17:58:23 +00:00
Seungha Yang
a52fc6deed d3d11decoder: Use D3D11/DXGI standard colorimetry
D3D11/DXGI supports smaller set of colorimetry than all possible
combination. This restriction would make more streams convertible
by using ID3D11VideoProcessor

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1743>
2020-11-02 18:48:58 +09:00
Seungha Yang
a3a7e21f87 d3d11window: Use ID3D11VideoProcessor only if device supports corresponding conversion
... and drop support for ID3D11VideoProcessor if device doesn't
support ID3D11VideoContext1 interface and therefore we cannot
query conversion supportability.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1743>
2020-11-02 18:48:54 +09:00
Seungha Yang
337cb883fa d3d11h{264,265}dec: Submit picture level parameters only once
Submit PICTURE_PARAMETERS and INVERSE_QUANTIZATION_MATRIX
buffers only once per picture. Multiple submission is redundant.
Also this modification would fix broken hevc decoding with
dependent slice.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1749>
2020-11-01 14:29:42 +00:00
Seungha Yang
0bb73ec800 d3d11decoder: Get rid of framerate field from pad template
Framerate is optional value and we don't have any framerate
related restriction for those elements. This commit is to fix
negotiation failure when upstream doesn't set framerate on caps.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1747>
2020-11-01 00:51:46 +09:00
Seungha Yang
9a796482dc d3d11decoder: Allow 10bits only profiles
HEVC_VLD_Main10 and VP9_VLD_10bit_Profile2 might not support
8bit format (i.e., NV12) depending on GPU vendor.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1742>
2020-10-31 00:37:48 +09:00
Seungha Yang
b62867ecc8 d3d11videoprocessor: Fix wrong input/output supportability check
The flag argument of ID3D11VideoProcessorEnumerator::CheckVideoProcessorFormat
method is output value, not input.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1726>
2020-10-28 15:53:54 +00:00
Seungha Yang
fab234f2f1 d3d11memory: Adjust log level for some spammy debug messages
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1723>
2020-10-27 16:20:49 +00:00
Seungha Yang
10f622aa5d d3d11convert: Use ID3D11VideoProcessor only if device supports colorspace
Check whether conversion with given combination of input/output
format and dxgi colorspace is supported or not by driver.
If not, we should use shader.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1723>
2020-10-27 16:20:49 +00:00
Seungha Yang
6b992f291b d3d11videoprocessor: Add a method for device's conversion caps check
Add a wrapper method for
ID3D11VideoProcessorEnumerator1::CheckVideoProcessorFormatConversion.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1723>
2020-10-27 16:20:49 +00:00
Seungha Yang
1e038ce322 d3d11format: Map more colorimetry with dxgi colorspace
Map more logically identical set of GstVideoColorimetry formats
with dxgi color space.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1723>
2020-10-27 16:20:49 +00:00
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
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
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
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
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
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
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
Seungha Yang
0a454191c0 d3d11upload: Allow passthrough for system memory
... like how d3d11download and gl{upload,download} do.
This should've been part of the commit 9b72b04dad
but I missed.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1645>
2020-10-05 15:54:37 +00:00
Seungha Yang
a9314b4554 d3d11upload/d3d11download: Make use of staging buffer
... instead of direct cpu map for d3d11memory object. In this way,
we don't need per GstD3D11Memory staging texture.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1627>
2020-10-04 15:44:03 +00:00
Seungha Yang
f35eeaa02b d3d11: Don't hold staging texture
Staging texture is used for memory transfer between system and
gpu memory. Apart from d3d11{upload,download} elements, however,
it should happen very rarely.

Before this commit, d3d11bufferpool was allocating at least one
staging texture in order to calculate cpu accessible memory size,
and it wasn't freed for later use of the texture unconditionally.
But it will increase system memory usage. Although GstD3D11memory
object is implemented so that support CPU access, most memory
transfer will happen in d3d11{upload,download} elements.

By this commit, the initial staging texture will be freed immediately
once cpu accessible memory size is calculated.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1627>
2020-10-04 15:44:03 +00:00
Seungha Yang
899f9978f5 d3d11: Move to G_DECLARE_FINAL_TYPE
... and remove unnecessary forward declaration.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1627>
2020-10-04 15:44:03 +00:00
Seungha Yang
ea24a2e527 d3d11: Add support for packed 8bits 4:2:2 YUV formats
Note that newly added formats (YUY2, UYVY, and VYUY) are not supported
render target view formats. So such formats can be only input of d3d11convert
or d3d11videosink. Another note is that YUY2 format is a very common
format for hardware en/decoders on Windows.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1581>
2020-09-18 14:47:21 +00:00
Seungha Yang
08119ea515 d3d11vp9dec: Don't need to consider output_picture() call without GstVideoCodecFrame
Baseclass will be updated in order to ensure GstVideoCodecFrame.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1567>
2020-09-15 15:54:53 +00:00
Seungha Yang
b73a223dc5 d3d11vp9dec: Specify profile and alignment on sink template
Set supported profile(s) on sink template caps, so that decodebin
can filter out this element if profile of given vp9 stream is not
supported by hardware decoder.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1567>
2020-09-15 15:54:53 +00:00
Seungha Yang
bb5ef4fd5b d3d11decoder: Cleanup code
* Don't need to set pts/dts/duration on output buffer of frame.
  it's handled by baseclass
* Remove meaningless debug output

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1567>
2020-09-15 15:54:53 +00:00
Seungha Yang
95e007ac49 d3d11videosink: Fix crash caused by missing null termination
gst_caps_features_new() must be null terminated.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1524>
2020-08-24 20:03:05 +00:00
Seungha Yang
185d2f56a3 d3d11: Handle newly added GST_VIDEO_TRANSFER_BT601
Use the value for mapping between DXGI_COLOR_SPACE_TYPE and GstVideoColorimetry.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1410>
2020-08-12 15:18:56 +00:00
Seungha Yang
205ad89802 d3d11: Store more device information in context structure
It would be more informative for debugging

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1507>
2020-08-12 14:04:55 +00:00
Seungha Yang
ff9157eef4 d3d11: Selected adapter index should be unsigned integer
If d3d11device was created successfully, the index of adapter
must not be negative value

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1507>
2020-08-12 14:04:55 +00:00
Seungha Yang
9b72b04dad d3d11download: Allow linking with downstream d3d11 elements
It will make pipeline configuration easier since d3d11download
element can be placed unconditionally. This behavior is similar
to that of gldownload element.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1485>
2020-08-03 13:10:07 +00:00
Seungha Yang
d03e959f54 d3d11window: Remove timeout and wait a task if possible
If the run_async() method is expected to be called from streaming
thread and not from application thread, use INFINITE as timeout value
so that d3d11window can wait UI dispatcher thread in any case.

There is no way to get a robust timeout value from library side.
So the fixed timeout value might not be optimal and therefore
we should avoid it as much as possible.

Rule whether a timeout value can be INFINITE or not is,
* If the waiting can be cancelled by GstBaseSink:unlock(), use INFINITE.
  GstD3D11Window:on_resize() is one case for example.
* Otherwise, use timeout value
  Some details are, GstBaseSink:start() and GstBaseSink:stop() will be called
  when NULL to READY or READY to NULL state change, so there will be no
  chance for GstBaseSink:unlock() and GstBaseSink:unlock_stop()
  to be called around them. So there is no other way then timeout way.
  GstD3D11Window:consturcted() and GstD3D11Window:unprepare() are the case.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1461>
2020-07-24 04:53:44 +00:00
Seungha Yang
6ede4a99a7 d3d11window: Increase timeout to 10 sec for WinRT window implementations
No strong reason for this number, but we can follow other well known
UWP implementation ANGLE.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1461>
2020-07-24 04:53:44 +00:00
Seungha Yang
deaa29bd96 codecs: vp8decoder: Sync up with h264decoder implementation
Pass GstVideoCodecFrame with GstVp8Picture to new_picture() and
output_picture() methods for subclass to be able to reference
it directly.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1458>
2020-07-23 15:48:05 -04:00
Seungha Yang
e754d5a5b2 codecs: vp9decoder: Sync up with h264decoder implementation
* Pass GstVideoCodecFrame to new_picture() and output_picture()
* Pass the last reference of GstVp9Picture to subclass if possible

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1455>
2020-07-23 15:41:39 +00:00
Seungha Yang
128e533a6e d3d11decoder: Disable array-of-texture
Some 4K VP9 + super frame enabled streams would be broken with
array-of-texture configuration (i.e., allowing runtime texture registration
for DPB).

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1456>
2020-07-22 16:06:47 +00:00
Seungha Yang
2a0de96015 d3d11window: Disable d3d11 video processor for HDR10 stream.
d3d11 video processor is showing buggy behaviors in various cases.
And this HDR10 is one case of them.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1454>
2020-07-21 15:41:20 +00:00