Moved CLIP definitions into ImagingUtils.h

This commit is contained in:
Andrew Murray 2018-04-21 16:35:58 +10:00
parent eebe3ea923
commit 99dcc57720
6 changed files with 5 additions and 13 deletions

View File

@ -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))

View File

@ -19,9 +19,6 @@
#include "Imaging.h"
#define CLIP(x) ((x) <= 0 ? 0 : (x) < 256 ? (x) : 255)
Imaging
ImagingGetBand(Imaging imIn, int band)
{

View File

@ -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) */

View File

@ -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);
}
}

View File

@ -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 */

View File

@ -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\