--- ray/src/px/panim.c 1990/04/05 13:58:45 1.6 +++ ray/src/px/panim.c 2003/06/30 14:59:12 2.3 @@ -1,9 +1,6 @@ -/* Copyright (c) 1988 Regents of the University of California */ - #ifndef lint -static char SCCSid[] = "$SunId$ LBL"; +static const char RCSid[] = "$Id: panim.c,v 2.3 2003/06/30 14:59:12 schorsch Exp $"; #endif - /* * Send pictures to PC animation system. * @@ -11,6 +8,7 @@ static char SCCSid[] = "$SunId$ LBL"; */ #include +#include #include "random.h" #include "color.h" @@ -103,6 +101,11 @@ char *file; } /* get dimensions */ getheader(fp, NULL); + if (checkheader(fp, COLRFMT, NULL) < 0) { + fputs(file, stderr); + fputs(": not a Radiance picture\n", stderr); + exit(1); + } if (fgetresolu(&xres, &yres, fp) != (YMAJOR|YDECR) || xres > SCANLINE || yres > NUMSCANS) { fputs(file, stderr); @@ -113,7 +116,7 @@ char *file; xbeg = (SCANLINE-xres)/2; ybeg = (NUMSCANS-yres)/2; /* clear output */ - bzero(sc_frame_arr, sizeof(sc_frame_arr)); + memset(sc_frame_arr, '\0', sizeof(sc_frame_arr)); /* get frame */ for (y = yres-1; y >= 0; y--) { if (freadcolrs(scanin, xres, fp) < 0) { @@ -144,7 +147,7 @@ compgamma() /* compute gamma correction map */ register int i, val; for (i = 0; i < 256; i++) { - val = pow(i/256.0, 1.0/GAMMA) * 256.0; + val = pow((i+0.5)/256.0, 1.0/GAMMA) * 256.0; if (val > 248) val = 248; gammamap[i] = val; }