[vlc-commits] dxgi_fmt: move IsRGBShader to dxgi_fmt and rename to DxgiIsRGBFormat

Steve Lhomme git at videolan.org
Wed Feb 10 11:06:40 UTC 2021


vlc | branch: master | Steve Lhomme <robux4 at ycbcr.xyz> | Fri Jan 22 11:48:17 2021 +0100| [7ea2a470eb6f035110771e1fd92f7507e4351a87] | committer: Steve Lhomme

dxgi_fmt: move IsRGBShader to dxgi_fmt and rename to DxgiIsRGBFormat

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=7ea2a470eb6f035110771e1fd92f7507e4351a87
---

 modules/video_chroma/dxgi_fmt.c            | 11 +++++++++++
 modules/video_chroma/dxgi_fmt.h            |  2 ++
 modules/video_output/win32/d3d11_quad.c    |  4 ++--
 modules/video_output/win32/d3d11_shaders.c | 13 +------------
 modules/video_output/win32/d3d11_shaders.h |  2 --
 5 files changed, 16 insertions(+), 16 deletions(-)

diff --git a/modules/video_chroma/dxgi_fmt.c b/modules/video_chroma/dxgi_fmt.c
index fd42585608..e109e9e60c 100644
--- a/modules/video_chroma/dxgi_fmt.c
+++ b/modules/video_chroma/dxgi_fmt.c
@@ -177,3 +177,14 @@ UINT DxgiResourceCount(const d3d_format_t *d3d_fmt)
     }
     return D3D11_MAX_SHADER_VIEW;
 }
+
+bool DxgiIsRGBFormat(const d3d_format_t *cfg)
+{
+    return cfg->resourceFormat[0] != DXGI_FORMAT_R8_UNORM &&
+           cfg->resourceFormat[0] != DXGI_FORMAT_R16_UNORM &&
+           cfg->formatTexture != DXGI_FORMAT_YUY2 &&
+           cfg->formatTexture != DXGI_FORMAT_AYUV &&
+           cfg->formatTexture != DXGI_FORMAT_Y210 &&
+           cfg->formatTexture != DXGI_FORMAT_Y410 &&
+           cfg->formatTexture != DXGI_FORMAT_420_OPAQUE;
+}
diff --git a/modules/video_chroma/dxgi_fmt.h b/modules/video_chroma/dxgi_fmt.h
index e7f7d14543..4851def3d1 100644
--- a/modules/video_chroma/dxgi_fmt.h
+++ b/modules/video_chroma/dxgi_fmt.h
@@ -57,4 +57,6 @@ DXGI_FORMAT DxgiFourccFormat(vlc_fourcc_t fcc);
 const char *DxgiVendorStr(unsigned int gpu_vendor);
 UINT DxgiResourceCount(const d3d_format_t *);
 
+bool DxgiIsRGBFormat(const d3d_format_t *);
+
 #endif /* include-guard */
diff --git a/modules/video_output/win32/d3d11_quad.c b/modules/video_output/win32/d3d11_quad.c
index 3b0036c05c..ab427ee738 100644
--- a/modules/video_output/win32/d3d11_quad.c
+++ b/modules/video_output/win32/d3d11_quad.c
@@ -1004,7 +1004,7 @@ static void GetPrimariesTransform(FLOAT Primaries[4*4], video_color_primaries_t
 int D3D11_SetupQuad(vlc_object_t *o, d3d11_device_t *d3d_dev, const video_format_t *fmt, d3d_quad_t *quad,
                     const display_info_t *displayFormat)
 {
-    const bool RGB_src_shader = IsRGBShader(quad->textureFormat);
+    const bool RGB_src_shader = DxgiIsRGBFormat(quad->textureFormat);
 
     quad->shaderConstants.LuminanceScale = (float)displayFormat->luminance_peak / GetFormatLuminance(o, fmt);
 
@@ -1093,7 +1093,7 @@ int D3D11_SetupQuad(vlc_object_t *o, d3d11_device_t *d3d_dev, const video_format
     memcpy(colorspace.WhitePoint, IDENTITY_4X4, sizeof(colorspace.WhitePoint));
 
     const FLOAT *ppColorspace;
-    if (RGB_src_shader == IsRGBShader(displayFormat->pixelFormat))
+    if (RGB_src_shader == DxgiIsRGBFormat(displayFormat->pixelFormat))
     {
         ppColorspace = IDENTITY_4X4;
     }
diff --git a/modules/video_output/win32/d3d11_shaders.c b/modules/video_output/win32/d3d11_shaders.c
index 2e58ade861..df5abcaea6 100644
--- a/modules/video_output/win32/d3d11_shaders.c
+++ b/modules/video_output/win32/d3d11_shaders.c
@@ -194,17 +194,6 @@ VS_OUTPUT main( VS_INPUT In )\n\
 static ID3DBlob* D3D11_CompileShader(vlc_object_t *, const d3d11_shader_compiler_t *, const d3d11_device_t *,
                               const char *psz_shader, bool pixel);
 
-bool IsRGBShader(const d3d_format_t *cfg)
-{
-    return cfg->resourceFormat[0] != DXGI_FORMAT_R8_UNORM &&
-           cfg->resourceFormat[0] != DXGI_FORMAT_R16_UNORM &&
-           cfg->formatTexture != DXGI_FORMAT_YUY2 &&
-           cfg->formatTexture != DXGI_FORMAT_AYUV &&
-           cfg->formatTexture != DXGI_FORMAT_Y210 &&
-           cfg->formatTexture != DXGI_FORMAT_Y410 &&
-           cfg->formatTexture != DXGI_FORMAT_420_OPAQUE;
-}
-
 static HRESULT CompileTargetShader(vlc_object_t *o, const d3d11_shader_compiler_t *compiler,
                                    d3d11_device_t *d3d_dev,
                                    bool texture_array, size_t texture_count,
@@ -563,7 +552,7 @@ HRESULT (D3D11_CompilePixelShader)(vlc_object_t *o, const d3d11_shader_compiler_
         if (src_full_range)
             range_adjust = -1; /* lower the source to studio range */
     }
-    if (!IsRGBShader(quad->textureFormat) && !src_full_range && IsRGBShader(display->pixelFormat))
+    if (!DxgiIsRGBFormat(quad->textureFormat) && !src_full_range && DxgiIsRGBFormat(display->pixelFormat))
         range_adjust--; /* the YUV->RGB conversion already output full range */
 
     if (range_adjust != 0)
diff --git a/modules/video_output/win32/d3d11_shaders.h b/modules/video_output/win32/d3d11_shaders.h
index ff52633ddf..163c23ce57 100644
--- a/modules/video_output/win32/d3d11_shaders.h
+++ b/modules/video_output/win32/d3d11_shaders.h
@@ -104,8 +104,6 @@ typedef struct
 
 #define D3D11_MAX_RENDER_TARGET    2
 
-bool IsRGBShader(const d3d_format_t *);
-
 int D3D11_InitShaders(vlc_object_t *, d3d11_shader_compiler_t *);
 void D3D11_ReleaseShaders(d3d11_shader_compiler_t *);
 



More information about the vlc-commits mailing list