d3d11: Add support for deinterlacing by using ID3D11VideoProcessor interface

Add a new element d3d11deinterlace to support deinterlacing.
Similar to d3d11videosink and d3d11compositor, this element is
a wrapper bin of set of child elements including helpful
conversion elements (upload/download and color convert)
to make this element configurable between non-d3d11 elements.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2016>
This commit is contained in:
Seungha Yang 2021-01-22 00:10:28 +09:00
parent 0ee13755a8
commit cfbc580575
4 changed files with 2409 additions and 0 deletions

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,34 @@
/* GStreamer
* Copyright (C) 2021 Seungha Yang <seungha@centricular.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef __GST_D3D11_DEINTERLACE_H__
#define __GST_D3D11_DEINTERLACE_H__
#include <gst/gst.h>
#include <gst/d3d11/gstd3d11.h>
G_BEGIN_DECLS
void gst_d3d11_deinterlace_register (GstPlugin * plugin,
GstD3D11Device * device,
guint rank);
G_END_DECLS
#endif /* __GST_D3D11_DEINTERLACE_H__ */

View file

@ -86,6 +86,12 @@ if d3d11_winapi_desktop
endif
endif
# need dxgi1_5.h for HDR10 processing and d3d11_4.h for ID3D11VideoContext2 interface
if d3d11_conf.get('GST_D3D11_DXGI_HEADER_VERSION') >= 5 and d3d11_conf.get('GST_D3D11_HEADER_VERSION') >= 4
d3d11_sources += ['gstd3d11deinterlace.cpp']
extra_c_args += ['-DHAVE_D3D11_VIDEO_PROC']
endif
# MinGW 32bits compiler seems to be complaining about redundant-decls
# when ComPtr is in use. Let's just disable the warning
if cc.get_id() != 'msvc'

View file

@ -41,6 +41,9 @@
#ifdef HAVE_DXGI_DESKTOP_DUP
#include "gstd3d11desktopdupsrc.h"
#endif
#ifdef HAVE_D3D11_VIDEO_PROC
#include "gstd3d11deinterlace.h"
#endif
GST_DEBUG_CATEGORY (gst_d3d11_debug);
GST_DEBUG_CATEGORY (gst_d3d11_shader_debug);
@ -65,6 +68,10 @@ GST_DEBUG_CATEGORY (gst_d3d11_mpeg2_dec_debug);
GST_DEBUG_CATEGORY (gst_d3d11_desktop_dup_debug);
#endif
#ifdef HAVE_D3D11_VIDEO_PROC
GST_DEBUG_CATEGORY (gst_d3d11_deinterlace_debug);
#endif
#define GST_CAT_DEFAULT gst_d3d11_debug
static gboolean
@ -116,6 +123,11 @@ plugin_init (GstPlugin * plugin)
}
#endif
#ifdef HAVE_D3D11_VIDEO_PROC
GST_DEBUG_CATEGORY_INIT (gst_d3d11_deinterlace_debug,
"d3d11deinterlace", 0, "Direct3D11 Deinterlacer");
#endif
/* Enumerate devices to register decoders per device and to get the highest
* feature level */
/* AMD seems supporting up to 12 cards, and 8 for NVIDIA */
@ -169,6 +181,17 @@ plugin_init (GstPlugin * plugin)
}
#endif
#ifdef HAVE_D3D11_VIDEO_PROC
/* D3D11 video processor API is availble since Windows 8 */
if (gst_d3d11_is_windows_8_or_greater ()) {
gboolean hardware;
g_object_get (device, "hardware", &hardware, NULL);
if (hardware)
gst_d3d11_deinterlace_register (plugin, device, GST_RANK_MARGINAL);
}
#endif
gst_object_unref (device);
}