From bec01d3b0deb545b04c9377678fe1d4dfdbed159 Mon Sep 17 00:00:00 2001 From: Alexander Date: Thu, 17 Aug 2017 03:23:13 +0300 Subject: [PATCH 1/4] Use ImagingNewDirty when possible --- libImaging/Bands.c | 2 +- libImaging/Chops.c | 50 ++++++++++++++++++++--------------------- libImaging/Effects.c | 14 ++++++------ libImaging/ModeFilter.c | 6 ++--- libImaging/Quant.c | 4 ++-- 5 files changed, 38 insertions(+), 38 deletions(-) diff --git a/libImaging/Bands.c b/libImaging/Bands.c index ef4b2225d..7b1b9231a 100644 --- a/libImaging/Bands.c +++ b/libImaging/Bands.c @@ -91,7 +91,7 @@ ImagingSplit(Imaging imIn, Imaging bands[4]) } for (i = 0; i < imIn->bands; i++) { - bands[i] = ImagingNew("L", imIn->xsize, imIn->ysize); + bands[i] = ImagingNewDirty("L", imIn->xsize, imIn->ysize); if ( ! bands[i]) { for (j = 0; j < i; ++j) { ImagingDelete(bands[j]); diff --git a/libImaging/Chops.c b/libImaging/Chops.c index 73d961231..8059b6ffb 100644 --- a/libImaging/Chops.c +++ b/libImaging/Chops.c @@ -19,41 +19,41 @@ #include "Imaging.h" -#define CHOP(operation, mode)\ +#define CHOP(operation, mode)\ int x, y;\ Imaging imOut;\ imOut = create(imIn1, imIn2, mode);\ if (!imOut)\ - return NULL;\ + return NULL;\ for (y = 0; y < imOut->ysize; y++) {\ - UINT8* out = (UINT8*) imOut->image[y];\ - UINT8* in1 = (UINT8*) imIn1->image[y];\ - UINT8* in2 = (UINT8*) imIn2->image[y];\ - for (x = 0; x < imOut->linesize; x++) {\ - int temp = operation;\ - if (temp <= 0)\ - out[x] = 0;\ - else if (temp >= 255)\ - out[x] = 255;\ - else\ - out[x] = temp;\ - }\ + UINT8* out = (UINT8*) imOut->image[y];\ + UINT8* in1 = (UINT8*) imIn1->image[y];\ + UINT8* in2 = (UINT8*) imIn2->image[y];\ + for (x = 0; x < imOut->linesize; x++) {\ + int temp = operation;\ + if (temp <= 0)\ + out[x] = 0;\ + else if (temp >= 255)\ + out[x] = 255;\ + else\ + out[x] = temp;\ + }\ }\ return imOut; -#define CHOP2(operation, mode)\ +#define CHOP2(operation, mode)\ int x, y;\ Imaging imOut;\ imOut = create(imIn1, imIn2, mode);\ if (!imOut)\ - return NULL;\ + return NULL;\ for (y = 0; y < imOut->ysize; y++) {\ - UINT8* out = (UINT8*) imOut->image[y];\ - UINT8* in1 = (UINT8*) imIn1->image[y];\ - UINT8* in2 = (UINT8*) imIn2->image[y];\ - for (x = 0; x < imOut->linesize; x++) {\ - out[x] = operation;\ - }\ + UINT8* out = (UINT8*) imOut->image[y];\ + UINT8* in1 = (UINT8*) imIn1->image[y];\ + UINT8* in2 = (UINT8*) imIn2->image[y];\ + for (x = 0; x < imOut->linesize; x++) {\ + out[x] = operation;\ + }\ }\ return imOut; @@ -64,15 +64,15 @@ create(Imaging im1, Imaging im2, char* mode) if (!im1 || !im2 || im1->type != IMAGING_TYPE_UINT8 || (mode != NULL && (strcmp(im1->mode, "1") || strcmp(im2->mode, "1")))) - return (Imaging) ImagingError_ModeError(); + return (Imaging) ImagingError_ModeError(); if (im1->type != im2->type || im1->bands != im2->bands) - return (Imaging) ImagingError_Mismatch(); + return (Imaging) ImagingError_Mismatch(); xsize = (im1->xsize < im2->xsize) ? im1->xsize : im2->xsize; ysize = (im1->ysize < im2->ysize) ? im1->ysize : im2->ysize; - return ImagingNew(im1->mode, xsize, ysize); + return ImagingNewDirty(im1->mode, xsize, ysize); } Imaging diff --git a/libImaging/Effects.c b/libImaging/Effects.c index 899fbe637..aeef9d6ca 100644 --- a/libImaging/Effects.c +++ b/libImaging/Effects.c @@ -37,7 +37,7 @@ ImagingEffectMandelbrot(int xsize, int ysize, double extent[4], int quality) if (width < 0.0 || height < 0.0 || quality < 2) return (Imaging) ImagingError_ValueError(NULL); - im = ImagingNew("L", xsize, ysize); + im = ImagingNewDirty("L", xsize, ysize); if (!im) return NULL; @@ -81,7 +81,7 @@ ImagingEffectNoise(int xsize, int ysize, float sigma) int nextok; double this, next; - imOut = ImagingNew("L", xsize, ysize); + imOut = ImagingNewDirty("L", xsize, ysize); if (!imOut) return NULL; @@ -90,7 +90,7 @@ ImagingEffectNoise(int xsize, int ysize, float sigma) for (y = 0; y < imOut->ysize; y++) { UINT8* out = imOut->image8[y]; - for (x = 0; x < imOut->xsize; x++) { + for (x = 0; x < imOut->xsize; x++) { if (nextok) { this = next; nextok = 0; @@ -121,14 +121,14 @@ ImagingEffectSpread(Imaging imIn, int distance) Imaging imOut; int x, y; - imOut = ImagingNew(imIn->mode, imIn->xsize, imIn->ysize); + imOut = ImagingNewDirty(imIn->mode, imIn->xsize, imIn->ysize); if (!imOut) - return NULL; + return NULL; #define SPREAD(type, image)\ - for (y = 0; y < imIn->ysize; y++)\ - for (x = 0; x < imIn->xsize; x++) {\ + for (y = 0; y < imOut->ysize; y++)\ + for (x = 0; x < imOut->xsize; x++) {\ int xx = x + (rand() % distance) - distance/2;\ int yy = y + (rand() % distance) - distance/2;\ if (xx >= 0 && xx < imIn->xsize && yy >= 0 && yy < imIn->ysize) {\ diff --git a/libImaging/ModeFilter.c b/libImaging/ModeFilter.c index b1fc7e8e6..692da86db 100644 --- a/libImaging/ModeFilter.c +++ b/libImaging/ModeFilter.c @@ -26,11 +26,11 @@ ImagingModeFilter(Imaging im, int size) int histogram[256]; if (!im || im->bands != 1 || im->type != IMAGING_TYPE_UINT8) - return (Imaging) ImagingError_ModeError(); + return (Imaging) ImagingError_ModeError(); - imOut = ImagingNew(im->mode, im->xsize, im->ysize); + imOut = ImagingNewDirty(im->mode, im->xsize, im->ysize); if (!imOut) - return NULL; + return NULL; size = size / 2; diff --git a/libImaging/Quant.c b/libImaging/Quant.c index 25aa7f079..df3138162 100644 --- a/libImaging/Quant.c +++ b/libImaging/Quant.c @@ -1642,11 +1642,11 @@ ImagingQuantize(Imaging im, int colors, int mode, int kmeans) ImagingSectionLeave(&cookie); if (result > 0) { - imOut = ImagingNew("P", im->xsize, im->ysize); + imOut = ImagingNewDirty("P", im->xsize, im->ysize); ImagingSectionEnter(&cookie); for (i = y = 0; y < im->ysize; y++) - for (x=0; x < im->xsize; x++) + for (x = 0; x < im->xsize; x++) imOut->image8[y][x] = (unsigned char) newData[i++]; free(newData); From ef1df617f932edb73466af43a946d890f7f81bd4 Mon Sep 17 00:00:00 2001 From: Alexander Date: Tue, 12 Sep 2017 17:35:38 +0300 Subject: [PATCH 2/4] move _i2f to utils --- libImaging/Filter.c | 38 ++++++++------------------------------ libImaging/ImagingUtils.h | 15 +++++++++++++++ 2 files changed, 23 insertions(+), 30 deletions(-) diff --git a/libImaging/Filter.c b/libImaging/Filter.c index aab9cdce7..d7cb0102c 100644 --- a/libImaging/Filter.c +++ b/libImaging/Filter.c @@ -27,13 +27,6 @@ #include "Imaging.h" -#ifdef WORDS_BIGENDIAN - #define MAKE_UINT32(u0, u1, u2, u3) (u3 | (u2<<8) | (u1<<16) | (u0<<24)) -#else - #define MAKE_UINT32(u0, u1, u2, u3) (u0 | (u1<<8) | (u2<<16) | (u3<<24)) -#endif - - static inline UINT8 clip8(float in) { if (in <= 0.0) @@ -91,29 +84,14 @@ ImagingExpand(Imaging imIn, int xmargin, int ymargin, int mode) } -/* This is work around bug in GCC prior 4.9 in 64 bit mode. - GCC generates code with partial dependency which 3 times slower. - See: http://stackoverflow.com/a/26588074/253146 */ -#if defined(__x86_64__) && defined(__SSE__) && ! defined(__NO_INLINE__) && \ - ! defined(__clang__) && defined(GCC_VERSION) && (GCC_VERSION < 40900) -static float __attribute__((always_inline)) inline i2f(int v) { - float x; - __asm__("xorps %0, %0; cvtsi2ss %1, %0" : "=X"(x) : "r"(v) ); - return x; -} -#else -static float inline i2f(int v) { return (float) v; } -#endif - - void ImagingFilter3x3(Imaging imOut, Imaging im, const float* kernel, float offset) { #define KERNEL1x3(in0, x, kernel, d) ( \ - i2f((UINT8) in0[x-d]) * (kernel)[0] + \ - i2f((UINT8) in0[x]) * (kernel)[1] + \ - i2f((UINT8) in0[x+d]) * (kernel)[2]) + _i2f((UINT8) in0[x-d]) * (kernel)[0] + \ + _i2f((UINT8) in0[x]) * (kernel)[1] + \ + _i2f((UINT8) in0[x+d]) * (kernel)[2]) int x = 0, y = 0; @@ -210,11 +188,11 @@ ImagingFilter5x5(Imaging imOut, Imaging im, const float* kernel, float offset) { #define KERNEL1x5(in0, x, kernel, d) ( \ - i2f((UINT8) in0[x-d-d]) * (kernel)[0] + \ - i2f((UINT8) in0[x-d]) * (kernel)[1] + \ - i2f((UINT8) in0[x]) * (kernel)[2] + \ - i2f((UINT8) in0[x+d]) * (kernel)[3] + \ - i2f((UINT8) in0[x+d+d]) * (kernel)[4]) + _i2f((UINT8) in0[x-d-d]) * (kernel)[0] + \ + _i2f((UINT8) in0[x-d]) * (kernel)[1] + \ + _i2f((UINT8) in0[x]) * (kernel)[2] + \ + _i2f((UINT8) in0[x+d]) * (kernel)[3] + \ + _i2f((UINT8) in0[x+d+d]) * (kernel)[4]) int x = 0, y = 0; diff --git a/libImaging/ImagingUtils.h b/libImaging/ImagingUtils.h index 5541fec30..c6d4b765b 100644 --- a/libImaging/ImagingUtils.h +++ b/libImaging/ImagingUtils.h @@ -28,3 +28,18 @@ #define PREBLEND(mask, in1, in2, tmp1)\ (MULDIV255(in1, (255 - mask), tmp1) + in2) + + +/* This is work around bug in GCC prior 4.9 in 64 bit mode. + GCC generates code with partial dependency which 3 times slower. + See: http://stackoverflow.com/a/26588074/253146 */ +#if defined(__x86_64__) && defined(__SSE__) && ! defined(__NO_INLINE__) && \ + ! defined(__clang__) && defined(GCC_VERSION) && (GCC_VERSION < 40900) +static float __attribute__((always_inline)) inline _i2f(int v) { + float x; + __asm__("xorps %0, %0; cvtsi2ss %1, %0" : "=X"(x) : "r"(v) ); + return x; +} +#else +static float inline _i2f(int v) { return (float) v; } +#endif From be02f87ee7de9d45470da09de7ac0e3f142a851b Mon Sep 17 00:00:00 2001 From: Alexander Date: Thu, 14 Sep 2017 14:02:30 +0300 Subject: [PATCH 3/4] fix comment [ci skip] --- libImaging/ImagingUtils.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libImaging/ImagingUtils.h b/libImaging/ImagingUtils.h index c6d4b765b..b040fc303 100644 --- a/libImaging/ImagingUtils.h +++ b/libImaging/ImagingUtils.h @@ -30,8 +30,8 @@ (MULDIV255(in1, (255 - mask), tmp1) + in2) -/* This is work around bug in GCC prior 4.9 in 64 bit mode. - GCC generates code with partial dependency which 3 times slower. +/* 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 */ #if defined(__x86_64__) && defined(__SSE__) && ! defined(__NO_INLINE__) && \ ! defined(__clang__) && defined(GCC_VERSION) && (GCC_VERSION < 40900) From 763df3d90b50c6639201b37e05949d1cf9a838d9 Mon Sep 17 00:00:00 2001 From: Alexander Date: Sat, 16 Sep 2017 20:46:09 +0300 Subject: [PATCH 4/4] Convert tabs to spaces in Imaging.h --- libImaging/Imaging.h | 150 +++++++++++++++++++++---------------------- 1 file changed, 74 insertions(+), 76 deletions(-) diff --git a/libImaging/Imaging.h b/libImaging/Imaging.h index a48d373ee..60c5b4847 100644 --- a/libImaging/Imaging.h +++ b/libImaging/Imaging.h @@ -20,7 +20,7 @@ extern "C" { #ifndef M_PI -#define M_PI 3.1415926535897932384626433832795 +#define M_PI 3.1415926535897932384626433832795 #endif @@ -29,18 +29,18 @@ extern "C" { /* * Image data organization: * - * mode bytes byte order + * mode bytes byte order * ------------------------------- - * 1 1 1 - * L 1 L - * P 1 P + * 1 1 1 + * L 1 L + * P 1 P * I 4 I (32-bit integer, native byte order) * F 4 F (32-bit IEEE float, native byte order) - * RGB 4 R, G, B, - - * RGBA 4 R, G, B, A - * CMYK 4 C, M, Y, K - * YCbCr 4 Y, Cb, Cr, - - * Lab 4 L, a, b, - + * RGB 4 R, G, B, - + * RGBA 4 R, G, B, A + * CMYK 4 C, M, Y, K + * YCbCr 4 Y, Cb, Cr, - + * Lab 4 L, a, b, - * * experimental modes (incomplete): * LA 4 L, -, -, A @@ -78,26 +78,26 @@ typedef struct ImagingPaletteInstance* ImagingPalette; struct ImagingMemoryInstance { /* Format */ - char mode[IMAGING_MODE_LENGTH]; /* Band names ("1", "L", "P", "RGB", "RGBA", "CMYK", "YCbCr", "BGR;xy") */ - int type; /* Data type (IMAGING_TYPE_*) */ - int depth; /* Depth (ignored in this version) */ - int bands; /* Number of bands (1, 2, 3, or 4) */ - int xsize; /* Image dimension. */ + char mode[IMAGING_MODE_LENGTH]; /* Band names ("1", "L", "P", "RGB", "RGBA", "CMYK", "YCbCr", "BGR;xy") */ + int type; /* Data type (IMAGING_TYPE_*) */ + int depth; /* Depth (ignored in this version) */ + int bands; /* Number of bands (1, 2, 3, or 4) */ + int xsize; /* Image dimension. */ int ysize; /* Colour palette (for "P" images only) */ ImagingPalette palette; /* Data pointers */ - UINT8 **image8; /* Set for 8-bit images (pixelsize=1). */ - INT32 **image32; /* Set for 32-bit images (pixelsize=4). */ + UINT8 **image8; /* Set for 8-bit images (pixelsize=1). */ + INT32 **image32; /* Set for 32-bit images (pixelsize=4). */ /* Internals */ - char **image; /* Actual raster data. */ - char *block; /* Set if data is allocated in a single block. */ + char **image; /* Actual raster data. */ + char *block; /* Set if data is allocated in a single block. */ - int pixelsize; /* Size of a pixel, in bytes (1, 2 or 4) */ - int linesize; /* Size of a line, in bytes (xsize * pixelsize) */ + int pixelsize; /* Size of a pixel, in bytes (1, 2 or 4) */ + int linesize; /* Size of a line, in bytes (xsize * pixelsize) */ /* Virtual methods */ void (*destroy)(Imaging im); @@ -130,11 +130,11 @@ struct ImagingAccessInstance { struct ImagingHistogramInstance { /* Format */ - char mode[IMAGING_MODE_LENGTH]; /* Band names (of corresponding source image) */ - int bands; /* Number of bands (1, 3, or 4) */ + char mode[IMAGING_MODE_LENGTH]; /* Band names (of corresponding source image) */ + int bands; /* Number of bands (1, 3, or 4) */ /* Data */ - long *histogram; /* Histogram (bands*256 longs) */ + long *histogram; /* Histogram (bands*256 longs) */ }; @@ -142,13 +142,13 @@ struct ImagingHistogramInstance { struct ImagingPaletteInstance { /* Format */ - char mode[IMAGING_MODE_LENGTH]; /* Band names */ + char mode[IMAGING_MODE_LENGTH]; /* Band names */ /* Data */ UINT8 palette[1024];/* Palette data (same format as image data) */ - INT16* cache; /* Palette cache (used for predefined palettes) */ - int keep_cache; /* This palette will be reused; keep cache */ + INT16* cache; /* Palette cache (used for predefined palettes) */ + int keep_cache; /* This palette will be reused; keep cache */ }; @@ -170,8 +170,8 @@ extern Imaging ImagingNewMap(const char* filename, int readonly, extern Imaging ImagingNewPrologue(const char *mode, int xsize, int ysize); extern Imaging ImagingNewPrologueSubtype(const char *mode, - int xsize, int ysize, - int structure_size); + int xsize, int ysize, + int structure_size); extern void ImagingCopyInfo(Imaging destination, Imaging source); @@ -181,8 +181,6 @@ extern void ImagingAccessInit(void); extern ImagingAccess ImagingAccessNew(Imaging im); extern void _ImagingAccessDelete(Imaging im, ImagingAccess access); #define ImagingAccessDelete(im, access) /* nop, for now */ -/*#define ImagingAccessDelete(im, access) \ - ((access)->dynamic ? _ImagingAccessDelete((im), (access)), 0 : 0)) */ extern ImagingPalette ImagingPaletteNew(const char *mode); extern ImagingPalette ImagingPaletteNewBrowser(void); @@ -191,10 +189,10 @@ extern void ImagingPaletteDelete(ImagingPalette palette); extern int ImagingPaletteCachePrepare(ImagingPalette palette); extern void ImagingPaletteCacheUpdate(ImagingPalette palette, - int r, int g, int b); + int r, int g, int b); extern void ImagingPaletteCacheDelete(ImagingPalette palette); -#define ImagingPaletteCache(p, r, g, b)\ +#define ImagingPaletteCache(p, r, g, b)\ p->cache[(r>>2) + (g>>2)*64 + (b>>2)*64*64] extern Imaging ImagingQuantize(Imaging im, int colours, int mode, int kmeans); @@ -264,14 +262,14 @@ extern Imaging ImagingFilter( extern Imaging ImagingFlipLeftRight(Imaging imOut, Imaging imIn); extern Imaging ImagingFlipTopBottom(Imaging imOut, Imaging imIn); extern Imaging ImagingGaussianBlur(Imaging imOut, Imaging imIn, float radius, - int passes); + int passes); extern Imaging ImagingGetBand(Imaging im, int band); extern Imaging ImagingMerge(const char* mode, Imaging bands[4]); extern int ImagingSplit(Imaging im, Imaging bands[4]); extern int ImagingGetBBox(Imaging im, int bbox[4]); typedef struct { int x, y; INT32 count; INT32 pixel; } ImagingColorItem; extern ImagingColorItem* ImagingGetColors(Imaging im, int maxcolors, - int *colors); + int *colors); extern int ImagingGetExtrema(Imaging im, void *extrema); extern int ImagingGetProjection(Imaging im, UINT8* xproj, UINT8* yproj); extern ImagingHistogram ImagingGetHistogram( @@ -336,7 +334,7 @@ extern int ImagingDrawChord(Imaging im, int x0, int y0, int x1, int y1, extern int ImagingDrawEllipse(Imaging im, int x0, int y0, int x1, int y1, const void* ink, int fill, int op); extern int ImagingDrawLine(Imaging im, int x0, int y0, int x1, int y1, - const void* ink, int op); + const void* ink, int op); extern int ImagingDrawWideLine(Imaging im, int x0, int y0, int x1, int y1, const void* ink, int width, int op); extern int ImagingDrawPieslice(Imaging im, int x0, int y0, int x1, int y1, @@ -344,9 +342,9 @@ extern int ImagingDrawPieslice(Imaging im, int x0, int y0, int x1, int y1, int op); extern int ImagingDrawPoint(Imaging im, int x, int y, const void* ink, int op); extern int ImagingDrawPolygon(Imaging im, int points, int *xy, - const void* ink, int fill, int op); + const void* ink, int fill, int op); extern int ImagingDrawRectangle(Imaging im, int x0, int y0, int x1, int y1, - const void* ink, int fill, int op); + const void* ink, int fill, int op); /* Level 2 graphics (WORK IN PROGRESS) */ extern ImagingOutline ImagingOutlineNew(void); @@ -358,7 +356,7 @@ extern int ImagingDrawOutline(Imaging im, ImagingOutline outline, extern int ImagingOutlineMove(ImagingOutline outline, float x, float y); extern int ImagingOutlineLine(ImagingOutline outline, float x, float y); extern int ImagingOutlineCurve(ImagingOutline outline, float x1, float y1, - float x2, float y2, float x3, float y3); + float x2, float y2, float x3, float y3); extern int ImagingOutlineTransform(ImagingOutline outline, double a[6]); extern int ImagingOutlineClose(ImagingOutline outline); @@ -387,30 +385,30 @@ extern UINT32 ImagingCRC32(UINT32 crc, UINT8* buffer, int bytes); /* Codecs */ typedef struct ImagingCodecStateInstance *ImagingCodecState; typedef int (*ImagingCodec)(Imaging im, ImagingCodecState state, - UINT8* buffer, int bytes); + UINT8* buffer, int bytes); extern int ImagingBcnDecode(Imaging im, ImagingCodecState state, - UINT8* buffer, int bytes); + UINT8* buffer, int bytes); extern int ImagingBitDecode(Imaging im, ImagingCodecState state, - UINT8* buffer, int bytes); + UINT8* buffer, int bytes); extern int ImagingEpsEncode(Imaging im, ImagingCodecState state, - UINT8* buffer, int bytes); + UINT8* buffer, int bytes); extern int ImagingFliDecode(Imaging im, ImagingCodecState state, - UINT8* buffer, int bytes); + UINT8* buffer, int bytes); extern int ImagingGifDecode(Imaging im, ImagingCodecState state, - UINT8* buffer, int bytes); + UINT8* buffer, int bytes); extern int ImagingGifEncode(Imaging im, ImagingCodecState state, - UINT8* buffer, int bytes); + UINT8* buffer, int bytes); extern int ImagingHexDecode(Imaging im, ImagingCodecState state, - UINT8* buffer, int bytes); -#ifdef HAVE_LIBJPEG + UINT8* buffer, int bytes); +#ifdef HAVE_LIBJPEG extern int ImagingJpegDecode(Imaging im, ImagingCodecState state, - UINT8* buffer, int bytes); + UINT8* buffer, int bytes); extern int ImagingJpegDecodeCleanup(ImagingCodecState state); extern int ImagingJpegUseJCSExtensions(void); extern int ImagingJpegEncode(Imaging im, ImagingCodecState state, - UINT8* buffer, int bytes); + UINT8* buffer, int bytes); #endif #ifdef HAVE_OPENJPEG extern int ImagingJpeg2KDecode(Imaging im, ImagingCodecState state, @@ -421,45 +419,45 @@ extern int ImagingJpeg2KEncode(Imaging im, ImagingCodecState state, extern int ImagingJpeg2KEncodeCleanup(ImagingCodecState state); #endif extern int ImagingLzwDecode(Imaging im, ImagingCodecState state, - UINT8* buffer, int bytes); -#ifdef HAVE_LIBTIFF + UINT8* buffer, int bytes); +#ifdef HAVE_LIBTIFF extern int ImagingLibTiffDecode(Imaging im, ImagingCodecState state, - UINT8* buffer, int bytes); + UINT8* buffer, int bytes); extern int ImagingLibTiffEncode(Imaging im, ImagingCodecState state, - UINT8* buffer, int bytes); + UINT8* buffer, int bytes); #endif -#ifdef HAVE_LIBMPEG +#ifdef HAVE_LIBMPEG extern int ImagingMpegDecode(Imaging im, ImagingCodecState state, - UINT8* buffer, int bytes); + UINT8* buffer, int bytes); #endif extern int ImagingMspDecode(Imaging im, ImagingCodecState state, - UINT8* buffer, int bytes); + UINT8* buffer, int bytes); extern int ImagingPackbitsDecode(Imaging im, ImagingCodecState state, - UINT8* buffer, int bytes); + UINT8* buffer, int bytes); extern int ImagingPcdDecode(Imaging im, ImagingCodecState state, - UINT8* buffer, int bytes); + UINT8* buffer, int bytes); extern int ImagingPcxDecode(Imaging im, ImagingCodecState state, - UINT8* buffer, int bytes); + UINT8* buffer, int bytes); extern int ImagingPcxEncode(Imaging im, ImagingCodecState state, - UINT8* buffer, int bytes); + UINT8* buffer, int bytes); extern int ImagingRawDecode(Imaging im, ImagingCodecState state, - UINT8* buffer, int bytes); + UINT8* buffer, int bytes); extern int ImagingRawEncode(Imaging im, ImagingCodecState state, - UINT8* buffer, int bytes); + UINT8* buffer, int bytes); extern int ImagingSunRleDecode(Imaging im, ImagingCodecState state, - UINT8* buffer, int bytes); + UINT8* buffer, int bytes); extern int ImagingTgaRleDecode(Imaging im, ImagingCodecState state, - UINT8* buffer, int bytes); + UINT8* buffer, int bytes); extern int ImagingXbmDecode(Imaging im, ImagingCodecState state, - UINT8* buffer, int bytes); + UINT8* buffer, int bytes); extern int ImagingXbmEncode(Imaging im, ImagingCodecState state, - UINT8* buffer, int bytes); -#ifdef HAVE_LIBZ + UINT8* buffer, int bytes); +#ifdef HAVE_LIBZ extern int ImagingZipDecode(Imaging im, ImagingCodecState state, - UINT8* buffer, int bytes); + UINT8* buffer, int bytes); extern int ImagingZipDecodeCleanup(ImagingCodecState state); extern int ImagingZipEncode(Imaging im, ImagingCodecState state, - UINT8* buffer, int bytes); + UINT8* buffer, int bytes); extern int ImagingZipEncodeCleanup(ImagingCodecState state); #endif @@ -503,12 +501,12 @@ extern Py_ssize_t _imaging_tell_pyFd(PyObject *fd); /* Errcodes */ -#define IMAGING_CODEC_END 1 -#define IMAGING_CODEC_OVERRUN -1 -#define IMAGING_CODEC_BROKEN -2 -#define IMAGING_CODEC_UNKNOWN -3 -#define IMAGING_CODEC_CONFIG -8 -#define IMAGING_CODEC_MEMORY -9 +#define IMAGING_CODEC_END 1 +#define IMAGING_CODEC_OVERRUN -1 +#define IMAGING_CODEC_BROKEN -2 +#define IMAGING_CODEC_UNKNOWN -3 +#define IMAGING_CODEC_CONFIG -8 +#define IMAGING_CODEC_MEMORY -9