Remove BT.2020 support from QColorSpace

BT.2020 is an HDR color space and its luminance range doesn't match
that of the rest of the currently available color spaces. Without
support for white-point luminance in 5.14, there would be a behavior
change when luminance support is later introduced, so it is better to
remove it now, and reintroduce it when the necessary handling of
different luminance levels is available.

Change-Id: Ie29e4dd757faae3ac91d4252e1206acce42801dc
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
This commit is contained in:
Allan Sandfeld Jensen 2019-09-08 15:38:56 +02:00
parent c2e32a29c3
commit 89d0a03c06
6 changed files with 4 additions and 56 deletions

View File

@ -226,12 +226,6 @@ public:
{ 0.1351922452f, 0.7118769884f, 0.0000000000f },
{ 0.0313525312f, 0.0000856627f, 0.8251883388f } };
}
static QColorMatrix toXyzFromBt2020()
{
return QColorMatrix { { 0.6506130099f, 0.2695676684f, -0.0018652577f },
{ 0.1865101457f, 0.6840794086f, 0.0172256753f },
{ 0.1270887405f, 0.0463530831f, 0.8098278046f } };
}
};
inline bool operator==(const QColorMatrix &m1, const QColorMatrix &m2)

View File

@ -70,12 +70,6 @@ QColorSpacePrimaries::QColorSpacePrimaries(QColorSpace::Primaries primaries)
bluePoint = QPointF(0.150, 0.060);
whitePoint = QColorVector::D65Chromaticity();
break;
case QColorSpace::Primaries::Bt2020:
redPoint = QPointF(0.708, 0.292);
greenPoint = QPointF(0.190, 0.797);
bluePoint = QPointF(0.131, 0.046);
whitePoint = QColorVector::D65Chromaticity();
break;
case QColorSpace::Primaries::AdobeRgb:
redPoint = QPointF(0.640, 0.330);
greenPoint = QPointF(0.210, 0.710);
@ -191,11 +185,6 @@ QColorSpacePrivate::QColorSpacePrivate(QColorSpace::NamedColorSpace namedColorSp
transferFunction = QColorSpace::TransferFunction::ProPhotoRgb;
description = QStringLiteral("ProPhoto RGB");
break;
case QColorSpace::Bt2020:
primaries = QColorSpace::Primaries::Bt2020;
transferFunction = QColorSpace::TransferFunction::Bt2020;
description = QStringLiteral("BT.2020");
break;
default:
Q_UNREACHABLE();
}
@ -277,14 +266,6 @@ void QColorSpacePrivate::identifyColorSpace()
}
}
break;
case QColorSpace::Primaries::Bt2020:
if (transferFunction == QColorSpace::TransferFunction::Bt2020) {
namedColorSpace = QColorSpace::Bt2020;
if (description.isEmpty())
description = QStringLiteral("BT.2020");
return;
}
break;
default:
break;
}
@ -335,12 +316,6 @@ void QColorSpacePrivate::setTransferFunction()
if (qFuzzyIsNull(gamma))
gamma = 1.8f;
break;
case QColorSpace::TransferFunction::Bt2020:
trc[0].m_type = QColorTrc::Type::Function;
trc[0].m_fun = QColorTransferFunction::fromBt2020();
if (qFuzzyIsNull(gamma))
gamma = 1.961f;
break;
case QColorSpace::TransferFunction::Custom:
break;
default:
@ -415,8 +390,6 @@ QColorTransform QColorSpacePrivate::transformationToColorSpace(const QColorSpace
\l{http://www.color.org/chardata/rgb/DCIP3.xalter}{ICC registration of DCI-P3}
\value ProPhotoRgb The Pro Photo RGB color space, also known as ROMM RGB is a very wide gamut color space.
\l{http://www.color.org/chardata/rgb/rommrgb.xalter}{ICC registration of ROMM RGB}
\value Bt2020 BT.2020 also known as Rec.2020 is the color space of HDR TVs.
\l{http://www.color.org/chardata/rgb/BT2020.xalter}{ICC registration of BT.2020}
*/
/*!
@ -429,7 +402,6 @@ QColorTransform QColorSpacePrivate::transformationToColorSpace(const QColorSpace
\value AdobeRgb The Adobe RGB primaries
\value DciP3D65 The DCI-P3 primaries with the D65 whitepoint
\value ProPhotoRgb The ProPhoto RGB primaries with the D50 whitepoint
\value Bt2020 The BT.2020 primaries
*/
/*!
@ -442,7 +414,6 @@ QColorTransform QColorSpacePrivate::transformationToColorSpace(const QColorSpace
\value Gamma A transfer function that is a real gamma curve based on the value of gamma()
\value SRgb The sRGB transfer function, composed of linear and gamma parts
\value ProPhotoRgb The ProPhoto RGB transfer function, composed of linear and gamma parts
\value Bt2020 The BT.2020 transfer function, composed of linear and gamma parts
*/
/*!
@ -457,7 +428,7 @@ QColorSpace::QColorSpace()
*/
QColorSpace::QColorSpace(NamedColorSpace namedColorSpace)
{
static QColorSpacePrivate *predefinedColorspacePrivates[QColorSpace::Bt2020 + 1];
static QColorSpacePrivate *predefinedColorspacePrivates[QColorSpace::ProPhotoRgb + 1];
if (!predefinedColorspacePrivates[namedColorSpace]) {
predefinedColorspacePrivates[namedColorSpace] = new QColorSpacePrivate(namedColorSpace);
predefinedColorspacePrivates[namedColorSpace]->ref.ref();

View File

@ -59,8 +59,7 @@ public:
SRgbLinear,
AdobeRgb,
DisplayP3,
ProPhotoRgb,
Bt2020,
ProPhotoRgb
};
Q_ENUM(NamedColorSpace)
enum class Primaries {
@ -68,8 +67,7 @@ public:
SRgb,
AdobeRgb,
DciP3D65,
ProPhotoRgb,
Bt2020,
ProPhotoRgb
};
Q_ENUM(Primaries)
enum class TransferFunction {
@ -77,8 +75,7 @@ public:
Linear,
Gamma,
SRgb,
ProPhotoRgb,
Bt2020,
ProPhotoRgb
};
Q_ENUM(TransferFunction)

View File

@ -130,10 +130,6 @@ public:
{
return QColorTransferFunction(1.0f / 1.055f, 0.055f / 1.055f, 1.0f / 12.92f, 0.04045f, 0.0f, 0.0f, 2.4f);
}
static QColorTransferFunction fromBt2020()
{
return QColorTransferFunction(1.0f / 1.0993f, 0.0993f / 1.0993f, 1.0f / 4.5f, 0.08145f, 0.0f, 0.0f, 2.2f);
}
static QColorTransferFunction fromProPhotoRgb()
{
return QColorTransferFunction(1.0f, 0.0f, 1.0f / 16.0f, 16.0f / 512.0f, 0.0f, 0.0f, 1.8f);

View File

@ -687,9 +687,6 @@ bool fromIccProfile(const QByteArray &data, QColorSpace *colorSpace)
} else if (colorspaceDPtr->toXyz == QColorMatrix::toXyzFromDciP3D65()) {
qCDebug(lcIcc) << "fromIccProfile: DCI-P3 D65 primaries detected";
colorspaceDPtr->primaries = QColorSpace::Primaries::DciP3D65;
} else if (colorspaceDPtr->toXyz == QColorMatrix::toXyzFromBt2020()) {
qCDebug(lcIcc) << "fromIccProfile: BT.2020 primaries detected";
colorspaceDPtr->primaries = QColorSpace::Primaries::Bt2020;
}
if (colorspaceDPtr->toXyz == QColorMatrix::toXyzFromProPhotoRgb()) {
qCDebug(lcIcc) << "fromIccProfile: ProPhoto RGB primaries detected";

View File

@ -123,9 +123,6 @@ void tst_QColorSpace::namedColorSpaces_data()
QTest::newRow("ProPhoto RGB") << QColorSpace::ProPhotoRgb
<< QColorSpace::Primaries::ProPhotoRgb
<< QColorSpace::TransferFunction::ProPhotoRgb;
QTest::newRow("BT.2020") << QColorSpace::Bt2020
<< QColorSpace::Primaries::Bt2020
<< QColorSpace::TransferFunction::Bt2020;
}
void tst_QColorSpace::namedColorSpaces()
@ -220,7 +217,6 @@ void tst_QColorSpace::imageConversion_data()
QTest::newRow("Display-P3 -> sRGB") << QColorSpace::DisplayP3 << QColorSpace::SRgb << 0;
QTest::newRow("Adobe RGB -> sRGB") << QColorSpace::AdobeRgb << QColorSpace::SRgb << 2;
QTest::newRow("Display-P3 -> Adobe RGB") << QColorSpace::DisplayP3 << QColorSpace::AdobeRgb << 2;
QTest::newRow("Display-P3 -> BT.2020") << QColorSpace::DisplayP3 << QColorSpace::Bt2020 << 4;
QTest::newRow("sRGB -> sRGB Linear") << QColorSpace::SRgb << QColorSpace::SRgbLinear << 0;
}
@ -351,14 +347,12 @@ void tst_QColorSpace::primariesXyz()
QColorSpace adobeRgb = QColorSpace::AdobeRgb;
QColorSpace displayP3 = QColorSpace::DisplayP3;
QColorSpace proPhotoRgb = QColorSpace::ProPhotoRgb;
QColorSpace bt2020 = QColorSpace::Bt2020;
// Check if our calculated matrices, match the precalculated ones.
QCOMPARE(QColorSpacePrivate::get(sRgb)->toXyz, QColorMatrix::toXyzFromSRgb());
QCOMPARE(QColorSpacePrivate::get(adobeRgb)->toXyz, QColorMatrix::toXyzFromAdobeRgb());
QCOMPARE(QColorSpacePrivate::get(displayP3)->toXyz, QColorMatrix::toXyzFromDciP3D65());
QCOMPARE(QColorSpacePrivate::get(proPhotoRgb)->toXyz, QColorMatrix::toXyzFromProPhotoRgb());
QCOMPARE(QColorSpacePrivate::get(bt2020)->toXyz, QColorMatrix::toXyzFromBt2020());
}
#ifdef QT_BUILD_INTERNAL
@ -370,7 +364,6 @@ void tst_QColorSpace::primaries2_data()
QTest::newRow("DCI-P3 (D65)") << QColorSpace::Primaries::DciP3D65;
QTest::newRow("Adobe RGB (1998)") << QColorSpace::Primaries::AdobeRgb;
QTest::newRow("ProPhoto RGB") << QColorSpace::Primaries::ProPhotoRgb;
QTest::newRow("BT.2020") << QColorSpace::Primaries::Bt2020;
}
void tst_QColorSpace::primaries2()