d3d11window: Remove hack related to color space selection
authorSeungha Yang <seungha@centricular.com>
Thu, 9 Dec 2021 10:55:04 +0000 (19:55 +0900)
committerSeungha Yang <seungha@centricular.com>
Thu, 9 Dec 2021 11:12:12 +0000 (20:12 +0900)
Use input GstVideoColorPrimaries without any special case handling
otherwise rendered image color would be very wrong.

The hack was added to work around an issue that some Intel driver
couldn't handle wide color gamut image without HDR10 metadata, specifically PQ image.
But device capability can be checked via a method added in
https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1723
so there's no issue now.

Fixes: https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/issues/1175
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1430>

subprojects/gst-plugins-bad/sys/d3d11/gstd3d11pluginutils.cpp
subprojects/gst-plugins-bad/sys/d3d11/gstd3d11pluginutils.h
subprojects/gst-plugins-bad/sys/d3d11/gstd3d11window.cpp

index 624063e..fea93b5 100644 (file)
@@ -514,7 +514,7 @@ gst_d3d11_video_info_to_dxgi_color_space (GstVideoInfo * info)
 
 const GstDxgiColorSpace *
 gst_d3d11_find_swap_chain_color_space (GstVideoInfo * info,
-    IDXGISwapChain3 * swapchain, gboolean use_hdr10)
+    IDXGISwapChain3 * swapchain)
 {
   const GstDxgiColorSpace *colorspace = NULL;
   gint best_score = G_MAXINT;
@@ -535,14 +535,6 @@ gst_d3d11_find_swap_chain_color_space (GstVideoInfo * info,
     DXGI_COLOR_SPACE_TYPE cur_type =
         (DXGI_COLOR_SPACE_TYPE) rgb_colorspace_map[i].dxgi_color_space_type;
 
-    /* FIXME: Non-HDR colorspace with BT2020 primaries will break rendering.
-     * https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/issues/1175
-     * To workaround it, BT709 colorspace will be chosen for non-HDR case.
-     */
-    if (!use_hdr10 &&
-        rgb_colorspace_map[i].primaries == GST_VIDEO_COLOR_PRIMARIES_BT2020)
-      continue;
-
     hr = swapchain->CheckColorSpaceSupport (cur_type, &can_support);
 
     if (FAILED (hr))
index de78df4..b92eaca 100644 (file)
@@ -73,8 +73,7 @@ gboolean        gst_d3d11_hdr_meta_data_to_dxgi     (GstVideoMasteringDisplayInf
 const GstDxgiColorSpace * gst_d3d11_video_info_to_dxgi_color_space (GstVideoInfo * info);
 
 const GstDxgiColorSpace * gst_d3d11_find_swap_chain_color_space (GstVideoInfo * info,
-                                                                 IDXGISwapChain3 * swapchain,
-                                                                 gboolean use_hdr10);
+                                                                 IDXGISwapChain3 * swapchain);
 #endif
 
 GstBuffer *     gst_d3d11_allocate_staging_buffer_for (GstBuffer * buffer,
index d5c9acf..37928df 100644 (file)
@@ -583,17 +583,6 @@ gst_d3d11_window_prepare_default (GstD3D11Window * window, guint display_width,
   window->input_rect.bottom = GST_VIDEO_INFO_HEIGHT (&window->info);
 
   /* Step 4: Decide render color space and set it on converter/processor */
-
-  /* check HDR10 metadata. If HDR APIs are available, BT2020 primaries colorspcae
-   * will be used.
-   *
-   * FIXME: need to query h/w level support. If that's not the case, tone-mapping
-   * should be placed somewhere.
-   *
-   * FIXME: Non-HDR colorspace with BT2020 primaries will break rendering.
-   * https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/issues/1175
-   * To workaround it, BT709 colorspace will be chosen for non-HDR case.
-   */
 #if (GST_D3D11_DXGI_HEADER_VERSION >= 5)
   {
     GstVideoMasteringDisplayInfo minfo;
@@ -646,7 +635,7 @@ gst_d3d11_window_prepare_default (GstD3D11Window * window, guint display_width,
     if (gst_d3d11_result (hr, window->device)) {
       chosen_colorspace =
           gst_d3d11_find_swap_chain_color_space (&window->render_info,
-          swapchain3.Get (), have_hdr10);
+          swapchain3.Get ());
       if (chosen_colorspace) {
         native_colorspace_type =
             (DXGI_COLOR_SPACE_TYPE) chosen_colorspace->dxgi_color_space_type;