OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef UI_GFX_COLOR_SPACE_H_ | 5 #ifndef UI_GFX_COLOR_SPACE_H_ |
6 #define UI_GFX_COLOR_SPACE_H_ | 6 #define UI_GFX_COLOR_SPACE_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include "base/gtest_prod_util.h" | 10 #include "base/gtest_prod_util.h" |
(...skipping 25 matching lines...) Expand all Loading... | |
36 BT470M = 4, | 36 BT470M = 4, |
37 BT470BG = 5, | 37 BT470BG = 5, |
38 SMPTE170M = 6, | 38 SMPTE170M = 6, |
39 SMPTE240M = 7, | 39 SMPTE240M = 7, |
40 FILM = 8, | 40 FILM = 8, |
41 BT2020 = 9, | 41 BT2020 = 9, |
42 SMPTEST428_1 = 10, | 42 SMPTEST428_1 = 10, |
43 SMPTEST431_2 = 11, | 43 SMPTEST431_2 = 11, |
44 SMPTEST432_1 = 12, | 44 SMPTEST432_1 = 12, |
45 | 45 |
46 LAST_STANDARD_VALUE = SMPTEST432_1, | |
47 | |
46 // Chrome-specific values start at 1000. | 48 // Chrome-specific values start at 1000. |
47 XYZ_D50 = 1000, | 49 UNKNOWN = 1000, |
48 // TODO(hubbe): We need to store the primaries. | 50 XYZ_D50, |
49 CUSTOM = 1001, | 51 CUSTOM, |
50 LAST = CUSTOM | 52 LAST = UNKNOWN |
ccameron
2016/09/16 23:09:48
Should this be CUSTOM?
hubbe
2016/09/16 23:25:35
Ooops, yes, I rearranged it so that UNKNOWN is alw
| |
51 }; | 53 }; |
52 | 54 |
53 enum class TransferID : uint16_t { | 55 enum class TransferID : uint16_t { |
54 // The first 0-255 values should match the H264 specification. | 56 // The first 0-255 values should match the H264 specification. |
55 RESERVED0 = 0, | 57 RESERVED0 = 0, |
56 BT709 = 1, | 58 BT709 = 1, |
57 UNSPECIFIED = 2, | 59 UNSPECIFIED = 2, |
58 RESERVED = 3, | 60 RESERVED = 3, |
59 GAMMA22 = 4, | 61 GAMMA22 = 4, |
60 GAMMA28 = 5, | 62 GAMMA28 = 5, |
61 SMPTE170M = 6, | 63 SMPTE170M = 6, |
62 SMPTE240M = 7, | 64 SMPTE240M = 7, |
63 LINEAR = 8, | 65 LINEAR = 8, |
64 LOG = 9, | 66 LOG = 9, |
65 LOG_SQRT = 10, | 67 LOG_SQRT = 10, |
66 IEC61966_2_4 = 11, | 68 IEC61966_2_4 = 11, |
67 BT1361_ECG = 12, | 69 BT1361_ECG = 12, |
68 IEC61966_2_1 = 13, | 70 IEC61966_2_1 = 13, |
69 BT2020_10 = 14, | 71 BT2020_10 = 14, |
70 BT2020_12 = 15, | 72 BT2020_12 = 15, |
71 SMPTEST2084 = 16, | 73 SMPTEST2084 = 16, |
72 SMPTEST428_1 = 17, | 74 SMPTEST428_1 = 17, |
73 | 75 |
76 LAST_STANDARD_VALUE = SMPTEST428_1, | |
77 | |
74 // Chrome-specific values start at 1000. | 78 // Chrome-specific values start at 1000. |
75 GAMMA24 = 1000, | 79 UNKNOWN = 1000, |
80 GAMMA24, | |
76 | 81 |
77 // This is an ad-hoc transfer function that decodes SMPTE 2084 content | 82 // This is an ad-hoc transfer function that decodes SMPTE 2084 content |
78 // into a 0-1 range more or less suitable for viewing on a non-hdr | 83 // into a 0-1 range more or less suitable for viewing on a non-hdr |
79 // display. | 84 // display. |
80 SMPTEST2084_NON_HDR, | 85 SMPTEST2084_NON_HDR, |
81 | 86 |
82 // TODO(hubbe): Need to store an approximation of the gamma function(s). | 87 // TODO(hubbe): Need to store an approximation of the gamma function(s). |
83 CUSTOM, | 88 CUSTOM, |
84 LAST = CUSTOM, | 89 LAST = CUSTOM, |
85 }; | 90 }; |
86 | 91 |
87 enum class MatrixID : int16_t { | 92 enum class MatrixID : int16_t { |
88 // The first 0-255 values should match the H264 specification. | 93 // The first 0-255 values should match the H264 specification. |
89 RGB = 0, | 94 RGB = 0, |
90 BT709 = 1, | 95 BT709 = 1, |
91 UNSPECIFIED = 2, | 96 UNSPECIFIED = 2, |
92 RESERVED = 3, | 97 RESERVED = 3, |
93 FCC = 4, | 98 FCC = 4, |
94 BT470BG = 5, | 99 BT470BG = 5, |
95 SMPTE170M = 6, | 100 SMPTE170M = 6, |
96 SMPTE240M = 7, | 101 SMPTE240M = 7, |
97 YCOCG = 8, | 102 YCOCG = 8, |
98 BT2020_NCL = 9, | 103 BT2020_NCL = 9, |
99 BT2020_CL = 10, | 104 BT2020_CL = 10, |
100 YDZDX = 11, | 105 YDZDX = 11, |
101 | 106 |
107 LAST_STANDARD_VALUE = YDZDX, | |
108 | |
102 // Chrome-specific values start at 1000 | 109 // Chrome-specific values start at 1000 |
103 LAST = YDZDX, | 110 UNKNOWN = 1000, |
111 LAST = UNKNOWN, | |
104 }; | 112 }; |
105 | 113 |
106 // The h264 spec declares this as bool, so only the the first two values | 114 // The h264 spec declares this as bool, so only the the first two values |
107 // correspond to the h264 spec. Chrome-specific values can start at 2. | 115 // correspond to the h264 spec. Chrome-specific values can start at 2. |
108 // We use an enum instead of a bool becuase different bit depths may have | 116 // We use an enum instead of a bool becuase different bit depths may have |
109 // different definitions of what "limited" means. | 117 // different definitions of what "limited" means. |
110 enum class RangeID : int8_t { | 118 enum class RangeID : int8_t { |
111 FULL = 0, | 119 FULL = 0, |
112 LIMITED = 1, | 120 LIMITED = 1, |
113 | 121 |
114 LAST = LIMITED | 122 LAST = LIMITED |
115 }; | 123 }; |
116 | 124 |
117 ColorSpace(); | 125 ColorSpace(); |
118 ColorSpace(PrimaryID primaries, | 126 ColorSpace(PrimaryID primaries, |
119 TransferID transfer, | 127 TransferID transfer, |
120 MatrixID matrix, | 128 MatrixID matrix, |
121 RangeID full_range); | 129 RangeID full_range); |
130 ColorSpace(int primaries, int transfer, int matrix, RangeID full_range); | |
131 | |
132 static PrimaryID PrimaryIDFromInt(int primary_id); | |
133 static TransferID TransferIDFromInt(int transfer_id); | |
134 static MatrixID MatrixIDFromInt(int matrix_id); | |
122 | 135 |
123 static ColorSpace CreateSRGB(); | 136 static ColorSpace CreateSRGB(); |
124 static ColorSpace CreateXYZD50(); | 137 static ColorSpace CreateXYZD50(); |
125 | 138 |
126 // TODO: Remove these, and replace with more generic constructors. | 139 // TODO: Remove these, and replace with more generic constructors. |
127 static ColorSpace CreateJpeg(); | 140 static ColorSpace CreateJpeg(); |
128 static ColorSpace CreateREC601(); | 141 static ColorSpace CreateREC601(); |
129 static ColorSpace CreateREC709(); | 142 static ColorSpace CreateREC709(); |
130 | 143 |
131 bool operator==(const ColorSpace& other) const; | 144 bool operator==(const ColorSpace& other) const; |
(...skipping 15 matching lines...) Expand all Loading... | |
147 | 160 |
148 friend class ICCProfile; | 161 friend class ICCProfile; |
149 friend class ColorSpaceToColorSpaceTransform; | 162 friend class ColorSpaceToColorSpaceTransform; |
150 friend struct IPC::ParamTraits<gfx::ColorSpace>; | 163 friend struct IPC::ParamTraits<gfx::ColorSpace>; |
151 FRIEND_TEST_ALL_PREFIXES(SimpleColorSpace, GetColorSpace); | 164 FRIEND_TEST_ALL_PREFIXES(SimpleColorSpace, GetColorSpace); |
152 }; | 165 }; |
153 | 166 |
154 } // namespace gfx | 167 } // namespace gfx |
155 | 168 |
156 #endif // UI_GFX_COLOR_SPACE_H_ | 169 #endif // UI_GFX_COLOR_SPACE_H_ |
OLD | NEW |