| 42 |
|
|
| 43 |
|
/* BSDF value for boundary regions */ |
| 44 |
|
double bsdf_min = 0; |
| 45 |
< |
double bsdf_spec_peak = 0; |
| 45 |
> |
double bsdf_spec_val = 0; |
| 46 |
|
double bsdf_spec_rad = 0; |
| 47 |
|
|
| 48 |
|
/* processed incident DSF measurements */ |
| 310 |
|
} |
| 311 |
|
res += val; |
| 312 |
|
} |
| 313 |
< |
if ((rbf_colorimetry == RBCtristimulus) & (res > 1e-6)) { |
| 313 |
> |
sv->cieY = res / COSF(outvec[2]); |
| 314 |
> |
if (sv->cieY < bsdf_min) { /* never return less than bsdf_min */ |
| 315 |
> |
sv->cieY = bsdf_min; |
| 316 |
> |
} else if (rbf_colorimetry == RBCtristimulus) { |
| 317 |
|
C_CHROMA cres = (int)(usum/res + frandom()); |
| 318 |
|
cres |= (int)(vsum/res + frandom()) << 8; |
| 319 |
|
c_decodeChroma(&sv->spec, cres); |
| 320 |
|
} |
| 318 |
– |
sv->cieY = res / COSF(outvec[2]); |
| 319 |
– |
if (sv->cieY < bsdf_min) /* never return less than bsdf_min */ |
| 320 |
– |
sv->cieY = bsdf_min; |
| 321 |
|
return(SDEnone); |
| 322 |
|
} |
| 323 |
|
|
| 443 |
|
|
| 444 |
|
if (input_orient > 0 ^ invec[2] > 0) /* wrong side? */ |
| 445 |
|
return(NULL); |
| 446 |
< |
if ((bsdf_spec_peak <= bsdf_min) | (bsdf_spec_rad <= 0)) |
| 446 |
> |
if ((bsdf_spec_val <= bsdf_min) | (bsdf_spec_rad <= 0)) |
| 447 |
|
return(NULL); /* nothing set */ |
| 448 |
|
rbf = (RBFNODE *)malloc(sizeof(RBFNODE)); |
| 449 |
|
if (rbf == NULL) |
| 457 |
|
rbf->ejl = NULL; |
| 458 |
|
VCOPY(rbf->invec, invec); |
| 459 |
|
rbf->nrbf = 1; |
| 460 |
< |
rbf->rbfa[0].peak = bsdf_spec_peak * output_orient*ovec[2]; |
| 460 |
> |
rbf->rbfa[0].peak = bsdf_spec_val * COSF(ovec[2]); |
| 461 |
|
rbf->rbfa[0].chroma = c_dfchroma; |
| 462 |
|
rbf->rbfa[0].crad = ANG2R(bsdf_spec_rad); |
| 463 |
|
rbf->rbfa[0].gx = pos[0]; |
| 582 |
|
input_orient = output_orient = 0; |
| 583 |
|
rbf_colorimetry = RBCunknown; |
| 584 |
|
grid_res = GRIDRES; |
| 585 |
+ |
memset(bsdf_hist, 0, sizeof(bsdf_hist)); |
| 586 |
|
bsdf_min = 0; |
| 587 |
< |
bsdf_spec_peak = 0; |
| 587 |
> |
bsdf_spec_val = 0; |
| 588 |
|
bsdf_spec_rad = 0; |
| 589 |
|
} |
| 590 |
|
|
| 605 |
|
fprintf(ofp, "COLORIMETRY=%s\n", RBCident[rbf_colorimetry]); |
| 606 |
|
fprintf(ofp, "GRIDRES=%d\n", grid_res); |
| 607 |
|
fprintf(ofp, "BSDFMIN=%g\n", bsdf_min); |
| 608 |
< |
if ((bsdf_spec_peak > bsdf_min) & (bsdf_spec_rad > 0)) |
| 609 |
< |
fprintf(ofp, "BSDFSPEC= %f %f\n", bsdf_spec_peak, bsdf_spec_rad); |
| 608 |
> |
if ((bsdf_spec_val > bsdf_min) & (bsdf_spec_rad > 0)) |
| 609 |
> |
fprintf(ofp, "BSDFSPEC= %f %f\n", bsdf_spec_val, bsdf_spec_rad); |
| 610 |
|
fputformat(BSDFREP_FMT, ofp); |
| 611 |
|
fputc('\n', ofp); |
| 612 |
|
putint(BSDFREP_MAGIC, 2, ofp); |
| 699 |
|
return(0); |
| 700 |
|
} |
| 701 |
|
if (!strncmp(s, "BSDFSPEC=", 9)) { |
| 702 |
< |
sscanf(s+9, "%lf %lf", &bsdf_spec_peak, &bsdf_spec_rad); |
| 702 |
> |
sscanf(s+9, "%lf %lf", &bsdf_spec_val, &bsdf_spec_rad); |
| 703 |
|
return(0); |
| 704 |
|
} |
| 705 |
|
if (formatval(fmt, s) && strcmp(fmt, BSDFREP_FMT)) |