48 |
|
return(-1); |
49 |
|
} |
50 |
|
/* discard header */ |
51 |
< |
getheader(input, NULL); |
51 |
> |
if (checkheader(input, COLRFMT, NULL) < 0) { |
52 |
> |
fprintf(stderr, "%s: not a Radiance picture\n", fname); |
53 |
> |
return(-1); |
54 |
> |
} |
55 |
|
/* get picture dimensions */ |
56 |
|
if (fgetresolu(&xres, &yres, input) != (YMAJOR|YDECR)) { |
57 |
|
fprintf(stderr, "%s: bad picture size\n", fname); |
70 |
|
for (i = yres-1; i >= 0; i--) { |
71 |
|
if (freadcolrs(scanline, xres, input) < 0) |
72 |
|
return(-1); |
73 |
< |
normcolrs(scanline, xres); |
73 |
> |
normcolrs(scanline, xres, 0); |
74 |
|
plotscan(scanline, xres, i); |
75 |
|
} |
76 |
|
|
112 |
|
register int a; |
113 |
|
{ |
114 |
|
static int cerr[NCOLS][3]; |
115 |
< |
static int err[3]; |
115 |
> |
static int err[3], errp[3]; |
116 |
|
int b; |
117 |
|
register int ison; |
118 |
|
|
119 |
|
b = col[a]; |
120 |
+ |
errp[a] = err[a]; |
121 |
|
err[a] += b + cerr[x][a]; |
122 |
|
ison = err[a] > 128; |
123 |
|
if (ison) err[a] -= 256; |
124 |
< |
cerr[x][a] = err[a] /= 2; |
124 |
> |
err[a] /= 3; |
125 |
> |
cerr[x][a] = err[a] + errp[a]; |
126 |
|
return(ison); |
127 |
|
} |