Blender  V2.93
math_color_inline.c
Go to the documentation of this file.
1 /*
2  * This program is free software; you can redistribute it and/or
3  * modify it under the terms of the GNU General Public License
4  * as published by the Free Software Foundation; either version 2
5  * of the License, or (at your option) any later version.
6  *
7  * This program is distributed in the hope that it will be useful,
8  * but WITHOUT ANY WARRANTY; without even the implied warranty of
9  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10  * GNU General Public License for more details.
11  *
12  * You should have received a copy of the GNU General Public License
13  * along with this program; if not, write to the Free Software Foundation,
14  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
15  *
16  * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
17  * All rights reserved.
18  *
19  * The Original Code is: some of this file.
20  */
21 
26 #include "BLI_math_base.h"
27 #include "BLI_math_color.h"
28 #include "BLI_utildefines.h"
29 
30 #include "math.h"
31 
32 #ifndef __MATH_COLOR_INLINE_C__
33 # define __MATH_COLOR_INLINE_C__
34 
35 /******************************** Color Space ********************************/
36 
37 # ifdef BLI_HAVE_SSE2
38 
39 MALWAYS_INLINE __m128 srgb_to_linearrgb_v4_simd(const __m128 c)
40 {
41  __m128 cmp = _mm_cmplt_ps(c, _mm_set1_ps(0.04045f));
42  __m128 lt = _mm_max_ps(_mm_mul_ps(c, _mm_set1_ps(1.0f / 12.92f)), _mm_set1_ps(0.0f));
43  __m128 gtebase = _mm_mul_ps(_mm_add_ps(c, _mm_set1_ps(0.055f)),
44  _mm_set1_ps(1.0f / 1.055f)); /* FMA. */
45  __m128 gte = _bli_math_fastpow24(gtebase);
46  return _bli_math_blend_sse(cmp, lt, gte);
47 }
48 
49 MALWAYS_INLINE __m128 linearrgb_to_srgb_v4_simd(const __m128 c)
50 {
51  __m128 cmp = _mm_cmplt_ps(c, _mm_set1_ps(0.0031308f));
52  __m128 lt = _mm_max_ps(_mm_mul_ps(c, _mm_set1_ps(12.92f)), _mm_set1_ps(0.0f));
53  __m128 gte = _mm_add_ps(_mm_mul_ps(_mm_set1_ps(1.055f), _bli_math_fastpow512(c)),
54  _mm_set1_ps(-0.055f));
55  return _bli_math_blend_sse(cmp, lt, gte);
56 }
57 
58 MINLINE void srgb_to_linearrgb_v3_v3(float linear[3], const float srgb[3])
59 {
60  float r[4] = {srgb[0], srgb[1], srgb[2], 1.0f};
61  __m128 *rv = (__m128 *)&r;
62  *rv = srgb_to_linearrgb_v4_simd(*rv);
63  linear[0] = r[0];
64  linear[1] = r[1];
65  linear[2] = r[2];
66 }
67 
68 MINLINE void linearrgb_to_srgb_v3_v3(float srgb[3], const float linear[3])
69 {
70  float r[4] = {linear[0], linear[1], linear[2], 1.0f};
71  __m128 *rv = (__m128 *)&r;
72  *rv = linearrgb_to_srgb_v4_simd(*rv);
73  srgb[0] = r[0];
74  srgb[1] = r[1];
75  srgb[2] = r[2];
76 }
77 
78 # else /* BLI_HAVE_SSE2 */
79 
80 MINLINE void srgb_to_linearrgb_v3_v3(float linear[3], const float srgb[3])
81 {
82  linear[0] = srgb_to_linearrgb(srgb[0]);
83  linear[1] = srgb_to_linearrgb(srgb[1]);
84  linear[2] = srgb_to_linearrgb(srgb[2]);
85 }
86 
87 MINLINE void linearrgb_to_srgb_v3_v3(float srgb[3], const float linear[3])
88 {
89  srgb[0] = linearrgb_to_srgb(linear[0]);
90  srgb[1] = linearrgb_to_srgb(linear[1]);
91  srgb[2] = linearrgb_to_srgb(linear[2]);
92 }
93 # endif /* BLI_HAVE_SSE2 */
94 
95 MINLINE void srgb_to_linearrgb_v4(float linear[4], const float srgb[4])
96 {
97  srgb_to_linearrgb_v3_v3(linear, srgb);
98  linear[3] = srgb[3];
99 }
100 
101 MINLINE void linearrgb_to_srgb_v4(float srgb[4], const float linear[4])
102 {
103  linearrgb_to_srgb_v3_v3(srgb, linear);
104  srgb[3] = linear[3];
105 }
106 
107 MINLINE void linearrgb_to_srgb_uchar3(unsigned char srgb[3], const float linear[3])
108 {
109  float srgb_f[3];
110 
111  linearrgb_to_srgb_v3_v3(srgb_f, linear);
112  unit_float_to_uchar_clamp_v3(srgb, srgb_f);
113 }
114 
115 MINLINE void linearrgb_to_srgb_uchar4(unsigned char srgb[4], const float linear[4])
116 {
117  float srgb_f[4];
118 
119  linearrgb_to_srgb_v4(srgb_f, linear);
120  unit_float_to_uchar_clamp_v4(srgb, srgb_f);
121 }
122 
123 /* predivide versions to work on associated/pre-multiplied alpha. if this should
124  * be done or not depends on the background the image will be composited over,
125  * ideally you would never do color space conversion on an image with alpha
126  * because it is ill defined */
127 
128 MINLINE void srgb_to_linearrgb_predivide_v4(float linear[4], const float srgb[4])
129 {
130  float alpha, inv_alpha;
131 
132  if (srgb[3] == 1.0f || srgb[3] == 0.0f) {
133  alpha = 1.0f;
134  inv_alpha = 1.0f;
135  }
136  else {
137  alpha = srgb[3];
138  inv_alpha = 1.0f / alpha;
139  }
140 
141  linear[0] = srgb[0] * inv_alpha;
142  linear[1] = srgb[1] * inv_alpha;
143  linear[2] = srgb[2] * inv_alpha;
144  linear[3] = srgb[3];
145  srgb_to_linearrgb_v3_v3(linear, linear);
146  linear[0] *= alpha;
147  linear[1] *= alpha;
148  linear[2] *= alpha;
149 }
150 
151 MINLINE void linearrgb_to_srgb_predivide_v4(float srgb[4], const float linear[4])
152 {
153  float alpha, inv_alpha;
154 
155  if (linear[3] == 1.0f || linear[3] == 0.0f) {
156  alpha = 1.0f;
157  inv_alpha = 1.0f;
158  }
159  else {
160  alpha = linear[3];
161  inv_alpha = 1.0f / alpha;
162  }
163 
164  srgb[0] = linear[0] * inv_alpha;
165  srgb[1] = linear[1] * inv_alpha;
166  srgb[2] = linear[2] * inv_alpha;
167  srgb[3] = linear[3];
168  linearrgb_to_srgb_v3_v3(srgb, srgb);
169  srgb[0] *= alpha;
170  srgb[1] *= alpha;
171  srgb[2] *= alpha;
172 }
173 
174 /* LUT accelerated conversions */
175 
176 extern float BLI_color_from_srgb_table[256];
177 extern unsigned short BLI_color_to_srgb_table[0x10000];
178 
179 MINLINE unsigned short to_srgb_table_lookup(const float f)
180 {
181 
182  union {
183  float f;
184  unsigned short us[2];
185  } tmp;
186  tmp.f = f;
187 # ifdef __BIG_ENDIAN__
188  return BLI_color_to_srgb_table[tmp.us[0]];
189 # else
190  return BLI_color_to_srgb_table[tmp.us[1]];
191 # endif
192 }
193 
194 MINLINE void linearrgb_to_srgb_ushort4(unsigned short srgb[4], const float linear[4])
195 {
196  srgb[0] = to_srgb_table_lookup(linear[0]);
197  srgb[1] = to_srgb_table_lookup(linear[1]);
198  srgb[2] = to_srgb_table_lookup(linear[2]);
199  srgb[3] = unit_float_to_ushort_clamp(linear[3]);
200 }
201 
202 MINLINE void srgb_to_linearrgb_uchar4(float linear[4], const unsigned char srgb[4])
203 {
204  linear[0] = BLI_color_from_srgb_table[srgb[0]];
205  linear[1] = BLI_color_from_srgb_table[srgb[1]];
206  linear[2] = BLI_color_from_srgb_table[srgb[2]];
207  linear[3] = srgb[3] * (1.0f / 255.0f);
208 }
209 
210 MINLINE void srgb_to_linearrgb_uchar4_predivide(float linear[4], const unsigned char srgb[4])
211 {
212  float fsrgb[4];
213  int i;
214 
215  if (srgb[3] == 255 || srgb[3] == 0) {
216  srgb_to_linearrgb_uchar4(linear, srgb);
217  return;
218  }
219 
220  for (i = 0; i < 4; i++) {
221  fsrgb[i] = srgb[i] * (1.0f / 255.0f);
222  }
223 
224  srgb_to_linearrgb_predivide_v4(linear, fsrgb);
225 }
226 
228  uchar col[4], const uchar r, const uchar g, const uchar b, const uchar a)
229 {
230  col[0] = r;
231  col[1] = g;
232  col[2] = b;
233  col[3] = a;
234 }
235 
237  float col[4], const float r, const float g, const float b, const float a)
238 {
239  col[0] = r;
240  col[1] = g;
241  col[2] = b;
242  col[3] = a;
243 }
244 
246  uchar col[4], const uchar r, const uchar g, const uchar b, const uchar a)
247 {
248  if (col[3] == 0) {
249  col[0] = r;
250  col[1] = g;
251  col[2] = b;
252  col[3] = a;
253  }
254 }
255 
256 MINLINE void cpack_cpy_3ub(unsigned char r_col[3], const unsigned int pack)
257 {
258  r_col[0] = ((pack) >> 0) & 0xFF;
259  r_col[1] = ((pack) >> 8) & 0xFF;
260  r_col[2] = ((pack) >> 16) & 0xFF;
261 }
262 
263 /* -------------------------------------------------------------------- */
288 MINLINE float rgb_to_grayscale(const float rgb[3])
289 {
290  return (0.2126f * rgb[0]) + (0.7152f * rgb[1]) + (0.0722f * rgb[2]);
291 }
292 
293 MINLINE unsigned char rgb_to_grayscale_byte(const unsigned char rgb[3])
294 {
295  return (unsigned char)(((54 * (unsigned short)rgb[0]) + (182 * (unsigned short)rgb[1]) +
296  (19 * (unsigned short)rgb[2])) /
297  255);
298 }
299 
302 MINLINE int compare_rgb_uchar(const unsigned char col_a[3],
303  const unsigned char col_b[3],
304  const int limit)
305 {
306  const int r = (int)col_a[0] - (int)col_b[0];
307  if (abs(r) < limit) {
308  const int g = (int)col_a[1] - (int)col_b[1];
309  if (abs(g) < limit) {
310  const int b = (int)col_a[2] - (int)col_b[2];
311  if (abs(b) < limit) {
312  return 1;
313  }
314  }
315  }
316 
317  return 0;
318 }
319 
320 /* Using a triangle distribution which gives a more final uniform noise.
321  * See Banding in Games:A Noisy Rant(revision 5) Mikkel Gjøl, Playdead (slide 27) */
322 /* Return triangle noise in [-0.5..1.5[ range */
323 MINLINE float dither_random_value(float s, float t)
324 {
325  /* Original code from https://www.shadertoy.com/view/4t2SDh */
326  /* The noise reshaping technique does not work on CPU.
327  * We generate and merge two distribution instead */
328  /* Uniform noise in [0..1[ range */
329  float nrnd0 = sinf(s * 12.9898f + t * 78.233f) * 43758.5453f;
330  float nrnd1 = sinf(s * 19.9898f + t * 119.233f) * 43798.5453f;
331  nrnd0 -= floorf(nrnd0);
332  nrnd1 -= floorf(nrnd1);
333  /* Convert uniform distribution into triangle-shaped distribution. */
334  return nrnd0 + nrnd1 - 0.5f;
335 }
336 
338  unsigned char b[3], const float f[3], float dither, float s, float t)
339 {
340  float dither_value = dither_random_value(s, t) * 0.0033f * dither;
341 
342  b[0] = unit_float_to_uchar_clamp(dither_value + f[0]);
343  b[1] = unit_float_to_uchar_clamp(dither_value + f[1]);
344  b[2] = unit_float_to_uchar_clamp(dither_value + f[2]);
345 }
346 
347 /**************** Alpha Transformations *****************/
348 
349 MINLINE void premul_to_straight_v4_v4(float straight[4], const float premul[4])
350 {
351  if (premul[3] == 0.0f || premul[3] == 1.0f) {
352  straight[0] = premul[0];
353  straight[1] = premul[1];
354  straight[2] = premul[2];
355  straight[3] = premul[3];
356  }
357  else {
358  const float alpha_inv = 1.0f / premul[3];
359  straight[0] = premul[0] * alpha_inv;
360  straight[1] = premul[1] * alpha_inv;
361  straight[2] = premul[2] * alpha_inv;
362  straight[3] = premul[3];
363  }
364 }
365 
366 MINLINE void premul_to_straight_v4(float color[4])
367 {
368  premul_to_straight_v4_v4(color, color);
369 }
370 
371 MINLINE void straight_to_premul_v4_v4(float premul[4], const float straight[4])
372 {
373  const float alpha = straight[3];
374  premul[0] = straight[0] * alpha;
375  premul[1] = straight[1] * alpha;
376  premul[2] = straight[2] * alpha;
377  premul[3] = straight[3];
378 }
379 
380 MINLINE void straight_to_premul_v4(float color[4])
381 {
382  straight_to_premul_v4_v4(color, color);
383 }
384 
385 MINLINE void straight_uchar_to_premul_float(float result[4], const unsigned char color[4])
386 {
387  const float alpha = color[3] * (1.0f / 255.0f);
388  const float fac = alpha * (1.0f / 255.0f);
389 
390  result[0] = color[0] * fac;
391  result[1] = color[1] * fac;
392  result[2] = color[2] * fac;
393  result[3] = alpha;
394 }
395 
396 MINLINE void premul_float_to_straight_uchar(unsigned char *result, const float color[4])
397 {
398  if (color[3] == 0.0f || color[3] == 1.0f) {
399  result[0] = unit_float_to_uchar_clamp(color[0]);
400  result[1] = unit_float_to_uchar_clamp(color[1]);
401  result[2] = unit_float_to_uchar_clamp(color[2]);
402  result[3] = unit_float_to_uchar_clamp(color[3]);
403  }
404  else {
405  const float alpha_inv = 1.0f / color[3];
406 
407  /* hopefully this would be optimized */
408  result[0] = unit_float_to_uchar_clamp(color[0] * alpha_inv);
409  result[1] = unit_float_to_uchar_clamp(color[1] * alpha_inv);
410  result[2] = unit_float_to_uchar_clamp(color[2] * alpha_inv);
411  result[3] = unit_float_to_uchar_clamp(color[3]);
412  }
413 }
414 
415 #endif /* __MATH_COLOR_INLINE_C__ */
float srgb_to_linearrgb(float c)
Definition: math_color.c:434
float linearrgb_to_srgb(float c)
Definition: math_color.c:443
#define MALWAYS_INLINE
#define MINLINE
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 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
static CCL_NAMESPACE_BEGIN const double alpha
uint col
#define sinf(x)
#define floorf(x)
MINLINE unsigned char unit_float_to_uchar_clamp(float val)
#define unit_float_to_uchar_clamp_v4(v1, v2)
MINLINE unsigned short unit_float_to_ushort_clamp(float val)
#define unit_float_to_uchar_clamp_v3(v1, v2)
MINLINE void straight_to_premul_v4_v4(float premul[4], const float straight[4])
MINLINE void srgb_to_linearrgb_uchar4_predivide(float linear[4], const unsigned char srgb[4])
MINLINE void srgb_to_linearrgb_v3_v3(float linear[3], const float srgb[3])
MINLINE void rgba_uchar_args_set(uchar col[4], const uchar r, const uchar g, const uchar b, const uchar a)
MINLINE unsigned char rgb_to_grayscale_byte(const unsigned char rgb[3])
MINLINE void straight_uchar_to_premul_float(float result[4], const unsigned char color[4])
MINLINE void premul_to_straight_v4(float color[4])
unsigned short BLI_color_to_srgb_table[0x10000]
Definition: math_color.c:557
MINLINE void straight_to_premul_v4(float color[4])
MINLINE void rgba_float_args_set(float col[4], const float r, const float g, const float b, const float a)
MINLINE void linearrgb_to_srgb_ushort4(unsigned short srgb[4], const float linear[4])
MINLINE void cpack_cpy_3ub(unsigned char r_col[3], const unsigned int pack)
MINLINE float rgb_to_grayscale(const float rgb[3])
MINLINE void linearrgb_to_srgb_predivide_v4(float srgb[4], const float linear[4])
MINLINE void srgb_to_linearrgb_uchar4(float linear[4], const unsigned char srgb[4])
MINLINE int compare_rgb_uchar(const unsigned char col_a[3], const unsigned char col_b[3], const int limit)
MINLINE void srgb_to_linearrgb_v4(float linear[4], const float srgb[4])
MINLINE void float_to_byte_dither_v3(unsigned char b[3], const float f[3], float dither, float s, float t)
MINLINE void premul_to_straight_v4_v4(float straight[4], const float premul[4])
MINLINE void linearrgb_to_srgb_uchar4(unsigned char srgb[4], const float linear[4])
MINLINE void rgba_uchar_args_test_set(uchar col[4], const uchar r, const uchar g, const uchar b, const uchar a)
float BLI_color_from_srgb_table[256]
Definition: math_color.c:556
MINLINE void linearrgb_to_srgb_v3_v3(float srgb[3], const float linear[3])
MINLINE unsigned short to_srgb_table_lookup(const float f)
MINLINE void linearrgb_to_srgb_v4(float srgb[4], const float linear[4])
MINLINE void linearrgb_to_srgb_uchar3(unsigned char srgb[3], const float linear[3])
MINLINE void srgb_to_linearrgb_predivide_v4(float linear[4], const float srgb[4])
MINLINE float dither_random_value(float s, float t)
MINLINE void premul_float_to_straight_uchar(unsigned char *result, const float color[4])
static unsigned c
Definition: RandGen.cpp:97
static unsigned a[3]
Definition: RandGen.cpp:92
__forceinline const avxi abs(const avxi &a)
Definition: util_avxi.h:186