[vlc-commits] [Git][videolan/vlc][master] 2 commits: dxgi_fmt: allow rendering planes with a factor on the resources
Steve Lhomme (@robUx4)
gitlab at videolan.org
Mon May 29 05:37:37 UTC 2023
Steve Lhomme pushed to branch master at VideoLAN / VLC
Commits:
a5c028f7 by Steve Lhomme at 2023-05-29T05:08:23+00:00
dxgi_fmt: allow rendering planes with a factor on the resources
The resource we assign to the planes may not match the bitdepth of the source
when using DXGI_FORMAT_UNKNOWN.
- - - - -
5b59f2e5 by Steve Lhomme at 2023-05-29T05:08:23+00:00
dxgi_fmt: add support for planar YUV 4:4:4 10-bit/12-bit
- - - - -
5 changed files:
- modules/video_chroma/dxgi_fmt.c
- modules/video_chroma/dxgi_fmt.h
- modules/video_output/win32/d3d11_quad.cpp
- modules/video_output/win32/d3d_dynamic_shader.c
- modules/video_output/win32/d3d_shaders.c
Changes:
=====================================
modules/video_chroma/dxgi_fmt.c
=====================================
@@ -66,41 +66,43 @@ static const dxgi_format_t dxgi_formats[] = {
};
static const d3d_format_t d3d_formats[] = {
- { "NV12", DXGI_FORMAT_NV12, VLC_CODEC_NV12, 8, 2, 2, { DXGI_FORMAT_R8_UNORM, DXGI_FORMAT_R8G8_UNORM } },
- { "VA_NV12", DXGI_FORMAT_NV12, VLC_CODEC_D3D11_OPAQUE, 8, 2, 2, { DXGI_FORMAT_R8_UNORM, DXGI_FORMAT_R8G8_UNORM } },
- { "P010", DXGI_FORMAT_P010, VLC_CODEC_P010, 10, 2, 2, { DXGI_FORMAT_R16_UNORM, DXGI_FORMAT_R16G16_UNORM } },
- { "VA_P010", DXGI_FORMAT_P010, VLC_CODEC_D3D11_OPAQUE_10B, 10, 2, 2, { DXGI_FORMAT_R16_UNORM, DXGI_FORMAT_R16G16_UNORM } },
- { "VA_AYUV", DXGI_FORMAT_AYUV, VLC_CODEC_D3D11_OPAQUE, 8, 1, 1, { DXGI_FORMAT_R8G8B8A8_UNORM } },
- { "YUY2", DXGI_FORMAT_YUY2, VLC_CODEC_YUYV, 8, 1, 2, { DXGI_FORMAT_R8G8B8A8_UNORM } },
- { "VA_YUY2", DXGI_FORMAT_YUY2, VLC_CODEC_D3D11_OPAQUE, 8, 1, 2, { DXGI_FORMAT_R8G8B8A8_UNORM } },
+ { "NV12", DXGI_FORMAT_NV12, VLC_CODEC_NV12, 8, 2, 2, 1, { DXGI_FORMAT_R8_UNORM, DXGI_FORMAT_R8G8_UNORM } },
+ { "VA_NV12", DXGI_FORMAT_NV12, VLC_CODEC_D3D11_OPAQUE, 8, 2, 2, 1, { DXGI_FORMAT_R8_UNORM, DXGI_FORMAT_R8G8_UNORM } },
+ { "P010", DXGI_FORMAT_P010, VLC_CODEC_P010, 10, 2, 2, 1, { DXGI_FORMAT_R16_UNORM, DXGI_FORMAT_R16G16_UNORM } },
+ { "VA_P010", DXGI_FORMAT_P010, VLC_CODEC_D3D11_OPAQUE_10B, 10, 2, 2, 1, { DXGI_FORMAT_R16_UNORM, DXGI_FORMAT_R16G16_UNORM } },
+ { "VA_AYUV", DXGI_FORMAT_AYUV, VLC_CODEC_D3D11_OPAQUE, 8, 1, 1, 1, { DXGI_FORMAT_R8G8B8A8_UNORM } },
+ { "YUY2", DXGI_FORMAT_YUY2, VLC_CODEC_YUYV, 8, 1, 2, 1, { DXGI_FORMAT_R8G8B8A8_UNORM } },
+ { "VA_YUY2", DXGI_FORMAT_YUY2, VLC_CODEC_D3D11_OPAQUE, 8, 1, 2, 1, { DXGI_FORMAT_R8G8B8A8_UNORM } },
#ifdef BROKEN_PIXEL
- { "Y416", DXGI_FORMAT_Y416, VLC_CODEC_I444_16L, 16, 1, 1, { DXGI_FORMAT_R16G16B16A16_UINT } },
+ { "Y416", DXGI_FORMAT_Y416, VLC_CODEC_I444_16L, 16, 1, 1, 1, { DXGI_FORMAT_R16G16B16A16_UINT } },
#endif
- { "VA_Y210", DXGI_FORMAT_Y210, VLC_CODEC_D3D11_OPAQUE_10B, 10, 1, 2, { DXGI_FORMAT_R16G16B16A16_UNORM } },
- { "VA_Y410", DXGI_FORMAT_Y410, VLC_CODEC_D3D11_OPAQUE_10B, 10, 1, 1, { DXGI_FORMAT_R10G10B10A2_UNORM } },
+ { "VA_Y210", DXGI_FORMAT_Y210, VLC_CODEC_D3D11_OPAQUE_10B, 10, 1, 2, 1, { DXGI_FORMAT_R16G16B16A16_UNORM } },
+ { "VA_Y410", DXGI_FORMAT_Y410, VLC_CODEC_D3D11_OPAQUE_10B, 10, 1, 1, 1, { DXGI_FORMAT_R10G10B10A2_UNORM } },
#ifdef UNTESTED
- { "Y210", DXGI_FORMAT_Y210, VLC_CODEC_I422_10L, 10, 1, 2, { DXGI_FORMAT_R16G16B16A16_UNORM } },
- { "Y410", DXGI_FORMAT_Y410, VLC_CODEC_I444, 10, 1, 1, { DXGI_FORMAT_R10G10B10A2_UNORM } },
- { "NV11", DXGI_FORMAT_NV11, VLC_CODEC_I411, 8, 4, 1, { DXGI_FORMAT_R8_UNORM, DXGI_FORMAT_R8G8_UNORM} },
+ { "Y210", DXGI_FORMAT_Y210, VLC_CODEC_I422_10L, 10, 1, 2, 1, { DXGI_FORMAT_R16G16B16A16_UNORM } },
+ { "Y410", DXGI_FORMAT_Y410, VLC_CODEC_I444, 10, 1, 1, 1, { DXGI_FORMAT_R10G10B10A2_UNORM } },
+ { "NV11", DXGI_FORMAT_NV11, VLC_CODEC_I411, 8, 4, 1, 1, { DXGI_FORMAT_R8_UNORM, DXGI_FORMAT_R8G8_UNORM} },
#endif
- { "I420", DXGI_FORMAT_UNKNOWN, VLC_CODEC_I420, 8, 2, 2, { DXGI_FORMAT_R8_UNORM, DXGI_FORMAT_R8_UNORM, DXGI_FORMAT_R8_UNORM } },
- { "I420_10", DXGI_FORMAT_UNKNOWN, VLC_CODEC_I420_10L, 10, 2, 2, { DXGI_FORMAT_R16_UNORM, DXGI_FORMAT_R16_UNORM, DXGI_FORMAT_R16_UNORM } },
- { "YUVA", DXGI_FORMAT_UNKNOWN, VLC_CODEC_YUVA, 8, 1, 1, { DXGI_FORMAT_R8_UNORM, DXGI_FORMAT_R8_UNORM, DXGI_FORMAT_R8_UNORM, DXGI_FORMAT_R8_UNORM } },
- { "I444", DXGI_FORMAT_UNKNOWN, VLC_CODEC_I444, 8, 1, 1, { DXGI_FORMAT_R8_UNORM, DXGI_FORMAT_R8_UNORM, DXGI_FORMAT_R8_UNORM } },
- { "I444_16", DXGI_FORMAT_UNKNOWN, VLC_CODEC_I444_16L, 16, 1, 1, { DXGI_FORMAT_R16_UNORM, DXGI_FORMAT_R16_UNORM, DXGI_FORMAT_R16_UNORM } },
- { "B8G8R8A8", DXGI_FORMAT_B8G8R8A8_UNORM, VLC_CODEC_BGRA, 8, 1, 1, { DXGI_FORMAT_B8G8R8A8_UNORM } },
- { "VA_BGRA", DXGI_FORMAT_B8G8R8A8_UNORM, VLC_CODEC_D3D11_OPAQUE_BGRA, 8, 1, 1, { DXGI_FORMAT_B8G8R8A8_UNORM } },
- { "R8G8B8A8", DXGI_FORMAT_R8G8B8A8_UNORM, VLC_CODEC_RGBA, 8, 1, 1, { DXGI_FORMAT_R8G8B8A8_UNORM } },
- { "VA_RGBA", DXGI_FORMAT_R8G8B8A8_UNORM, VLC_CODEC_D3D11_OPAQUE_RGBA, 8, 1, 1, { DXGI_FORMAT_R8G8B8A8_UNORM } },
- { "R8G8B8X8", DXGI_FORMAT_B8G8R8X8_UNORM, VLC_CODEC_RGB32, 8, 1, 1, { DXGI_FORMAT_B8G8R8X8_UNORM } },
- { "RGBA64", DXGI_FORMAT_R16G16B16A16_UNORM, VLC_CODEC_RGBA64, 16, 1, 1, { DXGI_FORMAT_R16G16B16A16_UNORM } },
- { "RGB10A2", DXGI_FORMAT_R10G10B10A2_UNORM, VLC_CODEC_RGBA10, 10, 1, 1, { DXGI_FORMAT_R10G10B10A2_UNORM } },
- { "VA_RGB10", DXGI_FORMAT_R10G10B10A2_UNORM, VLC_CODEC_D3D11_OPAQUE_RGBA, 10, 1, 1, { DXGI_FORMAT_R10G10B10A2_UNORM } },
- { "AYUV", DXGI_FORMAT_AYUV, VLC_CODEC_VUYA, 8, 1, 1, { DXGI_FORMAT_R8G8B8A8_UNORM } },
- { "B5G6R5", DXGI_FORMAT_B5G6R5_UNORM, VLC_CODEC_RGB16, 5, 1, 1, { DXGI_FORMAT_B5G6R5_UNORM } },
- { "I420_OPAQUE", DXGI_FORMAT_420_OPAQUE, VLC_CODEC_D3D11_OPAQUE, 8, 2, 2, { DXGI_FORMAT_UNKNOWN } },
-
- { NULL, 0, 0, 0, 0, 0, { DXGI_FORMAT_UNKNOWN } }
+ { "I420", DXGI_FORMAT_UNKNOWN, VLC_CODEC_I420, 8, 2, 2, 1, { DXGI_FORMAT_R8_UNORM, DXGI_FORMAT_R8_UNORM, DXGI_FORMAT_R8_UNORM } },
+ { "I420_10", DXGI_FORMAT_UNKNOWN, VLC_CODEC_I420_10L, 10, 2, 2, 1, { DXGI_FORMAT_R16_UNORM, DXGI_FORMAT_R16_UNORM, DXGI_FORMAT_R16_UNORM } },
+ { "YUVA", DXGI_FORMAT_UNKNOWN, VLC_CODEC_YUVA, 8, 1, 1, 1, { DXGI_FORMAT_R8_UNORM, DXGI_FORMAT_R8_UNORM, DXGI_FORMAT_R8_UNORM, DXGI_FORMAT_R8_UNORM } },
+ { "I444", DXGI_FORMAT_UNKNOWN, VLC_CODEC_I444, 8, 1, 1, 1, { DXGI_FORMAT_R8_UNORM, DXGI_FORMAT_R8_UNORM, DXGI_FORMAT_R8_UNORM } },
+ { "I444_10", DXGI_FORMAT_UNKNOWN, VLC_CODEC_I444_10L, 10, 1, 1, 1 << 6, { DXGI_FORMAT_R16_UNORM, DXGI_FORMAT_R16_UNORM, DXGI_FORMAT_R16_UNORM } },
+ { "I444_12", DXGI_FORMAT_UNKNOWN, VLC_CODEC_I444_12L, 10, 1, 1, 1 << 4, { DXGI_FORMAT_R16_UNORM, DXGI_FORMAT_R16_UNORM, DXGI_FORMAT_R16_UNORM } },
+ { "I444_16", DXGI_FORMAT_UNKNOWN, VLC_CODEC_I444_16L, 16, 1, 1, 1, { DXGI_FORMAT_R16_UNORM, DXGI_FORMAT_R16_UNORM, DXGI_FORMAT_R16_UNORM } },
+ { "B8G8R8A8", DXGI_FORMAT_B8G8R8A8_UNORM, VLC_CODEC_BGRA, 8, 1, 1, 1, { DXGI_FORMAT_B8G8R8A8_UNORM } },
+ { "VA_BGRA", DXGI_FORMAT_B8G8R8A8_UNORM, VLC_CODEC_D3D11_OPAQUE_BGRA, 8, 1, 1, 1, { DXGI_FORMAT_B8G8R8A8_UNORM } },
+ { "R8G8B8A8", DXGI_FORMAT_R8G8B8A8_UNORM, VLC_CODEC_RGBA, 8, 1, 1, 1, { DXGI_FORMAT_R8G8B8A8_UNORM } },
+ { "VA_RGBA", DXGI_FORMAT_R8G8B8A8_UNORM, VLC_CODEC_D3D11_OPAQUE_RGBA, 8, 1, 1, 1, { DXGI_FORMAT_R8G8B8A8_UNORM } },
+ { "R8G8B8X8", DXGI_FORMAT_B8G8R8X8_UNORM, VLC_CODEC_RGB32, 8, 1, 1, 1, { DXGI_FORMAT_B8G8R8X8_UNORM } },
+ { "RGBA64", DXGI_FORMAT_R16G16B16A16_UNORM, VLC_CODEC_RGBA64, 16, 1, 1, 1, { DXGI_FORMAT_R16G16B16A16_UNORM } },
+ { "RGB10A2", DXGI_FORMAT_R10G10B10A2_UNORM, VLC_CODEC_RGBA10, 10, 1, 1, 1, { DXGI_FORMAT_R10G10B10A2_UNORM } },
+ { "VA_RGB10", DXGI_FORMAT_R10G10B10A2_UNORM, VLC_CODEC_D3D11_OPAQUE_RGBA, 10, 1, 1, 1, { DXGI_FORMAT_R10G10B10A2_UNORM } },
+ { "AYUV", DXGI_FORMAT_AYUV, VLC_CODEC_VUYA, 8, 1, 1, 1, { DXGI_FORMAT_R8G8B8A8_UNORM } },
+ { "B5G6R5", DXGI_FORMAT_B5G6R5_UNORM, VLC_CODEC_RGB16, 5, 1, 1, 1, { DXGI_FORMAT_B5G6R5_UNORM } },
+ { "I420_OPAQUE", DXGI_FORMAT_420_OPAQUE, VLC_CODEC_D3D11_OPAQUE, 8, 2, 2, 1, { DXGI_FORMAT_UNKNOWN } },
+
+ { NULL, 0, 0, 0, 0, 0, 0, { DXGI_FORMAT_UNKNOWN } }
};
const char *DxgiFormatToStr(DXGI_FORMAT format)
=====================================
modules/video_chroma/dxgi_fmt.h
=====================================
@@ -51,6 +51,7 @@ typedef struct
uint8_t bitsPerChannel;
uint8_t widthDenominator;
uint8_t heightDenominator;
+ uint8_t resourceFactor; // the plane depth doesn't match the resource depth
DXGI_FORMAT resourceFormat[DXGI_MAX_SHADER_VIEW];
} d3d_format_t;
=====================================
modules/video_output/win32/d3d11_quad.cpp
=====================================
@@ -341,6 +341,9 @@ void d3d11_quad_t::UpdateViewport(const RECT *rect, const d3d_format_t *display)
case DXGI_FORMAT_UNKNOWN:
switch ( generic.textureFormat->fourcc )
{
+ case VLC_CODEC_I444_16L:
+ case VLC_CODEC_I444_12L:
+ case VLC_CODEC_I444_10L:
case VLC_CODEC_I444:
if ( display->formatTexture != DXGI_FORMAT_NV12 &&
display->formatTexture != DXGI_FORMAT_P010 )
=====================================
modules/video_output/win32/d3d_dynamic_shader.c
=====================================
@@ -515,6 +515,8 @@ HRESULT (D3D_CompilePixelShader)(vlc_object_t *o, const d3d_shader_compiler_t *c
psz_shader_resource_views[0] = "3"; shader_views[0] = 3;
break;
case VLC_CODEC_I444_16L:
+ case VLC_CODEC_I444_12L:
+ case VLC_CODEC_I444_10L:
case VLC_CODEC_I444:
case VLC_CODEC_I420:
psz_sampler[0] = "SAMPLE_TRIPLANAR_TO_YUVA";
=====================================
modules/video_output/win32/d3d_shaders.c
=====================================
@@ -571,6 +571,10 @@ void D3D_SetupQuad(vlc_object_t *o, const video_format_t *fmt, d3d_quad_t *quad,
WhitePoint[2*4 + 3] = -itu_achromacy;
}
+ WhitePoint[0*4 + 0] *= quad->textureFormat->resourceFactor;
+ WhitePoint[1*4 + 1] *= quad->textureFormat->resourceFactor;
+ WhitePoint[2*4 + 2] *= quad->textureFormat->resourceFactor;
+
MultMat43(quad->shaderConstants->Colorspace, ppColorspace, WhitePoint);
if (fmt->primaries != displayFormat->primaries)
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/8b79382d32b06c9ba6047757d11a8208f4e8f583...5b59f2e5ec35a4903fc7d0722667a151e704962e
--
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/8b79382d32b06c9ba6047757d11a8208f4e8f583...5b59f2e5ec35a4903fc7d0722667a151e704962e
You're receiving this email because of your account on code.videolan.org.
VideoLAN code repository instance
More information about the vlc-commits
mailing list