Blender  V2.93
imageprocess.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 
30 #include <math.h>
31 #include <stdlib.h>
32 
33 #include "MEM_guardedalloc.h"
34 
35 #include "BLI_math.h"
36 #include "BLI_task.h"
37 #include "BLI_utildefines.h"
38 
39 #include "IMB_colormanagement.h"
40 #include "IMB_imbuf.h"
41 #include "IMB_imbuf_types.h"
42 #include <math.h>
43 
44 /* Only this one is used liberally here, and in imbuf */
45 void IMB_convert_rgba_to_abgr(struct ImBuf *ibuf)
46 {
47  size_t size;
48  unsigned char rt, *cp = (unsigned char *)ibuf->rect;
49  float rtf, *cpf = ibuf->rect_float;
50 
51  if (ibuf->rect) {
52  size = ibuf->x * ibuf->y;
53 
54  while (size-- > 0) {
55  rt = cp[0];
56  cp[0] = cp[3];
57  cp[3] = rt;
58  rt = cp[1];
59  cp[1] = cp[2];
60  cp[2] = rt;
61  cp += 4;
62  }
63  }
64 
65  if (ibuf->rect_float) {
66  size = ibuf->x * ibuf->y;
67 
68  while (size-- > 0) {
69  rtf = cpf[0];
70  cpf[0] = cpf[3];
71  cpf[3] = rtf;
72  rtf = cpf[1];
73  cpf[1] = cpf[2];
74  cpf[2] = rtf;
75  cpf += 4;
76  }
77  }
78 }
79 
80 static void pixel_from_buffer(struct ImBuf *ibuf, unsigned char **outI, float **outF, int x, int y)
81 
82 {
83  size_t offset = ((size_t)ibuf->x) * y * 4 + 4 * x;
84 
85  if (ibuf->rect) {
86  *outI = (unsigned char *)ibuf->rect + offset;
87  }
88 
89  if (ibuf->rect_float) {
90  *outF = ibuf->rect_float + offset;
91  }
92 }
93 
94 /* -------------------------------------------------------------------- */
99  struct ImBuf *in, unsigned char outI[4], float outF[4], float u, float v)
100 {
101  if (outF) {
102  BLI_bicubic_interpolation_fl(in->rect_float, outF, in->x, in->y, 4, u, v);
103  }
104  else {
105  BLI_bicubic_interpolation_char((unsigned char *)in->rect, outI, in->x, in->y, 4, u, v);
106  }
107 }
108 
109 void bicubic_interpolation(ImBuf *in, ImBuf *out, float u, float v, int xout, int yout)
110 {
111  unsigned char *outI = NULL;
112  float *outF = NULL;
113 
114  if (in == NULL || (in->rect == NULL && in->rect_float == NULL)) {
115  return;
116  }
117 
118  /* GCC warns these could be uninitialized, but its ok. */
119  pixel_from_buffer(out, &outI, &outF, xout, yout);
120 
121  bicubic_interpolation_color(in, outI, outF, u, v);
122 }
123 
126 /* -------------------------------------------------------------------- */
131  struct ImBuf *in, unsigned char outI[4], float outF[4], float u, float v)
132 {
133  if (outF) {
134  BLI_bilinear_interpolation_fl(in->rect_float, outF, in->x, in->y, 4, u, v);
135  }
136  else {
137  BLI_bilinear_interpolation_char((unsigned char *)in->rect, outI, in->x, in->y, 4, u, v);
138  }
139 }
140 
141 /* function assumes out to be zero'ed, only does RGBA */
142 /* BILINEAR INTERPOLATION */
143 
144 /* Note about wrapping, the u/v still needs to be within the image bounds,
145  * just the interpolation is wrapped.
146  * This the same as bilinear_interpolation_color except it wraps
147  * rather than using empty and emptyI. */
149  struct ImBuf *in, unsigned char outI[4], float outF[4], float u, float v)
150 {
151  float *row1, *row2, *row3, *row4, a, b;
152  unsigned char *row1I, *row2I, *row3I, *row4I;
153  float a_b, ma_b, a_mb, ma_mb;
154  int y1, y2, x1, x2;
155 
156  /* ImBuf in must have a valid rect or rect_float, assume this is already checked */
157 
158  x1 = (int)floor(u);
159  x2 = (int)ceil(u);
160  y1 = (int)floor(v);
161  y2 = (int)ceil(v);
162 
163  /* sample area entirely outside image? */
164  if (x2 < 0 || x1 > in->x - 1 || y2 < 0 || y1 > in->y - 1) {
165  return;
166  }
167 
168  /* wrap interpolation pixels - main difference from bilinear_interpolation_color */
169  if (x1 < 0) {
170  x1 = in->x + x1;
171  }
172  if (y1 < 0) {
173  y1 = in->y + y1;
174  }
175 
176  if (x2 >= in->x) {
177  x2 = x2 - in->x;
178  }
179  if (y2 >= in->y) {
180  y2 = y2 - in->y;
181  }
182 
183  a = u - floorf(u);
184  b = v - floorf(v);
185  a_b = a * b;
186  ma_b = (1.0f - a) * b;
187  a_mb = a * (1.0f - b);
188  ma_mb = (1.0f - a) * (1.0f - b);
189 
190  if (outF) {
191  /* sample including outside of edges of image */
192  row1 = in->rect_float + ((size_t)in->x) * y1 * 4 + 4 * x1;
193  row2 = in->rect_float + ((size_t)in->x) * y2 * 4 + 4 * x1;
194  row3 = in->rect_float + ((size_t)in->x) * y1 * 4 + 4 * x2;
195  row4 = in->rect_float + ((size_t)in->x) * y2 * 4 + 4 * x2;
196 
197  outF[0] = ma_mb * row1[0] + a_mb * row3[0] + ma_b * row2[0] + a_b * row4[0];
198  outF[1] = ma_mb * row1[1] + a_mb * row3[1] + ma_b * row2[1] + a_b * row4[1];
199  outF[2] = ma_mb * row1[2] + a_mb * row3[2] + ma_b * row2[2] + a_b * row4[2];
200  outF[3] = ma_mb * row1[3] + a_mb * row3[3] + ma_b * row2[3] + a_b * row4[3];
201 
202  /* clamp here or else we can easily get off-range */
203  clamp_v4(outF, 0.0f, 1.0f);
204  }
205  if (outI) {
206  /* sample including outside of edges of image */
207  row1I = (unsigned char *)in->rect + ((size_t)in->x) * y1 * 4 + 4 * x1;
208  row2I = (unsigned char *)in->rect + ((size_t)in->x) * y2 * 4 + 4 * x1;
209  row3I = (unsigned char *)in->rect + ((size_t)in->x) * y1 * 4 + 4 * x2;
210  row4I = (unsigned char *)in->rect + ((size_t)in->x) * y2 * 4 + 4 * x2;
211 
212  /* Tested with white images and this should not wrap back to zero. */
213  outI[0] = roundf(ma_mb * row1I[0] + a_mb * row3I[0] + ma_b * row2I[0] + a_b * row4I[0]);
214  outI[1] = roundf(ma_mb * row1I[1] + a_mb * row3I[1] + ma_b * row2I[1] + a_b * row4I[1]);
215  outI[2] = roundf(ma_mb * row1I[2] + a_mb * row3I[2] + ma_b * row2I[2] + a_b * row4I[2]);
216  outI[3] = roundf(ma_mb * row1I[3] + a_mb * row3I[3] + ma_b * row2I[3] + a_b * row4I[3]);
217  }
218 }
219 
220 void bilinear_interpolation(ImBuf *in, ImBuf *out, float u, float v, int xout, int yout)
221 {
222  unsigned char *outI = NULL;
223  float *outF = NULL;
224 
225  if (in == NULL || (in->rect == NULL && in->rect_float == NULL)) {
226  return;
227  }
228 
229  /* gcc warns these could be uninitialized, but its ok. */
230  pixel_from_buffer(out, &outI, &outF, xout, yout);
231 
232  bilinear_interpolation_color(in, outI, outF, u, v);
233 }
234 
237 /* -------------------------------------------------------------------- */
241 /* function assumes out to be zero'ed, only does RGBA */
243  struct ImBuf *in, unsigned char outI[4], float outF[4], float u, float v)
244 {
245  const float *dataF;
246  unsigned char *dataI;
247  int y1, x1;
248 
249  /* ImBuf in must have a valid rect or rect_float, assume this is already checked */
250 
251  x1 = (int)(u);
252  y1 = (int)(v);
253 
254  /* sample area entirely outside image? */
255  if (x1 < 0 || x1 > in->x - 1 || y1 < 0 || y1 > in->y - 1) {
256  if (outI) {
257  outI[0] = outI[1] = outI[2] = outI[3] = 0;
258  }
259  if (outF) {
260  outF[0] = outF[1] = outF[2] = outF[3] = 0.0f;
261  }
262  return;
263  }
264 
265  /* sample including outside of edges of image */
266  if (x1 < 0 || y1 < 0) {
267  if (outI) {
268  outI[0] = 0;
269  outI[1] = 0;
270  outI[2] = 0;
271  outI[3] = 0;
272  }
273  if (outF) {
274  outF[0] = 0.0f;
275  outF[1] = 0.0f;
276  outF[2] = 0.0f;
277  outF[3] = 0.0f;
278  }
279  }
280  else {
281  dataI = (unsigned char *)in->rect + ((size_t)in->x) * y1 * 4 + 4 * x1;
282  if (outI) {
283  outI[0] = dataI[0];
284  outI[1] = dataI[1];
285  outI[2] = dataI[2];
286  outI[3] = dataI[3];
287  }
288  dataF = in->rect_float + ((size_t)in->x) * y1 * 4 + 4 * x1;
289  if (outF) {
290  outF[0] = dataF[0];
291  outF[1] = dataF[1];
292  outF[2] = dataF[2];
293  outF[3] = dataF[3];
294  }
295  }
296 }
297 
299  struct ImBuf *in, unsigned char outI[4], float outF[4], float u, float v)
300 {
301  const float *dataF;
302  unsigned char *dataI;
303  int y, x;
304 
305  /* ImBuf in must have a valid rect or rect_float, assume this is already checked */
306 
307  x = (int)floor(u);
308  y = (int)floor(v);
309 
310  x = x % in->x;
311  y = y % in->y;
312 
313  /* wrap interpolation pixels - main difference from nearest_interpolation_color */
314  if (x < 0) {
315  x += in->x;
316  }
317  if (y < 0) {
318  y += in->y;
319  }
320 
321  dataI = (unsigned char *)in->rect + ((size_t)in->x) * y * 4 + 4 * x;
322  if (outI) {
323  outI[0] = dataI[0];
324  outI[1] = dataI[1];
325  outI[2] = dataI[2];
326  outI[3] = dataI[3];
327  }
328  dataF = in->rect_float + ((size_t)in->x) * y * 4 + 4 * x;
329  if (outF) {
330  outF[0] = dataF[0];
331  outF[1] = dataF[1];
332  outF[2] = dataF[2];
333  outF[3] = dataF[3];
334  }
335 }
336 
337 void nearest_interpolation(ImBuf *in, ImBuf *out, float u, float v, int xout, int yout)
338 {
339  unsigned char *outI = NULL;
340  float *outF = NULL;
341 
342  if (in == NULL || (in->rect == NULL && in->rect_float == NULL)) {
343  return;
344  }
345 
346  /* gcc warns these could be uninitialized, but its ok. */
347  pixel_from_buffer(out, &outI, &outF, xout, yout);
348 
349  nearest_interpolation_color(in, outI, outF, u, v);
350 }
351 
352 /* -------------------------------------------------------------------- */
356 static void processor_apply_func(TaskPool *__restrict pool, void *taskdata)
357 {
358  void (*do_thread)(void *) = (void (*)(void *))BLI_task_pool_user_data(pool);
359  do_thread(taskdata);
360 }
361 
363  int buffer_lines,
364  int handle_size,
365  void *init_customdata,
366  void(init_handle)(void *handle, int start_line, int tot_line, void *customdata),
367  void *(do_thread)(void *))
368 {
369  const int lines_per_task = 64;
370 
372 
373  void *handles;
374  int total_tasks = (buffer_lines + lines_per_task - 1) / lines_per_task;
375  int i, start_line;
376 
378 
379  handles = MEM_callocN(handle_size * total_tasks, "processor apply threaded handles");
380 
381  start_line = 0;
382 
383  for (i = 0; i < total_tasks; i++) {
384  int lines_per_current_task;
385  void *handle = ((char *)handles) + handle_size * i;
386 
387  if (i < total_tasks - 1) {
388  lines_per_current_task = lines_per_task;
389  }
390  else {
391  lines_per_current_task = buffer_lines - start_line;
392  }
393 
394  init_handle(handle, start_line, lines_per_current_task, init_customdata);
395 
397 
398  start_line += lines_per_task;
399  }
400 
401  /* work and wait until tasks are done */
403 
404  /* Free memory. */
407 }
408 
409 typedef struct ScanlineGlobalData {
410  void *custom_data;
415 
416 static void processor_apply_scanline_func(TaskPool *__restrict pool, void *taskdata)
417 {
419  int start_scanline = POINTER_AS_INT(taskdata);
420  int num_scanlines = min_ii(data->scanlines_per_task, data->total_scanlines - start_scanline);
421  data->do_thread(data->custom_data, start_scanline, num_scanlines);
422 }
423 
424 void IMB_processor_apply_threaded_scanlines(int total_scanlines,
425  ScanlineThreadFunc do_thread,
426  void *custom_data)
427 {
428  const int scanlines_per_task = 64;
430  data.custom_data = custom_data;
431  data.do_thread = do_thread;
432  data.scanlines_per_task = scanlines_per_task;
433  data.total_scanlines = total_scanlines;
434  const int total_tasks = (total_scanlines + scanlines_per_task - 1) / scanlines_per_task;
436  for (int i = 0, start_line = 0; i < total_tasks; i++) {
439  start_line += scanlines_per_task;
440  }
441 
442  /* work and wait until tasks are done */
444 
445  /* Free memory. */
447 }
448 
451 /* -------------------------------------------------------------------- */
455 void IMB_alpha_under_color_float(float *rect_float, int x, int y, float backcol[3])
456 {
457  size_t a = ((size_t)x) * y;
458  float *fp = rect_float;
459 
460  while (a--) {
461  const float mul = 1.0f - fp[3];
462  madd_v3_v3fl(fp, backcol, mul);
463  fp[3] = 1.0f;
464 
465  fp += 4;
466  }
467 }
468 
469 void IMB_alpha_under_color_byte(unsigned char *rect, int x, int y, const float backcol[3])
470 {
471  size_t a = ((size_t)x) * y;
472  unsigned char *cp = rect;
473 
474  while (a--) {
475  if (cp[3] == 255) {
476  /* pass */
477  }
478  else if (cp[3] == 0) {
479  cp[0] = backcol[0] * 255;
480  cp[1] = backcol[1] * 255;
481  cp[2] = backcol[2] * 255;
482  }
483  else {
484  float alpha = cp[3] / 255.0;
485  float mul = 1.0f - alpha;
486 
487  cp[0] = (cp[0] * alpha) + mul * backcol[0];
488  cp[1] = (cp[1] * alpha) + mul * backcol[1];
489  cp[2] = (cp[2] * alpha) + mul * backcol[2];
490  }
491 
492  cp[3] = 255;
493 
494  cp += 4;
495  }
496 }
497 
500 /* -------------------------------------------------------------------- */
504 /* Sample pixel of image using NEAREST method. */
505 void IMB_sampleImageAtLocation(ImBuf *ibuf, float x, float y, bool make_linear_rgb, float color[4])
506 {
507  if (ibuf->rect_float) {
508  nearest_interpolation_color(ibuf, NULL, color, x, y);
509  }
510  else {
511  unsigned char byte_color[4];
512  nearest_interpolation_color(ibuf, byte_color, NULL, x, y);
513  rgba_uchar_to_float(color, byte_color);
514  if (make_linear_rgb) {
516  }
517  }
518 }
519 
MINLINE int min_ii(int a, int b)
void rgba_uchar_to_float(float r_col[4], const unsigned char col_ub[4])
Definition: math_color.c:414
void BLI_bilinear_interpolation_fl(const float *buffer, float *output, int width, int height, int components, float u, float v)
Definition: math_interp.c:461
void BLI_bicubic_interpolation_fl(const float *buffer, float *output, int width, int height, int components, float u, float v)
Definition: math_interp.c:246
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:252
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:468
MINLINE void madd_v3_v3fl(float r[3], const float a[3], float f)
MINLINE void clamp_v4(float vec[4], const float min, const float max)
void * BLI_task_pool_user_data(TaskPool *pool)
Definition: task_pool.cc:541
void BLI_task_pool_work_and_wait(TaskPool *pool)
Definition: task_pool.cc:496
TaskPool * BLI_task_pool_create(void *userdata, TaskPriority priority)
Definition: task_pool.cc:406
void BLI_task_pool_free(TaskPool *pool)
Definition: task_pool.cc:456
@ TASK_PRIORITY_LOW
Definition: BLI_task.h:66
void BLI_task_pool_push(TaskPool *pool, TaskRunFunction run, void *taskdata, bool free_taskdata, TaskFreeFunction freedata)
Definition: task_pool.cc:475
#define POINTER_FROM_INT(i)
#define POINTER_AS_INT(i)
_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 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
_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
void IMB_colormanagement_colorspace_to_scene_linear_v4(float pixel[4], bool predivide, struct ColorSpace *colorspace)
void(* ScanlineThreadFunc)(void *custom_data, int start_scanline, int num_scanlines)
Definition: IMB_imbuf.h:735
Contains defines and structs used throughout the imbuf module.
Read Guarded memory(de)allocation.
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)
static CCL_NAMESPACE_BEGIN const double alpha
TaskPool * task_pool
static void pixel_from_buffer(struct ImBuf *ibuf, unsigned char **outI, float **outF, int x, int y)
Definition: imageprocess.c:80
struct ScanlineGlobalData ScanlineGlobalData
void bicubic_interpolation_color(struct ImBuf *in, unsigned char outI[4], float outF[4], float u, float v)
Definition: imageprocess.c:98
void IMB_sampleImageAtLocation(ImBuf *ibuf, float x, float y, bool make_linear_rgb, float color[4])
Definition: imageprocess.c:505
static void processor_apply_scanline_func(TaskPool *__restrict pool, void *taskdata)
Definition: imageprocess.c:416
void bilinear_interpolation_color(struct ImBuf *in, unsigned char outI[4], float outF[4], float u, float v)
Definition: imageprocess.c:130
static void processor_apply_func(TaskPool *__restrict pool, void *taskdata)
Definition: imageprocess.c:356
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:362
void nearest_interpolation_color_wrap(struct ImBuf *in, unsigned char outI[4], float outF[4], float u, float v)
Definition: imageprocess.c:298
void nearest_interpolation_color(struct ImBuf *in, unsigned char outI[4], float outF[4], float u, float v)
Definition: imageprocess.c:242
void bilinear_interpolation_color_wrap(struct ImBuf *in, unsigned char outI[4], float outF[4], float u, float v)
Definition: imageprocess.c:148
void nearest_interpolation(ImBuf *in, ImBuf *out, float u, float v, int xout, int yout)
Definition: imageprocess.c:337
void IMB_processor_apply_threaded_scanlines(int total_scanlines, ScanlineThreadFunc do_thread, void *custom_data)
Definition: imageprocess.c:424
void bicubic_interpolation(ImBuf *in, ImBuf *out, float u, float v, int xout, int yout)
Definition: imageprocess.c:109
void bilinear_interpolation(ImBuf *in, ImBuf *out, float u, float v, int xout, int yout)
Definition: imageprocess.c:220
void IMB_convert_rgba_to_abgr(struct ImBuf *ibuf)
Definition: imageprocess.c:45
void IMB_alpha_under_color_float(float *rect_float, int x, int y, float backcol[3])
Definition: imageprocess.c:455
void IMB_alpha_under_color_byte(unsigned char *rect, int x, int y, const float backcol[3])
Definition: imageprocess.c:469
#define floorf(x)
void(* MEM_freeN)(void *vmemh)
Definition: mallocn.c:41
void *(* MEM_callocN)(size_t len, const char *str)
Definition: mallocn.c:45
static unsigned a[3]
Definition: RandGen.cpp:92
struct ColorSpace * rect_colorspace
unsigned int * rect
float * rect_float
ScanlineThreadFunc do_thread
Definition: imageprocess.c:411
ccl_device_inline float2 floor(const float2 &a)
ccl_device_inline float3 ceil(const float3 &a)
ParamHandle ** handles