Add PixelFormat::NV12
This commit is contained in:
@@ -558,6 +558,11 @@ API_ENUM() enum class PixelFormat : uint32
|
||||
/// </summary>
|
||||
YUY2 = 108,
|
||||
|
||||
/// <summary>
|
||||
/// Packed YUV 4:2:0 video texture format. Texture uses separate views to access the luma (Y) plane separately from the chroma (UV) planes. For luminance data view, the mapping to the view channel is Y->R8. For chrominance data view, the mapping to the view channel is U->R8 and V->G8.
|
||||
/// </summary>
|
||||
NV12 = 109,
|
||||
|
||||
/// <summary>
|
||||
/// The maximum format value (for internal use only).
|
||||
/// </summary>
|
||||
|
||||
@@ -150,6 +150,8 @@ void PixelFormatExtensions::Init()
|
||||
PixelFormat::BC4_UNorm,
|
||||
};
|
||||
InitFormat(formats8, 4);
|
||||
|
||||
sizeOfInBits[(int32)PixelFormat::NV12] = 12;
|
||||
}
|
||||
|
||||
int32 PixelFormatExtensions::SizeInBits(PixelFormat format)
|
||||
@@ -379,6 +381,7 @@ bool PixelFormatExtensions::IsVideo(const PixelFormat format)
|
||||
switch (format)
|
||||
{
|
||||
case PixelFormat::YUY2:
|
||||
case PixelFormat::NV12:
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
|
||||
@@ -349,6 +349,10 @@ void RenderTools::ComputePitch(PixelFormat format, int32 width, int32 height, ui
|
||||
rowPitch = ((width + 1) >> 1) * 4;
|
||||
slicePitch = rowPitch * height;
|
||||
break;
|
||||
case PixelFormat::NV12:
|
||||
rowPitch = width;
|
||||
slicePitch = width * height * 3 / 2;
|
||||
break;
|
||||
default:
|
||||
// Default byte alignment
|
||||
rowPitch = (width * PixelFormatExtensions::SizeInBits(format) + 7) / 8;
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
|
||||
// @formatter:off
|
||||
|
||||
DXGI_FORMAT PixelFormatToDXGIFormat[109] =
|
||||
DXGI_FORMAT PixelFormatToDXGIFormat[110] =
|
||||
{
|
||||
DXGI_FORMAT_UNKNOWN,
|
||||
DXGI_FORMAT_R32G32B32A32_TYPELESS,
|
||||
@@ -120,6 +120,7 @@ DXGI_FORMAT PixelFormatToDXGIFormat[109] =
|
||||
DXGI_FORMAT_UNKNOWN, // ASTC_10x10_UNorm
|
||||
DXGI_FORMAT_UNKNOWN, // ASTC_10x10_UNorm_sRGB
|
||||
DXGI_FORMAT_YUY2,
|
||||
DXGI_FORMAT_NV12,
|
||||
};
|
||||
|
||||
// @formatter:on
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
// @formatter:off
|
||||
|
||||
VkFormat RenderToolsVulkan::PixelFormatToVkFormat[109] =
|
||||
VkFormat RenderToolsVulkan::PixelFormatToVkFormat[110] =
|
||||
{
|
||||
VK_FORMAT_UNDEFINED,
|
||||
VK_FORMAT_R32G32B32A32_SFLOAT,
|
||||
@@ -119,6 +119,7 @@ VkFormat RenderToolsVulkan::PixelFormatToVkFormat[109] =
|
||||
VK_FORMAT_ASTC_10x10_UNORM_BLOCK,
|
||||
VK_FORMAT_ASTC_10x10_SRGB_BLOCK,
|
||||
VK_FORMAT_G8B8G8R8_422_UNORM, // YUY2
|
||||
VK_FORMAT_G8_B8R8_2PLANE_420_UNORM, // NV12
|
||||
};
|
||||
|
||||
VkBlendFactor RenderToolsVulkan::BlendToVkBlendFactor[20] =
|
||||
|
||||
@@ -96,6 +96,8 @@ namespace MF
|
||||
player.Format = PixelFormat::B5G6R5_UNorm;
|
||||
else if (subtype == MFVideoFormat_RGB555)
|
||||
player.Format = PixelFormat::B5G5R5A1_UNorm;
|
||||
else if (subtype == MFVideoFormat_NV12)
|
||||
player.Format = PixelFormat::NV12;
|
||||
else if (subtype == MFVideoFormat_YUY2)
|
||||
player.Format = PixelFormat::YUY2;
|
||||
#if (WDK_NTDDI_VERSION >= NTDDI_WIN10)
|
||||
|
||||
Reference in New Issue
Block a user