From a8b2fbf77f6226ee8a0abfa6d2bd259dcf24eeff Mon Sep 17 00:00:00 2001 From: Seungha Yang Date: Mon, 2 May 2022 22:41:53 +0900 Subject: [PATCH] d3d11decoder: Handle DPB size margin in a single place ... instead of each subclass Part-of: --- subprojects/gst-plugins-bad/sys/d3d11/gstd3d11av1dec.cpp | 5 +---- subprojects/gst-plugins-bad/sys/d3d11/gstd3d11decoder.cpp | 3 +++ subprojects/gst-plugins-bad/sys/d3d11/gstd3d11h264dec.cpp | 4 +--- subprojects/gst-plugins-bad/sys/d3d11/gstd3d11h265dec.cpp | 4 +--- subprojects/gst-plugins-bad/sys/d3d11/gstd3d11mpeg2dec.cpp | 5 +---- subprojects/gst-plugins-bad/sys/d3d11/gstd3d11vp8dec.cpp | 5 +---- subprojects/gst-plugins-bad/sys/d3d11/gstd3d11vp9dec.cpp | 5 +---- 7 files changed, 9 insertions(+), 22 deletions(-) diff --git a/subprojects/gst-plugins-bad/sys/d3d11/gstd3d11av1dec.cpp b/subprojects/gst-plugins-bad/sys/d3d11/gstd3d11av1dec.cpp index 6d19cd6..d6ffe8e 100644 --- a/subprojects/gst-plugins-bad/sys/d3d11/gstd3d11av1dec.cpp +++ b/subprojects/gst-plugins-bad/sys/d3d11/gstd3d11av1dec.cpp @@ -365,9 +365,6 @@ typedef struct _GST_DXVA_Status_AV1 #pragma pack(pop) -/* reference list 8 + 4 margin */ -#define NUM_OUTPUT_VIEW 12 - /* *INDENT-OFF* */ typedef struct _GstD3D11AV1DecInner { @@ -687,7 +684,7 @@ gst_d3d11_av1_dec_new_sequence (GstAV1Decoder * decoder, if (!gst_d3d11_decoder_configure (inner->d3d11_decoder, decoder->input_state, &info, (gint) inner->max_width, - (gint) inner->max_height, NUM_OUTPUT_VIEW)) { + (gint) inner->max_height, max_dpb_size)) { GST_ERROR_OBJECT (self, "Failed to create decoder"); return GST_FLOW_NOT_NEGOTIATED; } diff --git a/subprojects/gst-plugins-bad/sys/d3d11/gstd3d11decoder.cpp b/subprojects/gst-plugins-bad/sys/d3d11/gstd3d11decoder.cpp index 53fe381..cc5845a 100644 --- a/subprojects/gst-plugins-bad/sys/d3d11/gstd3d11decoder.cpp +++ b/subprojects/gst-plugins-bad/sys/d3d11/gstd3d11decoder.cpp @@ -731,6 +731,9 @@ gst_d3d11_decoder_configure (GstD3D11Decoder * decoder, return FALSE; } + /* Additional 4 frames to help zero-copying */ + dpb_size += 4; + decoder->input_state = gst_video_codec_state_ref (input_state); decoder->info = decoder->output_info = *info; decoder->coded_width = coded_width; diff --git a/subprojects/gst-plugins-bad/sys/d3d11/gstd3d11h264dec.cpp b/subprojects/gst-plugins-bad/sys/d3d11/gstd3d11h264dec.cpp index 89fcedb..10a63c3 100644 --- a/subprojects/gst-plugins-bad/sys/d3d11/gstd3d11h264dec.cpp +++ b/subprojects/gst-plugins-bad/sys/d3d11/gstd3d11h264dec.cpp @@ -455,9 +455,7 @@ gst_d3d11_h264_dec_new_sequence (GstH264Decoder * decoder, inner->max_dpb_size = max_dpb_size; if (!gst_d3d11_decoder_configure (inner->d3d11_decoder, decoder->input_state, &info, - inner->coded_width, inner->coded_height, - /* Additional 4 views margin for zero-copy rendering */ - max_dpb_size + 4)) { + inner->coded_width, inner->coded_height, max_dpb_size)) { GST_ERROR_OBJECT (self, "Failed to create decoder"); return GST_FLOW_NOT_NEGOTIATED; } diff --git a/subprojects/gst-plugins-bad/sys/d3d11/gstd3d11h265dec.cpp b/subprojects/gst-plugins-bad/sys/d3d11/gstd3d11h265dec.cpp index 509f0a1..64c03dd 100644 --- a/subprojects/gst-plugins-bad/sys/d3d11/gstd3d11h265dec.cpp +++ b/subprojects/gst-plugins-bad/sys/d3d11/gstd3d11h265dec.cpp @@ -407,9 +407,7 @@ gst_d3d11_h265_dec_new_sequence (GstH265Decoder * decoder, if (!gst_d3d11_decoder_configure (inner->d3d11_decoder, decoder->input_state, &info, - inner->coded_width, inner->coded_height, - /* Additional 4 views margin for zero-copy rendering */ - max_dpb_size + 4)) { + inner->coded_width, inner->coded_height, max_dpb_size)) { GST_ERROR_OBJECT (self, "Failed to create decoder"); return GST_FLOW_NOT_NEGOTIATED; } diff --git a/subprojects/gst-plugins-bad/sys/d3d11/gstd3d11mpeg2dec.cpp b/subprojects/gst-plugins-bad/sys/d3d11/gstd3d11mpeg2dec.cpp index 21f1e8f..58102fd 100644 --- a/subprojects/gst-plugins-bad/sys/d3d11/gstd3d11mpeg2dec.cpp +++ b/subprojects/gst-plugins-bad/sys/d3d11/gstd3d11mpeg2dec.cpp @@ -53,9 +53,6 @@ GST_DEBUG_CATEGORY_EXTERN (gst_d3d11_mpeg2_dec_debug); #define GST_CAT_DEFAULT gst_d3d11_mpeg2_dec_debug -/* reference list 2 + 4 margin */ -#define NUM_OUTPUT_VIEW 6 - /* *INDENT-OFF* */ typedef struct _GstD3D11Mpeg2DecInner { @@ -398,7 +395,7 @@ gst_d3d11_mpeg2_dec_new_sequence (GstMpeg2Decoder * decoder, if (!gst_d3d11_decoder_configure (inner->d3d11_decoder, decoder->input_state, &info, - inner->width, inner->height, NUM_OUTPUT_VIEW)) { + inner->width, inner->height, max_dpb_size)) { GST_ERROR_OBJECT (self, "Failed to create decoder"); return GST_FLOW_NOT_NEGOTIATED; } diff --git a/subprojects/gst-plugins-bad/sys/d3d11/gstd3d11vp8dec.cpp b/subprojects/gst-plugins-bad/sys/d3d11/gstd3d11vp8dec.cpp index 93bcf77..d54980c 100644 --- a/subprojects/gst-plugins-bad/sys/d3d11/gstd3d11vp8dec.cpp +++ b/subprojects/gst-plugins-bad/sys/d3d11/gstd3d11vp8dec.cpp @@ -53,9 +53,6 @@ GST_DEBUG_CATEGORY_EXTERN (gst_d3d11_vp8_dec_debug); #define GST_CAT_DEFAULT gst_d3d11_vp8_dec_debug -/* reference list 4 + 4 margin */ -#define NUM_OUTPUT_VIEW 8 - /* *INDENT-OFF* */ typedef struct _GstD3D11Vp8DecInner { @@ -331,7 +328,7 @@ gst_d3d11_vp8_dec_new_sequence (GstVp8Decoder * decoder, if (!gst_d3d11_decoder_configure (inner->d3d11_decoder, decoder->input_state, &info, inner->width, inner->height, - NUM_OUTPUT_VIEW)) { + max_dpb_size)) { GST_ERROR_OBJECT (self, "Failed to create decoder"); return GST_FLOW_NOT_NEGOTIATED; } diff --git a/subprojects/gst-plugins-bad/sys/d3d11/gstd3d11vp9dec.cpp b/subprojects/gst-plugins-bad/sys/d3d11/gstd3d11vp9dec.cpp index ab66a4e..90b1bb3 100644 --- a/subprojects/gst-plugins-bad/sys/d3d11/gstd3d11vp9dec.cpp +++ b/subprojects/gst-plugins-bad/sys/d3d11/gstd3d11vp9dec.cpp @@ -84,9 +84,6 @@ GST_DEBUG_CATEGORY_EXTERN (gst_d3d11_vp9_dec_debug); #define GST_CAT_DEFAULT gst_d3d11_vp9_dec_debug -/* reference list 8 + 4 margin */ -#define NUM_OUTPUT_VIEW 12 - /* *INDENT-OFF* */ typedef struct _GstD3D11Vp9DecInner { @@ -385,7 +382,7 @@ gst_d3d11_vp9_dec_new_sequence (GstVp9Decoder * decoder, if (!gst_d3d11_decoder_configure (inner->d3d11_decoder, decoder->input_state, &info, (gint) frame_hdr->width, - (gint) frame_hdr->height, NUM_OUTPUT_VIEW)) { + (gint) frame_hdr->height, max_dpb_size)) { GST_ERROR_OBJECT (self, "Failed to create decoder"); return GST_FLOW_NOT_NEGOTIATED; } -- 2.7.4