Blender  V2.93
util_color.h
Go to the documentation of this file.
1 /*
2  * Copyright 2011-2013 Blender Foundation
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #ifndef __UTIL_COLOR_H__
18 #define __UTIL_COLOR_H__
19 
20 #include "util/util_math.h"
21 #include "util/util_types.h"
22 
23 #if !defined(__KERNEL_GPU__) && defined(__KERNEL_SSE2__)
24 # include "util/util_simd.h"
25 #endif
26 
28 
30 {
31  return ((val <= 0.0f) ? 0 :
32  ((val > (1.0f - 0.5f / 255.0f)) ? 255 : (uchar)((255.0f * val) + 0.5f)));
33 }
34 
36 {
37  uchar r, g, b;
38 
39  r = float_to_byte(c.x);
40  g = float_to_byte(c.y);
41  b = float_to_byte(c.z);
42 
43  return make_uchar4(r, g, b, 0);
44 }
45 
47 {
48  uchar r, g, b, a;
49 
50  r = float_to_byte(c.x);
51  g = float_to_byte(c.y);
52  b = float_to_byte(c.z);
53  a = float_to_byte(c.w);
54 
55  return make_uchar4(r, g, b, a);
56 }
57 
59 {
60  return make_float3(c.x * (1.0f / 255.0f), c.y * (1.0f / 255.0f), c.z * (1.0f / 255.0f));
61 }
62 
64 {
65  return make_float4(
66  c.x * (1.0f / 255.0f), c.y * (1.0f / 255.0f), c.z * (1.0f / 255.0f), c.w * (1.0f / 255.0f));
67 }
68 
70 {
71  if (c < 0.04045f)
72  return (c < 0.0f) ? 0.0f : c * (1.0f / 12.92f);
73  else
74  return powf((c + 0.055f) * (1.0f / 1.055f), 2.4f);
75 }
76 
78 {
79  if (c < 0.0031308f)
80  return (c < 0.0f) ? 0.0f : c * 12.92f;
81  else
82  return 1.055f * powf(c, 1.0f / 2.4f) - 0.055f;
83 }
84 
86 {
87  float cmax, cmin, h, s, v, cdelta;
88  float3 c;
89 
90  cmax = fmaxf(rgb.x, fmaxf(rgb.y, rgb.z));
91  cmin = min(rgb.x, min(rgb.y, rgb.z));
92  cdelta = cmax - cmin;
93 
94  v = cmax;
95 
96  if (cmax != 0.0f) {
97  s = cdelta / cmax;
98  }
99  else {
100  s = 0.0f;
101  h = 0.0f;
102  }
103 
104  if (s != 0.0f) {
105  float3 cmax3 = make_float3(cmax, cmax, cmax);
106  c = (cmax3 - rgb) / cdelta;
107 
108  if (rgb.x == cmax)
109  h = c.z - c.y;
110  else if (rgb.y == cmax)
111  h = 2.0f + c.x - c.z;
112  else
113  h = 4.0f + c.y - c.x;
114 
115  h /= 6.0f;
116 
117  if (h < 0.0f)
118  h += 1.0f;
119  }
120  else {
121  h = 0.0f;
122  }
123 
124  return make_float3(h, s, v);
125 }
126 
128 {
129  float i, f, p, q, t, h, s, v;
130  float3 rgb;
131 
132  h = hsv.x;
133  s = hsv.y;
134  v = hsv.z;
135 
136  if (s != 0.0f) {
137  if (h == 1.0f)
138  h = 0.0f;
139 
140  h *= 6.0f;
141  i = floorf(h);
142  f = h - i;
143  rgb = make_float3(f, f, f);
144  p = v * (1.0f - s);
145  q = v * (1.0f - (s * f));
146  t = v * (1.0f - (s * (1.0f - f)));
147 
148  if (i == 0.0f)
149  rgb = make_float3(v, t, p);
150  else if (i == 1.0f)
151  rgb = make_float3(q, v, p);
152  else if (i == 2.0f)
153  rgb = make_float3(p, v, t);
154  else if (i == 3.0f)
155  rgb = make_float3(p, q, v);
156  else if (i == 4.0f)
157  rgb = make_float3(t, p, v);
158  else
159  rgb = make_float3(v, p, q);
160  }
161  else {
162  rgb = make_float3(v, v, v);
163  }
164 
165  return rgb;
166 }
167 
168 ccl_device float3 xyY_to_xyz(float x, float y, float Y)
169 {
170  float X, Z;
171 
172  if (y != 0.0f)
173  X = (x / y) * Y;
174  else
175  X = 0.0f;
176 
177  if (y != 0.0f && Y != 0.0f)
178  Z = (1.0f - x - y) / y * Y;
179  else
180  Z = 0.0f;
181 
182  return make_float3(X, Y, Z);
183 }
184 
185 #ifdef __KERNEL_SSE2__
186 /*
187  * Calculate initial guess for arg^exp based on float representation
188  * This method gives a constant bias,
189  * which can be easily compensated by multiplication with bias_coeff.
190  * Gives better results for exponents near 1 (e. g. 4/5).
191  * exp = exponent, encoded as uint32_t
192  * e2coeff = 2^(127/exponent - 127) * bias_coeff^(1/exponent), encoded as uint32_t
193  */
194 template<unsigned exp, unsigned e2coeff> ccl_device_inline ssef fastpow(const ssef &arg)
195 {
196  ssef ret;
197  ret = arg * cast(ssei(e2coeff));
198  ret = ssef(cast(ret));
199  ret = ret * cast(ssei(exp));
200  ret = cast(ssei(ret));
201  return ret;
202 }
203 
204 /* Improve x ^ 1.0f/5.0f solution with Newton-Raphson method */
205 ccl_device_inline ssef improve_5throot_solution(const ssef &old_result, const ssef &x)
206 {
207  ssef approx2 = old_result * old_result;
208  ssef approx4 = approx2 * approx2;
209  ssef t = x / approx4;
210  ssef summ = madd(ssef(4.0f), old_result, t);
211  return summ * ssef(1.0f / 5.0f);
212 }
213 
214 /* Calculate powf(x, 2.4). Working domain: 1e-10 < x < 1e+10 */
215 ccl_device_inline ssef fastpow24(const ssef &arg)
216 {
217  /* max, avg and |avg| errors were calculated in gcc without FMA instructions
218  * The final precision should be better than powf in glibc */
219 
220  /* Calculate x^4/5, coefficient 0.994 was constructed manually to minimize avg error */
221  /* 0x3F4CCCCD = 4/5 */
222  /* 0x4F55A7FB = 2^(127/(4/5) - 127) * 0.994^(1/(4/5)) */
223  ssef x = fastpow<0x3F4CCCCD, 0x4F55A7FB>(arg); // error max = 0.17 avg = 0.0018 |avg| = 0.05
224  ssef arg2 = arg * arg;
225  ssef arg4 = arg2 * arg2;
226  x = improve_5throot_solution(x,
227  arg4); /* error max = 0.018 avg = 0.0031 |avg| = 0.0031 */
228  x = improve_5throot_solution(x,
229  arg4); /* error max = 0.00021 avg = 1.6e-05 |avg| = 1.6e-05 */
230  x = improve_5throot_solution(x,
231  arg4); /* error max = 6.1e-07 avg = 5.2e-08 |avg| = 1.1e-07 */
232  return x * (x * x);
233 }
234 
235 ccl_device ssef color_srgb_to_linear(const ssef &c)
236 {
237  sseb cmp = c < ssef(0.04045f);
238  ssef lt = max(c * ssef(1.0f / 12.92f), ssef(0.0f));
239  ssef gtebase = (c + ssef(0.055f)) * ssef(1.0f / 1.055f); /* fma */
240  ssef gte = fastpow24(gtebase);
241  return select(cmp, lt, gte);
242 }
243 #endif /* __KERNEL_SSE2__ */
244 
246 {
247  return make_float3(
249 }
250 
252 {
253  return make_float3(
255 }
256 
258 {
259  return make_float4(
261 }
262 
264 {
265 #ifdef __KERNEL_SSE2__
266  ssef r_ssef;
267  float4 &r = (float4 &)r_ssef;
268  r = c;
269  r_ssef = color_srgb_to_linear(r_ssef);
270  r.w = c.w;
271  return r;
272 #else
273  return make_float4(
275 #endif
276 }
277 
279 {
280  color += one_float3();
281  if (variance) {
282  *variance *= sqr3(one_float3() / color);
283  }
284  return log3(color);
285 }
286 
288 {
289  return exp3(color) - one_float3();
290 }
291 
293 
294 #endif /* __UTIL_COLOR_H__ */
unsigned char uchar
Definition: BLI_sys_types.h:86
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum const void *lists _GL_VOID_RET _GL_VOID const GLdouble *equation _GL_VOID_RET _GL_VOID GLdouble GLdouble blue _GL_VOID_RET _GL_VOID GLfloat GLfloat blue _GL_VOID_RET _GL_VOID GLint GLint blue _GL_VOID_RET _GL_VOID GLshort GLshort blue _GL_VOID_RET _GL_VOID GLubyte GLubyte blue _GL_VOID_RET _GL_VOID GLuint GLuint blue _GL_VOID_RET _GL_VOID GLushort GLushort blue _GL_VOID_RET _GL_VOID GLbyte GLbyte GLbyte alpha _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble alpha _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat alpha _GL_VOID_RET _GL_VOID GLint GLint GLint alpha _GL_VOID_RET _GL_VOID GLshort GLshort GLshort alpha _GL_VOID_RET _GL_VOID GLubyte GLubyte GLubyte alpha _GL_VOID_RET _GL_VOID GLuint GLuint GLuint alpha _GL_VOID_RET _GL_VOID GLushort GLushort GLushort alpha _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLint GLsizei GLsizei GLenum type _GL_VOID_RET _GL_VOID GLsizei GLenum GLenum const void *pixels _GL_VOID_RET _GL_VOID const void *pointer _GL_VOID_RET _GL_VOID GLdouble v _GL_VOID_RET _GL_VOID GLfloat v _GL_VOID_RET _GL_VOID GLint GLint i2 _GL_VOID_RET _GL_VOID GLint j _GL_VOID_RET _GL_VOID GLfloat param _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble GLdouble GLdouble zFar _GL_VOID_RET _GL_UINT GLdouble *equation _GL_VOID_RET _GL_VOID GLenum GLint *params _GL_VOID_RET _GL_VOID GLenum GLfloat *v _GL_VOID_RET _GL_VOID GLenum GLfloat *params _GL_VOID_RET _GL_VOID GLfloat *values _GL_VOID_RET _GL_VOID GLushort *values _GL_VOID_RET _GL_VOID GLenum GLfloat *params _GL_VOID_RET _GL_VOID GLenum GLdouble *params _GL_VOID_RET _GL_VOID GLenum GLint *params _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_BOOL GLfloat param _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID GLenum GLfloat param _GL_VOID_RET _GL_VOID GLenum GLint param _GL_VOID_RET _GL_VOID GLushort pattern _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLint const GLdouble *points _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLint GLdouble GLdouble GLint GLint const GLdouble *points _GL_VOID_RET _GL_VOID GLdouble GLdouble u2 _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLdouble GLdouble v2 _GL_VOID_RET _GL_VOID GLenum GLfloat param _GL_VOID_RET _GL_VOID GLenum GLint param _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLdouble GLdouble nz _GL_VOID_RET _GL_VOID GLfloat GLfloat nz _GL_VOID_RET _GL_VOID GLint GLint nz _GL_VOID_RET _GL_VOID GLshort GLshort nz _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_VOID GLsizei const GLfloat *values _GL_VOID_RET _GL_VOID GLsizei const GLushort *values _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID const GLuint const GLclampf *priorities _GL_VOID_RET _GL_VOID GLdouble y _GL_VOID_RET _GL_VOID GLfloat y _GL_VOID_RET _GL_VOID GLint y _GL_VOID_RET _GL_VOID GLshort y _GL_VOID_RET _GL_VOID GLdouble GLdouble z _GL_VOID_RET _GL_VOID GLfloat GLfloat z _GL_VOID_RET _GL_VOID GLint GLint z _GL_VOID_RET _GL_VOID GLshort GLshort z _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble w _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat w _GL_VOID_RET _GL_VOID GLint GLint GLint w _GL_VOID_RET _GL_VOID GLshort GLshort GLshort w _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble y2 _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat y2 _GL_VOID_RET _GL_VOID GLint GLint GLint y2 _GL_VOID_RET _GL_VOID GLshort GLshort GLshort y2 _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble z _GL_VOID_RET _GL_VOID GLdouble GLdouble z _GL_VOID_RET _GL_VOID GLuint *buffer _GL_VOID_RET _GL_VOID GLdouble t _GL_VOID_RET _GL_VOID GLfloat t _GL_VOID_RET _GL_VOID GLint t _GL_VOID_RET _GL_VOID GLshort t _GL_VOID_RET _GL_VOID GLdouble GLdouble r _GL_VOID_RET _GL_VOID GLfloat GLfloat r _GL_VOID_RET _GL_VOID GLint GLint r _GL_VOID_RET _GL_VOID GLshort GLshort r _GL_VOID_RET _GL_VOID GLdouble GLdouble r
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum const void *lists _GL_VOID_RET _GL_VOID const GLdouble *equation _GL_VOID_RET _GL_VOID GLdouble GLdouble blue _GL_VOID_RET _GL_VOID GLfloat GLfloat blue _GL_VOID_RET _GL_VOID GLint GLint blue _GL_VOID_RET _GL_VOID GLshort GLshort blue _GL_VOID_RET _GL_VOID GLubyte GLubyte blue _GL_VOID_RET _GL_VOID GLuint GLuint blue _GL_VOID_RET _GL_VOID GLushort GLushort blue _GL_VOID_RET _GL_VOID GLbyte GLbyte GLbyte alpha _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble alpha _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat alpha _GL_VOID_RET _GL_VOID GLint GLint GLint alpha _GL_VOID_RET _GL_VOID GLshort GLshort GLshort alpha _GL_VOID_RET _GL_VOID GLubyte GLubyte GLubyte alpha _GL_VOID_RET _GL_VOID GLuint GLuint GLuint alpha _GL_VOID_RET _GL_VOID GLushort GLushort GLushort alpha _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLint y
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum const void *lists _GL_VOID_RET _GL_VOID const GLdouble *equation _GL_VOID_RET _GL_VOID GLdouble GLdouble blue _GL_VOID_RET _GL_VOID GLfloat GLfloat blue _GL_VOID_RET _GL_VOID GLint GLint blue _GL_VOID_RET _GL_VOID GLshort GLshort blue _GL_VOID_RET _GL_VOID GLubyte GLubyte blue _GL_VOID_RET _GL_VOID GLuint GLuint blue _GL_VOID_RET _GL_VOID GLushort GLushort blue _GL_VOID_RET _GL_VOID GLbyte GLbyte GLbyte alpha _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble alpha _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat alpha _GL_VOID_RET _GL_VOID GLint GLint GLint alpha _GL_VOID_RET _GL_VOID GLshort GLshort GLshort alpha _GL_VOID_RET _GL_VOID GLubyte GLubyte GLubyte alpha _GL_VOID_RET _GL_VOID GLuint GLuint GLuint alpha _GL_VOID_RET _GL_VOID GLushort GLushort GLushort alpha _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLint GLsizei GLsizei GLenum type _GL_VOID_RET _GL_VOID GLsizei GLenum GLenum const void *pixels _GL_VOID_RET _GL_VOID const void *pointer _GL_VOID_RET _GL_VOID GLdouble v _GL_VOID_RET _GL_VOID GLfloat v _GL_VOID_RET _GL_VOID GLint GLint i2 _GL_VOID_RET _GL_VOID GLint j _GL_VOID_RET _GL_VOID GLfloat param _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble GLdouble GLdouble zFar _GL_VOID_RET _GL_UINT GLdouble *equation _GL_VOID_RET _GL_VOID GLenum GLint *params _GL_VOID_RET _GL_VOID GLenum GLfloat *v _GL_VOID_RET _GL_VOID GLenum GLfloat *params _GL_VOID_RET _GL_VOID GLfloat *values _GL_VOID_RET _GL_VOID GLushort *values _GL_VOID_RET _GL_VOID GLenum GLfloat *params _GL_VOID_RET _GL_VOID GLenum GLdouble *params _GL_VOID_RET _GL_VOID GLenum GLint *params _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_BOOL GLfloat param _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID GLenum GLfloat param _GL_VOID_RET _GL_VOID GLenum GLint param _GL_VOID_RET _GL_VOID GLushort pattern _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLint const GLdouble *points _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLint GLdouble GLdouble GLint GLint const GLdouble *points _GL_VOID_RET _GL_VOID GLdouble GLdouble u2 _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLdouble GLdouble v2 _GL_VOID_RET _GL_VOID GLenum GLfloat param _GL_VOID_RET _GL_VOID GLenum GLint param _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLdouble GLdouble nz _GL_VOID_RET _GL_VOID GLfloat GLfloat nz _GL_VOID_RET _GL_VOID GLint GLint nz _GL_VOID_RET _GL_VOID GLshort GLshort nz _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_VOID GLsizei const GLfloat *values _GL_VOID_RET _GL_VOID GLsizei const GLushort *values _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID const GLuint const GLclampf *priorities _GL_VOID_RET _GL_VOID GLdouble y _GL_VOID_RET _GL_VOID GLfloat y _GL_VOID_RET _GL_VOID GLint y _GL_VOID_RET _GL_VOID GLshort y _GL_VOID_RET _GL_VOID GLdouble GLdouble z _GL_VOID_RET _GL_VOID GLfloat GLfloat z _GL_VOID_RET _GL_VOID GLint GLint z _GL_VOID_RET _GL_VOID GLshort GLshort z _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble w _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat w _GL_VOID_RET _GL_VOID GLint GLint GLint w _GL_VOID_RET _GL_VOID GLshort GLshort GLshort w _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble y2 _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat y2 _GL_VOID_RET _GL_VOID GLint GLint GLint y2 _GL_VOID_RET _GL_VOID GLshort GLshort GLshort y2 _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble z _GL_VOID_RET _GL_VOID GLdouble GLdouble z _GL_VOID_RET _GL_VOID GLuint *buffer _GL_VOID_RET _GL_VOID GLdouble t _GL_VOID_RET _GL_VOID GLfloat t _GL_VOID_RET _GL_VOID GLint t _GL_VOID_RET _GL_VOID GLshort t _GL_VOID_RET _GL_VOID GLdouble t
#define X
Definition: GeomUtils.cpp:213
#define Z
Definition: GeomUtils.cpp:215
#define Y
Definition: GeomUtils.cpp:214
ATTR_WARN_UNUSED_RESULT const BMVert * v
#define ccl_device
#define ccl_device_inline
#define powf(x, y)
#define CCL_NAMESPACE_END
#define fmaxf(x, y)
#define floorf(x)
#define make_uchar4(x, y, z, w)
#define make_float4(x, y, z, w)
#define make_float3(x, y, z)
U * cast(T *in)
Definition: Cast.h:27
static unsigned c
Definition: RandGen.cpp:97
static unsigned a[3]
Definition: RandGen.cpp:92
INLINE Rall1d< T, V, S > exp(const Rall1d< T, V, S > &arg)
Definition: rall1d.h:295
return ret
#define min(a, b)
Definition: sort.c:51
float z
Definition: sky_float3.h:35
float y
Definition: sky_float3.h:35
float x
Definition: sky_float3.h:35
float max
__forceinline const avxb select(const avxb &m, const avxb &t, const avxb &f)
Definition: util_avxb.h:167
__forceinline const avxf madd(const avxf &a, const avxf &b, const avxf &c)
Ternary Operators.
Definition: util_avxf.h:334
ccl_device float3 color_highlight_compress(float3 color, float3 *variance)
Definition: util_color.h:278
ccl_device float color_linear_to_srgb(float c)
Definition: util_color.h:77
ccl_device float3 xyY_to_xyz(float x, float y, float Y)
Definition: util_color.h:168
ccl_device_inline float4 color_uchar4_to_float4(uchar4 c)
Definition: util_color.h:63
ccl_device uchar4 color_float4_to_uchar4(float4 c)
Definition: util_color.h:46
ccl_device float3 color_srgb_to_linear_v3(float3 c)
Definition: util_color.h:245
ccl_device float4 color_linear_to_srgb_v4(float4 c)
Definition: util_color.h:257
ccl_device float3 rgb_to_hsv(float3 rgb)
Definition: util_color.h:85
ccl_device float3 color_highlight_uncompress(float3 color)
Definition: util_color.h:287
ccl_device float4 color_srgb_to_linear_v4(float4 c)
Definition: util_color.h:263
ccl_device float3 color_linear_to_srgb_v3(float3 c)
Definition: util_color.h:251
ccl_device float3 hsv_to_rgb(float3 hsv)
Definition: util_color.h:127
ccl_device float color_srgb_to_linear(float c)
Definition: util_color.h:69
ccl_device_inline float3 color_byte_to_float(uchar4 c)
Definition: util_color.h:58
ccl_device uchar4 color_float_to_byte(float3 c)
Definition: util_color.h:35
CCL_NAMESPACE_BEGIN ccl_device uchar float_to_byte(float val)
Definition: util_color.h:29
ccl_device_inline float3 one_float3()
ccl_device_inline float3 sqr3(float3 a)
ccl_device_inline float3 exp3(float3 v)
ccl_device_inline float3 log3(float3 v)