diff options
author | Thomas Deutschmann <whissi@gentoo.org> | 2021-09-27 11:19:24 +0200 |
---|---|---|
committer | Thomas Deutschmann <whissi@gentoo.org> | 2021-10-20 18:22:47 +0200 |
commit | cc6be9c3577168805ec34b2d396e63361012282b (patch) | |
tree | 7dc794b08a1a6a786d540516c623cb1eebfb1863 /toolbin | |
parent | Import Ghostscript 9.54 (diff) | |
download | ghostscript-gpl-patches-cc6be9c3577168805ec34b2d396e63361012282b.tar.gz ghostscript-gpl-patches-cc6be9c3577168805ec34b2d396e63361012282b.tar.bz2 ghostscript-gpl-patches-cc6be9c3577168805ec34b2d396e63361012282b.zip |
Import Ghostscript 9.55ghostscript-9.55
Signed-off-by: Thomas Deutschmann <whissi@gentoo.org>
Diffstat (limited to 'toolbin')
-rw-r--r-- | toolbin/bmpcmp.c | 442 | ||||
-rw-r--r-- | toolbin/color/icc_creator/nclr/Artifex_6CLR.icc | bin | 0 -> 1523780 bytes | |||
-rw-r--r-- | toolbin/color/src_color/objsrc_profiles_example.txt | 8 | ||||
-rwxr-xr-x | toolbin/headercompile.pl | 12 | ||||
-rwxr-xr-x | toolbin/localcluster/clusterpush.pl | 3 | ||||
-rw-r--r-- | toolbin/tif_config.h.for.bmpcmp | 371 | ||||
-rw-r--r-- | toolbin/tiffconf.h.for.bmpcmp | 122 |
7 files changed, 757 insertions, 201 deletions
diff --git a/toolbin/bmpcmp.c b/toolbin/bmpcmp.c index 78b7ef7b..6bd905bf 100644 --- a/toolbin/bmpcmp.c +++ b/toolbin/bmpcmp.c @@ -97,17 +97,30 @@ typedef struct int lab; } Params; +typedef struct +{ + int width; + int height; + int span; + int bpp; + int cmyk; + void *lab; + /* Below are the entries for handling spot colors and the */ + /* CMYK equivalents (only used for PSD images currently). */ + int *num_spots; + unsigned char *spots; + /* used to map the second file colors to the same colorants */ + /* as the first and issue a warning if they did not match. */ + int *color_map; +} Image; + + typedef struct ImageReader { FILE *file; const char* file_name; void *(*read)(struct ImageReader *, - int *w, - int *h, - int *s, - int *bpp, - int *cmyk, - void **lab); + Image *); } ImageReader; /* @@ -121,10 +134,6 @@ typedef void (DiffFn)(unsigned char *bmp, BBox *bbox, Params *params); -/* Nasty (as if the rest of this code isn't!) global variables for holding - * spot color details. */ -static unsigned char spots[256*4]; -static int spotfill = 0; static void *Malloc(size_t size) { void *block; @@ -384,12 +393,7 @@ static unsigned char *bmp_load_sub(unsigned char *bmp, } static void *bmp_read(ImageReader *im, - int *width, - int *height, - int *span, - int *bpp, - int *cmyk, - void **lab) + Image *img) { int offset; long filelen, filepos; @@ -397,8 +401,8 @@ static void *bmp_read(ImageReader *im, unsigned char *bmp; /* No CMYK bmp support */ - *cmyk = 0; - *lab = NULL; + img->cmyk = 0; + img->lab = NULL; filepos = ftell(im->file); fseek(im->file, 0, SEEK_END); @@ -415,7 +419,7 @@ static void *bmp_read(ImageReader *im, fread(bmp, 1, filelen, im->file); offset = getdword(bmp+10); - data = bmp_load_sub(bmp+14, width, height, span, bpp, offset-14, filelen); + data = bmp_load_sub(bmp+14, &img->width, &img->height, &img->span, &img->bpp, offset-14, filelen); free(bmp); return data; } @@ -465,24 +469,19 @@ static int get_short(FILE *file, int rev) } static void *cups_read(ImageReader *im, - int *width, - int *height, - int *span, - int *bpp, - int *cmyk, - int rev, - void **lab) + Image *img, + int rev) { unsigned char *data, *d; int c, x, y, b, bpc, bpl; int colspace; - *lab = NULL; + img->lab = NULL; if (skip_bytes(im->file, 372) == EOF) return NULL; - *width = get_int(im->file, rev); - *height = get_int(im->file, rev); + img->width = get_int(im->file, rev); + img->height = get_int(im->file, rev); if (skip_bytes(im->file, 4) == EOF) return NULL; bpc = get_int(im->file, rev); @@ -513,14 +512,14 @@ static void *cups_read(ImageReader *im, if (skip_bytes(im->file, 1796-424) == EOF) return NULL; - data = Malloc(*width * *height * 4); - *span = *width * 4; - *bpp = 32; - for (y = *height; y > 0; y--) { + data = Malloc(img->width * img->height * 4); + img->span = img->width * 4; + img->bpp = 32; + for (y = img->height; y > 0; y--) { b = 0; c = 0; - d = data + (y - 1) * *span; - for (x = *width; x > 0; x--) { + d = data + (y - 1) * img->span; + for (x = img->width; x > 0; x--) { b >>= 1; if (b == 0) { c = fgetc(im->file); @@ -540,35 +539,25 @@ static void *cups_read(ImageReader *im, *d++ = 0; } } - skip_bytes(im->file, bpl-((*width+7)>>3)); + skip_bytes(im->file, bpl-((img->width+7)>>3)); } /* No CMYK cups support */ - *cmyk = 0; + img->cmyk = 0; return data; } static void *cups_read_le(ImageReader *im, - int *width, - int *height, - int *span, - int *bpp, - int *cmyk, - void **lab) + Image *img) { - return cups_read(im, width, height, span, bpp, cmyk, 0, lab); + return cups_read(im, img, 0); } static void *cups_read_be(ImageReader *im, - int *width, - int *height, - int *span, - int *bpp, - int *cmyk, - void **lab) + Image *img) { - return cups_read(im, width, height, span, bpp, cmyk, 1, lab); + return cups_read(im, img, 1); } static void skip_to_eol(FILE *file) @@ -981,18 +970,13 @@ static int pam_header_read(FILE *file, } static void *pnm_read(ImageReader *im, - int *width, - int *height, - int *span, - int *bpp, - int *cmyk, - void **lab) + Image *img) { unsigned char *bmp; int c, maxval; void (*read)(FILE *, int, int, int, unsigned char *); - *lab = NULL; + img->lab = NULL; c = fgetc(im->file); /* Skip over any white space before the P */ @@ -1001,7 +985,7 @@ static void *pnm_read(ImageReader *im, } if (c == EOF) return NULL; - *cmyk = 0; + img->cmyk = 0; switch (get_pnm_num(im->file)) { case 1: @@ -1031,22 +1015,22 @@ static void *pnm_read(ImageReader *im, return NULL; } if (read == pam_read) { - *cmyk = pam_header_read(im->file, width, height, &maxval); + img->cmyk = pam_header_read(im->file, &img->width, &img->height, &maxval); } else { - *width = get_pnm_num(im->file); - *height = get_pnm_num(im->file); + img->width = get_pnm_num(im->file); + img->height = get_pnm_num(im->file); if (read != pbm_read) maxval = get_pnm_num(im->file); else maxval = 1; } - *span = *width * 4; - *bpp = 32; /* We always convert to 32bpp */ + img->span = img->width * 4; + img->bpp = 32; /* We always convert to 32bpp */ - bmp = Malloc(*width * *height * 4); + bmp = Malloc(img->width * img->height * 4); - read(im->file, *width, *height, maxval, bmp); + read(im->file, img->width, img->height, maxval, bmp); return bmp; } @@ -1093,12 +1077,7 @@ static toff_t tiff_csize(thandle_t im_) } static void* tif_read(ImageReader* im, - int* im_width, - int* im_height, - int* span, - int* bpp, - int* cmyk, - void **lab) + Image *img) { TIFF* tif; uint16 compression; @@ -1118,7 +1097,7 @@ static void* tif_read(ImageReader* im, cmsContext ctx; #endif - *lab = NULL; + img->lab = NULL; /* There is only one image in each file */ if (ftell(im->file) != 0) @@ -1222,7 +1201,7 @@ static void* tif_read(ImageReader* im, /* Do calloc just to make sure alpha value is known */ data_lab = Calloc(height * width * 4); - *lab = data_lab; + img->lab = data_lab; } #endif @@ -1287,11 +1266,11 @@ static void* tif_read(ImageReader* im, _TIFFfree(buf); TIFFClose(tif); - *im_width = width; - *im_height = height; - *span = width * 4; - *bpp = 32; - *cmyk = num_comps == 4; + img->width = width; + img->height = height; + img->span = width * 4; + img->bpp = 32; + img->cmyk = num_comps == 4; return data; } @@ -1299,12 +1278,7 @@ static void* tif_read(ImageReader* im, #ifdef HAVE_LIBPNG static void *png_read(ImageReader *im, - int *width, - int *height, - int *span, - int *bpp, - int *cmyk, - void **lab) + Image *img) { png_structp png; png_infop info; @@ -1313,7 +1287,7 @@ static void *png_read(ImageReader *im, unsigned char *data; int expand = 0; - *lab = NULL; + img->lab = NULL; /* There is only one image in each file */ if (ftell(im->file) != 0) @@ -1370,28 +1344,23 @@ static void *png_read(ImageReader *im, png_read_end(png, NULL); png_destroy_read_struct(&png, &info, NULL); - *width = w; - *height = h; - *span = (int) stride; - *bpp = (int) (stride * 8) / w; - *cmyk = 0; + img->width = w; + img->height = h; + img->span = (int) stride; + img->bpp = (int) (stride * 8) / w; + img->cmyk = 0; return data; } #endif static void *psd_read(ImageReader *im, - int *width, - int *height, - int *span, - int *bpp, - int *cmyk, - void **lab) -{ - int c, ir_len, w, h, n, x, y, z, N; + Image *img) +{ + int c, ir_len, w, h, span, n, x, y, z, N; unsigned char *bmp, *line, *ptr; int bpc; - *lab = NULL; + img->lab = NULL; if (feof(im->file)) return NULL; @@ -1404,14 +1373,14 @@ static void *psd_read(ImageReader *im, } /* Skip zeros */ - c = get_short(im->file, 1); - c = get_int(im->file, 1); + (void)get_short(im->file, 1); + (void)get_int(im->file, 1); n = get_short(im->file, 1); - *bpp = n * 8; + img->bpp = n * 8; - h = *height = get_int(im->file, 1); - w = *width = get_int(im->file, 1); + h = img->height = get_int(im->file, 1); + w = img->width = get_int(im->file, 1); bpc = get_short(im->file, 1); if (bpc != 8 && bpc != 16) { fprintf(stderr, "bmpcmp: We only support 8bpp or 16bpp psd files!\n"); @@ -1419,19 +1388,19 @@ static void *psd_read(ImageReader *im, } c = get_short(im->file, 1); if (c == 4) { - *cmyk = 1; + img->cmyk = 1; if (n < 4) { fprintf(stderr, "bmpcmp: Unexpected number of components (%d) in a CMYK (+spots) PSD file!\n", n); exit(1); } } else if (c == 3) { - *cmyk = 0; /* RGB */ + img->cmyk = 0; /* RGB */ if (n != 3) { fprintf(stderr, "bmpcmp: Unexpected number of components (%d) in a RGB PSD file!\n", n); exit(1); } } else if (c == 1) { - *cmyk = 0; /* Greyscale */ + img->cmyk = 0; /* Greyscale */ if (n != 1) { fprintf(stderr, "bmpcmp: Unexpected number of components (%d) in a Greyscale PSD file!\n", n); exit(1); @@ -1449,64 +1418,100 @@ static void *psd_read(ImageReader *im, } /* Image Resources section */ - spotfill = 0; ir_len = get_int(im->file, 1); while (ir_len > 0) { - int data_len, pad; - c = fgetc(im->file)<<24; if (--ir_len == 0) break; - c |= fgetc(im->file)<<16; if (--ir_len == 0) break; - c |= fgetc(im->file)<<8; if (--ir_len == 0) break; - c |= fgetc(im->file); if (--ir_len == 0) break; + int data_len; + + if (ir_len < 12) /* enough for "8BIM", short data_type (0x3ef), 2-byte pad, int data_len */ + break; /* not enough data */ + c = get_int(im->file, 1); /* c == 8BIM */ - c = fgetc(im->file)<<8; if (--ir_len == 0) break; - c |= fgetc(im->file); if (--ir_len == 0) break; + c = get_short(im->file, 1); /* Skip the padded id (which will always be 00 00) */ - pad = fgetc(im->file); if (--ir_len == 0) break; - pad |= fgetc(im->file)<<8; if (--ir_len == 0) break; - /* Get the data len */ - data_len = fgetc(im->file)<<24; if (--ir_len == 0) break; - data_len |= fgetc(im->file)<<16; if (--ir_len == 0) break; - data_len |= fgetc(im->file)<<8; if (--ir_len == 0) break; - data_len |= fgetc(im->file); if (--ir_len == 0) break; + (void)get_short(im->file, 1); + data_len = get_int(im->file, 1); + ir_len -= 12; if (c == 0x3ef) { - while (data_len > 0) { + int spotnum = 0; + int i; + + while (data_len > 0) { + unsigned char spot[4]; + + if (ir_len < 14) /* enough for short colorspace, and CMYK data */ + break; /* Read the colorspace */ - c = fgetc(im->file)<<8; if (--ir_len == 0) break; - c |= fgetc(im->file); if (--ir_len == 0) break; + c = get_short(im->file, 1); /* We only support CMYK spots! */ if (c != 2) { fprintf(stderr, "bmpcmp: Spot color equivalent not CMYK! (%d)\n", c); exit(EXIT_FAILURE); } /* c == 2 = COLORSPACE = CMYK */ - /* 16 bits C, 16 bits M, 16 bits Y, 16 bits K */ - spots[spotfill++] = 0xff - fgetc(im->file); if (--ir_len == 0) break; - c = fgetc(im->file); if (--ir_len == 0) break; - spots[spotfill++] = 0xff - fgetc(im->file); if (--ir_len == 0) break; - c = fgetc(im->file); if (--ir_len == 0) break; - spots[spotfill++] = 0xff - fgetc(im->file); if (--ir_len == 0) break; - c = fgetc(im->file); if (--ir_len == 0) break; - spots[spotfill++] = 0xff - fgetc(im->file); if (--ir_len == 0) break; - c = fgetc(im->file); if (--ir_len == 0) break; + /* 16 bits C, 16 bits M, 16 bits Y, 16 bits K, ignore the low byte */ + spot[0] = 0xff - fgetc(im->file); /* high byte of Cyan */ + (void)fgetc(im->file); /* ignore low byte */ + spot[1] = 0xff - fgetc(im->file); /* high byte of Magenta */ + (void)fgetc(im->file); /* ignore low byte */ + spot[2] = 0xff - fgetc(im->file); /* high byte of Yellow */ + (void)fgetc(im->file); /* ignore low byte */ + spot[3] = 0xff - fgetc(im->file); /* high byte of Black */ + (void)fgetc(im->file); /* ignore low byte */ /* 2 bytes opacity (always seems to be 0) */ - c = fgetc(im->file); if (--ir_len == 0) break; - c = fgetc(im->file); if (--ir_len == 0) break; + (void)get_short(im->file, 1); /* 1 byte 'kind' (0 = selected, 1 = protected) */ - c = fgetc(im->file); if (--ir_len == 0) break; + (void)fgetc(im->file); /* 1 byte padding */ - c = fgetc(im->file); if (--ir_len == 0) break; + (void)fgetc(im->file); data_len -= 14; - } - } - if (ir_len > 0) - { - while (data_len > 0) - { - c = fgetc(im->file); if (--ir_len == 0) break; - data_len--; - } + ir_len -= 14; + + /* Check if the spot colorants were filled in by the first image and */ + /* if so, fill in the color_map with the matching spot number. */ + if (*(img->num_spots) == 0) { /* num_spots not updated until finished with this file */ + /* Spots not seen, this must be the first image */ + img->spots[spotnum*4 + 0] = spot[0]; + img->spots[spotnum*4 + 1] = spot[1]; + img->spots[spotnum*4 + 2] = spot[2]; + img->spots[spotnum*4 + 3] = spot[3]; + img->color_map[spotnum + 4] = spotnum + 4; /* default, map to self */ + } else { + /* spots were set by the first file. See if the colorant order matches */ + if (img->spots[spotnum*4 + 0] != spot[0] || img->spots[spotnum*4 + 1] != spot[1] || + img->spots[spotnum*4 + 2] != spot[2] || img->spots[spotnum*4 + 3] != spot[3] ) { + /* This spot didn't match, issue a warning and see if we can map */ + fprintf(stderr, "bmpcmp: spot colorant number %d did not match.\n", spotnum); + for (i=(*(img->num_spots)-1); i >= 0 ; --i) { + if (img->spots[i*4 + 0] == spot[0] && img->spots[i*4 + 1] == spot[1] && + img->spots[i*4 + 2] == spot[2] && img->spots[i*4 + 3] == spot[3]) { + img->color_map[spotnum + 4] = i + 4; + fprintf(stderr, "bmpcmp: spot colorant %d in file 2 matches colorant %d.\n", + spotnum, i); + break; + } + } + if (i < 0) { + /* a match was not found. stop */ + fprintf(stderr, "bmpcmp: no matching colorant found for color_map\n"); + exit(1); + } + } + } + spotnum++; + } + *(img->num_spots) = spotnum; /* save for the next image file */ +#ifdef VERBOSE + fprintf(stderr, "color map:"); + for (i=0; i < 4+nimg->um_spots; i++) + fprintf(stderr, " %d->%d,", i, color_map[i]); + fprintf(stderr, "\n"); +#endif } + /* skip any remaining data */ + ir_len -= data_len; + while (data_len-- > 0) + (void)fgetc(im->file); } /* Skip Layer and Mask section */ @@ -1526,10 +1531,10 @@ static void *psd_read(ImageReader *im, N = n; if (N < 4) N = 4; - *span = (w * N + 3) & ~3; - bmp = Malloc(*span * h); + img->span = span = (w * N + 3) & ~3; + bmp = Malloc(span * h); line = Malloc(w * (bpc>>3)); - ptr = bmp + *span * (h-1); + ptr = bmp + span * (h-1); if (bpc == 8) { if (n == 1) { /* Greyscale */ @@ -1544,10 +1549,10 @@ static void *psd_read(ImageReader *im, *ptr++ = val; *ptr++ = 0; } - ptr -= w*N + *span; + ptr -= w*N + span; line -= w; } - ptr += *span * h + 1; + ptr += span * h + 1; } else if (n == 3) { /* RGB (reverse to get BGR) */ ptr += 2; @@ -1561,10 +1566,10 @@ static void *psd_read(ImageReader *im, *ptr = *line++; ptr += N; } - ptr -= w*N + *span; + ptr -= w*N + span; line -= w; } - ptr += *span * h - 1; + ptr += span * h - 1; } ptr += 4; for (y = 0; y < h; y++) @@ -1574,13 +1579,14 @@ static void *psd_read(ImageReader *im, *ptr = 0; ptr += N; } - ptr -= w*N + *span; + ptr -= w*N + span; } - ptr += *span * h + 1; + ptr += span * h + 1; } else { /* CMYK + (maybe) spots */ for (z = 0; z < n; z++) { + ptr = bmp + img->color_map[z] + span * (h-1); for (y = 0; y < h; y++) { fread(line, 1, w, im->file); @@ -1589,10 +1595,9 @@ static void *psd_read(ImageReader *im, *ptr = 255 - *line++; ptr += n; } - ptr -= w*n + *span; + ptr -= w*n + span; line -= w; } - ptr += *span * h + 1; } } } else { @@ -1611,10 +1616,10 @@ static void *psd_read(ImageReader *im, *ptr++ = val; *ptr++ = 0; } - ptr -= w*N + *span; + ptr -= w*N + span; line -= w*2; } - ptr += *span * h + 1; + ptr += span * h + 1; } else if (n == 3) { /* RGB (reverse to get BGR) */ ptr += 2; @@ -1629,10 +1634,10 @@ static void *psd_read(ImageReader *im, line++; ptr += N; } - ptr -= w*N + *span; + ptr -= w*N + span; line -= w*2; } - ptr += *span * h - 1; + ptr += span * h - 1; } ptr += 4; for (y = 0; y < h; y++) @@ -1642,26 +1647,26 @@ static void *psd_read(ImageReader *im, *ptr = 0; ptr += N; } - ptr -= w*N + *span; + ptr -= w*N + span; } - ptr += *span * h + 1; + ptr += span * h + 1; } else { /* CMYK + (maybe) spots */ for (z = 0; z < n; z++) { + ptr = bmp + img->color_map[z] + span * (h-1); for (y = 0; y < h; y++) { fread(line, 2, w, im->file); for (x = 0; x < w; x++) { *ptr = 255 - *line++; - line++; + line++; /* skip the low byte of data */ ptr += n; } - ptr -= w*n + *span; + ptr -= w*n + span; line -= 2*w; } - ptr += *span * h + 1; } } } @@ -1669,13 +1674,13 @@ static void *psd_read(ImageReader *im, /* Skip over any following header */ if (!feof(im->file)) - c = fgetc(im->file); + (void)fgetc(im->file); if (!feof(im->file)) - c = fgetc(im->file); + (void)fgetc(im->file); if (!feof(im->file)) - c = fgetc(im->file); + (void)fgetc(im->file); if (!feof(im->file)) - c = fgetc(im->file); + (void)fgetc(im->file); return bmp; } @@ -3631,8 +3636,13 @@ static void rediff(unsigned char *map, *global = local; } -static void unspot(unsigned char *bmp, int w, int h, int span, int bpp) +static void unspot(unsigned char *bmp, Image *img) { + int w = img->width; + int h = img->height; + int span = img->span; + int bpp = img->bpp; + unsigned char *spots = img->spots; int x, y, z, n = bpp>>3; unsigned char *p = bmp; @@ -3668,13 +3678,26 @@ static void unspot(unsigned char *bmp, int w, int h, int span, int bpp) } } +static int +is_eof(FILE *file) +{ + int c = fgetc(file); + + if (c == EOF) + return 1; + ungetc(c, file); + return 0; +} + int main(int argc, char *argv[]) { int w, h, s, bpp, cmyk; - int w2, h2, s2, bpp2, cmyk2; + int w2, h2; int nx, ny, n; int xstep, ystep; int imagecount; + Image im1 = { 0 }; + Image im2 = { 0 }; unsigned char *bmp; unsigned char *bmp2; unsigned char *map; @@ -3691,6 +3714,19 @@ int main(int argc, char *argv[]) int can_compare = 1; void *lab1, *lab2; + /* The following is for CMYK+spots (currently only PSD */ + int num_spots = 0; + unsigned char spots[256*4] = { 0 }; /* shared between both images */ + int color_map[256] = { 0, 1, 2, 3, 0 }; + + im1.spots = (unsigned char *)&spots; + im2.spots = (unsigned char *)&spots; + im1.num_spots = &num_spots; + im2.num_spots = &num_spots; + im1.color_map = (int *)&color_map; + im2.color_map = (int *)&color_map; + /* end CMYK+spots section */ + parseArgs(argc, argv, ¶ms); if (params.window <= 1 && params.threshold == 0) { diffFn = simple_diff; @@ -3711,22 +3747,48 @@ int main(int argc, char *argv[]) image_open(&image2, params.filename2); imagecount = 0; - while (((bmp2 = NULL, - bmp = image1.read(&image1, &w, &h, &s, &bpp, &cmyk, &lab1)) != NULL) && - ((bmp2 = image2.read(&image2, &w2, &h2, &s2, &bpp2, &cmyk2, &lab2)) != NULL)) - { + while (!is_eof(image1.file) && !is_eof(image2.file)) { + /* Reset CMYK+spots values for next image (page) in file */ + /* NB: Probably not needed since PSD only supports one image==page */ + num_spots = 0; + memset(spots, 0, sizeof(spots)); + memset(color_map, 0, sizeof(color_map)); + for (n=0; n < 4; n++) + color_map[n] = n; + + bmp2 = NULL; + if ((bmp = image1.read(&image1, &im1)) == NULL) { + fprintf(stderr, "Unable to read image 1, %s, image #%d\n", params.filename1, imagecount+1); + break; + } + + if ((bmp2 = image2.read(&image2, &im2)) == NULL) { + fprintf(stderr, "Unable to read image 2, %s, image #%d\n", params.filename2, imagecount+1); + break; + } imagecount++; /* Check images are compatible */ - if ((w != w2) || (h != h2) || (s != s2) || (bpp != bpp2) || - (cmyk != cmyk2)) + if ((im1.width != im2.width) || + (im1.height != im2.height) || + (im1.span != im2.span) || + (im1.bpp != im2.bpp) || + (im1.cmyk != im2.cmyk)) { fprintf(stderr, "bmpcmp: Page %d: Can't compare images " "(w=%d,%d) (h=%d,%d) (s=%d,%d) (bpp=%d,%d) (cmyk=%d,%d)!\n", - imagecount, w, w2, h, h2, s, s2, bpp, bpp2, cmyk, cmyk2); + imagecount, im1.width, im2.width, im1.height, im2.height, + im1.span, im2.span, im1.bpp, im2.bpp, im1.cmyk, im2.cmyk); can_compare = 0; continue; } + w = im1.width; + h = im1.height; + s = im1.span; + bpp = im1.bpp; + cmyk = im1.cmyk; + lab1 = im1.lab; + lab2 = im2.lab; if (params.lab && (lab1 == NULL || lab2 == NULL)) { fprintf(stderr, "bmpcmp: Lab compare failed (only valid for tiffs with icc profiles)\n"); @@ -3821,10 +3883,10 @@ int main(int argc, char *argv[]) /* bbox */ boxlist = Malloc(sizeof(*boxlist) * nx * ny); - if (bpp >= 32) + if (bpp > 32) { - unspot(bmp, w, h, s, bpp); - unspot(bmp2, w, h, s, bpp); + unspot(bmp, &im1); + unspot(bmp2, &im2); } /* Now save the changed bmps */ @@ -3866,25 +3928,25 @@ int main(int argc, char *argv[]) default: break; } -#ifdef HAVE_LIBPNG + #ifdef HAVE_LIBPNG sprintf(str1, "%s.%05d.png", params.outroot, n); sprintf(str2, "%s.%05d.png", params.outroot, n+1); sprintf(str3, "%s.%05d.png", params.outroot, n+2); save_png(bmp, boxlist, s, bpp, str1); save_png(bmp2, boxlist, s, bpp, str2); -#else + #else sprintf(str1, "%s.%05d.bmp", params.outroot, n); sprintf(str2, "%s.%05d.bmp", params.outroot, n+1); sprintf(str3, "%s.%05d.bmp", params.outroot, n+2); save_bmp(bmp, boxlist, s, bpp, str1); save_bmp(bmp2, boxlist, s, bpp, str2); -#endif + #endif diff_bmp(bmp, map, boxlist, s, w); -#ifdef HAVE_LIBPNG + #ifdef HAVE_LIBPNG save_png(bmp, boxlist, s, bpp, str3); -#else + #else save_bmp(bmp, boxlist, s, bpp, str3); -#endif + #endif sprintf(str4, "%s.%05d.meta", params.outroot, n); save_meta(boxlist, str4, w, h, imagecount, params.threshold, params.window); n += 3; diff --git a/toolbin/color/icc_creator/nclr/Artifex_6CLR.icc b/toolbin/color/icc_creator/nclr/Artifex_6CLR.icc Binary files differnew file mode 100644 index 00000000..11013260 --- /dev/null +++ b/toolbin/color/icc_creator/nclr/Artifex_6CLR.icc diff --git a/toolbin/color/src_color/objsrc_profiles_example.txt b/toolbin/color/src_color/objsrc_profiles_example.txt index 336d9ed0..b3400e42 100644 --- a/toolbin/color/src_color/objsrc_profiles_example.txt +++ b/toolbin/color/src_color/objsrc_profiles_example.txt @@ -1,6 +1,6 @@ -Graphic_CMYK cmyk_src_cyan.icc 0 1 0 0 -Image_CMYK cmyk_src_magenta.icc 0 1 0 0 +Vector_CMYK cmyk_src_cyan.icc 0 1 0 0 +Image_CMYK cmyk_src_magenta.icc 0 1 0 0 Text_CMYK cmyk_src_yellow.icc 0 1 0 0 -Graphic_RGB rgb_source_red.icc 0 1 0 +Vector_RGB rgb_source_red.icc 0 1 0 Image_RGB rgb_source_green.icc 0 1 0 -Text_RGB rgb_source_blue.icc 0 1 0 +Text_RGB rgb_source_blue.icc 0 1 0
\ No newline at end of file diff --git a/toolbin/headercompile.pl b/toolbin/headercompile.pl index 2b3a95b3..2b9c3220 100755 --- a/toolbin/headercompile.pl +++ b/toolbin/headercompile.pl @@ -99,7 +99,7 @@ sub pcompare($$) return $v; } -# main: Work starts here +# main: Work starts here readdeps("base"); readdeps("psi"); @@ -267,7 +267,7 @@ for (my $ui=$mx-1; $ui >= 0; $ui--) { if (!exists $dirs{$f}) { next; } - + $h = $dirs{$f}."/".$f; my $ret = system("cc -DHAVE_INTTYPES_H -Ibase -Ipsi -Ilcms2mt -Ilcms2 -Iopenjpeg/src/lib/openjp2 -Ijpeg -Ijbig2dec -Iobj -o tmp.o $h > tmp.err 2>&1"); @@ -385,9 +385,9 @@ sub rewrite_make($) open(F, "$f") || die "WTF?"; while (<F>) { $_ =~ s/[\r\n]*$//; - if ($_ =~ m/^\# Dependencies:/) { - last; - } + if ($_ =~ m/^\# Dependencies:/) { + last; + } if ($_ =~ m/^([a-z0-9_\-]+_h)=/) { my $f = $1; # Gather up the line, allowing for continuations @@ -406,7 +406,7 @@ sub rewrite_make($) } $_ = $block; } - + my $makefile = 0; if ($_ =~ m/\$\(MAKEFILE\)/) { $makefile = 1; diff --git a/toolbin/localcluster/clusterpush.pl b/toolbin/localcluster/clusterpush.pl index a7d9cb57..2f251551 100755 --- a/toolbin/localcluster/clusterpush.pl +++ b/toolbin/localcluster/clusterpush.pl @@ -28,6 +28,7 @@ my %products=('abort' =>1, 'runtests'=>1, 'extract'=>1, 'extractmu'=>1, + 'muwasm'=>1, 'extractgs'=>1); my $user; @@ -174,7 +175,7 @@ if (!$product) { } elsif ($directory eq 'extract') { $product='extract'; } else { - $product='gs pcl xps gpdl' + $product='gs pcl xps gpdl gpdf' } } diff --git a/toolbin/tif_config.h.for.bmpcmp b/toolbin/tif_config.h.for.bmpcmp new file mode 100644 index 00000000..50159808 --- /dev/null +++ b/toolbin/tif_config.h.for.bmpcmp @@ -0,0 +1,371 @@ +/* libtiff/tif_config.h. Hand edited version for bmpcmp in the cluster. */ + +/* Define if building universal (internal helper macro) */ +/* #undef AC_APPLE_UNIVERSAL_BUILD */ + +/* Support CCITT Group 3 & 4 algorithms */ +#define CCITT_SUPPORT 1 + +/* Pick up YCbCr subsampling info from the JPEG data stream to support files + lacking the tag (default enabled). */ +#define CHECK_JPEG_YCBCR_SUBSAMPLING 1 + +/* enable partial strip reading for large strips (experimental) */ +/* #undef CHUNKY_STRIP_READ_SUPPORT */ + +/* Support C++ stream API (requires C++ compiler) */ +#define CXX_SUPPORT 1 + +/* Treat extra sample as alpha (default enabled). The RGBA interface will + treat a fourth sample with no EXTRASAMPLE_ value as being ASSOCALPHA. Many + packages produce RGBA files but don't mark the alpha properly. */ +#define DEFAULT_EXTRASAMPLE_AS_ALPHA 1 + +/* enable deferred strip/tile offset/size loading */ +/* #undef DEFER_STRILE_LOAD */ + +/* Define to 1 if you have the <assert.h> header file. */ +#define HAVE_ASSERT_H 1 + +/* Define to 1 if you have the declaration of `optarg', and to 0 if you don't. + */ +#define HAVE_DECL_OPTARG 1 + +/* Define to 1 if you have the <dlfcn.h> header file. */ +#define HAVE_DLFCN_H 1 + +/* Define to 1 if you have the <fcntl.h> header file. */ +#define HAVE_FCNTL_H 1 + +/* Define to 1 if fseeko (and presumably ftello) exists and is declared. */ +#define HAVE_FSEEKO 1 + +/* Define to 1 if you have the `getopt' function. */ +#define HAVE_GETOPT 1 + +/* Define to 1 if you have the <GLUT/glut.h> header file. */ +/* #undef HAVE_GLUT_GLUT_H */ + +/* Define to 1 if you have the <GL/glut.h> header file. */ +/* #undef HAVE_GL_GLUT_H */ + +/* Define to 1 if you have the <GL/glu.h> header file. */ +/* #undef HAVE_GL_GLU_H */ + +/* Define to 1 if you have the <GL/gl.h> header file. */ +#define HAVE_GL_GL_H 1 + +/* Define as 0 or 1 according to the floating point format suported by the + machine */ +#define HAVE_IEEEFP 1 + +/* Define to 1 if you have the <inttypes.h> header file. */ +#define HAVE_INTTYPES_H 1 + +/* Define to 1 if you have the <io.h> header file. */ +/* #undef HAVE_IO_H */ + +/* Define to 1 if you have the `jbg_newlen' function. */ +/* #undef HAVE_JBG_NEWLEN */ + +/* Define to 1 if you have the `lfind' function. */ +#define HAVE_LFIND 1 + +/* Define to 1 if you have the <memory.h> header file. */ +#define HAVE_MEMORY_H 1 + +/* Define to 1 if you have the `mmap' function. */ +#define HAVE_MMAP 1 + +/* Define to 1 if you have the <OpenGL/glu.h> header file. */ +/* #undef HAVE_OPENGL_GLU_H */ + +/* Define to 1 if you have the <OpenGL/gl.h> header file. */ +/* #undef HAVE_OPENGL_GL_H */ + +/* Define if you have POSIX threads libraries and header files. */ +#define HAVE_PTHREAD 1 + +/* Define to 1 if you have the <search.h> header file. */ +#define HAVE_SEARCH_H 1 + +/* Define to 1 if you have the `setmode' function. */ +/* #undef HAVE_SETMODE */ + +/* Define to 1 if you have the `snprintf' function. */ +#define HAVE_SNPRINTF 1 + +/* Define to 1 if you have the <stdint.h> header file. */ +#define HAVE_STDINT_H 1 + +/* Define to 1 if you have the <stdlib.h> header file. */ +#define HAVE_STDLIB_H 1 + +/* Define to 1 if you have the `strcasecmp' function. */ +#define HAVE_STRCASECMP 1 + +/* Define to 1 if you have the <strings.h> header file. */ +#define HAVE_STRINGS_H 1 + +/* Define to 1 if you have the <string.h> header file. */ +#define HAVE_STRING_H 1 + +/* Define to 1 if you have the `strtol' function. */ +#define HAVE_STRTOL 1 + +/* Define to 1 if you have the `strtoll' function. */ +#define HAVE_STRTOLL 1 + +/* Define to 1 if you have the `strtoul' function. */ +#define HAVE_STRTOUL 1 + +/* Define to 1 if you have the `strtoull' function. */ +#define HAVE_STRTOULL 1 + +/* Define to 1 if you have the <sys/stat.h> header file. */ +#define HAVE_SYS_STAT_H 1 + +/* Define to 1 if you have the <sys/types.h> header file. */ +#define HAVE_SYS_TYPES_H 1 + +/* Define to 1 if you have the <unistd.h> header file. */ +#define HAVE_UNISTD_H 1 + +/* Use nonstandard varargs form for the GLU tesselator callback */ +/* #undef HAVE_VARARGS_GLU_TESSCB */ + +/* Define to 1 if you have the <windows.h> header file. */ +/* #undef HAVE_WINDOWS_H */ + +/* Native cpu byte order: 1 if big-endian (Motorola) or 0 if little-endian + (Intel) */ +#define HOST_BIGENDIAN 0 + +/* Set the native cpu bit order (FILLORDER_LSB2MSB or FILLORDER_MSB2LSB) */ +#define HOST_FILLORDER FILLORDER_LSB2MSB + +/* Support ISO JBIG compression (requires JBIG-KIT library) */ +#undef JBIG_SUPPORT + +/* 8/12 bit libjpeg dual mode enabled */ +#undef JPEG_DUAL_MODE_8_12 + +/* Support JPEG compression (requires IJG JPEG library) */ +#undef JPEG_SUPPORT + +/* Support libdeflate enhanced compression */ +#undef LIBDEFLATE_SUPPORT + +/* 12bit libjpeg primary include file with path */ +#undef LIBJPEG_12_PATH + +/* Support LogLuv high dynamic range encoding */ +#define LOGLUV_SUPPORT 1 + +/* Define to the sub-directory where libtool stores uninstalled libraries. */ +#define LT_OBJDIR ".libs/" + +/* Support LZMA2 compression */ +/* #undef LZMA_SUPPORT */ + +/* Support LZW algorithm */ +#define LZW_SUPPORT 1 + +/* Support Microsoft Document Imaging format */ +#define MDI_SUPPORT 1 + +/* Support NeXT 2-bit RLE algorithm */ +#define NEXT_SUPPORT 1 + +/* Support Old JPEG compresson (read-only) */ +#undef OJPEG_SUPPORT + +/* Name of package */ +#define PACKAGE "tiff" + +/* Define to the address where bug reports for this package should be sent. */ +#define PACKAGE_BUGREPORT "tiff@lists.maptools.org" + +/* Define to the full name of this package. */ +#define PACKAGE_NAME "LibTIFF Software" + +/* Define to the full name and version of this package. */ +#define PACKAGE_STRING "LibTIFF Software 4.2.0" + +/* Define to the one symbol short name of this package. */ +#define PACKAGE_TARNAME "tiff" + +/* Define to the home page for this package. */ +#define PACKAGE_URL "" + +/* Define to the version of this package. */ +#define PACKAGE_VERSION "4.2.0" + +/* Support Macintosh PackBits algorithm */ +#define PACKBITS_SUPPORT 1 + +/* Support Pixar log-format algorithm (requires Zlib) */ +#define PIXARLOG_SUPPORT 1 + +/* Define to necessary symbol if this constant uses a non-standard name on + your system. */ +/* #undef PTHREAD_CREATE_JOINABLE */ + +/* The size of `signed int', as computed by sizeof. */ +#define SIZEOF_SIGNED_INT 4 + +/* The size of `signed long', as computed by sizeof. */ +#define SIZEOF_SIGNED_LONG 8 + +/* The size of `signed long long', as computed by sizeof. */ +#define SIZEOF_SIGNED_LONG_LONG 8 + +/* The size of `size_t', as computed by sizeof. */ +#define SIZEOF_SIZE_T 8 + +/* The size of `unsigned char *', as computed by sizeof. */ +#define SIZEOF_UNSIGNED_CHAR_P 8 + +/* The size of `unsigned int', as computed by sizeof. */ +#define SIZEOF_UNSIGNED_INT 4 + +/* The size of `unsigned long', as computed by sizeof. */ +#define SIZEOF_UNSIGNED_LONG 8 + +/* The size of `unsigned long long', as computed by sizeof. */ +#define SIZEOF_UNSIGNED_LONG_LONG 8 + +/* Define to 1 if you have the ANSI C header files. */ +#define STDC_HEADERS 1 + +/* Support strip chopping (whether or not to convert single-strip uncompressed + images to mutiple strips of specified size to reduce memory usage) */ +#define STRIPCHOP_DEFAULT TIFF_STRIPCHOP + +/* Default size of the strip in bytes (when strip chopping enabled) */ +#define STRIP_SIZE_DEFAULT 8192 + +/* Enable SubIFD tag (330) support */ +#define SUBIFD_SUPPORT 1 + +/* Support ThunderScan 4-bit RLE algorithm */ +#define THUNDER_SUPPORT 1 + +/* Signed 16-bit type */ +#define TIFF_INT16_T signed short + +/* Signed 32-bit type formatter */ +#define TIFF_INT32_FORMAT "%d" + +/* Signed 32-bit type */ +#define TIFF_INT32_T signed int + +/* Signed 64-bit type formatter */ +#define TIFF_INT64_FORMAT "%ld" + +/* Signed 64-bit type */ +#define TIFF_INT64_T signed long + +/* Signed 8-bit type */ +#define TIFF_INT8_T signed char + +/* Pointer difference type formatter */ +#define TIFF_PTRDIFF_FORMAT "%ld" + +/* Pointer difference type */ +#define TIFF_PTRDIFF_T ptrdiff_t + +/* Size type formatter */ +#define TIFF_SIZE_FORMAT "%lu" + +/* Unsigned size type */ +#define TIFF_SIZE_T unsigned long + +/* Signed size type formatter */ +#define TIFF_SSIZE_FORMAT "%ld" + +/* Signed size type */ +#define TIFF_SSIZE_T signed long + +/* Unsigned 16-bit type */ +#define TIFF_UINT16_T unsigned short + +/* Unsigned 32-bit type formatter */ +#define TIFF_UINT32_FORMAT "%u" + +/* Unsigned 32-bit type */ +#define TIFF_UINT32_T unsigned int + +/* Unsigned 64-bit type formatter */ +#define TIFF_UINT64_FORMAT "%lu" + +/* Unsigned 64-bit type */ +#define TIFF_UINT64_T unsigned long + +/* Unsigned 8-bit type */ +#define TIFF_UINT8_T unsigned char + +/* Define to 1 if you can safely include both <sys/time.h> and <time.h>. */ +#define TIME_WITH_SYS_TIME 1 + +/* Define to 1 if your <sys/time.h> declares `struct tm'. */ +/* #undef TM_IN_SYS_TIME */ + +/* define to use win32 IO system */ +/* #undef USE_WIN32_FILEIO */ + +/* Version number of package */ +#define VERSION "4.2.0" + +/* Support webp compression */ +/* #undef WEBP_SUPPORT */ + +/* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most + significant byte first (like Motorola and SPARC, unlike Intel). */ +#if defined AC_APPLE_UNIVERSAL_BUILD +# if defined __BIG_ENDIAN__ +# define WORDS_BIGENDIAN 1 +# endif +#else +# ifndef WORDS_BIGENDIAN +/* # undef WORDS_BIGENDIAN */ +# endif +#endif + +/* Define to 1 if the X Window System is missing or not being used. */ +/* #undef X_DISPLAY_MISSING */ + +/* Support Deflate compression */ +#define ZIP_SUPPORT 1 + +/* Support zstd compression */ +/* #undef ZSTD_SUPPORT */ + +/* Enable large inode numbers on Mac OS X 10.5. */ +#ifndef _DARWIN_USE_64_BIT_INODE +# define _DARWIN_USE_64_BIT_INODE 1 +#endif + +/* Number of bits in a file offset, on hosts where this is settable. */ +/* #undef _FILE_OFFSET_BITS */ + +/* Define to 1 to make fseeko visible on some hosts (e.g. glibc 2.2). */ +/* #undef _LARGEFILE_SOURCE */ + +/* Define for large files, on AIX-style hosts. */ +/* #undef _LARGE_FILES */ + +/* Define to empty if `const' does not conform to ANSI C. */ +/* #undef const */ + +/* Define to `__inline__' or `__inline' if that's what the C compiler + calls it, or to nothing if 'inline' is not supported under any name. */ +#ifndef __cplusplus +/* #undef inline */ +#endif + +/* Define to `long int' if <sys/types.h> does not define. */ +/* #undef off_t */ + +/* Define to `unsigned int' if <sys/types.h> does not define. */ +/* #undef size_t */ diff --git a/toolbin/tiffconf.h.for.bmpcmp b/toolbin/tiffconf.h.for.bmpcmp new file mode 100644 index 00000000..5827d2ab --- /dev/null +++ b/toolbin/tiffconf.h.for.bmpcmp @@ -0,0 +1,122 @@ +/* libtiff/tiffconf.h. Hand edited version for bmpcmp in the cluster. */ +/* + Configuration defines for installed libtiff. + This file maintained for backward compatibility. Do not use definitions + from this file in your programs. +*/ + +#ifndef _TIFFCONF_ +#define _TIFFCONF_ + +/* Signed 16-bit type */ +#define TIFF_INT16_T signed short + +/* Signed 32-bit type */ +#define TIFF_INT32_T signed int + +/* Signed 64-bit type */ +#define TIFF_INT64_T signed long + +/* Signed 8-bit type */ +#define TIFF_INT8_T signed char + +/* Unsigned 16-bit type */ +#define TIFF_UINT16_T unsigned short + +/* Unsigned 32-bit type */ +#define TIFF_UINT32_T unsigned int + +/* Unsigned 64-bit type */ +#define TIFF_UINT64_T unsigned long + +/* Unsigned 8-bit type */ +#define TIFF_UINT8_T unsigned char + +/* Signed size type */ +#define TIFF_SSIZE_T signed long + +/* Pointer difference type */ +#define TIFF_PTRDIFF_T ptrdiff_t + +/* Compatibility stuff. */ + +/* Define as 0 or 1 according to the floating point format suported by the + machine */ +#define HAVE_IEEEFP 1 + +/* Set the native cpu bit order (FILLORDER_LSB2MSB or FILLORDER_MSB2LSB) */ +#define HOST_FILLORDER FILLORDER_LSB2MSB + +/* Native cpu byte order: 1 if big-endian (Motorola) or 0 if little-endian + (Intel) */ +#define HOST_BIGENDIAN 0 + +/* Support CCITT Group 3 & 4 algorithms */ +#define CCITT_SUPPORT 1 + +/* Support JPEG compression (requires IJG JPEG library) */ +/* #define JPEG_SUPPORT 1 */ + +/* Support JBIG compression (requires JBIG-KIT library) */ +/* #undef JBIG_SUPPORT */ + +/* Support LogLuv high dynamic range encoding */ +#define LOGLUV_SUPPORT 1 + +/* Support LZW algorithm */ +#define LZW_SUPPORT 1 + +/* Support NeXT 2-bit RLE algorithm */ +#define NEXT_SUPPORT 1 + +/* Support Old JPEG compresson (read contrib/ojpeg/README first! Compilation + fails with unpatched IJG JPEG library) */ +/*#define OJPEG_SUPPORT 1*/ + +/* Support Macintosh PackBits algorithm */ +#define PACKBITS_SUPPORT 1 + +/* Support Pixar log-format algorithm (requires Zlib) */ +#define PIXARLOG_SUPPORT 1 + +/* Support ThunderScan 4-bit RLE algorithm */ +#define THUNDER_SUPPORT 1 + +/* Support Deflate compression */ +#define ZIP_SUPPORT 1 + +/* Support libdeflate enhanced compression */ +/* #undef LIBDEFLATE_SUPPORT */ + +/* Support strip chopping (whether or not to convert single-strip uncompressed + images to mutiple strips of ~8Kb to reduce memory usage) */ +#define STRIPCHOP_DEFAULT TIFF_STRIPCHOP + +/* Enable SubIFD tag (330) support */ +#define SUBIFD_SUPPORT 1 + +/* Treat extra sample as alpha (default enabled). The RGBA interface will + treat a fourth sample with no EXTRASAMPLE_ value as being ASSOCALPHA. Many + packages produce RGBA files but don't mark the alpha properly. */ +#define DEFAULT_EXTRASAMPLE_AS_ALPHA 1 + +/* Pick up YCbCr subsampling info from the JPEG data stream to support files + lacking the tag (default enabled). */ +#define CHECK_JPEG_YCBCR_SUBSAMPLING 1 + +/* Support MS MDI magic number files as TIFF */ +#define MDI_SUPPORT 1 + +/* + * Feature support definitions. + * XXX: These macros are obsoleted. Don't use them in your apps! + * Macros stays here for backward compatibility and should be always defined. + */ +#define COLORIMETRY_SUPPORT +#define YCBCR_SUPPORT +#define CMYK_SUPPORT +#define ICC_SUPPORT +#define PHOTOSHOP_SUPPORT +#define IPTC_SUPPORT + +#endif /* _TIFFCONF_ */ |