do { \
cpl_size x, \
y; \
TYPE *tdata; \
\
tdata = (TYPE*)data; \
\
for (y = 0; y < wdwsize[1]; y++) \
{ \
for (x = 0; x < wdwsize[0]; x++) \
{ \
if (badp == NULL || badp[x] == CPL_BINARY_0) \
{ \
double g; \
if (noise_abs_limit >= 0.0 && fabs(g) > noise_abs_limit) \
g = (g < 0.0 ? -1 : +1) * noise_abs_limit; \
if (type == CPL_TYPE_INT) \
else \
tdata[x] += g; \
} \
} \
tdata += size[0]; \
if (badp != NULL) \
badp += size[0]; \
} \
} while (0)
double clipm_math_rng_gaussian(void)
Generate gaussian-distributed random number.
Definition: clipm_math_rng.c:255
int clipm_math_round_d2i(double in)
Round a double value to the nearest integer.
Definition: clipm_math.c:73