home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.sources.misc
- Path: sparky!kent
- From: cristy@eplrx7.es.duPont.com (John Cristy)
- Subject: v34i088: imagemagick - X11 image processing and display v2.2, Patch02
- Message-ID: <1992Dec27.232211.1662@sparky.imd.sterling.com>
- Followup-To: comp.sources.d
- Summary: X11 image processing and display utilities
- X-Md4-Signature: 302b92355d1dae52f6f0df17254be26e
- Keywords: UNIX VMS X11 SGI DEC Cray Sun Vax
- Sender: kent@sparky.imd.sterling.com (Kent Landfield)
- Organization: DuPont Engineering Physics Laboratory
- References: <csm-v34i028=imagemagick.141926@sparky.IMD.Sterling.COM>
- Date: Sun, 27 Dec 1992 23:22:11 GMT
- Approved: kent@sparky.imd.sterling.com
-
- Submitted-by: cristy@eplrx7.es.duPont.com (John Cristy)
- Posting-number: Volume 34, Issue 88
- Archive-name: imagemagick/patch02
- Environment: UNIX, VMS, X11, SGI, DEC, Cray, Sun, Vax
- Patch-To: imagemagick: Volume 34, Issue 28-54
-
- ImageMagick 2.2 Patch #2
-
- To apply this patch:
-
- cd to the top of the source tree (to the directory containing the
- "ImageMagick" subdirectories) and do:
-
- patch -p < ThisFile
-
- Prereq: ImageMagick 2.2.1 (posted from comp.sources.misc, Volume 34,
- Issue 28 + Patch 1).
-
- Alternatively get the entire distribution as contrib/ImageMagick.tar.Z
- on export.lcs.mit.edu. I will post this patch to comp.sources.misc in
- a few days.
- ------------------
- #! /bin/sh
- # This is a shell archive. Remove anything before this line, then feed it
- # into a shell via "sh file" or similar. To overwrite existing files,
- # type "sh file -c".
- # Contents: fix-02
- # Wrapped by kent@sparky on Sun Dec 27 17:17:45 1992
- PATH=/bin:/usr/bin:/usr/ucb:/usr/local/bin:/usr/lbin ; export PATH
- echo If this archive is complete, you will see the following message:
- echo ' "shar: End of archive."'
- if test -f 'fix-02' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'fix-02'\"
- else
- echo shar: Extracting \"'fix-02'\" \(11479 characters\)
- sed "s/^X//" >'fix-02' <<'END_OF_FILE'
- Xdiff -r -c ImageMagick/ChangeLog ImageMagick2.2.2/ChangeLog
- X*** ImageMagick/ChangeLog Mon Dec 21 14:12:35 1992
- X--- ImageMagick2.2.2/ChangeLog Tue Dec 22 16:07:20 1992
- X***************
- X*** 1,3 ****
- X--- 1,14 ----
- X+ ImageMagick 2.2.2
- X+
- X+ o Dithering did not work properly on the Cray (due to right shift problem).
- X+
- X+ o In most cases dithering requires 1/2 as much memory as previously.
- X+
- X+ o Dithering was sped up by ~15%.
- X+
- X+ o Occasionally the quantization error was reported incorrectly.
- X+
- X+
- X ImageMagick 2.2.1
- X
- X o The number of colors reported with the -verbose option was on
- Xdiff -r -c ImageMagick/X.c ImageMagick2.2.2/X.c
- X*** ImageMagick/X.c Mon Dec 21 14:12:34 1992
- X--- ImageMagick2.2.2/X.c Tue Dec 22 16:06:18 1992
- X***************
- X*** 1283,1291 ****
- X /*
- X Initialize annotated image.
- X */
- X! if (image->packets != (image->columns*image->rows))
- X! if (!UncompressImage(image))
- X! return(False);
- X /*
- X Initialize annotated pixmap.
- X */
- X--- 1283,1290 ----
- X /*
- X Initialize annotated image.
- X */
- X! if (!UncompressImage(image))
- X! return(False);
- X /*
- X Initialize annotated pixmap.
- X */
- Xdiff -r -c ImageMagick/display.h ImageMagick2.2.2/display.h
- X*** ImageMagick/display.h Tue Dec 22 16:23:13 1992
- X--- ImageMagick2.2.2/display.h Tue Dec 22 16:23:32 1992
- X***************
- X*** 51,55 ****
- X */
- X #ifndef lint
- X static char
- X! Version[]="@(#)ImageMagick 2.2.1 92/12/10 cristy@dupont.com";
- X #endif
- X--- 51,55 ----
- X */
- X #ifndef lint
- X static char
- X! Version[]="@(#)ImageMagick 2.2.2 92/12/22 cristy@dupont.com";
- X #endif
- Xdiff -r -c ImageMagick/image.c ImageMagick2.2.2/image.c
- X*** ImageMagick/image.c Fri Dec 18 17:07:28 1992
- X--- ImageMagick2.2.2/image.c Tue Dec 22 16:06:19 1992
- X***************
- X*** 731,739 ****
- X /*
- X Image must be uncompressed.
- X */
- X! if (image->packets != (image->columns*image->rows))
- X! if (!UncompressImage(image))
- X! return;
- X if (!image->alpha)
- X {
- X /*
- X--- 731,738 ----
- X /*
- X Image must be uncompressed.
- X */
- X! if (!UncompressImage(image))
- X! return;
- X if (!image->alpha)
- X {
- X /*
- X***************
- X*** 5190,5195 ****
- X--- 5189,5196 ----
- X RunlengthPacket
- X *uncompressed_pixels;
- X
- X+ if (image->packets == (image->columns*image->rows))
- X+ return(True);
- X /*
- X Uncompress runlength-encoded packets.
- X */
- XCommon subdirectories: ImageMagick/images and ImageMagick2.2.2/images
- Xdiff -r -c ImageMagick/quantize.c ImageMagick2.2.2/quantize.c
- X*** ImageMagick/quantize.c Mon Dec 21 11:12:00 1992
- X--- ImageMagick2.2.2/quantize.c Tue Dec 22 16:06:18 1992
- X***************
- X*** 745,753 ****
- X blue;
- X } ScaledColorPacket;
- X
- X- Image
- X- *dithered_image;
- X-
- X int
- X *cache,
- X odd_scanline;
- X--- 745,750 ----
- X***************
- X*** 769,786 ****
- X *cs,
- X *ns;
- X
- X register unsigned int
- X id;
- X
- X- register unsigned short
- X- index;
- X-
- X ScaledColorPacket
- X *scanline;
- X
- X unsigned char
- X! *range_limit,
- X! *range_table;
- X
- X unsigned int
- X i,
- X--- 766,785 ----
- X *cs,
- X *ns;
- X
- X+ register unsigned char
- X+ *range_limit;
- X+
- X register unsigned int
- X id;
- X
- X ScaledColorPacket
- X *scanline;
- X
- X unsigned char
- X! blue,
- X! green,
- X! *range_table,
- X! red;
- X
- X unsigned int
- X i,
- X***************
- X*** 787,803 ****
- X x,
- X y;
- X
- X /*
- X! Initialize dithered image attributes.
- X */
- X! image->orphan=True;
- X! dithered_image=CopyImage(image,image->columns,image->rows,False);
- X! image->orphan=False;
- X! if (dithered_image == (Image *) NULL)
- X! {
- X! Warning("unable to dither image","memory allocation failed");
- X! return(True);
- X! }
- X /*
- X Allocate the cache & scanline buffers to keep track of quantization error.
- X */
- X--- 786,800 ----
- X x,
- X y;
- X
- X+ unsigned short
- X+ index;
- X+
- X /*
- X! Image must be uncompressed.
- X */
- X! if (!UncompressImage(image))
- X! return(True);
- X! image->compression=NoCompression;
- X /*
- X Allocate the cache & scanline buffers to keep track of quantization error.
- X */
- X***************
- X*** 827,846 ****
- X Preload first scanline.
- X */
- X p=image->pixels;
- X- image->runlength=p->length+1;
- X cs=scanline+1;
- X for (i=0; i < image->columns; i++)
- X {
- X- if (image->runlength > 0)
- X- image->runlength--;
- X- else
- X- {
- X- p++;
- X- image->runlength=p->length;
- X- }
- X cs->red=p->red;
- X cs->green=p->green;
- X cs->blue=p->blue;
- X cs++;
- X }
- X odd_scanline=False;
- X--- 824,836 ----
- X Preload first scanline.
- X */
- X p=image->pixels;
- X cs=scanline+1;
- X for (i=0; i < image->columns; i++)
- X {
- X cs->red=p->red;
- X cs->green=p->green;
- X cs->blue=p->blue;
- X+ p++;
- X cs++;
- X }
- X odd_scanline=False;
- X***************
- X*** 856,871 ****
- X ns+=(image->columns+2);
- X for (i=0; i < image->columns; i++)
- X {
- X- if (image->runlength > 0)
- X- image->runlength--;
- X- else
- X- {
- X- p++;
- X- image->runlength=p->length;
- X- }
- X ns->red=p->red;
- X ns->green=p->green;
- X ns->blue=p->blue;
- X ns++;
- X }
- X }
- X--- 846,855 ----
- X ns+=(image->columns+2);
- X for (i=0; i < image->columns; i++)
- X {
- X ns->red=p->red;
- X ns->green=p->green;
- X ns->blue=p->blue;
- X+ p++;
- X ns++;
- X }
- X }
- X***************
- X*** 874,880 ****
- X /*
- X Distribute error left-to-right for even scanlines.
- X */
- X! q=dithered_image->pixels+image->columns*y;
- X cs=scanline+1;
- X ns=scanline+(image->columns+2)+1;
- X step=1;
- X--- 858,864 ----
- X /*
- X Distribute error left-to-right for even scanlines.
- X */
- X! q=image->pixels+image->columns*y;
- X cs=scanline+1;
- X ns=scanline+(image->columns+2)+1;
- X step=1;
- X***************
- X*** 884,890 ****
- X /*
- X Distribute error right-to-left for odd scanlines.
- X */
- X! q=dithered_image->pixels+image->columns*y+(image->columns-1);
- X cs=scanline+(image->columns+2)+(image->columns-1)+1;
- X ns=scanline+(image->columns-1)+1;
- X step=(-1);
- X--- 868,874 ----
- X /*
- X Distribute error right-to-left for odd scanlines.
- X */
- X! q=image->pixels+image->columns*y+(image->columns-1);
- X cs=scanline+(image->columns+2)+(image->columns-1)+1;
- X ns=scanline+(image->columns-1)+1;
- X step=(-1);
- X***************
- X*** 891,900 ****
- X }
- X for (x=0; x < image->columns; x++)
- X {
- X! q->red=range_limit[cs->red];
- X! q->green=range_limit[cs->green];
- X! q->blue=range_limit[cs->blue];
- X! i=(q->red >> 2) << 12 | (q->green >> 2) << 6 | q->blue >> 2;
- X if (cache[i] < 0)
- X {
- X /*
- X--- 875,884 ----
- X }
- X for (x=0; x < image->columns; x++)
- X {
- X! red=range_limit[cs->red];
- X! green=range_limit[cs->green];
- X! blue=range_limit[cs->blue];
- X! i=(red >> 2) << 12 | (green >> 2) << 6 | blue >> 2;
- X if (cache[i] < 0)
- X {
- X /*
- X***************
- X*** 903,911 ****
- X node=cube.root;
- X for ( ; ; )
- X {
- X! id=(q->red > node->mid_red ? 1 : 0) |
- X! (q->green > node->mid_green ? 1 : 0) << 1 |
- X! (q->blue > node->mid_blue ? 1 : 0) << 2;
- X if ((node->children & (1 << id)) == 0)
- X break;
- X node=node->child[id];
- X--- 887,895 ----
- X node=cube.root;
- X for ( ; ; )
- X {
- X! id=(red > node->mid_red ? 1 : 0) |
- X! (green > node->mid_green ? 1 : 0) << 1 |
- X! (blue > node->mid_blue ? 1 : 0) << 2;
- X if ((node->children & (1 << id)) == 0)
- X break;
- X node=node->child[id];
- X***************
- X*** 913,931 ****
- X /*
- X Find closest color among siblings and their children.
- X */
- X! cube.color.red=q->red;
- X! cube.color.green=q->green;
- X! cube.color.blue=q->blue;
- X cube.distance=(~0);
- X ClosestColor(node->parent);
- X cache[i]=cube.color_number;
- X }
- X index=(unsigned short) cache[i];
- X! red_error=(int) q->red-(int) cube.colormap[index].red;
- X! green_error=(int) q->green-(int) cube.colormap[index].green;
- X! blue_error=(int) q->blue-(int) cube.colormap[index].blue;
- X q->index=index;
- X- q->length=0;
- X q+=step;
- X /*
- X Propagate the error in these proportions:
- X--- 897,914 ----
- X /*
- X Find closest color among siblings and their children.
- X */
- X! cube.color.red=red;
- X! cube.color.green=green;
- X! cube.color.blue=blue;
- X cube.distance=(~0);
- X ClosestColor(node->parent);
- X cache[i]=cube.color_number;
- X }
- X index=(unsigned short) cache[i];
- X! red_error=(int) red-(int) cube.colormap[index].red;
- X! green_error=(int) green-(int) cube.colormap[index].green;
- X! blue_error=(int) blue-(int) cube.colormap[index].blue;
- X q->index=index;
- X q+=step;
- X /*
- X Propagate the error in these proportions:
- X***************
- X*** 933,953 ****
- X 3/16 5/16 1/16
- X */
- X cs+=step;
- X! cs->red+=red_error-((red_error*9+8) >> 4);
- X! cs->green+=green_error-((green_error*9+8) >> 4);
- X! cs->blue+=blue_error-((blue_error*9+8) >> 4);
- X ns-=step;
- X! ns->red+=(red_error*3+8) >> 4;
- X! ns->green+=(green_error*3+8) >> 4;
- X! ns->blue+=(blue_error*3+8) >> 4;
- X ns+=step;
- X! ns->red+=(red_error*5+8) >> 4;
- X! ns->green+=(green_error*5+8) >> 4;
- X! ns->blue+=(blue_error*5+8) >> 4;
- X ns+=step;
- X! ns->red+=(red_error+8) >> 4;
- X! ns->green+=(green_error+8) >> 4;
- X! ns->blue+=(blue_error+8) >> 4;
- X }
- X odd_scanline=!odd_scanline;
- X }
- X--- 916,936 ----
- X 3/16 5/16 1/16
- X */
- X cs+=step;
- X! cs->red+=(red_error-((red_error*9+8)/16));
- X! cs->green+=(green_error-((green_error*9+8)/16));
- X! cs->blue+=(blue_error-((blue_error*9+8)/16));
- X ns-=step;
- X! ns->red+=(red_error*3+8)/16;
- X! ns->green+=(green_error*3+8)/16;
- X! ns->blue+=(blue_error*3+8)/16;
- X ns+=step;
- X! ns->red+=(red_error*5+8)/16;
- X! ns->green+=(green_error*5+8)/16;
- X! ns->blue+=(blue_error*5+8)/16;
- X ns+=step;
- X! ns->red+=(red_error+8)/16;
- X! ns->green+=(green_error+8)/16;
- X! ns->blue+=(blue_error+8)/16;
- X }
- X odd_scanline=!odd_scanline;
- X }
- X***************
- X*** 957,968 ****
- X (void) free((char *) scanline);
- X (void) free((char *) range_table);
- X (void) free((char *) cache);
- X- (void) free((char *) image->pixels);
- X- image->packets=dithered_image->packets;
- X- image->pixels=dithered_image->pixels;
- X- dithered_image->file=(FILE *) NULL;
- X- dithered_image->pixels=(RunlengthPacket *) NULL;
- X- DestroyImage(dithered_image);
- X return(False);
- X }
- X
- X--- 940,945 ----
- XCommon subdirectories: ImageMagick/scenes and ImageMagick2.2.2/scenes
- XCommon subdirectories: ImageMagick/utilities and ImageMagick2.2.2/utilities
- XCommon subdirectories: ImageMagick/xtp and ImageMagick2.2.2/xtp
- X--
- Xcristy@dupont.com
- X
- END_OF_FILE
- if test 11479 -ne `wc -c <'fix-02'`; then
- echo shar: \"'fix-02'\" unpacked with wrong size!
- fi
- # end of 'fix-02'
- fi
- echo shar: End of archive.
- exit 0
- exit 0 # Just in case...
-