summaryrefslogtreecommitdiff
path: root/sys/d3d11/gstd3d11decoder.h
diff options
context:
space:
mode:
authorSeungha Yang <seungha@centricular.com>2021-09-16 00:59:37 +0900
committerSeungha Yang <seungha@centricular.com>2021-09-17 20:03:28 +0900
commit7d1f6459a09f23d6f0735956f0cd14fdefdaf16d (patch)
treea98292de34f7ddb52b0c267aca6dae50df2fd0a2 /sys/d3d11/gstd3d11decoder.h
parenta77f793c8bc4559367604e3203a07c5841d64c06 (diff)
downloadgstreamer-plugins-bad-7d1f6459a09f23d6f0735956f0cd14fdefdaf16d.tar.gz
d3d11decoder: Refactor for more unified decoding flow
... and various code cleanup. * Move spreaded decoding API calls into one method Previously, decoding flow of most codecs are - Call DecoderBeginFrame() on start_picture() - Call {Get,Release}DecoderBuffer() on decode_slice() - Call SubmitDecoderBuffers() and DecoderEndFrame() on end_picture() Such spreaded API calls make it hard to keep track of status of decoding. Now it will be done at once in a new method. * Drop a code for non-zero wBadSliceChopping When bitstream buffer provided by driver is not sufficient to write compressed bitstream data, host decoder needs to make use of wBadSliceChopping so that driver can understand there are multiple bitstream buffer. But it's a bit unrealistic and not tested. Since FFMpeg's DXVA implemetaion doesn't support it, we might be able to ignore the case for now. * Make code more portable Consider common logic of GstCodecs -> DXVA translation for all D3D APIs (i,e., D3D9, D3D11, and D3D12). Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2525>
Diffstat (limited to 'sys/d3d11/gstd3d11decoder.h')
-rw-r--r--sys/d3d11/gstd3d11decoder.h78
1 files changed, 45 insertions, 33 deletions
diff --git a/sys/d3d11/gstd3d11decoder.h b/sys/d3d11/gstd3d11decoder.h
index f7ec66131..08445fe65 100644
--- a/sys/d3d11/gstd3d11decoder.h
+++ b/sys/d3d11/gstd3d11decoder.h
@@ -34,17 +34,17 @@ typedef struct _GstD3D11DecoderClassData GstD3D11DecoderClassData;
typedef enum
{
- GST_D3D11_CODEC_NONE,
- GST_D3D11_CODEC_H264,
- GST_D3D11_CODEC_VP9,
- GST_D3D11_CODEC_H265,
- GST_D3D11_CODEC_VP8,
- GST_D3D11_CODEC_MPEG2,
- GST_D3D11_CODEC_AV1,
+ GST_DXVA_CODEC_NONE,
+ GST_DXVA_CODEC_MPEG2,
+ GST_DXVA_CODEC_H264,
+ GST_DXVA_CODEC_H265,
+ GST_DXVA_CODEC_VP8,
+ GST_DXVA_CODEC_VP9,
+ GST_DXVA_CODEC_AV1,
/* the last of supported codec */
- GST_D3D11_CODEC_LAST
-} GstD3D11Codec;
+ GST_DXVA_CODEC_LAST
+} GstDXVACodec;
typedef struct
{
@@ -53,36 +53,37 @@ typedef struct
guint vendor_id;
} GstD3D11DecoderSubClassData;
-GstD3D11Decoder * gst_d3d11_decoder_new (GstD3D11Device * device);
+typedef struct _GstD3D11DecodeInputStreamArgs
+{
+ gpointer picture_params;
+ gsize picture_params_size;
+
+ gpointer slice_control;
+ gsize slice_control_size;
+
+ gpointer bitstream;
+ gsize bitstream_size;
+
+ gpointer inverse_quantization_matrix;
+ gsize inverse_quantization_matrix_size;
+} GstD3D11DecodeInputStreamArgs;
+
+GstD3D11Decoder * gst_d3d11_decoder_new (GstD3D11Device * device,
+ GstDXVACodec codec);
gboolean gst_d3d11_decoder_is_configured (GstD3D11Decoder * decoder);
gboolean gst_d3d11_decoder_configure (GstD3D11Decoder * decoder,
- GstD3D11Codec codec,
GstVideoCodecState * input_state,
GstVideoInfo * info,
gint coded_width,
gint coded_height,
guint dpb_size);
-gboolean gst_d3d11_decoder_begin_frame (GstD3D11Decoder * decoder,
- ID3D11VideoDecoderOutputView * output_view,
- guint content_key_size,
- gconstpointer content_key);
-
-gboolean gst_d3d11_decoder_end_frame (GstD3D11Decoder * decoder);
+gboolean gst_d3d11_decoder_decode_frame (GstD3D11Decoder * decoder,
+ ID3D11VideoDecoderOutputView * output_view,
+ GstD3D11DecodeInputStreamArgs * input_args);
-gboolean gst_d3d11_decoder_get_decoder_buffer (GstD3D11Decoder * decoder,
- D3D11_VIDEO_DECODER_BUFFER_TYPE type,
- guint * buffer_size,
- gpointer * buffer);
-
-gboolean gst_d3d11_decoder_release_decoder_buffer (GstD3D11Decoder * decoder,
- D3D11_VIDEO_DECODER_BUFFER_TYPE type);
-
-gboolean gst_d3d11_decoder_submit_decoder_buffers (GstD3D11Decoder * decoder,
- guint buffer_count,
- const D3D11_VIDEO_DECODER_BUFFER_DESC * buffers);
GstBuffer * gst_d3d11_decoder_get_output_view_buffer (GstD3D11Decoder * decoder,
GstVideoDecoder * videodec);
@@ -110,25 +111,36 @@ gboolean gst_d3d11_decoder_set_flushing (GstD3D11Decoder * decod
gboolean flushing);
/* Utils for class registration */
+typedef struct _GstDXVAResolution
+{
+ guint width;
+ guint height;
+} GstDXVAResolution;
+
+static const GstDXVAResolution gst_dxva_resolutions[] = {
+ {1920, 1088}, {2560, 1440}, {3840, 2160}, {4096, 2160},
+ {7680, 4320}, {8192, 4320}
+};
+
gboolean gst_d3d11_decoder_util_is_legacy_device (GstD3D11Device * device);
-gboolean gst_d3d11_decoder_get_supported_decoder_profile (GstD3D11Decoder * decoder,
- GstD3D11Codec codec,
+gboolean gst_d3d11_decoder_get_supported_decoder_profile (GstD3D11Device * device,
+ GstDXVACodec codec,
GstVideoFormat format,
const GUID ** selected_profile);
-gboolean gst_d3d11_decoder_supports_format (GstD3D11Decoder * decoder,
+gboolean gst_d3d11_decoder_supports_format (GstD3D11Device * device,
const GUID * decoder_profile,
DXGI_FORMAT format);
-gboolean gst_d3d11_decoder_supports_resolution (GstD3D11Decoder * decoder,
+gboolean gst_d3d11_decoder_supports_resolution (GstD3D11Device * device,
const GUID * decoder_profile,
DXGI_FORMAT format,
guint width,
guint height);
GstD3D11DecoderClassData * gst_d3d11_decoder_class_data_new (GstD3D11Device * device,
- GstD3D11Codec codec,
+ GstDXVACodec codec,
GstCaps * sink_caps,
GstCaps * src_caps);