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,
|
||||
// in 0.00002 nits
|
||||
.display_primaries = {
|
||||
{to16Bit(colorimetry.redPrimary.x()), to16Bit(colorimetry.redPrimary.y())},
|
||||
{to16Bit(colorimetry.greenPrimary.x()), to16Bit(colorimetry.greenPrimary.y())},
|
||||
{to16Bit(colorimetry.bluePrimary.x()), to16Bit(colorimetry.bluePrimary.y())},
|
||||
{to16Bit(colorimetry.red.x()), to16Bit(colorimetry.red.y())},
|
||||
{to16Bit(colorimetry.green.x()), to16Bit(colorimetry.green.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
|
||||
.max_display_mastering_luminance = uint16_t(std::round(metadata.desiredContentMaxLuminance)),
|
||||
// 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);
|
||||
if (chromaticity) {
|
||||
m_colorimetry = {
|
||||
.redPrimary = {chromaticity->red_x, chromaticity->red_y},
|
||||
.greenPrimary = {chromaticity->green_x, chromaticity->green_y},
|
||||
.bluePrimary = {chromaticity->blue_x, chromaticity->blue_y},
|
||||
.whitePoint = {chromaticity->white_x, chromaticity->white_y},
|
||||
.red = {chromaticity->red_x, chromaticity->red_y},
|
||||
.green = {chromaticity->green_x, chromaticity->green_y},
|
||||
.blue = {chromaticity->blue_x, chromaticity->blue_y},
|
||||
.white = {chromaticity->white_x, chromaticity->white_y},
|
||||
};
|
||||
} else {
|
||||
// assume sRGB
|
||||
m_colorimetry = {
|
||||
.redPrimary = {0.64, 0.33},
|
||||
.greenPrimary = {0.30, 0.60},
|
||||
.bluePrimary = {0.15, 0.06},
|
||||
.whitePoint = {0.3127, 0.3290},
|
||||
.red = {0.64, 0.33},
|
||||
.green = {0.30, 0.60},
|
||||
.blue = {0.15, 0.06},
|
||||
.white = {0.3127, 0.3290},
|
||||
.name = NamedColorimetry::BT709,
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -240,7 +241,7 @@ QString Edid::hash() const
|
|||
return m_hash;
|
||||
}
|
||||
|
||||
Edid::Colorimetry Edid::colorimetry() const
|
||||
Colorimetry Edid::colorimetry() const
|
||||
{
|
||||
return m_colorimetry;
|
||||
}
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
#pragma once
|
||||
|
||||
#include "kwin_export.h"
|
||||
#include "libkwineffects/colorspace.h"
|
||||
|
||||
#include <QByteArray>
|
||||
#include <QList>
|
||||
|
@ -78,13 +79,6 @@ public:
|
|||
|
||||
QString hash() const;
|
||||
|
||||
struct Colorimetry
|
||||
{
|
||||
QVector2D redPrimary;
|
||||
QVector2D greenPrimary;
|
||||
QVector2D bluePrimary;
|
||||
QVector2D whitePoint;
|
||||
};
|
||||
Colorimetry colorimetry() const;
|
||||
|
||||
struct HDRMetadata
|
||||
|
|
Loading…
Reference in a new issue