Skip to content

armgit / krita

Public Imported from GitHub
0

Krita is a free and open source cross-platform application that offers an end-to-end solution for creating digital art files from scratch built on the KDE and Qt frameworks.

C++

Rename contentLightLevelInformation to relativeContentLightLevelInformation.

Wolthera van Hövell tot Westerflierc95d8ec2cecb
diff --git a/libs/image/kis_hdr_metadata.h b/libs/image/kis_hdr_metadata.h
index 7f2b8e996c..8c59463434 100644
--- a/libs/image/kis_hdr_metadata.h
+++ b/libs/image/kis_hdr_metadata.h
@@ -9,12 +9,12 @@
#include <QPointF>
#include <boost/operators.hpp>
/**
- * KisContentLightLevelInformation is a struct that represents
+ * KisRelativeContentLightLevelInformation is a struct that represents
* HDR10 metadata. It is similar to the same values in MasteringInfo in
- * KisSurfaceColorimetry.h
+ * KisSurfaceColorimetry.h, though typically relative to the diffuse white.
*/
-struct KisContentLightLevelInformation: public boost::equality_comparable<KisContentLightLevelInformation> {
+struct KisRelativeContentLightLevelInformation: public boost::equality_comparable<KisRelativeContentLightLevelInformation> {
/**
* MaxContentLightLevel or MaxCLL is the brightest pixel in the frame sequence.
*/
@@ -26,16 +26,19 @@ struct KisContentLightLevelInformation: public boost::equality_comparable<KisCon
*/
double maxFrameAverageLightLevel = 0.0;
- bool operator==(const KisContentLightLevelInformation & other) const {
- return qFuzzyCompare(maxContentLightLevel, other.maxContentLightLevel)
- && qFuzzyCompare(maxFrameAverageLightLevel, other.maxFrameAverageLightLevel);
- };
-
enum CalculationType {
XYZLuminance, ///< Calculate luminance by converting to xyz.
Rec2020Component, ///< Calculate luminance by converting to rec2020
RGBComponent ///< Calculate luminance on the RGB components if possible.
};
+
+ CalculationType type;
+
+ bool operator==(const KisRelativeContentLightLevelInformation & other) const {
+ return qFuzzyCompare(maxContentLightLevel, other.maxContentLightLevel)
+ && qFuzzyCompare(maxFrameAverageLightLevel, other.maxFrameAverageLightLevel)
+ && (type == other.type);
+ };
};
/**
diff --git a/libs/image/kis_image.cc b/libs/image/kis_image.cc
index f473e7d561..a37d10ff03 100644
--- a/libs/image/kis_image.cc
+++ b/libs/image/kis_image.cc
@@ -280,7 +280,7 @@ public:
KisCompositeProgressProxy compositeProgressProxy;
- std::optional<KisContentLightLevelInformation> contentLightLevelInformation;
+ std::optional<KisRelativeContentLightLevelInformation> relativeContentLightLevelInformation;
std::optional<KisColorVolumeInformation> colorVolumeInformation;
std::optional<double> diffuseWhiteLightLevel;
@@ -502,7 +502,7 @@ void KisImage::copyFromImageImpl(const KisImage &rhs, int policy)
m_d->isolateGroup = rhs.m_d->isolateGroup;
m_d->colorVolumeInformation = rhs.m_d->colorVolumeInformation;
- m_d->contentLightLevelInformation = rhs.m_d->contentLightLevelInformation;
+ m_d->relativeContentLightLevelInformation = rhs.m_d->relativeContentLightLevelInformation;
m_d->diffuseWhiteLightLevel = rhs.m_d->diffuseWhiteLightLevel;
QQueue<KisNodeSP> linearizedNodes;
@@ -2089,16 +2089,16 @@ bool KisImage::startIsolatedMode(KisNodeSP node, bool isolateLayer, bool isolate
return true;
}
-std::optional<KisContentLightLevelInformation> KisImage::contentLightLevelInformation() const
+std::optional<KisRelativeContentLightLevelInformation> KisImage::relativeContentLightLevelInformation() const
{
- return m_d->contentLightLevelInformation;
+ return m_d->relativeContentLightLevelInformation;
}
-void KisImage::setContentLightLevelInformation(const std::optional<KisContentLightLevelInformation> clli)
+void KisImage::setRelativeContentLightLevelInformation(const std::optional<KisRelativeContentLightLevelInformation> clli)
{
- if (!m_d->contentLightLevelInformation ||
- !(*m_d->contentLightLevelInformation == *clli)) {
- m_d->contentLightLevelInformation = clli;
+ if (!m_d->relativeContentLightLevelInformation ||
+ !(*m_d->relativeContentLightLevelInformation == *clli)) {
+ m_d->relativeContentLightLevelInformation = clli;
emit sigContentLightLevelInformationChanged();
}
}
@@ -2114,12 +2114,12 @@ void KisImage::calculateContentLightLevelInformation(int type)
emitSignals, actionName);
KisSharedPtr<KisContentLightLevelProcessingVistor> visitor =
- new KisContentLightLevelProcessingVistor(KisContentLightLevelInformation::CalculationType(type));
+ new KisContentLightLevelProcessingVistor(KisRelativeContentLightLevelInformation::CalculationType(type));
applicator.applyVisitorAllFrames(visitor, KisStrokeJobData::SEQUENTIAL);
applicator.end();
waitForDone();
- m_d->contentLightLevelInformation = std::make_optional(visitor->contentLightLevelInformation());
+ m_d->relativeContentLightLevelInformation = std::make_optional(visitor->contentLightLevelInformation());
emit sigContentLightLevelInformationChanged();
}
diff --git a/libs/image/kis_image.h b/libs/image/kis_image.h
index 4b3979a8de..59f8ad8623 100644
--- a/libs/image/kis_image.h
+++ b/libs/image/kis_image.h
@@ -43,7 +43,7 @@ class KisProofingConfiguration;
class KisPaintDevice;
class KisImageGlobalSelectionManagementInterface;
-struct KisContentLightLevelInformation;
+struct KisRelativeContentLightLevelInformation;
struct KisColorVolumeInformation;
namespace KisMetaData
@@ -805,15 +805,15 @@ public:
bool startIsolatedMode(KisNodeSP node, bool isolateLayer, bool isolateGroup);
/**
- * @brief contentLightLevelInformation
- * This returns (optionally) a KisContentLightLevelInformation with the
+ * @brief relativeContentLightLevelInformation
+ * This returns (optionally) a KisRelativeContentLightLevelInformation with the
* MaxCLL and MaxFALL of the image. Note that MaxCLL and MaxFALL will
* not be in cd/m², but rather in linear XYZ Y. To get the cd/m², multiply
* these values with diffuseWhiteLightLevel().
*/
- std::optional<KisContentLightLevelInformation> contentLightLevelInformation() const;
+ std::optional<KisRelativeContentLightLevelInformation> relativeContentLightLevelInformation() const;
- void setContentLightLevelInformation(const std::optional<KisContentLightLevelInformation> clli);
+ void setRelativeContentLightLevelInformation(const std::optional<KisRelativeContentLightLevelInformation> clli);
/**
* @brief colorVolumeInformation
* @return the KisColorVolumeInformation of the image.
diff --git a/libs/image/processing/KisContentLightLevelProcessingVistor.cpp b/libs/image/processing/KisContentLightLevelProcessingVistor.cpp
index ce9bf0ffaa..61fb93349e 100644
--- a/libs/image/processing/KisContentLightLevelProcessingVistor.cpp
+++ b/libs/image/processing/KisContentLightLevelProcessingVistor.cpp
@@ -13,11 +13,11 @@
struct KisContentLightLevelProcessingVistor::Private {
- KisContentLightLevelInformation::CalculationType type;
- QList<KisContentLightLevelInformation> clli;
+ KisRelativeContentLightLevelInformation::CalculationType type;
+ QList<KisRelativeContentLightLevelInformation> clli;
};
-KisContentLightLevelProcessingVistor::KisContentLightLevelProcessingVistor(KisContentLightLevelInformation::CalculationType type)
+KisContentLightLevelProcessingVistor::KisContentLightLevelProcessingVistor(KisRelativeContentLightLevelInformation::CalculationType type)
: KisDoNothingProcessingVisitor(), d(new Private)
{
d->type = type;
@@ -39,12 +39,12 @@ void KisContentLightLevelProcessingVistor::visit(KisGroupLayer *layer, KisUndoAd
d->clli.append(calculateForDev(dev));
}
-KisContentLightLevelInformation KisContentLightLevelProcessingVistor::contentLightLevelInformation() const
+KisRelativeContentLightLevelInformation KisContentLightLevelProcessingVistor::contentLightLevelInformation() const
{
- KisContentLightLevelInformation clli;
+ KisRelativeContentLightLevelInformation clli;
double total = 0.0;
for(int i = 0; i < d->clli.size(); i++) {
- KisContentLightLevelInformation c = d->clli.at(i);
+ KisRelativeContentLightLevelInformation c = d->clli.at(i);
clli.maxContentLightLevel = qMax(clli.maxContentLightLevel, c.maxContentLightLevel);
total += c.maxFrameAverageLightLevel;
}
@@ -52,18 +52,18 @@ KisContentLightLevelInformation KisContentLightLevelProcessingVistor::contentLig
return clli;
}
-KisContentLightLevelInformation KisContentLightLevelProcessingVistor::calculateForDev(KisPaintDeviceSP dev)
+KisRelativeContentLightLevelInformation KisContentLightLevelProcessingVistor::calculateForDev(KisPaintDeviceSP dev)
{
- KisContentLightLevelInformation clli;
+ KisRelativeContentLightLevelInformation clli;
double average = 0.0;
int divider = 0;
const QRectF imageBounds = dev->extent();
bool canConvertLinear = dev->colorSpace()->colorModelId() == RGBAColorModelID && dev->colorSpace()->profile()->getColorPrimaries() != PRIMARIES_UNSPECIFIED;
- if ((d->type == KisContentLightLevelInformation::RGBComponent && canConvertLinear)
- || d->type == KisContentLightLevelInformation::Rec2020Component){
- if (d->type == KisContentLightLevelInformation::Rec2020Component) {
+ if ((d->type == KisRelativeContentLightLevelInformation::RGBComponent && canConvertLinear)
+ || d->type == KisRelativeContentLightLevelInformation::Rec2020Component){
+ if (d->type == KisRelativeContentLightLevelInformation::Rec2020Component) {
const KoColorSpace *rec2020CS = KoColorSpaceRegistry::instance()->colorSpace(RGBAColorModelID.id(),
Float32BitsColorDepthID.id(),
KoColorSpaceRegistry::instance()->p2020G10Profile());
diff --git a/libs/image/processing/KisContentLightLevelProcessingVistor.h b/libs/image/processing/KisContentLightLevelProcessingVistor.h
index 1186d8c1cd..7633bc8ccc 100644
--- a/libs/image/processing/KisContentLightLevelProcessingVistor.h
+++ b/libs/image/processing/KisContentLightLevelProcessingVistor.h
@@ -20,16 +20,16 @@ class KisContentLightLevelProcessingVistor : public KisDoNothingProcessingVisito
{
public:
- KisContentLightLevelProcessingVistor(KisContentLightLevelInformation::CalculationType type = KisContentLightLevelInformation::XYZLuminance);
+ KisContentLightLevelProcessingVistor(KisRelativeContentLightLevelInformation::CalculationType type = KisRelativeContentLightLevelInformation::XYZLuminance);
~KisContentLightLevelProcessingVistor() override;
using KisDoNothingProcessingVisitor::visit;
void visit(KisGroupLayer *layer, KisUndoAdapter *undoAdapter) override;
- KisContentLightLevelInformation contentLightLevelInformation() const;
+ KisRelativeContentLightLevelInformation contentLightLevelInformation() const;
private:
- KisContentLightLevelInformation calculateForDev(KisPaintDeviceSP dev);
+ KisRelativeContentLightLevelInformation calculateForDev(KisPaintDeviceSP dev);
struct Private;
QScopedPointer<Private> d;
};
diff --git a/libs/impex/HdrMetaDataCheck.h b/libs/impex/HdrMetaDataCheck.h
index 8056486627..d631a1df9e 100644
--- a/libs/impex/HdrMetaDataCheck.h
+++ b/libs/impex/HdrMetaDataCheck.h
@@ -25,7 +25,7 @@ public:
bool checkNeeded(KisImageSP image) const override
{
- return image->contentLightLevelInformation() && image->colorVolumeInformation() && image->diffuseWhiteLightLevel();
+ return image->relativeContentLightLevelInformation() && image->colorVolumeInformation() && image->diffuseWhiteLightLevel();
}
Level check(KisImageSP /*image*/) const override
diff --git a/libs/ui/animation/KisHDRMetadataOptions.cpp b/libs/ui/animation/KisHDRMetadataOptions.cpp
index 84ed89df43..a3fd7fe53a 100644
--- a/libs/ui/animation/KisHDRMetadataOptions.cpp
+++ b/libs/ui/animation/KisHDRMetadataOptions.cpp
@@ -79,7 +79,7 @@ QString KisHDRMetadataOptions::generateFFMpegOptions() const
.arg(cprim(cvi.white.x())).arg(cprim(cvi.white.y()))
.arg(lum(cvi.maxLuminance)).arg(lum(cvi.minLuminance));
}
- if (clli != KisContentLightLevelInformation()) {
+ if (clli != KisRelativeContentLightLevelInformation()) {
x265Params += QString("max-cll=%11,%12:")
.arg(int(clli.maxContentLightLevel*diffuseWhite))
.arg(int(clli.maxFrameAverageLightLevel*diffuseWhite));
diff --git a/libs/ui/animation/KisHDRMetadataOptions.h b/libs/ui/animation/KisHDRMetadataOptions.h
index a32b9d1177..896d74d13e 100644
--- a/libs/ui/animation/KisHDRMetadataOptions.h
+++ b/libs/ui/animation/KisHDRMetadataOptions.h
@@ -19,7 +19,7 @@ struct KisHDRMetadataOptions
KisColorVolumeInformation cvi;
- KisContentLightLevelInformation clli;
+ KisRelativeContentLightLevelInformation clli;
double diffuseWhite = 80;
diff --git a/libs/ui/dialogs/kis_dlg_image_properties.cc b/libs/ui/dialogs/kis_dlg_image_properties.cc
index 34ec0e4b1c..338fcf591e 100644
--- a/libs/ui/dialogs/kis_dlg_image_properties.cc
+++ b/libs/ui/dialogs/kis_dlg_image_properties.cc
@@ -129,9 +129,9 @@ KisDlgImageProperties::KisDlgImageProperties(KisImageWSP image, KisDisplayColorC
m_page->cmbColorVolumePresets->addItem(i18n("Rec. 2100 PQ"), "p2100-pq");
m_page->cmbColorVolumePresets->addItem(i18n("DCI-P3 D65"), "dci-p3-d65");
- m_page->cmbLumiCalcType->addItem(i18n("XYZ Luminance"), KisContentLightLevelInformation::XYZLuminance);
- m_page->cmbLumiCalcType->addItem(i18n("Rec 2020 Per Component"), KisContentLightLevelInformation::Rec2020Component);
- m_page->cmbLumiCalcType->addItem(i18n("RGB Per Component"), KisContentLightLevelInformation::RGBComponent);
+ m_page->cmbLumiCalcType->addItem(i18n("XYZ Luminance"), KisRelativeContentLightLevelInformation::XYZLuminance);
+ m_page->cmbLumiCalcType->addItem(i18n("Rec 2020 Per Component"), KisRelativeContentLightLevelInformation::Rec2020Component);
+ m_page->cmbLumiCalcType->addItem(i18n("RGB Per Component"), KisRelativeContentLightLevelInformation::RGBComponent);
m_page->cmbLumiCalcType->setItemData(0, i18nc("@tooltip", "Calculate the brightness in nits against XYZ luminance."), Qt::ToolTipRole);
m_page->cmbLumiCalcType->setItemData(1, i18nc("@tooltip", "Calculate the brightness in nits by testing the components in linear rec 2020."), Qt::ToolTipRole);
@@ -251,7 +251,7 @@ void KisDlgImageProperties::updateHDRLightLevels()
if (d->image->contentLightLevelInformation()) {
m_page->gbxContentLightLevel->setChecked(true);
double diffuseWhite = d->image->diffuseWhiteLightLevel()? *d->image->diffuseWhiteLightLevel(): 80.0;
- KisContentLightLevelInformation clli = *d->image->contentLightLevelInformation();
+ KisRelativeContentLightLevelInformation clli = *d->image->contentLightLevelInformation();
m_page->spnMaxCll->setValue(clli.maxContentLightLevel*diffuseWhite);
m_page->spnMaxFall->setValue(clli.maxFrameAverageLightLevel*diffuseWhite);
} else {
@@ -288,12 +288,12 @@ void KisDlgImageProperties::setHDRLightLevelsOnImage()
{
if (m_page->gbxContentLightLevel->isChecked()) {
double diffuseWhite = d->image->diffuseWhiteLightLevel()? *d->image->diffuseWhiteLightLevel(): 80.0;
- KisContentLightLevelInformation clli;
+ KisRelativeContentLightLevelInformation clli;
clli.maxContentLightLevel = m_page->spnMaxCll->value() / diffuseWhite;
clli.maxFrameAverageLightLevel = m_page->spnMaxFall->value() / diffuseWhite;
- d->image->setContentLightLevelInformation(std::make_optional(clli));
+ d->image->setRelativeContentLightLevelInformation(std::make_optional(clli));
} else {
- d->image->setContentLightLevelInformation(std::nullopt);
+ d->image->setRelativeContentLightLevelInformation(std::nullopt);
}
}
diff --git a/plugins/impex/libkra/kis_kra_loader.cpp b/plugins/impex/libkra/kis_kra_loader.cpp
index 065f260503..67108e7c65 100644
--- a/plugins/impex/libkra/kis_kra_loader.cpp
+++ b/plugins/impex/libkra/kis_kra_loader.cpp
@@ -1558,11 +1558,11 @@ void KisKraLoader::loadHDRMetadata(const QDomElement &elem, KisImageSP image)
image->setDiffuseWhiteLightLevel(dW);
}
if (child.tagName() == CONTENTLIGHTLEVEL) {
- KisContentLightLevelInformation clli;
+ KisRelativeContentLightLevelInformation clli;
clli.maxContentLightLevel = child.attribute(MAXCLL, "0.0").toDouble();
clli.maxFrameAverageLightLevel = child.attribute(MAXFALL, "0.0").toDouble();
- std::optional<KisContentLightLevelInformation> ci = std::make_optional(clli);
- image->setContentLightLevelInformation(ci);
+ std::optional<KisRelativeContentLightLevelInformation> ci = std::make_optional(clli);
+ image->setRelativeContentLightLevelInformation(ci);
}
if (child.tagName() == COLORVOLUME) {
KisColorVolumeInformation cv;
diff --git a/plugins/impex/libkra/kis_kra_saver.cpp b/plugins/impex/libkra/kis_kra_saver.cpp
index 6c4d19f954..9aac6b2860 100644
--- a/plugins/impex/libkra/kis_kra_saver.cpp
+++ b/plugins/impex/libkra/kis_kra_saver.cpp
@@ -705,15 +705,15 @@ void KisKraSaver::saveColorHistory(QDomDocument &doc, QDomElement &element)
void KisKraSaver::saveHDRMetadata(QDomDocument &doc, QDomElement &element, KisImageSP image)
{
- if (!image->diffuseWhiteLightLevel() && !image->colorVolumeInformation() && !image->contentLightLevelInformation()) {
+ if (!image->diffuseWhiteLightLevel() && !image->colorVolumeInformation() && !image->relativeContentLightLevelInformation()) {
return;
}
QDomElement hdr = doc.createElement(HDRMETADATA);
if (image->diffuseWhiteLightLevel()) {
KisDomUtils::saveValue(&hdr, DIFFUSEWHITE, *image->diffuseWhiteLightLevel());
}
- if (image->contentLightLevelInformation()) {
- KisContentLightLevelInformation c = *image->contentLightLevelInformation();
+ if (image->relativeContentLightLevelInformation()) {
+ KisRelativeContentLightLevelInformation c = *image->relativeContentLightLevelInformation();
QDomElement clli = doc.createElement(CONTENTLIGHTLEVEL);
clli.setAttribute(MAXCLL, KisDomUtils::toString(c.maxContentLightLevel));
clli.setAttribute(MAXFALL, KisDomUtils::toString(c.maxFrameAverageLightLevel));