--- ray/src/px/mt160r.c 1990/01/26 08:17:31 1.6 +++ ray/src/px/mt160r.c 1991/05/06 13:14:21 1.8 @@ -49,7 +49,10 @@ char *fname; return(-1); } /* discard header */ - getheader(input, NULL); + if (checkheader(input, COLRFMT, NULL) < 0) { + fprintf(stderr, "%s: not a Radiance picture\n", fname); + return(-1); + } /* get picture dimensions */ if (fgetresolu(&xres, &yres, input) != (YMAJOR|YDECR)) { fprintf(stderr, "%s: bad picture size\n", fname); @@ -115,14 +118,16 @@ COLR clr; register int x; { static int cerr[NCOLS]; - static int err; + static int err, errp; int b; register int isblack; b = normbright(clr); + errp = err; err += b + cerr[x]; isblack = err < 128; if (!isblack) err -= 256; - cerr[x] = err /= 2; + err /= 3; + cerr[x] = err + errp; return(isblack); }