23 unsigned int c1, c2, c3,
error;
28 for (
x--;
x > 0;
x--) {
30 c1 += (c2 << 1) + c3 +
error;
37 *
point = (c1 + (c2 << 1) + c2 + error) >> 2;
47 for (
x--;
x > 0;
x--) {
55 *
point = 0.25f * (c1 + (c2 * 2) + c2);
61 unsigned int c1, c2, c3,
error;
62 unsigned char *point2;
68 for (
y--;
y > 0;
y--) {
71 c1 += (c2 << 1) + c3 +
error;
78 *
point = (c1 + (c2 << 1) + c2 + error) >> 2;
84 float c1, c2, c3, *point2;
89 for (
y--;
y > 0;
y--) {
98 *
point = 0.25f * (c1 + (c2 * 2) + c2);
104 unsigned char *
point;
145 unsigned char *
point;
190 const int rowlen = in->
x;
193 for (
int y = 0;
y < in->
y;
y++) {
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;
201 for (
int x = 0;
x < rowlen;
x++) {
202 const char *r11, *r13, *r21, *r23, *r31, *r33;
215 if (
x == rowlen - 1) {
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]) >>
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]) >>
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]) >>
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]) >>
247 for (
int y = 0;
y < in->
y;
y++) {
250 const float *row1 = (
y == 0) ? row2 : row2 -
channels * rowlen;
251 const float *row3 = (
y == in->
y - 1) ? row2 : row2 +
channels * rowlen;
253 float *cp = (
float *)
out->rect_float +
y *
channels * rowlen;
255 for (
int x = 0;
x < rowlen;
x++) {
256 const float *r11, *r13, *r21, *r23, *r31, *r33;
269 if (
x == rowlen - 1) {
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]) *
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]) *
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]) *
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]) *
309 const char *row1, *row2, *row3;
320 row1 = (
char *)(temprect + (
y - 2) * rowlen);
321 row2 = row1 + rowlen;
322 row3 = row2 + rowlen;
330 for (
x = 0;
x < rowlen;
x++) {
331 if (
mask[((
y - 1) * rowlen) +
x] == 0) {
332 if (*row1 || *row2 || *row3 || *(row1 + 1) || *(row3 + 1)) {
335 else if ((
x != rowlen - 1) && (*(row1 + 2) || *(row2 + 2) || *(row3 + 2))) {
355 for (
x = 0;
x < ibuf->
x;
x++) {
356 for (
y = 0;
y < ibuf->
y;
y++) {
357 if (
mask[ibuf->
x *
y +
x] == val) {
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);
379 if (x < 0 || x >=
w || y < 0 || y >= h) {
387 const void *
buffer,
const char *
mask,
const int index,
const int depth,
const bool is_float)
392 const int alpha_index = depth * index + (depth - 1);
395 res =
mask[index] != 0 ? 1 : 0;
397 else if ((is_float && ((
const float *)
buffer)[alpha_index] != 0.0f) ||
398 (!is_float && ((
const unsigned char *)
buffer)[alpha_index] != 0)) {
408 const int width = ibuf->
x;
411 const int chsize = ibuf->
rect_float ?
sizeof(
float) :
sizeof(
unsigned char);
412 const size_t bsize = ((size_t)
width) *
height * depth * chsize;
418 char *srcmask =
mask;
419 int cannot_early_out = 1,
r, n, k, i, j,
c;
427 for (i = -n; i <= n; i++) {
428 for (j = -n; j <= n; j++) {
429 weight[k++] =
sqrt((
float)i * i + j * j);
445 for (
r = 0; cannot_early_out == 1 &&
r <
filter;
r++) {
447 cannot_early_out = 0;
457 float acc[4] = {0, 0, 0, 0};
468 for (i = -n; i <= n; i++) {
469 for (j = -n; j <= n; j++) {
470 if (i != 0 || j != 0) {
475 for (
c = 0;
c < depth;
c++) {
476 tmp[
c] = ((
const float *)srcbuf)[depth * tmpindex +
c];
480 for (
c = 0;
c < depth;
c++) {
481 tmp[
c] = (
float)((
const unsigned char *)srcbuf)[depth * tmpindex +
c];
487 for (
c = 0;
c < depth;
c++) {
488 acc[
c] += weight[k] * tmp[
c];
497 for (
c = 0;
c < depth;
c++) {
502 for (
c = 0;
c < depth;
c++) {
503 ((
float *)dstbuf)[depth * index +
c] = acc[
c];
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]));
513 if (dstmask !=
NULL) {
516 cannot_early_out = 1;
524 memcpy(srcbuf, dstbuf, bsize);
525 if (dstmask !=
NULL) {
526 memcpy(srcmask, dstmask, ((
size_t)
width) *
height);
532 if (dstmask !=
NULL) {
546 if (ibuf->
mipmap[curmap]) {
559 ibuf->
miptot = curmap + 2;
560 hbuf = ibuf->
mipmap[curmap];
565 if (!hbuf || (hbuf->
x <= 2 && hbuf->
y <= 2)) {
598 ibuf->
miptot = curmap + 2;
599 hbuf = ibuf->
mipmap[curmap];
602 if (hbuf->
x < 2 && hbuf->
y < 2) {
613 return (level == 0) ? ibuf : ibuf->
mipmap[level - 1];
624 for (
y = 0;
y < h;
y++) {
625 for (
x = 0;
x <
w;
x++, cp += 4) {
633 for (
y = 0;
y < h;
y++) {
634 for (
x = 0;
x <
w;
x++, cp += 4) {
636 cp[0] = (cp[0] * val) >> 8;
637 cp[1] = (cp[1] * val) >> 8;
638 cp[2] = (cp[2] * val) >> 8;
651 for (
y = 0;
y < h;
y++) {
652 for (
x = 0;
x <
w;
x++, cp += 4) {
686 for (
y = 0;
y < h;
y++) {
687 for (
x = 0;
x <
w;
x++, cp += 4) {
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;
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;
typedef float(TangentPoint)[2]
_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)
struct ImBuf * IMB_onehalf(struct ImBuf *ibuf1)
struct ImBuf * IMB_allocImBuf(unsigned int x, unsigned int y, unsigned char planes, unsigned int flags)
void imb_freemipmapImBuf(struct ImBuf *ibuf)
#define FILTER_MASK_MARGIN
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.
void IMB_premultiply_alpha(ImBuf *ibuf)
void IMB_unpremultiply_rect_float(float *rect_float, int channels, int w, int h)
void IMB_premultiply_rect_float(float *rect_float, int channels, int w, int h)
void IMB_mask_filter_extend(char *mask, int width, int height)
void IMB_filtery(struct ImBuf *ibuf)
void IMB_makemipmap(ImBuf *ibuf, int use_filter)
static void imb_filterN(ImBuf *out, ImBuf *in)
void IMB_remakemipmap(ImBuf *ibuf, int use_filter)
void IMB_unpremultiply_alpha(ImBuf *ibuf)
static void filtcolumf(float *point, int y, int skip)
static void filtrowf(float *point, int x)
void IMB_mask_clear(ImBuf *ibuf, const char *mask, int val)
static void filtcolum(unsigned char *point, int y, int skip)
ImBuf * IMB_getmipmap(ImBuf *ibuf, int level)
void IMB_filter_extend(struct ImBuf *ibuf, char *mask, int filter)
void IMB_premultiply_rect(unsigned int *rect, char planes, int w, int h)
void imb_filterx(struct ImBuf *ibuf)
void IMB_unpremultiply_rect(unsigned int *rect, char planes, int w, int h)
void IMB_filter(struct ImBuf *ibuf)
static void filtrow(unsigned char *point, int x)
static int filter_make_index(const int x, const int y, const int w, const int h)
static int check_pixel_assigned(const void *buffer, const char *mask, const int index, const int depth, const bool is_float)
void IMB_freeImBuf(ImBuf *UNUSED(ibuf))
DO_INLINE void filter(lfVector *V, fmatrix3x3 *S)
ccl_global float * buffer
void(* MEM_freeN)(void *vmemh)
void *(* MEM_dupallocN)(const void *vmemh)
MINLINE unsigned char unit_float_to_uchar_clamp(float val)
ccl_device_inline float4 mask(const int4 &mask, const float4 &a)
static void error(const char *str)
static const pxr::TfToken out("out", pxr::TfToken::Immortal)
struct ImBuf * mipmap[IMB_MIPMAP_LEVELS]