Blender  V3.3
filter.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 
8 #include <math.h>
9 
10 #include "MEM_guardedalloc.h"
11 
12 #include "BLI_math_base.h"
13 #include "BLI_utildefines.h"
14 
15 #include "IMB_filter.h"
16 #include "IMB_imbuf.h"
17 #include "IMB_imbuf_types.h"
18 
19 #include "imbuf.h"
20 
21 static void filtrow(unsigned char *point, int x)
22 {
23  unsigned int c1, c2, c3, error;
24 
25  if (x > 1) {
26  c1 = c2 = *point;
27  error = 2;
28  for (x--; x > 0; x--) {
29  c3 = point[4];
30  c1 += (c2 << 1) + c3 + error;
31  error = c1 & 3;
32  *point = c1 >> 2;
33  point += 4;
34  c1 = c2;
35  c2 = c3;
36  }
37  *point = (c1 + (c2 << 1) + c2 + error) >> 2;
38  }
39 }
40 
41 static void filtrowf(float *point, int x)
42 {
43  float c1, c2, c3;
44 
45  if (x > 1) {
46  c1 = c2 = *point;
47  for (x--; x > 0; x--) {
48  c3 = point[4];
49  c1 += (c2 * 2) + c3;
50  *point = 0.25f * c1;
51  point += 4;
52  c1 = c2;
53  c2 = c3;
54  }
55  *point = 0.25f * (c1 + (c2 * 2) + c2);
56  }
57 }
58 
59 static void filtcolum(unsigned char *point, int y, int skip)
60 {
61  unsigned int c1, c2, c3, error;
62  unsigned char *point2;
63 
64  if (y > 1) {
65  c1 = c2 = *point;
66  point2 = point;
67  error = 2;
68  for (y--; y > 0; y--) {
69  point2 += skip;
70  c3 = *point2;
71  c1 += (c2 << 1) + c3 + error;
72  error = c1 & 3;
73  *point = c1 >> 2;
74  point = point2;
75  c1 = c2;
76  c2 = c3;
77  }
78  *point = (c1 + (c2 << 1) + c2 + error) >> 2;
79  }
80 }
81 
82 static void filtcolumf(float *point, int y, int skip)
83 {
84  float c1, c2, c3, *point2;
85 
86  if (y > 1) {
87  c1 = c2 = *point;
88  point2 = point;
89  for (y--; y > 0; y--) {
90  point2 += skip;
91  c3 = *point2;
92  c1 += (c2 * 2) + c3;
93  *point = 0.25f * c1;
94  point = point2;
95  c1 = c2;
96  c2 = c3;
97  }
98  *point = 0.25f * (c1 + (c2 * 2) + c2);
99  }
100 }
101 
102 void IMB_filtery(struct ImBuf *ibuf)
103 {
104  unsigned char *point;
105  float *pointf;
106  int x, y, skip;
107 
108  point = (unsigned char *)ibuf->rect;
109  pointf = ibuf->rect_float;
110 
111  x = ibuf->x;
112  y = ibuf->y;
113  skip = x << 2;
114 
115  for (; x > 0; x--) {
116  if (point) {
117  if (ibuf->planes > 24) {
118  filtcolum(point, y, skip);
119  }
120  point++;
121  filtcolum(point, y, skip);
122  point++;
123  filtcolum(point, y, skip);
124  point++;
125  filtcolum(point, y, skip);
126  point++;
127  }
128  if (pointf) {
129  if (ibuf->planes > 24) {
130  filtcolumf(pointf, y, skip);
131  }
132  pointf++;
133  filtcolumf(pointf, y, skip);
134  pointf++;
135  filtcolumf(pointf, y, skip);
136  pointf++;
137  filtcolumf(pointf, y, skip);
138  pointf++;
139  }
140  }
141 }
142 
143 void imb_filterx(struct ImBuf *ibuf)
144 {
145  unsigned char *point;
146  float *pointf;
147  int x, y, skip;
148 
149  point = (unsigned char *)ibuf->rect;
150  pointf = ibuf->rect_float;
151 
152  x = ibuf->x;
153  y = ibuf->y;
154  skip = (x << 2) - 3;
155 
156  for (; y > 0; y--) {
157  if (point) {
158  if (ibuf->planes > 24) {
159  filtrow(point, x);
160  }
161  point++;
162  filtrow(point, x);
163  point++;
164  filtrow(point, x);
165  point++;
166  filtrow(point, x);
167  point += skip;
168  }
169  if (pointf) {
170  if (ibuf->planes > 24) {
171  filtrowf(pointf, x);
172  }
173  pointf++;
174  filtrowf(pointf, x);
175  pointf++;
176  filtrowf(pointf, x);
177  pointf++;
178  filtrowf(pointf, x);
179  pointf += skip;
180  }
181  }
182 }
183 
184 static void imb_filterN(ImBuf *out, ImBuf *in)
185 {
186  BLI_assert(out->channels == in->channels);
187  BLI_assert(out->x == in->x && out->y == in->y);
188 
189  const int channels = in->channels;
190  const int rowlen = in->x;
191 
192  if (in->rect && out->rect) {
193  for (int y = 0; y < in->y; y++) {
194  /* setup rows */
195  const char *row2 = (const char *)in->rect + y * channels * rowlen;
196  const char *row1 = (y == 0) ? row2 : row2 - channels * rowlen;
197  const char *row3 = (y == in->y - 1) ? row2 : row2 + channels * rowlen;
198 
199  char *cp = (char *)out->rect + y * channels * rowlen;
200 
201  for (int x = 0; x < rowlen; x++) {
202  const char *r11, *r13, *r21, *r23, *r31, *r33;
203 
204  if (x == 0) {
205  r11 = row1;
206  r21 = row2;
207  r31 = row3;
208  }
209  else {
210  r11 = row1 - channels;
211  r21 = row2 - channels;
212  r31 = row3 - channels;
213  }
214 
215  if (x == rowlen - 1) {
216  r13 = row1;
217  r23 = row2;
218  r33 = row3;
219  }
220  else {
221  r13 = row1 + channels;
222  r23 = row2 + channels;
223  r33 = row3 + channels;
224  }
225 
226  cp[0] = (r11[0] + 2 * row1[0] + r13[0] + 2 * r21[0] + 4 * row2[0] + 2 * r23[0] + r31[0] +
227  2 * row3[0] + r33[0]) >>
228  4;
229  cp[1] = (r11[1] + 2 * row1[1] + r13[1] + 2 * r21[1] + 4 * row2[1] + 2 * r23[1] + r31[1] +
230  2 * row3[1] + r33[1]) >>
231  4;
232  cp[2] = (r11[2] + 2 * row1[2] + r13[2] + 2 * r21[2] + 4 * row2[2] + 2 * r23[2] + r31[2] +
233  2 * row3[2] + r33[2]) >>
234  4;
235  cp[3] = (r11[3] + 2 * row1[3] + r13[3] + 2 * r21[3] + 4 * row2[3] + 2 * r23[3] + r31[3] +
236  2 * row3[3] + r33[3]) >>
237  4;
238  cp += channels;
239  row1 += channels;
240  row2 += channels;
241  row3 += channels;
242  }
243  }
244  }
245 
246  if (in->rect_float && out->rect_float) {
247  for (int y = 0; y < in->y; y++) {
248  /* setup rows */
249  const float *row2 = (const float *)in->rect_float + y * channels * rowlen;
250  const float *row1 = (y == 0) ? row2 : row2 - channels * rowlen;
251  const float *row3 = (y == in->y - 1) ? row2 : row2 + channels * rowlen;
252 
253  float *cp = (float *)out->rect_float + y * channels * rowlen;
254 
255  for (int x = 0; x < rowlen; x++) {
256  const float *r11, *r13, *r21, *r23, *r31, *r33;
257 
258  if (x == 0) {
259  r11 = row1;
260  r21 = row2;
261  r31 = row3;
262  }
263  else {
264  r11 = row1 - channels;
265  r21 = row2 - channels;
266  r31 = row3 - channels;
267  }
268 
269  if (x == rowlen - 1) {
270  r13 = row1;
271  r23 = row2;
272  r33 = row3;
273  }
274  else {
275  r13 = row1 + channels;
276  r23 = row2 + channels;
277  r33 = row3 + channels;
278  }
279 
280  cp[0] = (r11[0] + 2 * row1[0] + r13[0] + 2 * r21[0] + 4 * row2[0] + 2 * r23[0] + r31[0] +
281  2 * row3[0] + r33[0]) *
282  (1.0f / 16.0f);
283  cp[1] = (r11[1] + 2 * row1[1] + r13[1] + 2 * r21[1] + 4 * row2[1] + 2 * r23[1] + r31[1] +
284  2 * row3[1] + r33[1]) *
285  (1.0f / 16.0f);
286  cp[2] = (r11[2] + 2 * row1[2] + r13[2] + 2 * r21[2] + 4 * row2[2] + 2 * r23[2] + r31[2] +
287  2 * row3[2] + r33[2]) *
288  (1.0f / 16.0f);
289  cp[3] = (r11[3] + 2 * row1[3] + r13[3] + 2 * r21[3] + 4 * row2[3] + 2 * r23[3] + r31[3] +
290  2 * row3[3] + r33[3]) *
291  (1.0f / 16.0f);
292  cp += channels;
293  row1 += channels;
294  row2 += channels;
295  row3 += channels;
296  }
297  }
298  }
299 }
300 
301 void IMB_filter(struct ImBuf *ibuf)
302 {
303  IMB_filtery(ibuf);
304  imb_filterx(ibuf);
305 }
306 
308 {
309  const char *row1, *row2, *row3;
310  int rowlen, x, y;
311  char *temprect;
312 
313  rowlen = width;
314 
315  /* make a copy, to prevent flooding */
316  temprect = MEM_dupallocN(mask);
317 
318  for (y = 1; y <= height; y++) {
319  /* setup rows */
320  row1 = (char *)(temprect + (y - 2) * rowlen);
321  row2 = row1 + rowlen;
322  row3 = row2 + rowlen;
323  if (y == 1) {
324  row1 = row2;
325  }
326  else if (y == height) {
327  row3 = row2;
328  }
329 
330  for (x = 0; x < rowlen; x++) {
331  if (mask[((y - 1) * rowlen) + x] == 0) {
332  if (*row1 || *row2 || *row3 || *(row1 + 1) || *(row3 + 1)) {
333  mask[((y - 1) * rowlen) + x] = FILTER_MASK_MARGIN;
334  }
335  else if ((x != rowlen - 1) && (*(row1 + 2) || *(row2 + 2) || *(row3 + 2))) {
336  mask[((y - 1) * rowlen) + x] = FILTER_MASK_MARGIN;
337  }
338  }
339 
340  if (x != 0) {
341  row1++;
342  row2++;
343  row3++;
344  }
345  }
346  }
347 
348  MEM_freeN(temprect);
349 }
350 
351 void IMB_mask_clear(ImBuf *ibuf, const char *mask, int val)
352 {
353  int x, y;
354  if (ibuf->rect_float) {
355  for (x = 0; x < ibuf->x; x++) {
356  for (y = 0; y < ibuf->y; y++) {
357  if (mask[ibuf->x * y + x] == val) {
358  float *col = ibuf->rect_float + 4 * (ibuf->x * y + x);
359  col[0] = col[1] = col[2] = col[3] = 0.0f;
360  }
361  }
362  }
363  }
364  else {
365  /* char buffer */
366  for (x = 0; x < ibuf->x; x++) {
367  for (y = 0; y < ibuf->y; y++) {
368  if (mask[ibuf->x * y + x] == val) {
369  char *col = (char *)(ibuf->rect + ibuf->x * y + x);
370  col[0] = col[1] = col[2] = col[3] = 0;
371  }
372  }
373  }
374  }
375 }
376 
377 static int filter_make_index(const int x, const int y, const int w, const int h)
378 {
379  if (x < 0 || x >= w || y < 0 || y >= h) {
380  return -1; /* return bad index */
381  }
382 
383  return y * w + x;
384 }
385 
387  const void *buffer, const char *mask, const int index, const int depth, const bool is_float)
388 {
389  int res = 0;
390 
391  if (index >= 0) {
392  const int alpha_index = depth * index + (depth - 1);
393 
394  if (mask != NULL) {
395  res = mask[index] != 0 ? 1 : 0;
396  }
397  else if ((is_float && ((const float *)buffer)[alpha_index] != 0.0f) ||
398  (!is_float && ((const unsigned char *)buffer)[alpha_index] != 0)) {
399  res = 1;
400  }
401  }
402 
403  return res;
404 }
405 
406 void IMB_filter_extend(struct ImBuf *ibuf, char *mask, int filter)
407 {
408  const int width = ibuf->x;
409  const int height = ibuf->y;
410  const int depth = 4; /* always 4 channels */
411  const int chsize = ibuf->rect_float ? sizeof(float) : sizeof(unsigned char);
412  const size_t bsize = ((size_t)width) * height * depth * chsize;
413  const bool is_float = (ibuf->rect_float != NULL);
414  void *dstbuf = (void *)MEM_dupallocN(ibuf->rect_float ? (void *)ibuf->rect_float :
415  (void *)ibuf->rect);
416  char *dstmask = mask == NULL ? NULL : (char *)MEM_dupallocN(mask);
417  void *srcbuf = ibuf->rect_float ? (void *)ibuf->rect_float : (void *)ibuf->rect;
418  char *srcmask = mask;
419  int cannot_early_out = 1, r, n, k, i, j, c;
420  float weight[25];
421 
422  /* build a weights buffer */
423  n = 1;
424 
425 #if 0
426  k = 0;
427  for (i = -n; i <= n; i++) {
428  for (j = -n; j <= n; j++) {
429  weight[k++] = sqrt((float)i * i + j * j);
430  }
431  }
432 #endif
433 
434  weight[0] = 1;
435  weight[1] = 2;
436  weight[2] = 1;
437  weight[3] = 2;
438  weight[4] = 0;
439  weight[5] = 2;
440  weight[6] = 1;
441  weight[7] = 2;
442  weight[8] = 1;
443 
444  /* run passes */
445  for (r = 0; cannot_early_out == 1 && r < filter; r++) {
446  int x, y;
447  cannot_early_out = 0;
448 
449  for (y = 0; y < height; y++) {
450  for (x = 0; x < width; x++) {
451  const int index = filter_make_index(x, y, width, height);
452 
453  /* only update unassigned pixels */
454  if (!check_pixel_assigned(srcbuf, srcmask, index, depth, is_float)) {
455  float tmp[4];
456  float wsum = 0;
457  float acc[4] = {0, 0, 0, 0};
458  k = 0;
459 
461  srcbuf, srcmask, filter_make_index(x - 1, y, width, height), depth, is_float) ||
463  srcbuf, srcmask, filter_make_index(x + 1, y, width, height), depth, is_float) ||
465  srcbuf, srcmask, filter_make_index(x, y - 1, width, height), depth, is_float) ||
467  srcbuf, srcmask, filter_make_index(x, y + 1, width, height), depth, is_float)) {
468  for (i = -n; i <= n; i++) {
469  for (j = -n; j <= n; j++) {
470  if (i != 0 || j != 0) {
471  const int tmpindex = filter_make_index(x + i, y + j, width, height);
472 
473  if (check_pixel_assigned(srcbuf, srcmask, tmpindex, depth, is_float)) {
474  if (is_float) {
475  for (c = 0; c < depth; c++) {
476  tmp[c] = ((const float *)srcbuf)[depth * tmpindex + c];
477  }
478  }
479  else {
480  for (c = 0; c < depth; c++) {
481  tmp[c] = (float)((const unsigned char *)srcbuf)[depth * tmpindex + c];
482  }
483  }
484 
485  wsum += weight[k];
486 
487  for (c = 0; c < depth; c++) {
488  acc[c] += weight[k] * tmp[c];
489  }
490  }
491  }
492  k++;
493  }
494  }
495 
496  if (wsum != 0) {
497  for (c = 0; c < depth; c++) {
498  acc[c] /= wsum;
499  }
500 
501  if (is_float) {
502  for (c = 0; c < depth; c++) {
503  ((float *)dstbuf)[depth * index + c] = acc[c];
504  }
505  }
506  else {
507  for (c = 0; c < depth; c++) {
508  ((unsigned char *)dstbuf)[depth * index + c] =
509  acc[c] > 255 ? 255 : (acc[c] < 0 ? 0 : (unsigned char)roundf(acc[c]));
510  }
511  }
512 
513  if (dstmask != NULL) {
514  dstmask[index] = FILTER_MASK_MARGIN; /* assigned */
515  }
516  cannot_early_out = 1;
517  }
518  }
519  }
520  }
521  }
522 
523  /* keep the original buffer up to date. */
524  memcpy(srcbuf, dstbuf, bsize);
525  if (dstmask != NULL) {
526  memcpy(srcmask, dstmask, ((size_t)width) * height);
527  }
528  }
529 
530  /* free memory */
531  MEM_freeN(dstbuf);
532  if (dstmask != NULL) {
533  MEM_freeN(dstmask);
534  }
535 }
536 
537 void IMB_remakemipmap(ImBuf *ibuf, int use_filter)
538 {
539  ImBuf *hbuf = ibuf;
540  int curmap = 0;
541 
542  ibuf->miptot = 1;
543 
544  while (curmap < IMB_MIPMAP_LEVELS) {
545 
546  if (ibuf->mipmap[curmap]) {
547 
548  if (use_filter) {
549  ImBuf *nbuf = IMB_allocImBuf(hbuf->x, hbuf->y, hbuf->planes, hbuf->flags);
550  imb_filterN(nbuf, hbuf);
551  imb_onehalf_no_alloc(ibuf->mipmap[curmap], nbuf);
552  IMB_freeImBuf(nbuf);
553  }
554  else {
555  imb_onehalf_no_alloc(ibuf->mipmap[curmap], hbuf);
556  }
557  }
558 
559  ibuf->miptot = curmap + 2;
560  hbuf = ibuf->mipmap[curmap];
561  if (hbuf) {
562  hbuf->miplevel = curmap + 1;
563  }
564 
565  if (!hbuf || (hbuf->x <= 2 && hbuf->y <= 2)) {
566  break;
567  }
568 
569  curmap++;
570  }
571 }
572 
573 void IMB_makemipmap(ImBuf *ibuf, int use_filter)
574 {
575  ImBuf *hbuf = ibuf;
576  int curmap = 0;
577 
578  imb_freemipmapImBuf(ibuf);
579 
580  /* no mipmap for non RGBA images */
581  if (ibuf->rect_float && ibuf->channels < 4) {
582  return;
583  }
584 
585  ibuf->miptot = 1;
586 
587  while (curmap < IMB_MIPMAP_LEVELS) {
588  if (use_filter) {
589  ImBuf *nbuf = IMB_allocImBuf(hbuf->x, hbuf->y, hbuf->planes, hbuf->flags);
590  imb_filterN(nbuf, hbuf);
591  ibuf->mipmap[curmap] = IMB_onehalf(nbuf);
592  IMB_freeImBuf(nbuf);
593  }
594  else {
595  ibuf->mipmap[curmap] = IMB_onehalf(hbuf);
596  }
597 
598  ibuf->miptot = curmap + 2;
599  hbuf = ibuf->mipmap[curmap];
600  hbuf->miplevel = curmap + 1;
601 
602  if (hbuf->x < 2 && hbuf->y < 2) {
603  break;
604  }
605 
606  curmap++;
607  }
608 }
609 
610 ImBuf *IMB_getmipmap(ImBuf *ibuf, int level)
611 {
612  CLAMP(level, 0, ibuf->miptot - 1);
613  return (level == 0) ? ibuf : ibuf->mipmap[level - 1];
614 }
615 
616 void IMB_premultiply_rect(unsigned int *rect, char planes, int w, int h)
617 {
618  char *cp;
619  int x, y, val;
620 
621  if (planes == 24) { /* put alpha at 255 */
622  cp = (char *)(rect);
623 
624  for (y = 0; y < h; y++) {
625  for (x = 0; x < w; x++, cp += 4) {
626  cp[3] = 255;
627  }
628  }
629  }
630  else {
631  cp = (char *)(rect);
632 
633  for (y = 0; y < h; y++) {
634  for (x = 0; x < w; x++, cp += 4) {
635  val = cp[3];
636  cp[0] = (cp[0] * val) >> 8;
637  cp[1] = (cp[1] * val) >> 8;
638  cp[2] = (cp[2] * val) >> 8;
639  }
640  }
641  }
642 }
643 
644 void IMB_premultiply_rect_float(float *rect_float, int channels, int w, int h)
645 {
646  float val, *cp;
647  int x, y;
648 
649  if (channels == 4) {
650  cp = rect_float;
651  for (y = 0; y < h; y++) {
652  for (x = 0; x < w; x++, cp += 4) {
653  val = cp[3];
654  cp[0] = cp[0] * val;
655  cp[1] = cp[1] * val;
656  cp[2] = cp[2] * val;
657  }
658  }
659  }
660 }
661 
663 {
664  if (ibuf == NULL) {
665  return;
666  }
667 
668  if (ibuf->rect) {
669  IMB_premultiply_rect(ibuf->rect, ibuf->planes, ibuf->x, ibuf->y);
670  }
671 
672  if (ibuf->rect_float) {
673  IMB_premultiply_rect_float(ibuf->rect_float, ibuf->channels, ibuf->x, ibuf->y);
674  }
675 }
676 
677 void IMB_unpremultiply_rect(unsigned int *rect, char planes, int w, int h)
678 {
679  char *cp;
680  int x, y;
681  float val;
682 
683  if (planes == 24) { /* put alpha at 255 */
684  cp = (char *)(rect);
685 
686  for (y = 0; y < h; y++) {
687  for (x = 0; x < w; x++, cp += 4) {
688  cp[3] = 255;
689  }
690  }
691  }
692  else {
693  cp = (char *)(rect);
694 
695  for (y = 0; y < h; y++) {
696  for (x = 0; x < w; x++, cp += 4) {
697  val = cp[3] != 0 ? 1.0f / (float)cp[3] : 1.0f;
698  cp[0] = unit_float_to_uchar_clamp(cp[0] * val);
699  cp[1] = unit_float_to_uchar_clamp(cp[1] * val);
700  cp[2] = unit_float_to_uchar_clamp(cp[2] * val);
701  }
702  }
703  }
704 }
705 
706 void IMB_unpremultiply_rect_float(float *rect_float, int channels, int w, int h)
707 {
708  float val, *fp;
709  int x, y;
710 
711  if (channels == 4) {
712  fp = rect_float;
713  for (y = 0; y < h; y++) {
714  for (x = 0; x < w; x++, fp += 4) {
715  val = fp[3] != 0.0f ? 1.0f / fp[3] : 1.0f;
716  fp[0] = fp[0] * val;
717  fp[1] = fp[1] * val;
718  fp[2] = fp[2] * val;
719  }
720  }
721  }
722 }
723 
725 {
726  if (ibuf == NULL) {
727  return;
728  }
729 
730  if (ibuf->rect) {
731  IMB_unpremultiply_rect(ibuf->rect, ibuf->planes, ibuf->x, ibuf->y);
732  }
733 
734  if (ibuf->rect_float) {
735  IMB_unpremultiply_rect_float(ibuf->rect_float, ibuf->channels, ibuf->x, ibuf->y);
736  }
737 }
typedef float(TangentPoint)[2]
#define BLI_assert(a)
Definition: BLI_assert.h:46
sqrt(x)+1/max(0
_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 height
_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 width
Function declarations for filter.c.
void imb_onehalf_no_alloc(struct ImBuf *ibuf2, struct ImBuf *ibuf1)
Definition: scaling.c:356
struct ImBuf * IMB_onehalf(struct ImBuf *ibuf1)
Definition: scaling.c:433
struct ImBuf * IMB_allocImBuf(unsigned int x, unsigned int y, unsigned char planes, unsigned int flags)
Definition: allocimbuf.c:500
void imb_freemipmapImBuf(struct ImBuf *ibuf)
Definition: allocimbuf.c:64
#define FILTER_MASK_MARGIN
Definition: IMB_imbuf.h:458
Contains defines and structs used throughout the imbuf module.
#define IMB_MIPMAP_LEVELS
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
in reality light always falls off quadratically Particle Retrieve the data of the particle that spawned the object for example to give variation to multiple instances of an object Point Retrieve information about points in a point cloud Retrieve the edges of an object as it appears to Cycles topology will always appear triangulated Convert a blackbody temperature to an RGB value Normal Generate a perturbed normal from an RGB normal map image Typically used for faking highly detailed surfaces Generate an OSL shader from a file or text data block Image Sample an image file as a texture Sky Generate a procedural sky texture Noise Generate fractal Perlin noise Wave Generate procedural bands or rings with noise Voronoi Generate Worley noise based on the distance to random points Typically used to generate textures such as or biological cells Brick Generate a procedural texture producing bricks Texture Retrieve multiple types of texture coordinates nTypically used as inputs for texture nodes Vector Convert a point
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 producing a negative Combine Generate a color from its and blue channels(Deprecated)") DefNode(ShaderNode
SIMD_FORCE_INLINE const btScalar & w() const
Return the w value.
Definition: btQuadWord.h:119
void IMB_premultiply_alpha(ImBuf *ibuf)
Definition: filter.c:662
void IMB_unpremultiply_rect_float(float *rect_float, int channels, int w, int h)
Definition: filter.c:706
void IMB_premultiply_rect_float(float *rect_float, int channels, int w, int h)
Definition: filter.c:644
void IMB_mask_filter_extend(char *mask, int width, int height)
Definition: filter.c:307
void IMB_filtery(struct ImBuf *ibuf)
Definition: filter.c:102
void IMB_makemipmap(ImBuf *ibuf, int use_filter)
Definition: filter.c:573
static void imb_filterN(ImBuf *out, ImBuf *in)
Definition: filter.c:184
void IMB_remakemipmap(ImBuf *ibuf, int use_filter)
Definition: filter.c:537
void IMB_unpremultiply_alpha(ImBuf *ibuf)
Definition: filter.c:724
static void filtcolumf(float *point, int y, int skip)
Definition: filter.c:82
static void filtrowf(float *point, int x)
Definition: filter.c:41
void IMB_mask_clear(ImBuf *ibuf, const char *mask, int val)
Definition: filter.c:351
static void filtcolum(unsigned char *point, int y, int skip)
Definition: filter.c:59
ImBuf * IMB_getmipmap(ImBuf *ibuf, int level)
Definition: filter.c:610
void IMB_filter_extend(struct ImBuf *ibuf, char *mask, int filter)
Definition: filter.c:406
void IMB_premultiply_rect(unsigned int *rect, char planes, int w, int h)
Definition: filter.c:616
void imb_filterx(struct ImBuf *ibuf)
Definition: filter.c:143
void IMB_unpremultiply_rect(unsigned int *rect, char planes, int w, int h)
Definition: filter.c:677
void IMB_filter(struct ImBuf *ibuf)
Definition: filter.c:301
static void filtrow(unsigned char *point, int x)
Definition: filter.c:21
static int filter_make_index(const int x, const int y, const int w, const int h)
Definition: filter.c:377
static int check_pixel_assigned(const void *buffer, const char *mask, const int index, const int depth, const bool is_float)
Definition: filter.c:386
uint col
void IMB_freeImBuf(ImBuf *UNUSED(ibuf))
DO_INLINE void filter(lfVector *V, fmatrix3x3 *S)
ccl_global float * buffer
void(* MEM_freeN)(void *vmemh)
Definition: mallocn.c:27
void *(* MEM_dupallocN)(const void *vmemh)
Definition: mallocn.c:28
MINLINE unsigned char unit_float_to_uchar_clamp(float val)
ccl_device_inline float4 mask(const int4 &mask, const float4 &a)
Definition: math_float4.h:513
static void error(const char *str)
Definition: meshlaplacian.c:51
static unsigned c
Definition: RandGen.cpp:83
static const pxr::TfToken out("out", pxr::TfToken::Immortal)
struct ImBuf * mipmap[IMB_MIPMAP_LEVELS]
int channels
unsigned char planes
unsigned int * rect
int miplevel
float * rect_float