System: urt version 3.0 Patch #: 1 Priority: Medium - High Subject: Revision 1 of URT 3.0 From: spencer@eecs.umich.edu Description: Fixed core dump in rletogif, compile warnings in giftorle. Minor update bug in getx11 fixed. getx11 now exits if all its input files are bogus. New program: rlestereo, combines two images (left and right eye) into a red-blue (or green) stereo pair. Configuration file for Interactive Systems 386/ix. Minor fix to rleskel: ignore trailing garbage in an input image. Fix: From rn, say "| patch -p -N -d DIR", where DIR is your urt source directory. Outside of rn, say "cd DIR; patch -p -N . + + # DEST is where all programs will be put. Can be overridden for specific + # directories below. + # RI is where the include files live. You probably shouldn't change this. + # RL is where the tool directories find the RLE library. You can change + # this, but see the README instructions about making the toolkit in this + # case. + + # Path names not starting with a / are relative to this directory. + # Path names starting with a / are absolute. + + #defpath DEST bin + #defpath RI include + #defpath RL lib + + # Note! LIB_DEST, INC_DEST, and MAN_DEST must be defined for the + # library, include files, or manual pages, respectively, to be + # installed anywhere. + + ##defpath MAN_DEST /usr/site/man + ##defpath LIB_DEST + ##defpath GET_DEST + ##defpath CNV_DEST + ##defpath TOOLS_DEST + ##defpath INC_DEST + + # Control of formatting. If your "roff" program needs to be piped to + # something to print, set ROFFPIPE to (e.g.) "| lpr" + ROFF = nroff + ROFFOPT = -man + ROFFPIPE = | lpr + + # Stuff you like to have removed from directories to "make clean" + OTHERJUNK = core *~ #*# + + # Files needed for the various options above. + #ifdef BOBCAT + LIBBOBCAT = -ldd98700 -ldd98710 -ldd98721 -ldd98731 -ldd98736 -ldd300h -lddbyte -lsb1 -lsb2 + #endif + + #ifdef CX3D + # Where are the include files for the CX3D + INCCX3D = /usr/site/include + LIBCX3D = -lcx3d + #endif + + #ifdef DVIRLE + #define DVIRLE_LIBSUBDIR Defined if LIBMCTEX is under cnv/tex directory + # The MC-TeX library. + LIBMCTEX = lib/lib.a # Note! relative to cnv/tex directory + # Where to find the MC-TeX include files. + INCMCTEX = h # Note! relative to cnv/tex directory + # where to find the font description file + CONFFILE = /usr/local/lib/tex/fontdesc + #endif + + #ifdef FB + LIBFB = /usr/brl/lib/libfb.a + #endif + + #ifdef GRINNELL + # Library containing GMR27 functions. + LIBGRINNELL = -lfb + #endif + + #ifdef HPQCR + # HP device io library. + LIBHPQCR = -ldvio + #endif + + #ifdef IRIS + LIBIRIS = -Zg + #endif + + #ifdef IRIS4D + LIBIRIS4D = -lgl_s + #endif + + #ifdef PBMPLUS + # PBMDIR should refer to the root of your PBM source tree. + PBMDIR = + INCPBMPLUS = -I$(PBMDIR)/ppm -I$(PBMDIR)/pgm -I$(PBMDIR)/pbm + LIBPBMPLUS = $(PBMDIR)/ppm/libppm.a $(PBMDIR)/pgm/libpgm.a \ + $(PBMDIR)/pbm/libpbm.a + #endif + + #ifdef SUNRASTER|SUNTOOLS|TAAC1 + LIBSUNTOOLS_COM = -lsuntool -lsunwindow -lpixrect + #endif + + #ifdef SUNRASTER + LIBSUNRASTER = $(LIBSUNTOOLS_COM) + #endif + + #ifdef SUNTOOLS + LIBSUNTOOLS = $(LIBSUNTOOLS_COM) + #endif + + #ifdef TAAC1 + LIBTAAC1 = -ltaac1 $(LIBSUNTOOLS_COM) + #endif + + #ifdef TIFF + # Location of tiff library and include files. Relative to "cnv" directory. + INCTIFF = + LIBTIFF = -ltiff + #endif + + #ifdef X10 + LIBX10 = -lX + INCX10 = + #endif + + #ifdef X11 + LIBX11 = -lX11 + INCX11 = + #endif Index: config/README *** config/README.old Wed Aug 15 16:37:28 1990 --- config/README Wed Aug 15 16:37:29 1990 *************** *** 145,150 **** --- 145,152 ---- SUNCC Adds C compiler flags for a Sun-3 workstation. Specifically, you get -f68881. + 386IXCC Adds compiler flags for the Interactive systems 386/ix. + ExtraCFLAGS A Make variable that can be used to supply extra flags to the C compiler. This might be used to refer to another system include directory, or to give flags like '-ansi' to the Index: get/getmex.c *** get/getmex.c.old Wed Aug 15 16:38:23 1990 --- get/getmex.c Wed Aug 15 16:38:24 1990 *************** *** 503,509 **** gammapcolor(index,r,g,b) register int index,r,g,b; - float gamma; { short i; --- 503,508 ---- Index: get/getx11/getx11.c *** get/getx11/getx11.c.old Wed Aug 15 16:20:27 1990 --- get/getx11/getx11.c Wed Aug 15 16:20:28 1990 *************** *** 1294,1300 **** if ( flip_book ) flip_frame = img_info; ! while (1) { XNextEvent(dpy, &event); --- 1294,1300 ---- if ( flip_book ) flip_frame = img_info; ! while (n) { XNextEvent(dpy, &event); *************** *** 1363,1369 **** {/* X calls by John Bradley, U of Penn, hacked up by mrf.... */ Boolean first = 1; int height = DisplayHeight(dpy, screen)/4; /* use DH/4 */ ! int s; s = flip_book_frams_sec; MapPixWindow ( img, True ); --- 1363,1369 ---- {/* X calls by John Bradley, U of Penn, hacked up by mrf.... */ Boolean first = 1; int height = DisplayHeight(dpy, screen)/4; /* use DH/4 */ ! int s, ly = 0; s = flip_book_frams_sec; MapPixWindow ( img, True ); *************** *** 1370,1376 **** while (1) { /* loop until button released */ Window foo,poo; ! int rx, ry, x, y, ly = 0, inc; unsigned int mask; if (XQueryPointer(dpy, img->window, &foo, &poo, --- 1370,1376 ---- while (1) { /* loop until button released */ Window foo,poo; ! int rx, ry, x, y, inc; unsigned int mask; if (XQueryPointer(dpy, img->window, &foo, &poo, Index: cnv/giftorle.c *** cnv/giftorle.c.old Wed Aug 15 16:36:05 1990 --- cnv/giftorle.c Wed Aug 15 16:36:06 1990 *************** *** 44,50 **** #endif /* USE_STDLIB_H */ #ifndef lint ! static char rcsid[] = "$Id: giftorle.c,v 3.0 90/08/03 15:17:24 spencer Exp $"; #endif #define MAXCOLORMAPSIZE 256 --- 44,50 ---- #endif /* USE_STDLIB_H */ #ifndef lint ! static char rcsid[] = "$Id: giftorle.c,v 3.1 90/08/15 13:24:45 spencer Exp $"; #endif #define MAXCOLORMAPSIZE 256 *************** *** 59,66 **** #define MAX_LWZ_BITS 12 #define ReadOK(file,buffer,len) (fread(buffer,len,1,file)!=0) ! #define EasyFail(str,status) while(1){fprintf(stderr,str);return(status);} ! #define HardFail(str,status) while(1){fprintf(stderr,str);exit (status);} #define LM_to_uint(a,b) (((b)<<8)|(a)) --- 59,66 ---- #define MAX_LWZ_BITS 12 #define ReadOK(file,buffer,len) (fread(buffer,len,1,file)!=0) ! #define EasyFail(str,status) {fprintf(stderr,str);return(status);} ! #define HardFail(str,status) {fprintf(stderr,str);exit (status);} #define LM_to_uint(a,b) (((b)<<8)|(a)) Index: makefile.hdr *** makefile.hdr.old Wed Aug 15 16:40:10 1990 --- makefile.hdr Wed Aug 15 16:40:10 1990 *************** *** 24,29 **** --- 24,30 ---- #ifadd CRAY2CC ExtraLIBS -lm -lnet #ifadd IRIS4DCC ExtraLIBS -lbsd #ifadd IRIS4DCC ExtraLIBS -lmalloc + #ifadd 386IXCC ExtraLIBS -linet #emit ExtraLIBS ExtraLIBS = Index: man/makefile.src *** man/makefile.src.old Wed Aug 15 16:40:18 1990 --- man/makefile.src Wed Aug 15 16:40:18 1990 *************** *** 51,56 **** --- 51,57 ---- man1/rlespiff.1 \ man1/rlesplice.1 \ man1/rlesplit.1 \ + man1/rlestereo.1 \ man1/rleswap.1 \ man1/rletoascii.1 \ man1/rletoraw.1 \ Index: tools/makefile.src *** tools/makefile.src.old Wed Aug 15 16:44:09 1990 --- tools/makefile.src Wed Aug 15 16:44:09 1990 *************** *** 35,40 **** --- 35,41 ---- rlespiff.out \ rlesplice.out \ rlesplit.out \ + rlestereo.out \ rleswap.out \ rlezoom.out \ smush.out \ Index: tools/rleskel.c *** tools/rleskel.c.old Wed Aug 15 16:44:56 1990 --- tools/rleskel.c Wed Aug 15 16:44:56 1990 *************** *** 142,147 **** --- 142,151 ---- rle_putrow( rows, width, &out_hdr ); } + /* Protect from bad input. */ + while ( rle_getskip( &in_hdr ) != 32768 ) + ; + /* Free memory. */ rle_row_free( &in_hdr, rows ); Index: man/man1/rlestereo.1 *** man/man1/rlestereo.1.old Wed Aug 15 16:41:53 1990 --- man/man1/rlestereo.1 Wed Aug 15 16:41:55 1990 *************** *** 0 **** --- 1,49 ---- + .\" Copyright (c) 1986, University of Utah + .TH RLESTEREO 1 "July 31, 1990" 1 + .UC 4 + .SH NAME + rlestereo \- produce anaglyph from stereo pair + .SH SYNOPSIS + .B rlestereo + .\" sample options... + [ + .B \-l + .I "leftscale" + ] + [ + .B \-r + .I "rightscale" + ] + .I "leftimage rightimage" + .SH DESCRIPTION + .IR Rlestereo + reads the two named RLE files and produces a single image suitable for + viewing + with red-blue or red-green glasses. + + The 'left' image is converted to + greyscale and written on the red channel. The 'right' image is converted + to greyscale and written on the blue or green channel. The intensity of the + two channels may be scaled in order to compensate for the relative + intensities of the two base colors as viewed through the glasses. + .SH OPTIONS + .TP + .B \-g + The right-eye image is written to the green channel rather than the + blue. + .TP + .BI \-l " leftscale" + Scale the intensities of the left-eye greyscale image by the given amount. + The default value is 0.7. + .TP + .B \-r " rightscale" + Scale the intensities of the right-eye greyscale image by the given amount. + The default value is 1.0. + .SH SEE ALSO + .IR urt (1), + .IR RLE (5). + .br + .sp 1 + Cardboard glasses are available at many comic book stores. + .SH AUTHOR + Craig Kolb, Yale University Index: tools/rlestereo.c *** tools/rlestereo.c.old Wed Aug 15 16:22:52 1990 --- tools/rlestereo.c Wed Aug 15 16:22:54 1990 *************** *** 0 **** --- 1,264 ---- + /* + * This software is copyrighted as noted below. It may be freely copied, + * modified, and redistributed, provided that the copyright notice is + * preserved on all copies. + * + * There is no warranty or other guarantee of fitness for this software, + * it is provided solely "as is". Bug reports or fixes may be sent + * to the author, who may or may not act on them as he desires. + * + * You may not include this software in a program or other software product + * without supplying the source, or without informing the end-user that the + * source is available for no extra charge. + * + * If you modify this software, you should include a notice giving the + * name of the person performing the modification, the date of modification, + * and the reason for such modification. + */ + /* + * rlestereo.c - Merge two RLE images to form a single red-green or red-blue + * image suitable for viewing with them goofy glasses. + * + * Author: Craig E. Kolb + * Department of Mathematics + * Yale Unversity + * Date: Mon Jul 30 1990 + * Copyright (C) 1990, Craig E. Kolb + */ + + #include + #include "rle.h" + + #ifdef USE_STDLIB_H + #include + #endif + + #define LEFTSCALE 0.7 /* Default left scale factor. */ + #define RIGHTSCALE 1.0 /* Default right scale factor. */ + + /* + * Macro to convert input values to greyscale, taking colormap into + * account. + */ + #define REDC 0.30 + #define GREENC 0.59 + #define BLUEC 0.11 + #define GREYCONV(r,g,b,m) (REDC*m[0][r]+GREENC*m[1][g]+BLUEC*m[2][b]) + + float LeftScale = LEFTSCALE; /* Scale factor for left channel. */ + float RightScale = RIGHTSCALE; /* Scale factor for right channel. */ + int GreenFlag = 0; /* True if second channel is green. */ + int Xres, Yres; /* Image resolution. */ + int lcolors, rcolors; /* # channels in left/right images. */ + int RightIndex; /* Index of second channel (1 or 2). */ + int lchan1, lchan2; /* Channel indices for left image. */ + int rchan1, rchan2; /* Channel indices for right image. */ + rle_pixel **lmap, **rmap; /* Colormap for left/right images. */ + + void convert_line(); + + /* + * Read two named RLE files and produces a single image suitable for viewing + * with red-blue or red-green glasses. The 'left' image is converted to + * greyscale and written on the red channel. The 'right' image is converted + * to greyscale and written on the blue or green channel. The intensity of the + * two channels may be scaled in order to compensate for the relative + * intensities of the two base colors as viewed through the glasses. + * + * Options: + * + * -g Produce red-green image rather than red-blue. + * -l scale Scale factor for left-eye image (default 0.7). + * -r scale Scale factor for right-eye image (default 1.0). + */ + + void + main(argc, argv) + int argc; + char **argv; + { + int y, i, Xtmp, Ytmp, scaleflag = 0; + char *leftname = NULL, *rightname = NULL; + char *outname = NULL; + FILE *outfile = stdout; + int oflag; + rle_pixel **lline, **rline, **outline; + rle_hdr left_hdr, right_hdr; + int rle_cnt = 0, rle_err; + char *err_name = NULL; + + if (scanargs(argc, argv, + "% g%- l%-leftscale!f r%-rightscale!f o%-outfile!s \n\ + leftimage!s rightimage!s", + &GreenFlag, &scaleflag, &LeftScale, &scaleflag, &RightScale, + &oflag, &outname, + &leftname, &rightname) == 0) { + exit(-1); + } + + /* + * Open left and right images. + */ + left_hdr = right_hdr = rle_dflt_hdr; + left_hdr.rle_file = rle_open_f(cmd_name(argv), leftname, "r"); + right_hdr.rle_file = rle_open_f(cmd_name(argv), rightname, "r"); + + for (;;) + { + /* + * Read headers of both images. + */ + if ( (rle_err = + get_rle_setup(&left_hdr, &Xres, &Yres, cmd_name(argv), + leftname)) != RLE_SUCCESS ) + { + err_name = leftname; + break; + } + if ( (rle_err = + get_rle_setup(&right_hdr, &Xtmp, &Ytmp, cmd_name(argv), + rightname)) != RLE_SUCCESS ) + { + err_name = rightname; + break; + } + + /* Open the output file when first header is successfully read. */ + if ( rle_cnt == 0 ) + outfile = rle_open_f( cmd_name( argv ), outname, "w" ); + + /* Count the input images. */ + rle_cnt++; + + if (Xres != Xtmp || Yres != Ytmp) { + fprintf(stderr,"Images are of different sizes.\n"); + exit(-1); + } + + rle_dflt_hdr = left_hdr; + rle_dflt_hdr.ncolors = 3; + rle_dflt_hdr.ncmap = 0; + rle_dflt_hdr.rle_file = outfile; + rle_addhist(argv, &left_hdr, &rle_dflt_hdr); + rle_put_setup(&rle_dflt_hdr); + + /* + * Ignore alpha and any channels > #2. + */ + RLE_CLR_BIT(left_hdr, RLE_ALPHA); + RLE_CLR_BIT(right_hdr, RLE_ALPHA); + for (i = 3; i < left_hdr.ncolors; i++) + RLE_CLR_BIT(left_hdr, i); + for (i = 3; i < right_hdr.ncolors; i++) + RLE_CLR_BIT(right_hdr, i); + + lcolors = left_hdr.ncolors > 3 ? 3 : left_hdr.ncolors; + rcolors = right_hdr.ncolors > 3 ? 3 : right_hdr.ncolors; + + if (lcolors == 1) + lchan1 = lchan2 = 0; + else if (lcolors == 2) { + lchan1 = 1; + lchan2 = 0; + } else { + lchan1 = 1; + lchan2 = 2; + } + + if (rcolors == 1) + rchan1 = rchan2 = 0; + else if (rcolors == 2) { + rchan1 = 1; + rchan2 = 0; + } else { + rchan1 = 1; + rchan2 = 2; + } + + rle_row_alloc(&left_hdr, &lline); + rle_row_alloc(&right_hdr, &rline); + rle_row_alloc(&rle_dflt_hdr, &outline); + /* + * Zero unused channel of output scanline. + */ + if (GreenFlag) { + RightIndex = 1; + bzero(outline[2], Xres * sizeof(rle_pixel)); + } else { + RightIndex = 2; + bzero(outline[1], Xres * sizeof(rle_pixel)); + } + + /* + * In case there's a colormap, DTRT. We use a gamma of 1. + * here because we want the output image to have the same + * gamma as the left image. + */ + lmap = buildmap(&left_hdr, 3, 1., 1.0); + rmap = buildmap(&right_hdr, 3, 1., 1.0); + /* + * For each output scanline... + */ + for (y = 0; y < Yres; y++) { + /* + * Read left and right scanline, converting each + * to greyscale data. + */ + rle_getrow(&left_hdr, lline); + rle_getrow(&right_hdr, rline); + convert_line(outline, lline, rline); + rle_putrow(outline, Xres, &rle_dflt_hdr); + } + while ( rle_getskip(&left_hdr) != 32768 ) + ; + while ( rle_getskip(&right_hdr) != 32768 ) + ; + + rle_row_free(&left_hdr, lline); + rle_row_free(&right_hdr, rline); + rle_row_free(&rle_dflt_hdr, outline); + + rle_puteof( &rle_dflt_hdr ); + } + fclose(left_hdr.rle_file); + fclose(right_hdr.rle_file); + + /* Check for an error. EOF or EMPTY is ok if at least one image + * has been read. Otherwise, print an error message. + */ + if ( rle_cnt == 0 || (rle_err != RLE_EOF && rle_err != RLE_EMPTY) ) + rle_get_error( rle_err, cmd_name( argv ), err_name ); + exit(0); + } + + get_rle_setup(the_hdr, xres, yres, prog, file) + int *xres, *yres; + rle_hdr *the_hdr; + char *prog, file; + { + int err; + + err = rle_get_setup(the_hdr, prog, file); + *xres = the_hdr->xmax - the_hdr->xmin + 1; + *yres = the_hdr->ymax - the_hdr->ymin + 1; + the_hdr->xmax -= the_hdr->xmin; + the_hdr->xmin = 0; + return err; + } + + void + convert_line(out, left, right) + rle_pixel **out, **left, **right; + { + register int i; + + /* + * Convert input scanlines to 'stereo' output scanline. + */ + for (i = 0; i < Xres; i++) { + out[0][i] = LeftScale * GREYCONV(left[0][i], left[lchan1][i], + left[lchan2][i], lmap); + out[RightIndex][i] = RightScale * GREYCONV(right[0][i], + right[rchan1][i], right[rchan2][i], rmap); + } + } Index: cnv/rletogif/rletogif.c *** cnv/rletogif/rletogif.c.old Wed Aug 15 16:36:46 1990 --- cnv/rletogif/rletogif.c Wed Aug 15 16:36:47 1990 *************** *** 108,119 **** int get_scanlines() { int i; ! rle_pixel *save_scan_0 = scan[0]; if (sizeof(rle_pixel) != sizeof(gif_pixel)) error("rle pixel size not 8 bits"); if (rle_row_alloc(&in_hdr, &scan) < 0) error("can't allocate scan"); scanbuf = (gif_pixel**)malloc(sizeof(gif_pixel*)*(in_hdr.ymax+1)); if (scanbuf == NULL) error("can't allocate scanbuf"); for (i = 0; i <= in_hdr.ymax; i++) { --- 108,120 ---- int get_scanlines() { int i; ! rle_pixel *save_scan_0; if (sizeof(rle_pixel) != sizeof(gif_pixel)) error("rle pixel size not 8 bits"); if (rle_row_alloc(&in_hdr, &scan) < 0) error("can't allocate scan"); + save_scan_0 = scan[0]; scanbuf = (gif_pixel**)malloc(sizeof(gif_pixel*)*(in_hdr.ymax+1)); if (scanbuf == NULL) error("can't allocate scanbuf"); for (i = 0; i <= in_hdr.ymax; i++) { Index: get/getx11/timer.c *** get/getx11/timer.c.old Wed Aug 15 16:38:50 1990 --- get/getx11/timer.c Wed Aug 15 16:38:51 1990 *************** *** 34,39 **** --- 34,43 ---- (void) setitimer(ITIMER_REAL, itp, (struct itimerval *)0); } + #ifndef sigmask + #define sigmask(m) (1 << ((m)-1)) + #endif + void wait_timer() { Index: config/urt *** config/urt.old Wed Aug 15 16:37:52 1990 --- config/urt Wed Aug 15 16:37:52 1990 *************** *** 57,62 **** --- 57,63 ---- ##define IRIS4DCC Silicon Graphics Iris 4D. ##define IRISCC Silicon Graphics Iris 2400/3000. ##define SUNCC Sun 3 computers. + ##define 386IXCC SVr3 386/ix 2.2 # You can put any system dependent flags here. ExtraCFLAGS = Index: man/man1/urt.1 *** man/man1/urt.1.old Wed Aug 15 16:42:34 1990 --- man/man1/urt.1 Wed Aug 15 16:42:35 1990 *************** *** 119,124 **** --- 119,126 ---- .br \fBrlesplit\fR Split concatenated images into files. .br + \fBrlestereo\fR Combine two images into a "red-green" stereo pair. + .br \fBrleswap\fR Swap or select color channels. .br \fBrletoabA60\fR Convert RLE to Abekas A60 format.