mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-01-26 17:24:31 +03:00
Moved CLIP definitions into ImagingUtils.h
This commit is contained in:
parent
eebe3ea923
commit
99dcc57720
|
@ -96,8 +96,6 @@
|
|||
|
||||
#undef VERBOSE
|
||||
|
||||
#define CLIP(x) ((x) <= 0 ? 0 : (x) < 256 ? (x) : 255)
|
||||
|
||||
#define B16(p, i) ((((int)p[(i)]) << 8) + p[(i)+1])
|
||||
#define L16(p, i) ((((int)p[(i)+1]) << 8) + p[(i)])
|
||||
#define S16(v) ((v) < 32768 ? (v) : ((v) - 65536))
|
||||
|
@ -744,7 +742,7 @@ _prepare_lut_table(PyObject* table, Py_ssize_t table_size)
|
|||
prepared[i] = table_data[i] * (255 << PRECISION_BITS) + 0.5;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#undef PRECISION_BITS
|
||||
free(table_data);
|
||||
return prepared;
|
||||
|
@ -803,7 +801,7 @@ _color_lut_3d(ImagingObject* self, PyObject* args)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
if ( ! ImagingColorLUT3D_linear(imOut, self->image,
|
||||
if ( ! ImagingColorLUT3D_linear(imOut, self->image,
|
||||
table_channels, size1D, size2D, size3D,
|
||||
prepared_table)) {
|
||||
free(prepared_table);
|
||||
|
|
|
@ -19,9 +19,6 @@
|
|||
#include "Imaging.h"
|
||||
|
||||
|
||||
#define CLIP(x) ((x) <= 0 ? 0 : (x) < 256 ? (x) : 255)
|
||||
|
||||
|
||||
Imaging
|
||||
ImagingGetBand(Imaging imIn, int band)
|
||||
{
|
||||
|
|
|
@ -38,7 +38,6 @@
|
|||
#define MAX(a, b) (a)>(b) ? (a) : (b)
|
||||
#define MIN(a, b) (a)<(b) ? (a) : (b)
|
||||
|
||||
#define CLIP(v) ((v) <= 0 ? 0 : (v) >= 255 ? 255 : (v))
|
||||
#define CLIP16(v) ((v) <= -32768 ? -32768 : (v) >= 32767 ? 32767 : (v))
|
||||
|
||||
/* ITU-R Recommendation 601-2 (assuming nonlinear RGB) */
|
||||
|
|
|
@ -79,7 +79,6 @@ ImagingEffectNoise(int xsize, int ysize, float sigma)
|
|||
Imaging imOut;
|
||||
int x, y;
|
||||
int nextok;
|
||||
int d;
|
||||
double this, next;
|
||||
|
||||
imOut = ImagingNewDirty("L", xsize, ysize);
|
||||
|
@ -107,8 +106,7 @@ ImagingEffectNoise(int xsize, int ysize, float sigma)
|
|||
this = factor * v1;
|
||||
next = factor * v2;
|
||||
}
|
||||
d = 128 + sigma * this;
|
||||
out[x] = d<0 ? 0 : (d>UCHAR_MAX ? UCHAR_MAX : d);
|
||||
out[x] = CLIP(128 + sigma * this);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -30,6 +30,8 @@
|
|||
(MULDIV255(in1, (255 - mask), tmp1) + in2)
|
||||
|
||||
|
||||
#define CLIP(v) ((v) <= 0 ? 0 : (v) < 256 ? (v) : 255)
|
||||
|
||||
/* This is to work around a bug in GCC prior 4.9 in 64 bit mode.
|
||||
GCC generates code with partial dependency which is 3 times slower.
|
||||
See: http://stackoverflow.com/a/26588074/253146 */
|
||||
|
|
|
@ -45,8 +45,6 @@
|
|||
#define Y 2
|
||||
#define K 3
|
||||
|
||||
#define CLIP(x) ((x) <= 0 ? 0 : (x) < 256 ? (x) : 255)
|
||||
|
||||
/* byte-swapping macros */
|
||||
|
||||
#define C16N\
|
||||
|
|
Loading…
Reference in New Issue
Block a user