--- ray/src/util/radcompare.c 2019/08/15 17:28:45 2.21 +++ ray/src/util/radcompare.c 2020/06/30 22:53:05 2.24 @@ -1,5 +1,5 @@ #ifndef lint -static const char RCSid[] = "$Id: radcompare.c,v 2.21 2019/08/15 17:28:45 greg Exp $"; +static const char RCSid[] = "$Id: radcompare.c,v 2.24 2020/06/30 22:53:05 greg Exp $"; #endif /* * Compare Radiance files for significant differences @@ -224,12 +224,12 @@ color_check(COLOR c1, COLOR c2) static int norm_check(FVECT nv1, FVECT nv2) { - double max2 = nv1[2]*nv1[2]; + double max2 = nv1[2]*nv2[2]; int imax = 2; int i = 2; /* identify largest component */ while (i--) { - double tm2 = nv1[i]*nv1[i]; + double tm2 = nv1[i]*nv2[i]; if (tm2 > max2) { imax = i; max2 = tm2; @@ -317,6 +317,7 @@ equiv_string(char *s1, char *s2) static int setheadvar(char *val, void *p) { + char newval[128]; LUTAB *htp = (LUTAB *)p; LUENT *tep; char *key; @@ -359,8 +360,13 @@ setheadvar(char *val, void *p) return(-1); /* memory allocation error */ if (!tep->key) tep->key = strcpy(malloc(kln+1), key); - if (tep->data) + if (tep->data) { /* check for special cases */ + if (!strcmp(key, "EXPOSURE")) { + sprintf(newval, "%f", atof(tep->data)*atof(val)); + vln = strlen(val = newval); + } free(tep->data); + } tep->data = strcpy(malloc(vln+1), val); return(1); } @@ -696,7 +702,7 @@ set_refdepth(DEPTHCODEC *dcp, LUTAB *htp) static char depthvar[] = DEPTHSTR; const char *drval; - depthvar[LDEPTHSTR] = '\0'; + depthvar[LDEPTHSTR-1] = '\0'; drval = (const char *)lu_find(htp, depthvar)->data; if (!drval) return(0);