d3d11: Add AV1 decoder

Introduce Direct3D11/DXVA AV1 decoder element

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2365>
This commit is contained in:
Seungha Yang 2021-06-14 18:49:20 +09:00 committed by GStreamer Marge Bot
parent c3b26de1f2
commit 44e3399bf8
6 changed files with 1562 additions and 0 deletions

1505
sys/d3d11/gstd3d11av1dec.cpp Normal file

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_AV1_DEC_H__
#define __GST_D3D11_AV1_DEC_H__
#include "gstd3d11decoder.h"
G_BEGIN_DECLS
void gst_d3d11_av1_dec_register (GstPlugin * plugin,
GstD3D11Device * device,
GstD3D11Decoder * decoder,
guint rank);
G_END_DECLS
#endif /* __GST_D3D11_AV1_DEC_H__ */

View file

@ -84,6 +84,8 @@ DEFINE_GUID (GST_GUID_D3D11_DECODER_PROFILE_MPEG2_VLD, 0xee27417f, 0x5e28,
0x4e65, 0xbe, 0xea, 0x1d, 0x26, 0xb5, 0x08, 0xad, 0xc9);
DEFINE_GUID (GST_GUID_D3D11_DECODER_PROFILE_MPEG2and1_VLD, 0x86695f12, 0x340e,
0x4f04, 0x9f, 0xd3, 0x92, 0x53, 0xdd, 0x32, 0x74, 0x60);
DEFINE_GUID (GST_GUID_D3D11_DECODER_PROFILE_AV1_VLD_PROFILE0, 0xb8be4ccb,
0xcf53, 0x46ba, 0x8d, 0x59, 0xd6, 0xb8, 0xa6, 0xda, 0x5d, 0x2a);
static const GUID *profile_h264_list[] = {
&GST_GUID_D3D11_DECODER_PROFILE_H264_IDCT_FGT,
@ -116,6 +118,11 @@ static const GUID *profile_mpeg2_list[] = {
&GST_GUID_D3D11_DECODER_PROFILE_MPEG2and1_VLD
};
static const GUID *profile_av1_list[] = {
&GST_GUID_D3D11_DECODER_PROFILE_AV1_VLD_PROFILE0,
/* TODO: add more profile */
};
enum
{
PROP_0,
@ -544,6 +551,8 @@ gst_d3d11_codec_to_string (GstD3D11Codec codec)
return "VP8";
case GST_D3D11_CODEC_MPEG2:
return "MPEG2";
case GST_D3D11_CODEC_AV1:
return "AV1";
default:
g_assert_not_reached ();
break;
@ -605,6 +614,10 @@ gst_d3d11_decoder_get_supported_decoder_profile (GstD3D11Decoder * decoder,
profile_size = G_N_ELEMENTS (profile_mpeg2_list);
}
break;
case GST_D3D11_CODEC_AV1:
profile_list = profile_av1_list;
profile_size = G_N_ELEMENTS (profile_av1_list);
break;
default:
break;
}
@ -857,6 +870,7 @@ gst_d3d11_decoder_open (GstD3D11Decoder * self)
* But... where it is? */
switch (self->codec) {
case GST_D3D11_CODEC_H265:
case GST_D3D11_CODEC_AV1:
/* See directx_va_Setup() impl. in vlc */
if (vendor != GST_D3D11_DEVICE_VENDOR_XBOX)
alignment = 128;
@ -922,6 +936,7 @@ gst_d3d11_decoder_open (GstD3D11Decoder * self)
case GST_D3D11_CODEC_VP9:
case GST_D3D11_CODEC_VP8:
case GST_D3D11_CODEC_MPEG2:
case GST_D3D11_CODEC_AV1:
if (config_list[i].ConfigBitstreamRaw == 1)
best_config = &config_list[i];
break;

View file

@ -40,6 +40,7 @@ typedef enum
GST_D3D11_CODEC_H265,
GST_D3D11_CODEC_VP8,
GST_D3D11_CODEC_MPEG2,
GST_D3D11_CODEC_AV1,
/* the last of supported codec */
GST_D3D11_CODEC_LAST

View file

@ -17,6 +17,7 @@ d3d11_sources = [
]
d3d11_dec_sources = [
'gstd3d11av1dec.cpp',
'gstd3d11decoder.cpp',
'gstd3d11h264dec.cpp',
'gstd3d11vp9dec.cpp',

View file

@ -36,6 +36,7 @@
#include "gstd3d11vp9dec.h"
#include "gstd3d11vp8dec.h"
#include "gstd3d11mpeg2dec.h"
#include "gstd3d11av1dec.h"
#endif
#ifdef HAVE_DXGI_DESKTOP_DUP
#include "gstd3d11desktopdupsrc.h"
@ -61,6 +62,7 @@ GST_DEBUG_CATEGORY (gst_d3d11_h265_dec_debug);
GST_DEBUG_CATEGORY (gst_d3d11_vp9_dec_debug);
GST_DEBUG_CATEGORY (gst_d3d11_vp8_dec_debug);
GST_DEBUG_CATEGORY (gst_d3d11_mpeg2_dec_debug);
GST_DEBUG_CATEGORY (gst_d3d11_av1_dec_debug);
#endif
#ifdef HAVE_DXGI_DESKTOP_DUP
@ -113,6 +115,8 @@ plugin_init (GstPlugin * plugin)
"d3d11vp8dec", 0, "Direct3D11 VP8 Decoder");
GST_DEBUG_CATEGORY_INIT (gst_d3d11_mpeg2_dec_debug,
"d3d11mpeg2dec", 0, "Direct3D11 MPEG2 Decoder");
GST_DEBUG_CATEGORY_INIT (gst_d3d11_av1_dec_debug,
"d3d11av1dec", 0, "Direct3D11 AV1 Decoder");
}
#endif
@ -167,6 +171,8 @@ plugin_init (GstPlugin * plugin)
GST_RANK_SECONDARY);
gst_d3d11_mpeg2_dec_register (plugin, device, decoder,
GST_RANK_SECONDARY);
gst_d3d11_av1_dec_register (plugin, device, decoder,
GST_RANK_SECONDARY);
}
done: