d3d11decoder: Handle DPB size margin in a single place
authorSeungha Yang <seungha@centricular.com>
Mon, 2 May 2022 13:41:53 +0000 (22:41 +0900)
committerGStreamer Marge Bot <gitlab-merge-bot@gstreamer-foundation.org>
Tue, 3 May 2022 14:17:49 +0000 (14:17 +0000)
... instead of each subclass

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2343>

subprojects/gst-plugins-bad/sys/d3d11/gstd3d11av1dec.cpp
subprojects/gst-plugins-bad/sys/d3d11/gstd3d11decoder.cpp
subprojects/gst-plugins-bad/sys/d3d11/gstd3d11h264dec.cpp
subprojects/gst-plugins-bad/sys/d3d11/gstd3d11h265dec.cpp
subprojects/gst-plugins-bad/sys/d3d11/gstd3d11mpeg2dec.cpp
subprojects/gst-plugins-bad/sys/d3d11/gstd3d11vp8dec.cpp
subprojects/gst-plugins-bad/sys/d3d11/gstd3d11vp9dec.cpp

index 6d19cd6..d6ffe8e 100644 (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;
     }
index 53fe381..cc5845a 100644 (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;
index 89fcedb..10a63c3 100644 (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;
     }
index 509f0a1..64c03dd 100644 (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;
     }
index 21f1e8f..58102fd 100644 (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;
     }
index 93bcf77..d54980c 100644 (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;
   }
index ab66a4e..90b1bb3 100644 (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;
   }