64 |
|
return(-1); |
65 |
|
} |
66 |
|
/* discard header */ |
67 |
< |
getheader(input, NULL); |
67 |
> |
if (checkheader(input, COLRFMT, NULL) < 0) { |
68 |
> |
fprintf(stderr, "%s: not a Radiance picture\n", fname); |
69 |
> |
return(-1); |
70 |
> |
} |
71 |
|
/* get picture dimensions */ |
72 |
|
if (fgetresolu(&xres, &yres, input) != (YMAJOR|YDECR)) { |
73 |
|
fprintf(stderr, "%s: bad picture size\n", fname); |
143 |
|
int s; |
144 |
|
{ |
145 |
|
static int cerr[NCOLS][3]; |
146 |
< |
static int err[3]; |
146 |
> |
static int err[3], errp[3]; |
147 |
|
int b; |
148 |
|
register int a, ison; |
149 |
|
|
150 |
|
a = sub_add(s); /* use additive primary */ |
151 |
|
b = col[a]; |
152 |
+ |
errp[a] = err[a]; |
153 |
|
err[a] += b + cerr[x][a]; |
154 |
|
ison = err[a] < 128; |
155 |
|
if (!ison) err[a] -= 256; |
156 |
< |
cerr[x][a] = err[a] /= 2; |
156 |
> |
err[a] /= 3; |
157 |
> |
cerr[x][a] = err[a] + errp[a]; |
158 |
|
return(ison); |
159 |
|
} |