/src/skia/third_party/externals/dng_sdk/source/dng_color_spec.h
Line | Count | Source (jump to first uncovered line) |
1 | | /*****************************************************************************/ |
2 | | // Copyright 2006-2008 Adobe Systems Incorporated |
3 | | // All Rights Reserved. |
4 | | // |
5 | | // NOTICE: Adobe permits you to use, modify, and distribute this file in |
6 | | // accordance with the terms of the Adobe license agreement accompanying it. |
7 | | /*****************************************************************************/ |
8 | | |
9 | | /* $Id: //mondo/dng_sdk_1_4/dng_sdk/source/dng_color_spec.h#1 $ */ |
10 | | /* $DateTime: 2012/05/30 13:28:51 $ */ |
11 | | /* $Change: 832332 $ */ |
12 | | /* $Author: tknoll $ */ |
13 | | |
14 | | /** \file |
15 | | * Class for holding a specific color transform. |
16 | | */ |
17 | | |
18 | | #ifndef __dng_color_spec__ |
19 | | #define __dng_color_spec__ |
20 | | |
21 | | /*****************************************************************************/ |
22 | | |
23 | | #include "dng_classes.h" |
24 | | #include "dng_matrix.h" |
25 | | #include "dng_types.h" |
26 | | #include "dng_xy_coord.h" |
27 | | |
28 | | /*****************************************************************************/ |
29 | | |
30 | | /// \brief Compute a 3x3 matrix which maps colors from white point white1 to |
31 | | /// white point white2 |
32 | | /// |
33 | | /// Uses linearized Bradford adaptation matrix to compute a mapping from |
34 | | /// colors measured with one white point (white1) to another (white2). |
35 | | |
36 | | dng_matrix_3by3 MapWhiteMatrix (const dng_xy_coord &white1, |
37 | | const dng_xy_coord &white2); |
38 | | |
39 | | /*****************************************************************************/ |
40 | | |
41 | | /// Color transform taking into account white point and camera calibration and |
42 | | /// individual calibration from DNG negative. |
43 | | |
44 | | class dng_color_spec |
45 | | { |
46 | | |
47 | | private: |
48 | | |
49 | | uint32 fChannels; |
50 | | |
51 | | real64 fTemperature1; |
52 | | real64 fTemperature2; |
53 | | |
54 | | dng_matrix fColorMatrix1; |
55 | | dng_matrix fColorMatrix2; |
56 | | |
57 | | dng_matrix fForwardMatrix1; |
58 | | dng_matrix fForwardMatrix2; |
59 | | |
60 | | dng_matrix fReductionMatrix1; |
61 | | dng_matrix fReductionMatrix2; |
62 | | |
63 | | dng_matrix fCameraCalibration1; |
64 | | dng_matrix fCameraCalibration2; |
65 | | |
66 | | dng_matrix fAnalogBalance; |
67 | | |
68 | | dng_xy_coord fWhiteXY; |
69 | | |
70 | | dng_vector fCameraWhite; |
71 | | dng_matrix fCameraToPCS; |
72 | | |
73 | | dng_matrix fPCStoCamera; |
74 | | |
75 | | public: |
76 | | |
77 | | /// Read calibration info from DNG negative and construct a |
78 | | /// dng_color_spec. |
79 | | |
80 | | dng_color_spec (const dng_negative &negative, |
81 | | const dng_camera_profile *profile); |
82 | | |
83 | | virtual ~dng_color_spec () |
84 | 0 | { |
85 | 0 | } |
86 | | |
87 | | /// Number of channels used for this color transform. Three |
88 | | /// for most cameras. |
89 | | |
90 | | uint32 Channels () const |
91 | 0 | { |
92 | 0 | return fChannels; |
93 | 0 | } |
94 | | |
95 | | /// Setter for white point. Value is as XY colorspace coordinate. |
96 | | /// \param white White point to set as an XY value. |
97 | | |
98 | | void SetWhiteXY (const dng_xy_coord &white); |
99 | | |
100 | | /// Getter for white point. Value is as XY colorspace coordinate. |
101 | | /// \retval XY value of white point. |
102 | | |
103 | | const dng_xy_coord & WhiteXY () const; |
104 | | |
105 | | /// Return white point in camera native color coordinates. |
106 | | /// \retval A dng_vector with components ranging from 0.0 to 1.0 |
107 | | /// that is normalized such that one component is equal to 1.0 . |
108 | | |
109 | | const dng_vector & CameraWhite () const; |
110 | | |
111 | | /// Getter for camera to Profile Connection Space color transform. |
112 | | /// \retval A transform that takes into account all camera calibration |
113 | | /// transforms and white point. |
114 | | |
115 | | const dng_matrix & CameraToPCS () const; |
116 | | |
117 | | /// Getter for Profile Connection Space to camera color transform. |
118 | | /// \retval A transform that takes into account all camera calibration |
119 | | /// transforms and white point. |
120 | | |
121 | | const dng_matrix & PCStoCamera () const; |
122 | | |
123 | | /// Return the XY value to use for SetWhiteXY for a given camera color |
124 | | /// space coordinate as the white point. |
125 | | /// \param neutral A camera color space value to use for white point. |
126 | | /// Components range from 0.0 to 1.0 and should be normalized such that |
127 | | /// the largest value is 1.0 . |
128 | | /// \retval White point in XY space that makes neutral map to this |
129 | | /// XY value as closely as possible. |
130 | | |
131 | | dng_xy_coord NeutralToXY (const dng_vector &neutral); |
132 | | |
133 | | private: |
134 | | |
135 | | dng_matrix FindXYZtoCamera (const dng_xy_coord &white, |
136 | | dng_matrix *forwardMatrix = NULL, |
137 | | dng_matrix *reductionMatrix = NULL, |
138 | | dng_matrix *cameraCalibration = NULL); |
139 | | |
140 | | }; |
141 | | |
142 | | /*****************************************************************************/ |
143 | | |
144 | | #endif |
145 | | |
146 | | /*****************************************************************************/ |