d3d11decoder: Handle DPB size margin in a single place

... instead of each subclass

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2343>
This commit is contained in:
Seungha Yang 2022-05-02 22:41:53 +09:00 committed by GStreamer Marge Bot
parent 6a4c42c03f
commit a8b2fbf77f
7 changed files with 9 additions and 22 deletions

View file

@ -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;
}

View file

@ -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;

View file

@ -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;
}

View file

@ -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;
}

View file

@ -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;
}

View file

@ -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;
}

View file

@ -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;
}