utils/edid: use the common Colorimetry class instead of a separate struct
This commit is contained in:
parent
ebf6bd3a33
commit
7fa12ee4a6
3 changed files with 15 additions and 20 deletions
|
@ -719,11 +719,11 @@ std::shared_ptr<DrmBlob> DrmPipeline::createHdrMetadata(NamedTransferFunction tr
|
||||||
.metadata_type = 0,
|
.metadata_type = 0,
|
||||||
// in 0.00002 nits
|
// in 0.00002 nits
|
||||||
.display_primaries = {
|
.display_primaries = {
|
||||||
{to16Bit(colorimetry.redPrimary.x()), to16Bit(colorimetry.redPrimary.y())},
|
{to16Bit(colorimetry.red.x()), to16Bit(colorimetry.red.y())},
|
||||||
{to16Bit(colorimetry.greenPrimary.x()), to16Bit(colorimetry.greenPrimary.y())},
|
{to16Bit(colorimetry.green.x()), to16Bit(colorimetry.green.y())},
|
||||||
{to16Bit(colorimetry.bluePrimary.x()), to16Bit(colorimetry.bluePrimary.y())},
|
{to16Bit(colorimetry.blue.x()), to16Bit(colorimetry.blue.y())},
|
||||||
},
|
},
|
||||||
.white_point = {to16Bit(colorimetry.whitePoint.x()), to16Bit(colorimetry.whitePoint.y())},
|
.white_point = {to16Bit(colorimetry.white.x()), to16Bit(colorimetry.white.y())},
|
||||||
// in nits
|
// in nits
|
||||||
.max_display_mastering_luminance = uint16_t(std::round(metadata.desiredContentMaxLuminance)),
|
.max_display_mastering_luminance = uint16_t(std::round(metadata.desiredContentMaxLuminance)),
|
||||||
// in 0.0001 nits
|
// in 0.0001 nits
|
||||||
|
|
|
@ -124,18 +124,19 @@ Edid::Edid(const void *data, uint32_t size)
|
||||||
const auto chromaticity = di_edid_get_chromaticity_coords(edid);
|
const auto chromaticity = di_edid_get_chromaticity_coords(edid);
|
||||||
if (chromaticity) {
|
if (chromaticity) {
|
||||||
m_colorimetry = {
|
m_colorimetry = {
|
||||||
.redPrimary = {chromaticity->red_x, chromaticity->red_y},
|
.red = {chromaticity->red_x, chromaticity->red_y},
|
||||||
.greenPrimary = {chromaticity->green_x, chromaticity->green_y},
|
.green = {chromaticity->green_x, chromaticity->green_y},
|
||||||
.bluePrimary = {chromaticity->blue_x, chromaticity->blue_y},
|
.blue = {chromaticity->blue_x, chromaticity->blue_y},
|
||||||
.whitePoint = {chromaticity->white_x, chromaticity->white_y},
|
.white = {chromaticity->white_x, chromaticity->white_y},
|
||||||
};
|
};
|
||||||
} else {
|
} else {
|
||||||
// assume sRGB
|
// assume sRGB
|
||||||
m_colorimetry = {
|
m_colorimetry = {
|
||||||
.redPrimary = {0.64, 0.33},
|
.red = {0.64, 0.33},
|
||||||
.greenPrimary = {0.30, 0.60},
|
.green = {0.30, 0.60},
|
||||||
.bluePrimary = {0.15, 0.06},
|
.blue = {0.15, 0.06},
|
||||||
.whitePoint = {0.3127, 0.3290},
|
.white = {0.3127, 0.3290},
|
||||||
|
.name = NamedColorimetry::BT709,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -240,7 +241,7 @@ QString Edid::hash() const
|
||||||
return m_hash;
|
return m_hash;
|
||||||
}
|
}
|
||||||
|
|
||||||
Edid::Colorimetry Edid::colorimetry() const
|
Colorimetry Edid::colorimetry() const
|
||||||
{
|
{
|
||||||
return m_colorimetry;
|
return m_colorimetry;
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,6 +10,7 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "kwin_export.h"
|
#include "kwin_export.h"
|
||||||
|
#include "libkwineffects/colorspace.h"
|
||||||
|
|
||||||
#include <QByteArray>
|
#include <QByteArray>
|
||||||
#include <QList>
|
#include <QList>
|
||||||
|
@ -78,13 +79,6 @@ public:
|
||||||
|
|
||||||
QString hash() const;
|
QString hash() const;
|
||||||
|
|
||||||
struct Colorimetry
|
|
||||||
{
|
|
||||||
QVector2D redPrimary;
|
|
||||||
QVector2D greenPrimary;
|
|
||||||
QVector2D bluePrimary;
|
|
||||||
QVector2D whitePoint;
|
|
||||||
};
|
|
||||||
Colorimetry colorimetry() const;
|
Colorimetry colorimetry() const;
|
||||||
|
|
||||||
struct HDRMetadata
|
struct HDRMetadata
|
||||||
|
|
Loading…
Reference in a new issue