31 const unsigned int *limask,
32 const unsigned int *lomask,
48 if ((!limask[
x - rw] && lomask[
x - rw]) || (!limask[
x + 1] && lomask[
x + 1])) {
66 if ((!limask[
x - rw] && lomask[
x - rw]) || (!limask[
x - 1] && lomask[
x - 1])) {
84 if ((!limask[
x + rw] && lomask[
x + rw]) || (!limask[
x + 1] && lomask[
x + 1])) {
102 if ((!limask[
x + rw] && lomask[
x + rw]) || (!limask[
x - 1] && lomask[
x - 1])) {
110 else if (lomask[
x]) {
116 for (
x =
t - 1;
x >= (
t - rw) + 2;
x--) {
121 if ((!limask[
x - 1] && lomask[
x - 1]) || (!limask[
x + 1] && lomask[
x + 1])) {
129 else if (lomask[
x]) {
136 for (
x = rw - 2;
x;
x--) {
141 if ((!limask[
x - 1] && lomask[
x - 1]) || (!limask[
x + 1] && lomask[
x + 1])) {
149 else if (lomask[
x]) {
155 for (
x =
t - (rw << 1) + 1;
x >= rw;
x -= rw) {
160 if ((!limask[
x - rw] && lomask[
x - rw]) || (!limask[
x + rw] && lomask[
x + rw])) {
168 else if (lomask[
x]) {
175 for (
x =
t - rw;
x > rw;
x -= rw) {
180 if ((!limask[
x - rw] && lomask[
x - rw]) || (!limask[
x + rw] && lomask[
x + rw])) {
188 else if (lomask[
x]) {
201 const unsigned int *limask,
202 const unsigned int *lomask,
208 unsigned int isz = 0;
209 unsigned int osz = 0;
210 unsigned int gsz = 0;
218 if ((!limask[
x - rw] && lomask[
x - rw]) || (!limask[
x + 1] && lomask[
x + 1])) {
226 else if (lomask[
x]) {
227 if (!lomask[
x - rw] ||
243 if ((!limask[
x - rw] && lomask[
x - rw]) || (!limask[
x - 1] && lomask[
x - 1])) {
251 else if (lomask[
x]) {
252 if (!lomask[
x - rw] ||
268 if ((!limask[
x + rw] && lomask[
x + rw]) || (!limask[
x + 1] && lomask[
x + 1])) {
276 else if (lomask[
x]) {
277 if (!lomask[
x + rw] || !lomask[
x + 1]) {
292 if ((!limask[
x + rw] && lomask[
x + rw]) || (!limask[
x - 1] && lomask[
x - 1])) {
300 else if (lomask[
x]) {
301 if (!lomask[
x + rw] || !lomask[
x - 1]) {
311 for (
x =
t - 1;
x >= (
t - rw) + 2;
x--) {
316 if ((!limask[
x - 1] && lomask[
x - 1]) || (!limask[
x + 1] && lomask[
x + 1])) {
324 else if (lomask[
x]) {
325 if (!lomask[
x - 1] ||
338 for (
x = rw - 2;
x;
x--) {
343 if ((!limask[
x - 1] && lomask[
x - 1]) || (!limask[
x + 1] && lomask[
x + 1])) {
351 else if (lomask[
x]) {
352 if (!lomask[
x - 1] ||
364 for (
x =
t - (rw << 1) + 1;
x >= rw;
x -= rw) {
369 if ((!limask[
x - rw] && lomask[
x - rw]) || (!limask[
x + rw] && lomask[
x + rw])) {
377 else if (lomask[
x]) {
378 if (!lomask[
x - rw] || !lomask[
x + rw]) {
390 for (
x =
t - rw;
x > rw;
x -= rw) {
395 if ((!limask[
x - rw] && lomask[
x - rw]) || (!limask[
x + rw] && lomask[
x + rw])) {
403 else if (lomask[
x]) {
404 if (!lomask[
x - rw] || !lomask[
x + rw]) {
422 const unsigned int *limask,
423 const unsigned int *lomask,
429 unsigned int isz = 0;
430 unsigned int osz = 0;
431 unsigned int gsz = 0;
438 if (!limask[
x - rw] || !limask[
x + 1]) {
446 else if (lomask[
x]) {
455 if (!limask[
x - rw] || !limask[
x - 1]) {
463 else if (lomask[
x]) {
472 if (!limask[
x + rw] || !limask[
x + 1]) {
480 else if (lomask[
x]) {
489 if (!limask[
x + rw] || !limask[
x - 1]) {
497 else if (lomask[
x]) {
503 for (
x =
t - 1;
x >= (
t - rw) + 2;
x--) {
507 if (!limask[
x - 1] || !limask[
x + 1]) {
515 else if (lomask[
x]) {
522 for (
x = rw - 2;
x;
x--) {
526 if (!limask[
x - 1] || !limask[
x + 1]) {
534 else if (lomask[
x]) {
540 for (
x =
t - (rw << 1) + 1;
x >= rw;
x -= rw) {
544 if (!limask[
x - rw] || !limask[
x + rw]) {
552 else if (lomask[
x]) {
559 for (
x =
t - rw;
x > rw;
x -= rw) {
563 if (!limask[
x - rw] || !limask[
x + rw]) {
571 else if (lomask[
x]) {
584 const unsigned int *limask,
585 const unsigned int *lomask,
591 unsigned int isz = 0;
592 unsigned int osz = 0;
593 unsigned int gsz = 0;
600 if (!limask[
x - rw] || !limask[
x + 1]) {
608 else if (lomask[
x]) {
609 if (!lomask[
x - rw] ||
624 if (!limask[
x - rw] || !limask[
x - 1]) {
632 else if (lomask[
x]) {
633 if (!lomask[
x - rw] || !lomask[
x - 1]) {
647 if (!limask[
x + rw] || !limask[
x + 1]) {
655 else if (lomask[
x]) {
656 if (!lomask[
x + rw] ||
671 if (!limask[
x + rw] || !limask[
x - 1]) {
679 else if (lomask[
x]) {
680 if (!lomask[
x + rw] ||
691 for (
x =
t - 1;
x >= (
t - rw) + 2;
x--) {
695 if (!limask[
x - 1] || !limask[
x + 1]) {
703 else if (lomask[
x]) {
704 if (!lomask[
x - 1] ||
717 for (
x = rw - 2;
x;
x--) {
721 if (!limask[
x - 1] || !limask[
x + 1]) {
729 else if (lomask[
x]) {
730 if (!lomask[
x - 1] ||
742 for (
x =
t - (rw << 1) + 1;
x >= rw;
x -= rw) {
746 if (!limask[
x - rw] || !limask[
x + rw]) {
754 else if (lomask[
x]) {
755 if (!lomask[
x - rw] || !lomask[
x + rw]) {
767 for (
x =
t - rw;
x > rw;
x -= rw) {
771 if (!limask[
x - rw] || !limask[
x + rw]) {
779 else if (lomask[
x]) {
780 if (!lomask[
x - rw] || !lomask[
x + rw]) {
798 const unsigned int *limask,
799 const unsigned int *lomask,
815 for (
x = (
t - rw) + 1, dx =
x - (rw - 2); dx > rw;
x -= rw, dx -= rw) {
817 pix_prevRow =
a + rw;
818 pix_nextRow =
a - rw;
830 if ((!lomask[pix_nextCol] && !limask[pix_nextCol]) ||
831 (!lomask[pix_prevCol] && !limask[pix_prevCol]) ||
832 (!lomask[pix_nextRow] && !limask[pix_nextRow]) ||
833 (!lomask[pix_prevRow] && !limask[pix_prevRow])) {
844 if (!limask[pix_nextCol] || !limask[pix_prevCol] || !limask[pix_nextRow] ||
845 !limask[pix_prevRow]) {
868 const unsigned int *limask,
869 const unsigned int *lomask,
885 for (
x = (
t - rw) + 1, dx =
x - (rw - 2); dx > rw;
x -= rw, dx -= rw) {
887 pix_prevRow =
a + rw;
888 pix_nextRow =
a - rw;
900 if ((!lomask[pix_nextCol] && !limask[pix_nextCol]) ||
901 (!lomask[pix_prevCol] && !limask[pix_prevCol]) ||
902 (!lomask[pix_nextRow] && !limask[pix_nextRow]) ||
903 (!lomask[pix_prevRow] && !limask[pix_prevRow])) {
914 if ((!limask[pix_nextCol] && lomask[pix_nextCol]) ||
915 (!limask[pix_prevCol] && lomask[pix_prevCol]) ||
916 (!limask[pix_nextRow] && lomask[pix_nextRow]) ||
917 (!limask[pix_prevRow] && lomask[pix_prevRow])) {
940 const unsigned int *lres,
942 unsigned short *gbuf,
943 unsigned int *innerEdgeOffset,
944 unsigned int *outerEdgeOffset,
954 unsigned int gradientFillOffset;
957 unsigned int innerAccum = 0;
959 unsigned int outerAccum = 0;
961 unsigned int gradientAccum = 0;
1028 gradientFillOffset = 0;
1029 *innerEdgeOffset = gradientFillOffset + gsz;
1030 *outerEdgeOffset = (*innerEdgeOffset) + isz;
1032 gradientAccum = gradientFillOffset;
1033 innerAccum = *innerEdgeOffset;
1034 outerAccum = *outerEdgeOffset;
1036 for (
x = 0, dmin = 0;
x <
t;
x += rw, dmin++) {
1037 for (rsl = 0; rsl < rw; rsl++) {
1040 ud = gradientAccum << 1;
1045 else if (lres[
a] == 3) {
1046 ud = outerAccum << 1;
1052 else if (lres[
a] == 4) {
1053 ud = innerAccum << 1;
1065 const unsigned short *gbuf,
1069 unsigned int innerEdgeOffset,
1070 unsigned int outerEdgeOffset)
1077 const float rsopf = 1.5f;
1079 unsigned int gradientFillOffset;
1147 for (
x = gsz - 1;
x >= 0;
x--) {
1148 gradientFillOffset =
x << 1;
1149 t = gbuf[gradientFillOffset];
1150 fsz = gbuf[gradientFillOffset + 1];
1152 for (
a = outerEdgeOffset + osz - 1;
a >= outerEdgeOffset;
1156 dx = fsz - gbuf[ud + 1];
1157 ud = dx * dx + dy * dy;
1162 odist = (
float)(dmin);
1164 rsl = *(
unsigned int *)&odist;
1165 rsl = 0x5f3759df - (rsl >> 1);
1166 odist = *(
float *)&rsl;
1167 odist = odist * (rsopf - (rsf * odist *
1170 for (
a = innerEdgeOffset + isz - 1;
a >= innerEdgeOffset;
1174 dx = fsz - gbuf[ud + 1];
1175 ud = dx * dx + dy * dy;
1180 idist = (
float)(dmin);
1182 rsl = *(
unsigned int *)&idist;
1183 rsl = 0x5f3759df - (rsl >> 1);
1184 idist = *(
float *)&rsl;
1185 idist = idist * (rsopf - (rsf * idist * idist));
1196 res[gbuf[gradientFillOffset + 1] + (gbuf[gradientFillOffset] * rw)] =
1197 (idist / (idist + odist));
1206 unsigned int *limask;
1207 unsigned int *lomask;
1213 unsigned int isz = 0;
1214 unsigned int osz = 0;
1215 unsigned int gsz = 0;
1216 unsigned int rsize[3];
1217 unsigned int innerEdgeOffset =
1219 unsigned int outerEdgeOffset =
1222 unsigned short *gbuf;
1230 sizeof(
float) * (
t + 1));
1232 lres = (
unsigned int *)res;
1233 limask = (
unsigned int *)imask;
1234 lomask = (
unsigned int *)omask;
1261 if (this->m_adjacentOnly) {
1262 if (this->m_keepInside) {
1276 if (this->m_keepInside) {
1298 fsz = gsz + isz + osz;
1300 gbuf = (
unsigned short *)
MEM_callocN(
sizeof(
unsigned short) * fsz * 2,
"DEM");
1303 t, rw, lres, res, gbuf, &innerEdgeOffset, &outerEdgeOffset, isz, gsz);
1316 this->m_inputInnerMask =
nullptr;
1317 this->m_inputOuterMask =
nullptr;
1318 this->m_adjacentOnly =
false;
1319 this->m_keepInside =
false;
1327 if (this->m_cachedInstance ==
nullptr) {
1344 this->m_cachedInstance =
nullptr;
1349 if (this->m_cachedInstance) {
1350 return this->m_cachedInstance;
1354 if (this->m_cachedInstance ==
nullptr) {
1362 this->m_cachedInstance =
data;
1365 return this->m_cachedInstance;
1371 output[0] =
buffer[index];
1376 this->m_inputInnerMask =
nullptr;
1377 this->m_inputOuterMask =
nullptr;
1379 if (this->m_cachedInstance) {
1381 this->m_cachedInstance =
nullptr;
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 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 GLdouble y2 _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat y2 _GL_VOID_RET _GL_VOID GLint GLint GLint y2 _GL_VOID_RET _GL_VOID GLshort GLshort GLshort y2 _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble z _GL_VOID_RET _GL_VOID GLdouble GLdouble z _GL_VOID_RET _GL_VOID GLuint *buffer _GL_VOID_RET _GL_VOID GLdouble t _GL_VOID_RET _GL_VOID GLfloat t _GL_VOID_RET _GL_VOID GLint t _GL_VOID_RET _GL_VOID GLshort t _GL_VOID_RET _GL_VOID GLdouble t
Read Guarded memory(de)allocation.
void deinitExecution() override
bool determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output) override
DoubleEdgeMaskOperation()
void initExecution() override
void doDoubleEdgeMask(float *imask, float *omask, float *res)
void executePixel(float output[4], int x, int y, void *data) override
void * initializeTileData(rcti *rect) override
a MemoryBuffer contains access to the data of a chunk
float * getBuffer()
get the data of this MemoryBuffer
virtual void * initializeTileData(rcti *)
unsigned int getHeight() const
void addInputSocket(DataType datatype, ResizeMode resize_mode=ResizeMode::Center)
void addOutputSocket(DataType datatype)
unsigned int getWidth() const
SocketReader * getInputSocketReader(unsigned int inputSocketindex)
virtual bool determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output)
__kernel void ccl_constant KernelData ccl_global void ccl_global char ccl_global int ccl_global char ccl_global unsigned int ccl_global float * buffer
void(* MEM_freeN)(void *vmemh)
void *(* MEM_callocN)(size_t len, const char *str)
void *(* MEM_mallocN)(size_t len, const char *str)
static void do_fillGradientBuffer(unsigned int rw, float *res, const unsigned short *gbuf, unsigned int isz, unsigned int osz, unsigned int gsz, unsigned int innerEdgeOffset, unsigned int outerEdgeOffset)
static void do_adjacentKeepBorders(unsigned int t, unsigned int rw, const unsigned int *limask, const unsigned int *lomask, unsigned int *lres, float *res, unsigned int *rsize)
static void do_allEdgeDetection(unsigned int t, unsigned int rw, const unsigned int *limask, const unsigned int *lomask, unsigned int *lres, float *res, unsigned int *rsize, unsigned int in_isz, unsigned int in_osz, unsigned int in_gsz)
static void do_allBleedBorders(unsigned int t, unsigned int rw, const unsigned int *limask, const unsigned int *lomask, unsigned int *lres, float *res, unsigned int *rsize)
static void do_createEdgeLocationBuffer(unsigned int t, unsigned int rw, const unsigned int *lres, float *res, unsigned short *gbuf, unsigned int *innerEdgeOffset, unsigned int *outerEdgeOffset, unsigned int isz, unsigned int gsz)
static void do_adjacentEdgeDetection(unsigned int t, unsigned int rw, const unsigned int *limask, const unsigned int *lomask, unsigned int *lres, float *res, unsigned int *rsize, unsigned int in_isz, unsigned int in_osz, unsigned int in_gsz)
static void do_allKeepBorders(unsigned int t, unsigned int rw, const unsigned int *limask, const unsigned int *lomask, unsigned int *lres, float *res, unsigned int *rsize)
static void do_adjacentBleedBorders(unsigned int t, unsigned int rw, const unsigned int *limask, const unsigned int *lomask, unsigned int *lres, float *res, unsigned int *rsize)