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 
23 
25 {
26  //-----------------------------------------------
27  // The CIE x and y coordinates of the RGB triples
28  // (1,0,0), (0,1,0), (0,0,1) and (1,1,1).
29  //-----------------------------------------------
30 
35 
36  //--------------------------------------------
37  // Default constructor produces chromaticities
38  // according to Rec. ITU-R BT.709-3
39  //--------------------------------------------
40 
43  const IMATH_NAMESPACE::V2f& red =
44  IMATH_NAMESPACE::V2f (0.6400f, 0.3300f),
46  IMATH_NAMESPACE::V2f (0.3000f, 0.6000f),
47  const IMATH_NAMESPACE::V2f& blue =
48  IMATH_NAMESPACE::V2f (0.1500f, 0.0600f),
49  const IMATH_NAMESPACE::V2f& white =
50  IMATH_NAMESPACE::V2f (0.3127f, 0.3290f));
51 
52  //---------
53  // Equality
54  //---------
55 
57  bool operator== (const Chromaticities& v) const;
59  bool operator!= (const Chromaticities& v) const;
60 };
61 
62 //
63 // Conversions between RGB and CIE XYZ
64 //
65 // RGB to XYZ:
66 //
67 // Given a set of chromaticities, c, and the luminance, Y, of the RGB
68 // triple (1,1,1), or "white", RGBtoXYZ(c,Y) computes a matrix, M, so
69 // that multiplying an RGB value, v, with M produces an equivalent
70 // XYZ value, w. (w == v * M)
71 //
72 // If we define that
73 //
74 // (Xr, Yr, Zr) == (1, 0, 0) * M
75 // (Xg, Yg, Zg) == (0, 1, 0) * M
76 // (Xb, Yb, Zb) == (0, 0, 1) * M
77 // (Xw, Yw, Zw) == (1, 1, 1) * M,
78 //
79 // then the following statements are true:
80 //
81 // Xr / (Xr + Yr + Zr) == c.red.x
82 // Yr / (Xr + Yr + Zr) == c.red.y
83 //
84 // Xg / (Xg + Yg + Zg) == c.green.x
85 // Yg / (Xg + Yg + Zg) == c.green.y
86 //
87 // Xb / (Xb + Yb + Zb) == c.blue.x
88 // Yb / (Xb + Yb + Zb) == c.blue.y
89 //
90 // Xw / (Xw + Yw + Zw) == c.white.x
91 // Yw / (Xw + Yw + Zw) == c.white.y
92 //
93 // Yw == Y.
94 //
95 // XYZ to RGB:
96 //
97 // XYZtoRGB(c,Y) returns RGBtoXYZ(c,Y).inverse().
98 //
99 
101  RGBtoXYZ (const Chromaticities& chroma, float Y);
103  XYZtoRGB (const Chromaticities& chroma, float Y);
104 
106 
107 #endif
Matrix44< float > M44f
4x4 matrix of float
Definition: ImathMatrix.h:1137
#define OPENEXR_IMF_INTERNAL_NAMESPACE_HEADER_EXIT
Definition: ImfNamespace.h:83
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:25
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:80
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