HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
ImfChromaticities.h
Go to the documentation of this file.
1 //
2 // SPDX-License-Identifier: BSD-3-Clause
3 // Copyright (c) Contributors to the OpenEXR Project.
4 //
5 
6 #ifndef INCLUDED_IMF_CHROMATICITIES_H
7 #define INCLUDED_IMF_CHROMATICITIES_H
8 
9 //-----------------------------------------------------------------------------
10 //
11 // CIE (x,y) chromaticities, and conversions between
12 // RGB tiples and CIE XYZ tristimulus values.
13 //
14 //-----------------------------------------------------------------------------
15 
16 #include "ImfExport.h"
17 #include "ImfNamespace.h"
18 
19 #include "ImathMatrix.h"
20 #include "ImathVec.h"
21 
22 
24 
25 
27 {
28  //-----------------------------------------------
29  // The CIE x and y coordinates of the RGB triples
30  // (1,0,0), (0,1,0), (0,0,1) and (1,1,1).
31  //-----------------------------------------------
32 
37 
38  //--------------------------------------------
39  // Default constructor produces chromaticities
40  // according to Rec. ITU-R BT.709-3
41  //--------------------------------------------
42 
45  const IMATH_NAMESPACE::V2f &green = IMATH_NAMESPACE::V2f (0.3000f, 0.6000f),
46  const IMATH_NAMESPACE::V2f &blue = IMATH_NAMESPACE::V2f (0.1500f, 0.0600f),
47  const IMATH_NAMESPACE::V2f &white = IMATH_NAMESPACE::V2f (0.3127f, 0.3290f));
48 
49 
50  //---------
51  // Equality
52  //---------
53 
55  bool operator == (const Chromaticities &v) const;
57  bool operator != (const Chromaticities &v) const;
58 };
59 
60 
61 //
62 // Conversions between RGB and CIE XYZ
63 //
64 // RGB to XYZ:
65 //
66 // Given a set of chromaticities, c, and the luminance, Y, of the RGB
67 // triple (1,1,1), or "white", RGBtoXYZ(c,Y) computes a matrix, M, so
68 // that multiplying an RGB value, v, with M produces an equivalent
69 // XYZ value, w. (w == v * M)
70 //
71 // If we define that
72 //
73 // (Xr, Yr, Zr) == (1, 0, 0) * M
74 // (Xg, Yg, Zg) == (0, 1, 0) * M
75 // (Xb, Yb, Zb) == (0, 0, 1) * M
76 // (Xw, Yw, Zw) == (1, 1, 1) * M,
77 //
78 // then the following statements are true:
79 //
80 // Xr / (Xr + Yr + Zr) == c.red.x
81 // Yr / (Xr + Yr + Zr) == c.red.y
82 //
83 // Xg / (Xg + Yg + Zg) == c.green.x
84 // Yg / (Xg + Yg + Zg) == c.green.y
85 //
86 // Xb / (Xb + Yb + Zb) == c.blue.x
87 // Yb / (Xb + Yb + Zb) == c.blue.y
88 //
89 // Xw / (Xw + Yw + Zw) == c.white.x
90 // Yw / (Xw + Yw + Zw) == c.white.y
91 //
92 // Yw == Y.
93 //
94 // XYZ to RGB:
95 //
96 // XYZtoRGB(c,Y) returns RGBtoXYZ(c,Y).inverse().
97 //
98 
101 
102 
104 
105 #endif
Matrix44< float > M44f
4x4 matrix of float
Definition: ImathMatrix.h:1137
#define OPENEXR_IMF_INTERNAL_NAMESPACE_HEADER_EXIT
Definition: ImfNamespace.h:80
Y
Definition: ImathEuler.h:184
const GLdouble * v
Definition: glcorearb.h:837
IMATH_NAMESPACE::V2f red
IMATH_NAMESPACE::V2f blue
bool operator==(const BaseDimensions< T > &a, const BaseDimensions< Y > &b)
Definition: Dimensions.h:137
GLfloat f
Definition: glcorearb.h:1926
GLfloat green
Definition: glcorearb.h:112
struct IMF_EXPORT_TYPE Chromaticities
Definition: ImfForward.h:26
IMF_EXPORT IMATH_NAMESPACE::M44f RGBtoXYZ(const Chromaticities &chroma, float Y)
#define IMF_EXPORT
Definition: ImfExport.h:54
IMATH_NAMESPACE::V2f green
Vec2< float > V2f
Vec2 of float.
Definition: ImathVec.h:834
IMF_EXPORT IMATH_NAMESPACE::M44f XYZtoRGB(const Chromaticities &chroma, float Y)
#define OPENEXR_IMF_INTERNAL_NAMESPACE_HEADER_ENTER
Definition: ImfNamespace.h:79
bool operator!=(const BaseDimensions< T > &a, const BaseDimensions< Y > &b)
Definition: Dimensions.h:165
GLfloat GLfloat blue
Definition: glcorearb.h:112
#define IMF_EXPORT_TYPE
Definition: ImfExport.h:57
png_structrp int png_fixed_point red
Definition: png.h:1083
IMATH_NAMESPACE::V2f white