Blender  V3.3
imageprocess.c
Go to the documentation of this file.
1 /* SPDX-License-Identifier: GPL-2.0-or-later
2  * Copyright 2001-2002 NaN Holding BV. All rights reserved. */
3 
13 #include <math.h>
14 #include <stdlib.h>
15 
16 #include "MEM_guardedalloc.h"
17 
18 #include "BLI_math.h"
19 #include "BLI_task.h"
20 #include "BLI_utildefines.h"
21 
22 #include "IMB_colormanagement.h"
23 #include "IMB_imbuf.h"
24 #include "IMB_imbuf_types.h"
25 
26 void IMB_convert_rgba_to_abgr(struct ImBuf *ibuf)
27 {
28  size_t size;
29  unsigned char rt, *cp = (unsigned char *)ibuf->rect;
30  float rtf, *cpf = ibuf->rect_float;
31 
32  if (ibuf->rect) {
33  size = ibuf->x * ibuf->y;
34 
35  while (size-- > 0) {
36  rt = cp[0];
37  cp[0] = cp[3];
38  cp[3] = rt;
39  rt = cp[1];
40  cp[1] = cp[2];
41  cp[2] = rt;
42  cp += 4;
43  }
44  }
45 
46  if (ibuf->rect_float) {
47  size = ibuf->x * ibuf->y;
48 
49  while (size-- > 0) {
50  rtf = cpf[0];
51  cpf[0] = cpf[3];
52  cpf[3] = rtf;
53  rtf = cpf[1];
54  cpf[1] = cpf[2];
55  cpf[2] = rtf;
56  cpf += 4;
57  }
58  }
59 }
60 
61 static void pixel_from_buffer(
62  const struct ImBuf *ibuf, unsigned char **outI, float **outF, int x, int y)
63 
64 {
65  size_t offset = ((size_t)ibuf->x) * y * 4 + 4 * x;
66 
67  if (ibuf->rect) {
68  *outI = (unsigned char *)ibuf->rect + offset;
69  }
70 
71  if (ibuf->rect_float) {
72  *outF = ibuf->rect_float + offset;
73  }
74 }
75 
76 /* -------------------------------------------------------------------- */
81  const struct ImBuf *in, unsigned char outI[4], float outF[4], float u, float v)
82 {
83  if (outF) {
84  BLI_bicubic_interpolation_fl(in->rect_float, outF, in->x, in->y, 4, u, v);
85  }
86  else {
87  BLI_bicubic_interpolation_char((unsigned char *)in->rect, outI, in->x, in->y, 4, u, v);
88  }
89 }
90 
91 void bicubic_interpolation(const ImBuf *in, ImBuf *out, float u, float v, int xout, int yout)
92 {
93  unsigned char *outI = NULL;
94  float *outF = NULL;
95 
96  if (in == NULL || (in->rect == NULL && in->rect_float == NULL)) {
97  return;
98  }
99 
100  /* GCC warns these could be uninitialized, but its ok. */
101  pixel_from_buffer(out, &outI, &outF, xout, yout);
102 
103  bicubic_interpolation_color(in, outI, outF, u, v);
104 }
105 
108 /* -------------------------------------------------------------------- */
113  const struct ImBuf *in, unsigned char UNUSED(outI[4]), float outF[4], float u, float v)
114 {
115  BLI_assert(outF);
116  BLI_assert(in->rect_float);
117  BLI_bilinear_interpolation_fl(in->rect_float, outF, in->x, in->y, 4, u, v);
118 }
119 
121  const struct ImBuf *in, unsigned char outI[4], float UNUSED(outF[4]), float u, float v)
122 {
123  BLI_assert(outI);
124  BLI_assert(in->rect);
125  BLI_bilinear_interpolation_char((unsigned char *)in->rect, outI, in->x, in->y, 4, u, v);
126 }
127 
129  const struct ImBuf *in, unsigned char outI[4], float outF[4], float u, float v)
130 {
131  if (outF) {
132  BLI_bilinear_interpolation_fl(in->rect_float, outF, in->x, in->y, 4, u, v);
133  }
134  else {
135  BLI_bilinear_interpolation_char((unsigned char *)in->rect, outI, in->x, in->y, 4, u, v);
136  }
137 }
138 
139 /* function assumes out to be zero'ed, only does RGBA */
140 /* BILINEAR INTERPOLATION */
141 
143  const struct ImBuf *in, unsigned char outI[4], float outF[4], float u, float v)
144 {
145  float *row1, *row2, *row3, *row4, a, b;
146  unsigned char *row1I, *row2I, *row3I, *row4I;
147  float a_b, ma_b, a_mb, ma_mb;
148  int y1, y2, x1, x2;
149 
150  /* ImBuf in must have a valid rect or rect_float, assume this is already checked */
151 
152  x1 = (int)floor(u);
153  x2 = (int)ceil(u);
154  y1 = (int)floor(v);
155  y2 = (int)ceil(v);
156 
157  /* sample area entirely outside image? */
158  if (x2 < 0 || x1 > in->x - 1 || y2 < 0 || y1 > in->y - 1) {
159  return;
160  }
161 
162  /* Wrap interpolation pixels - main difference from #bilinear_interpolation_color. */
163  if (x1 < 0) {
164  x1 = in->x + x1;
165  }
166  if (y1 < 0) {
167  y1 = in->y + y1;
168  }
169 
170  if (x2 >= in->x) {
171  x2 = x2 - in->x;
172  }
173  if (y2 >= in->y) {
174  y2 = y2 - in->y;
175  }
176 
177  a = u - floorf(u);
178  b = v - floorf(v);
179  a_b = a * b;
180  ma_b = (1.0f - a) * b;
181  a_mb = a * (1.0f - b);
182  ma_mb = (1.0f - a) * (1.0f - b);
183 
184  if (outF) {
185  /* sample including outside of edges of image */
186  row1 = in->rect_float + ((size_t)in->x) * y1 * 4 + 4 * x1;
187  row2 = in->rect_float + ((size_t)in->x) * y2 * 4 + 4 * x1;
188  row3 = in->rect_float + ((size_t)in->x) * y1 * 4 + 4 * x2;
189  row4 = in->rect_float + ((size_t)in->x) * y2 * 4 + 4 * x2;
190 
191  outF[0] = ma_mb * row1[0] + a_mb * row3[0] + ma_b * row2[0] + a_b * row4[0];
192  outF[1] = ma_mb * row1[1] + a_mb * row3[1] + ma_b * row2[1] + a_b * row4[1];
193  outF[2] = ma_mb * row1[2] + a_mb * row3[2] + ma_b * row2[2] + a_b * row4[2];
194  outF[3] = ma_mb * row1[3] + a_mb * row3[3] + ma_b * row2[3] + a_b * row4[3];
195 
196  /* clamp here or else we can easily get off-range */
197  clamp_v4(outF, 0.0f, 1.0f);
198  }
199  if (outI) {
200  /* sample including outside of edges of image */
201  row1I = (unsigned char *)in->rect + ((size_t)in->x) * y1 * 4 + 4 * x1;
202  row2I = (unsigned char *)in->rect + ((size_t)in->x) * y2 * 4 + 4 * x1;
203  row3I = (unsigned char *)in->rect + ((size_t)in->x) * y1 * 4 + 4 * x2;
204  row4I = (unsigned char *)in->rect + ((size_t)in->x) * y2 * 4 + 4 * x2;
205 
206  /* Tested with white images and this should not wrap back to zero. */
207  outI[0] = roundf(ma_mb * row1I[0] + a_mb * row3I[0] + ma_b * row2I[0] + a_b * row4I[0]);
208  outI[1] = roundf(ma_mb * row1I[1] + a_mb * row3I[1] + ma_b * row2I[1] + a_b * row4I[1]);
209  outI[2] = roundf(ma_mb * row1I[2] + a_mb * row3I[2] + ma_b * row2I[2] + a_b * row4I[2]);
210  outI[3] = roundf(ma_mb * row1I[3] + a_mb * row3I[3] + ma_b * row2I[3] + a_b * row4I[3]);
211  }
212 }
213 
214 void bilinear_interpolation(const ImBuf *in, ImBuf *out, float u, float v, int xout, int yout)
215 {
216  unsigned char *outI = NULL;
217  float *outF = NULL;
218 
219  if (in == NULL || (in->rect == NULL && in->rect_float == NULL)) {
220  return;
221  }
222 
223  /* gcc warns these could be uninitialized, but its ok. */
224  pixel_from_buffer(out, &outI, &outF, xout, yout);
225 
226  bilinear_interpolation_color(in, outI, outF, u, v);
227 }
228 
231 /* -------------------------------------------------------------------- */
236  const struct ImBuf *in, unsigned char outI[4], float UNUSED(outF[4]), float u, float v)
237 {
238  BLI_assert(outI);
239  BLI_assert(in->rect);
240  /* ImBuf in must have a valid rect or rect_float, assume this is already checked */
241  int x1 = (int)(u);
242  int y1 = (int)(v);
243 
244  /* sample area entirely outside image? */
245  if (x1 < 0 || x1 >= in->x || y1 < 0 || y1 >= in->y) {
246  outI[0] = outI[1] = outI[2] = outI[3] = 0;
247  return;
248  }
249 
250  const size_t offset = ((size_t)in->x * y1 + x1) * 4;
251  const unsigned char *dataI = (unsigned char *)in->rect + offset;
252  outI[0] = dataI[0];
253  outI[1] = dataI[1];
254  outI[2] = dataI[2];
255  outI[3] = dataI[3];
256 }
257 
259  const struct ImBuf *in, unsigned char UNUSED(outI[4]), float outF[4], float u, float v)
260 {
261  BLI_assert(outF);
262  BLI_assert(in->rect_float);
263  /* ImBuf in must have a valid rect or rect_float, assume this is already checked */
264  int x1 = (int)(u);
265  int y1 = (int)(v);
266 
267  /* sample area entirely outside image? */
268  if (x1 < 0 || x1 >= in->x || y1 < 0 || y1 >= in->y) {
269  zero_v4(outF);
270  return;
271  }
272 
273  const size_t offset = ((size_t)in->x * y1 + x1) * 4;
274  const float *dataF = in->rect_float + offset;
275  copy_v4_v4(outF, dataF);
276 }
277 
279  const struct ImBuf *in, unsigned char outI[4], float outF[4], float u, float v)
280 {
281  if (outF) {
282  nearest_interpolation_color_fl(in, outI, outF, u, v);
283  }
284  else {
285  nearest_interpolation_color_char(in, outI, outF, u, v);
286  }
287 }
288 
290  const struct ImBuf *in, unsigned char outI[4], float outF[4], float u, float v)
291 {
292  const float *dataF;
293  unsigned char *dataI;
294  int y, x;
295 
296  /* ImBuf in must have a valid rect or rect_float, assume this is already checked */
297 
298  x = (int)floor(u);
299  y = (int)floor(v);
300 
301  x = x % in->x;
302  y = y % in->y;
303 
304  /* Wrap interpolation pixels - main difference from #nearest_interpolation_color. */
305  if (x < 0) {
306  x += in->x;
307  }
308  if (y < 0) {
309  y += in->y;
310  }
311 
312  dataI = (unsigned char *)in->rect + ((size_t)in->x) * y * 4 + 4 * x;
313  if (outI) {
314  outI[0] = dataI[0];
315  outI[1] = dataI[1];
316  outI[2] = dataI[2];
317  outI[3] = dataI[3];
318  }
319  dataF = in->rect_float + ((size_t)in->x) * y * 4 + 4 * x;
320  if (outF) {
321  outF[0] = dataF[0];
322  outF[1] = dataF[1];
323  outF[2] = dataF[2];
324  outF[3] = dataF[3];
325  }
326 }
327 
328 void nearest_interpolation(const ImBuf *in, ImBuf *out, float u, float v, int xout, int yout)
329 {
330  unsigned char *outI = NULL;
331  float *outF = NULL;
332 
333  if (in == NULL || (in->rect == NULL && in->rect_float == NULL)) {
334  return;
335  }
336 
337  /* gcc warns these could be uninitialized, but its ok. */
338  pixel_from_buffer(out, &outI, &outF, xout, yout);
339 
340  nearest_interpolation_color(in, outI, outF, u, v);
341 }
342 
345 /* -------------------------------------------------------------------- */
349 static void processor_apply_func(TaskPool *__restrict pool, void *taskdata)
350 {
351  void (*do_thread)(void *) = (void (*)(void *))BLI_task_pool_user_data(pool);
352  do_thread(taskdata);
353 }
354 
356  int buffer_lines,
357  int handle_size,
358  void *init_customdata,
359  void(init_handle)(void *handle, int start_line, int tot_line, void *customdata),
360  void *(do_thread)(void *))
361 {
362  const int lines_per_task = 64;
363 
365 
366  void *handles;
367  int total_tasks = (buffer_lines + lines_per_task - 1) / lines_per_task;
368  int i, start_line;
369 
371 
372  handles = MEM_callocN(handle_size * total_tasks, "processor apply threaded handles");
373 
374  start_line = 0;
375 
376  for (i = 0; i < total_tasks; i++) {
377  int lines_per_current_task;
378  void *handle = ((char *)handles) + handle_size * i;
379 
380  if (i < total_tasks - 1) {
381  lines_per_current_task = lines_per_task;
382  }
383  else {
384  lines_per_current_task = buffer_lines - start_line;
385  }
386 
387  init_handle(handle, start_line, lines_per_current_task, init_customdata);
388 
390 
391  start_line += lines_per_task;
392  }
393 
394  /* work and wait until tasks are done */
396 
397  /* Free memory. */
400 }
401 
402 typedef struct ScanlineGlobalData {
403  void *custom_data;
406 
407 static void processor_apply_parallel(void *__restrict userdata,
408  const int scanline,
409  const TaskParallelTLS *__restrict UNUSED(tls))
410 {
411  ScanlineGlobalData *data = userdata;
412  data->do_thread(data->custom_data, scanline);
413 }
414 
415 void IMB_processor_apply_threaded_scanlines(int total_scanlines,
416  ScanlineThreadFunc do_thread,
417  void *custom_data)
418 {
419  TaskParallelSettings settings;
421  .do_thread = do_thread,
422  .custom_data = custom_data,
423  };
424 
426  BLI_task_parallel_range(0, total_scanlines, &data, processor_apply_parallel, &settings);
427 }
428 
431 /* -------------------------------------------------------------------- */
435 void IMB_alpha_under_color_float(float *rect_float, int x, int y, float backcol[3])
436 {
437  size_t a = ((size_t)x) * y;
438  float *fp = rect_float;
439 
440  while (a--) {
441  const float mul = 1.0f - fp[3];
442  madd_v3_v3fl(fp, backcol, mul);
443  fp[3] = 1.0f;
444 
445  fp += 4;
446  }
447 }
448 
449 void IMB_alpha_under_color_byte(unsigned char *rect, int x, int y, const float backcol[3])
450 {
451  size_t a = ((size_t)x) * y;
452  unsigned char *cp = rect;
453 
454  while (a--) {
455  if (cp[3] == 255) {
456  /* pass */
457  }
458  else if (cp[3] == 0) {
459  cp[0] = backcol[0] * 255;
460  cp[1] = backcol[1] * 255;
461  cp[2] = backcol[2] * 255;
462  }
463  else {
464  float alpha = cp[3] / 255.0;
465  float mul = 1.0f - alpha;
466 
467  cp[0] = (cp[0] * alpha) + mul * backcol[0];
468  cp[1] = (cp[1] * alpha) + mul * backcol[1];
469  cp[2] = (cp[2] * alpha) + mul * backcol[2];
470  }
471 
472  cp[3] = 255;
473 
474  cp += 4;
475  }
476 }
477 
480 /* -------------------------------------------------------------------- */
484 void IMB_sampleImageAtLocation(ImBuf *ibuf, float x, float y, bool make_linear_rgb, float color[4])
485 {
486  if (ibuf->rect_float) {
488  }
489  else {
490  unsigned char byte_color[4];
491  nearest_interpolation_color(ibuf, byte_color, NULL, x, y);
492  rgba_uchar_to_float(color, byte_color);
493  if (make_linear_rgb) {
495  }
496  }
497 }
498 
#define BLI_assert(a)
Definition: BLI_assert.h:46
void rgba_uchar_to_float(float r_col[4], const unsigned char col_ub[4])
Definition: math_color.c:383
void BLI_bilinear_interpolation_fl(const float *buffer, float *output, int width, int height, int components, float u, float v)
Definition: math_interp.c:445
void BLI_bicubic_interpolation_fl(const float *buffer, float *output, int width, int height, int components, float u, float v)
Definition: math_interp.c:230
void BLI_bicubic_interpolation_char(const unsigned char *buffer, unsigned char *output, int width, int height, int components, float u, float v)
Definition: math_interp.c:236
void BLI_bilinear_interpolation_char(const unsigned char *buffer, unsigned char *output, int width, int height, int components, float u, float v)
Definition: math_interp.c:452
MINLINE void copy_v4_v4(float r[4], const float a[4])
MINLINE void madd_v3_v3fl(float r[3], const float a[3], float f)
MINLINE void clamp_v4(float vec[4], float min, float max)
MINLINE void zero_v4(float r[4])
@ TASK_PRIORITY_HIGH
Definition: BLI_task.h:57
void * BLI_task_pool_user_data(TaskPool *pool)
Definition: task_pool.cc:525
void BLI_task_pool_work_and_wait(TaskPool *pool)
Definition: task_pool.cc:480
void BLI_task_parallel_range(int start, int stop, void *userdata, TaskParallelRangeFunc func, const TaskParallelSettings *settings)
Definition: task_range.cc:94
TaskPool * BLI_task_pool_create(void *userdata, eTaskPriority priority)
Definition: task_pool.cc:390
BLI_INLINE void BLI_parallel_range_settings_defaults(TaskParallelSettings *settings)
Definition: BLI_task.h:293
void BLI_task_pool_free(TaskPool *pool)
Definition: task_pool.cc:440
void BLI_task_pool_push(TaskPool *pool, TaskRunFunction run, void *taskdata, bool free_taskdata, TaskFreeFunction freedata)
Definition: task_pool.cc:459
#define UNUSED(x)
_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 y1
_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 x2
void IMB_colormanagement_colorspace_to_scene_linear_v4(float pixel[4], bool predivide, struct ColorSpace *colorspace)
void(* ScanlineThreadFunc)(void *custom_data, int scanline)
Definition: IMB_imbuf.h:882
Contains defines and structs used throughout the imbuf module.
Read Guarded memory(de)allocation.
Group Output data from inside of a node group A color picker Mix two input colors RGB to Convert a color s luminance to a grayscale value Generate a normal vector and a dot product Bright Control the brightness and contrast of the input color Vector Map an input vectors to used to fine tune the interpolation of the input Camera Retrieve information about the camera and how it relates to the current shading point s position Clamp a value between a minimum and a maximum Vector Perform vector math operation Invert a color
ATTR_WARN_UNUSED_RESULT const BMVert * v
static DBVT_INLINE btScalar size(const btDbvtVolume &a)
Definition: btDbvt.cpp:52
static void mul(btAlignedObjectArray< T > &items, const Q &value)
SyclQueue void void size_t num_bytes void
TaskPool * task_pool
void nearest_interpolation(const ImBuf *in, ImBuf *out, float u, float v, int xout, int yout)
Definition: imageprocess.c:328
struct ScanlineGlobalData ScanlineGlobalData
static void processor_apply_parallel(void *__restrict userdata, const int scanline, const TaskParallelTLS *__restrict UNUSED(tls))
Definition: imageprocess.c:407
void bilinear_interpolation(const ImBuf *in, ImBuf *out, float u, float v, int xout, int yout)
Definition: imageprocess.c:214
void IMB_sampleImageAtLocation(ImBuf *ibuf, float x, float y, bool make_linear_rgb, float color[4])
Definition: imageprocess.c:484
static void processor_apply_func(TaskPool *__restrict pool, void *taskdata)
Definition: imageprocess.c:349
void IMB_processor_apply_threaded(int buffer_lines, int handle_size, void *init_customdata, void(init_handle)(void *handle, int start_line, int tot_line, void *customdata), void *(do_thread)(void *))
Definition: imageprocess.c:355
void bilinear_interpolation_color_char(const struct ImBuf *in, unsigned char outI[4], float UNUSED(outF[4]), float u, float v)
Definition: imageprocess.c:120
static void pixel_from_buffer(const struct ImBuf *ibuf, unsigned char **outI, float **outF, int x, int y)
Definition: imageprocess.c:61
void bicubic_interpolation(const ImBuf *in, ImBuf *out, float u, float v, int xout, int yout)
Definition: imageprocess.c:91
void IMB_processor_apply_threaded_scanlines(int total_scanlines, ScanlineThreadFunc do_thread, void *custom_data)
Definition: imageprocess.c:415
void bilinear_interpolation_color_fl(const struct ImBuf *in, unsigned char UNUSED(outI[4]), float outF[4], float u, float v)
Definition: imageprocess.c:112
void bicubic_interpolation_color(const struct ImBuf *in, unsigned char outI[4], float outF[4], float u, float v)
Definition: imageprocess.c:80
void nearest_interpolation_color(const struct ImBuf *in, unsigned char outI[4], float outF[4], float u, float v)
Definition: imageprocess.c:278
void nearest_interpolation_color_wrap(const struct ImBuf *in, unsigned char outI[4], float outF[4], float u, float v)
Definition: imageprocess.c:289
void IMB_convert_rgba_to_abgr(struct ImBuf *ibuf)
Definition: imageprocess.c:26
void nearest_interpolation_color_fl(const struct ImBuf *in, unsigned char UNUSED(outI[4]), float outF[4], float u, float v)
Definition: imageprocess.c:258
void nearest_interpolation_color_char(const struct ImBuf *in, unsigned char outI[4], float UNUSED(outF[4]), float u, float v)
Definition: imageprocess.c:235
void bilinear_interpolation_color(const struct ImBuf *in, unsigned char outI[4], float outF[4], float u, float v)
Definition: imageprocess.c:128
void IMB_alpha_under_color_float(float *rect_float, int x, int y, float backcol[3])
Definition: imageprocess.c:435
void IMB_alpha_under_color_byte(unsigned char *rect, int x, int y, const float backcol[3])
Definition: imageprocess.c:449
void bilinear_interpolation_color_wrap(const struct ImBuf *in, unsigned char outI[4], float outF[4], float u, float v)
Definition: imageprocess.c:142
ccl_gpu_kernel_postfix ccl_global float int int int int float bool int offset
void(* MEM_freeN)(void *vmemh)
Definition: mallocn.c:27
void *(* MEM_callocN)(size_t len, const char *str)
Definition: mallocn.c:31
ccl_device_inline float3 ceil(const float3 &a)
Definition: math_float3.h:363
#define floorf(x)
Definition: metal/compat.h:224
static unsigned a[3]
Definition: RandGen.cpp:78
T floor(const T &a)
static const pxr::TfToken out("out", pxr::TfToken::Immortal)
static const pxr::TfToken b("b", pxr::TfToken::Immortal)
struct ColorSpace * rect_colorspace
unsigned int * rect
float * rect_float
ScanlineThreadFunc do_thread
Definition: imageprocess.c:404
ParamHandle ** handles