mirror of
https://github.com/microsoft/DirectXTex.git
synced 2025-07-14 14:10:13 +02:00
texconv: updated colorspace names for -rotatecolor switch
This commit is contained in:
parent
98e48bc3a9
commit
69c1f365d5
@ -133,10 +133,10 @@ namespace
|
|||||||
ROTATE_HDR10_TO_709,
|
ROTATE_HDR10_TO_709,
|
||||||
ROTATE_709_TO_2020,
|
ROTATE_709_TO_2020,
|
||||||
ROTATE_2020_TO_709,
|
ROTATE_2020_TO_709,
|
||||||
ROTATE_P3_TO_HDR10,
|
ROTATE_P3D65_TO_HDR10,
|
||||||
ROTATE_P3_TO_2020,
|
ROTATE_P3D65_TO_2020,
|
||||||
ROTATE_709_TO_DISPLAY_P3,
|
ROTATE_709_TO_P3D65,
|
||||||
ROTATE_DISPLAY_P3_TO_709,
|
ROTATE_P3D65_TO_709,
|
||||||
};
|
};
|
||||||
|
|
||||||
static_assert(OPT_MAX <= 64, "dwOptions is a unsigned int bitfield");
|
static_assert(OPT_MAX <= 64, "dwOptions is a unsigned int bitfield");
|
||||||
@ -404,10 +404,10 @@ namespace
|
|||||||
{ L"2020to709", ROTATE_2020_TO_709 },
|
{ L"2020to709", ROTATE_2020_TO_709 },
|
||||||
{ L"709toHDR10", ROTATE_709_TO_HDR10 },
|
{ L"709toHDR10", ROTATE_709_TO_HDR10 },
|
||||||
{ L"HDR10to709", ROTATE_HDR10_TO_709 },
|
{ L"HDR10to709", ROTATE_HDR10_TO_709 },
|
||||||
{ L"P3to2020", ROTATE_P3_TO_2020 },
|
{ L"P3D65to2020", ROTATE_P3D65_TO_2020 },
|
||||||
{ L"P3toHDR10", ROTATE_P3_TO_HDR10 },
|
{ L"P3D65toHDR10", ROTATE_P3D65_TO_HDR10 },
|
||||||
{ L"709toDisplayP3", ROTATE_709_TO_DISPLAY_P3 },
|
{ L"709toP3D65", ROTATE_709_TO_P3D65 },
|
||||||
{ L"DisplayP3to709", ROTATE_DISPLAY_P3_TO_709 },
|
{ L"P3D65to709", ROTATE_P3D65_TO_709 },
|
||||||
{ nullptr, 0 },
|
{ nullptr, 0 },
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -1189,6 +1189,7 @@ namespace
|
|||||||
|
|
||||||
const XMVECTORF32 c_MaxNitsFor2084 = { { { 10000.0f, 10000.0f, 10000.0f, 1.f } } };
|
const XMVECTORF32 c_MaxNitsFor2084 = { { { 10000.0f, 10000.0f, 10000.0f, 1.f } } };
|
||||||
|
|
||||||
|
// HDTV to UHDTV (Rec.709 color primaries into Rec.2020)
|
||||||
const XMMATRIX c_from709to2020 =
|
const XMMATRIX c_from709to2020 =
|
||||||
{
|
{
|
||||||
0.6274040f, 0.0690970f, 0.0163916f, 0.f,
|
0.6274040f, 0.0690970f, 0.0163916f, 0.f,
|
||||||
@ -1197,6 +1198,7 @@ namespace
|
|||||||
0.f, 0.f, 0.f, 1.f
|
0.f, 0.f, 0.f, 1.f
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// UHDTV to HDTV
|
||||||
const XMMATRIX c_from2020to709 =
|
const XMMATRIX c_from2020to709 =
|
||||||
{
|
{
|
||||||
1.6604910f, -0.1245505f, -0.0181508f, 0.f,
|
1.6604910f, -0.1245505f, -0.0181508f, 0.f,
|
||||||
@ -1205,8 +1207,8 @@ namespace
|
|||||||
0.f, 0.f, 0.f, 1.f
|
0.f, 0.f, 0.f, 1.f
|
||||||
};
|
};
|
||||||
|
|
||||||
// DCI-P3 https://en.wikipedia.org/wiki/DCI-P3
|
// DCI-P3-D65 https://en.wikipedia.org/wiki/DCI-P3 to UHDTV (DCI-P3-D65 color primaries into Rec.2020)
|
||||||
const XMMATRIX c_fromP3to2020 =
|
const XMMATRIX c_fromP3D65to2020 =
|
||||||
{
|
{
|
||||||
0.753845f, 0.0457456f, -0.00121055f, 0.f,
|
0.753845f, 0.0457456f, -0.00121055f, 0.f,
|
||||||
0.198593f, 0.941777f, 0.0176041f, 0.f,
|
0.198593f, 0.941777f, 0.0176041f, 0.f,
|
||||||
@ -1214,8 +1216,8 @@ namespace
|
|||||||
0.f, 0.f, 0.f, 1.f
|
0.f, 0.f, 0.f, 1.f
|
||||||
};
|
};
|
||||||
|
|
||||||
// Display P3 (P3D65)
|
// HDTV to DCI-P3-D65 (a.k.a. Display P3 or P3D65)
|
||||||
const XMMATRIX c_from709toDisplayP3 =
|
const XMMATRIX c_from709toP3D65 =
|
||||||
{
|
{
|
||||||
0.822461969f, 0.033194199f, 0.017082631f, 0.f,
|
0.822461969f, 0.033194199f, 0.017082631f, 0.f,
|
||||||
0.1775380f, 0.9668058f, 0.0723974f, 0.f,
|
0.1775380f, 0.9668058f, 0.0723974f, 0.f,
|
||||||
@ -1223,7 +1225,8 @@ namespace
|
|||||||
0.f, 0.f, 0.f, 1.f
|
0.f, 0.f, 0.f, 1.f
|
||||||
};
|
};
|
||||||
|
|
||||||
const XMMATRIX c_fromDisplayP3to709 =
|
// DCI-P3-D65 to HDTV
|
||||||
|
const XMMATRIX c_fromP3D65to709 =
|
||||||
{
|
{
|
||||||
1.224940176f, -0.042056955f, -0.019637555f, 0.f,
|
1.224940176f, -0.042056955f, -0.019637555f, 0.f,
|
||||||
-0.224940176f, 1.042056955f, -0.078636046f, 0.f,
|
-0.224940176f, 1.042056955f, -0.078636046f, 0.f,
|
||||||
@ -2490,7 +2493,7 @@ int __cdecl wmain(_In_ int argc, _In_z_count_(argc) wchar_t* argv[])
|
|||||||
// --- Color rotation (if requested) -------------------------------------------
|
// --- Color rotation (if requested) -------------------------------------------
|
||||||
if (dwRotateColor)
|
if (dwRotateColor)
|
||||||
{
|
{
|
||||||
if (dwRotateColor == ROTATE_HDR10_TO_709 || dwRotateColor == ROTATE_DISPLAY_P3_TO_709)
|
if (dwRotateColor == ROTATE_HDR10_TO_709 || dwRotateColor == ROTATE_P3D65_TO_709)
|
||||||
{
|
{
|
||||||
std::unique_ptr<ScratchImage> timage(new (std::nothrow) ScratchImage);
|
std::unique_ptr<ScratchImage> timage(new (std::nothrow) ScratchImage);
|
||||||
if (!timage)
|
if (!timage)
|
||||||
@ -2639,7 +2642,7 @@ int __cdecl wmain(_In_ int argc, _In_z_count_(argc) wchar_t* argv[])
|
|||||||
}, *timage);
|
}, *timage);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ROTATE_P3_TO_HDR10:
|
case ROTATE_P3D65_TO_HDR10:
|
||||||
hr = TransformImage(image->GetImages(), image->GetImageCount(), image->GetMetadata(),
|
hr = TransformImage(image->GetImages(), image->GetImageCount(), image->GetMetadata(),
|
||||||
[&](XMVECTOR* outPixels, const XMVECTOR* inPixels, size_t w, size_t y)
|
[&](XMVECTOR* outPixels, const XMVECTOR* inPixels, size_t w, size_t y)
|
||||||
{
|
{
|
||||||
@ -2651,7 +2654,7 @@ int __cdecl wmain(_In_ int argc, _In_z_count_(argc) wchar_t* argv[])
|
|||||||
{
|
{
|
||||||
XMVECTOR value = inPixels[j];
|
XMVECTOR value = inPixels[j];
|
||||||
|
|
||||||
XMVECTOR nvalue = XMVector3Transform(value, c_fromP3to2020);
|
XMVECTOR nvalue = XMVector3Transform(value, c_fromP3D65to2020);
|
||||||
|
|
||||||
// Convert to ST.2084
|
// Convert to ST.2084
|
||||||
nvalue = XMVectorDivide(XMVectorMultiply(nvalue, paperWhite), c_MaxNitsFor2084);
|
nvalue = XMVectorDivide(XMVectorMultiply(nvalue, paperWhite), c_MaxNitsFor2084);
|
||||||
@ -2672,7 +2675,7 @@ int __cdecl wmain(_In_ int argc, _In_z_count_(argc) wchar_t* argv[])
|
|||||||
}, *timage);
|
}, *timage);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ROTATE_P3_TO_2020:
|
case ROTATE_P3D65_TO_2020:
|
||||||
hr = TransformImage(image->GetImages(), image->GetImageCount(), image->GetMetadata(),
|
hr = TransformImage(image->GetImages(), image->GetImageCount(), image->GetMetadata(),
|
||||||
[&](XMVECTOR* outPixels, const XMVECTOR* inPixels, size_t w, size_t y)
|
[&](XMVECTOR* outPixels, const XMVECTOR* inPixels, size_t w, size_t y)
|
||||||
{
|
{
|
||||||
@ -2682,7 +2685,7 @@ int __cdecl wmain(_In_ int argc, _In_z_count_(argc) wchar_t* argv[])
|
|||||||
{
|
{
|
||||||
XMVECTOR value = inPixels[j];
|
XMVECTOR value = inPixels[j];
|
||||||
|
|
||||||
XMVECTOR nvalue = XMVector3Transform(value, c_fromP3to2020);
|
XMVECTOR nvalue = XMVector3Transform(value, c_fromP3D65to2020);
|
||||||
|
|
||||||
value = XMVectorSelect(value, nvalue, g_XMSelect1110);
|
value = XMVectorSelect(value, nvalue, g_XMSelect1110);
|
||||||
|
|
||||||
@ -2691,7 +2694,7 @@ int __cdecl wmain(_In_ int argc, _In_z_count_(argc) wchar_t* argv[])
|
|||||||
}, *timage);
|
}, *timage);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ROTATE_709_TO_DISPLAY_P3:
|
case ROTATE_709_TO_P3D65:
|
||||||
hr = TransformImage(image->GetImages(), image->GetImageCount(), image->GetMetadata(),
|
hr = TransformImage(image->GetImages(), image->GetImageCount(), image->GetMetadata(),
|
||||||
[&](XMVECTOR* outPixels, const XMVECTOR* inPixels, size_t w, size_t y)
|
[&](XMVECTOR* outPixels, const XMVECTOR* inPixels, size_t w, size_t y)
|
||||||
{
|
{
|
||||||
@ -2701,7 +2704,7 @@ int __cdecl wmain(_In_ int argc, _In_z_count_(argc) wchar_t* argv[])
|
|||||||
{
|
{
|
||||||
XMVECTOR value = inPixels[j];
|
XMVECTOR value = inPixels[j];
|
||||||
|
|
||||||
XMVECTOR nvalue = XMVector3Transform(value, c_from709toDisplayP3);
|
XMVECTOR nvalue = XMVector3Transform(value, c_from709toP3D65);
|
||||||
|
|
||||||
value = XMVectorSelect(value, nvalue, g_XMSelect1110);
|
value = XMVectorSelect(value, nvalue, g_XMSelect1110);
|
||||||
|
|
||||||
@ -2710,7 +2713,7 @@ int __cdecl wmain(_In_ int argc, _In_z_count_(argc) wchar_t* argv[])
|
|||||||
}, *timage);
|
}, *timage);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ROTATE_DISPLAY_P3_TO_709:
|
case ROTATE_P3D65_TO_709:
|
||||||
hr = TransformImage(image->GetImages(), image->GetImageCount(), image->GetMetadata(),
|
hr = TransformImage(image->GetImages(), image->GetImageCount(), image->GetMetadata(),
|
||||||
[&](XMVECTOR* outPixels, const XMVECTOR* inPixels, size_t w, size_t y)
|
[&](XMVECTOR* outPixels, const XMVECTOR* inPixels, size_t w, size_t y)
|
||||||
{
|
{
|
||||||
@ -2720,7 +2723,7 @@ int __cdecl wmain(_In_ int argc, _In_z_count_(argc) wchar_t* argv[])
|
|||||||
{
|
{
|
||||||
XMVECTOR value = inPixels[j];
|
XMVECTOR value = inPixels[j];
|
||||||
|
|
||||||
XMVECTOR nvalue = XMVector3Transform(value, c_fromDisplayP3to709);
|
XMVECTOR nvalue = XMVector3Transform(value, c_fromP3D65to709);
|
||||||
|
|
||||||
value = XMVectorSelect(value, nvalue, g_XMSelect1110);
|
value = XMVectorSelect(value, nvalue, g_XMSelect1110);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user