libpromeki 1.0.0-alpha
PROfessional MEdia toolKIt
 
Loading...
Searching...
No Matches
masteringdisplay.h
Go to the documentation of this file.
1
8#pragma once
9
10
11#include <promeki/config.h>
12#if PROMEKI_ENABLE_CORE
13#include <promeki/namespace.h>
14#include <promeki/ciepoint.h>
15#include <promeki/string.h>
16#include <promeki/error.h>
17#include <promeki/result.h>
18#include <promeki/datatype.h>
19
20PROMEKI_NAMESPACE_BEGIN
21
22class DataStream;
23
63class MasteringDisplay {
64 public:
65 PROMEKI_DATATYPE(MasteringDisplay, DataTypeMasteringDisplay, 1)
66
67
68 Error writeToStream(DataStream &s) const;
70 template <uint32_t V> static Result<MasteringDisplay> readFromStream(DataStream &s);
71
72 static const MasteringDisplay HDR10;
73
74 MasteringDisplay() = default;
75
76 MasteringDisplay(const CIEPoint &red, const CIEPoint &green, const CIEPoint &blue, const CIEPoint &wp,
77 double minLum, double maxLum)
78 : _red(red), _green(green), _blue(blue), _whitePoint(wp), _minLum(minLum), _maxLum(maxLum) {}
79
80 bool isValid() const {
81 return _red.isValid() && _green.isValid() && _blue.isValid() && _whitePoint.isValid() &&
82 _maxLum > 0.0;
83 }
84
85 const CIEPoint &red() const { return _red; }
86 const CIEPoint &green() const { return _green; }
87 const CIEPoint &blue() const { return _blue; }
88 const CIEPoint &whitePoint() const { return _whitePoint; }
89 double minLuminance() const { return _minLum; }
90 double maxLuminance() const { return _maxLum; }
91
92 void setRed(const CIEPoint &v) { _red = v; }
93 void setGreen(const CIEPoint &v) { _green = v; }
94 void setBlue(const CIEPoint &v) { _blue = v; }
95 void setWhitePoint(const CIEPoint &v) { _whitePoint = v; }
96 void setMinLuminance(double v) { _minLum = v; }
97 void setMaxLuminance(double v) { _maxLum = v; }
98
99 bool operator==(const MasteringDisplay &o) const {
100 return _red.data() == o._red.data() && _green.data() == o._green.data() &&
101 _blue.data() == o._blue.data() && _whitePoint.data() == o._whitePoint.data() &&
102 _minLum == o._minLum && _maxLum == o._maxLum;
103 }
104 bool operator!=(const MasteringDisplay &o) const { return !(*this == o); }
105
106 String toString() const;
107
108 private:
109 CIEPoint _red;
110 CIEPoint _green;
111 CIEPoint _blue;
112 CIEPoint _whitePoint;
113 double _minLum = 0.0;
114 double _maxLum = 0.0;
115};
116
117PROMEKI_NAMESPACE_END
118
119#endif // PROMEKI_ENABLE_CORE