| 8 | 
  | 
 */ | 
| 9 | 
  | 
 | 
| 10 | 
  | 
#include <stdlib.h> | 
| 11 | 
– | 
#include <math.h> | 
| 11 | 
  | 
#include <ctype.h> | 
| 12 | 
+ | 
#include "rtmath.h" | 
| 13 | 
  | 
#include "platform.h" | 
| 14 | 
  | 
#include "rtio.h" | 
| 15 | 
  | 
#include "resolu.h" | 
| 16 | 
  | 
#include "color.h" | 
| 17 | 
+ | 
#include "depthcodec.h" | 
| 18 | 
+ | 
#include "normcodec.h" | 
| 19 | 
  | 
#include "lookup.h" | 
| 20 | 
  | 
                        /* Reporting levels */ | 
| 21 | 
  | 
#define REP_QUIET       0       /* no reporting */ | 
| 27 | 
  | 
 | 
| 28 | 
  | 
int     ign_header = 0;         /* ignore header differences? */ | 
| 29 | 
  | 
 | 
| 30 | 
+ | 
int     escape_newlines = 0;    /* allow backslash to skip newlines */ | 
| 31 | 
+ | 
 | 
| 32 | 
  | 
double  rel_min = 1e-5;         /* positive for relative comparisons */ | 
| 33 | 
  | 
 | 
| 34 | 
  | 
double  rms_lim = 0.01;         /* RMS difference limit */ | 
| 37 | 
  | 
 | 
| 38 | 
  | 
int     lin1cnt=0, lin2cnt=0;   /* file line position */ | 
| 39 | 
  | 
 | 
| 40 | 
+ | 
int     comment_c = '\0';       /* comment delimiter for text files */ | 
| 41 | 
+ | 
 | 
| 42 | 
  | 
const char      nsuffix[10][3] = {              /* 1st, 2nd, 3rd, etc. */ | 
| 43 | 
  | 
                        "th","st","nd","rd","th","th","th","th","th","th" | 
| 44 | 
  | 
                }; | 
| 51 | 
  | 
                        "ascii", | 
| 52 | 
  | 
                        COLRFMT, | 
| 53 | 
  | 
                        CIEFMT, | 
| 54 | 
+ | 
                        SPECFMT, | 
| 55 | 
+ | 
                        DEPTH16FMT, | 
| 56 | 
+ | 
                        NORMAL32FMT, | 
| 57 | 
  | 
                        "float", | 
| 58 | 
  | 
                        "double", | 
| 59 | 
  | 
                        "BSDF_RBFmesh", | 
| 60 | 
  | 
                        "Radiance_octree", | 
| 61 | 
  | 
                        "Radiance_tmesh", | 
| 62 | 
+ | 
                        "8-bit_indexed_name", | 
| 63 | 
+ | 
                        "16-bit_indexed_name", | 
| 64 | 
+ | 
                        "24-bit_indexed_name", | 
| 65 | 
  | 
                        "BINARY_unknown", | 
| 66 | 
  | 
                        NULL    /* terminator */ | 
| 67 | 
  | 
                }; | 
| 68 | 
  | 
                                /* keep consistent with above */ | 
| 69 | 
< | 
enum {TYP_UNKNOWN, TYP_TEXT, TYP_ASCII, TYP_RGBE, TYP_XYZE, TYP_FLOAT, | 
| 70 | 
< | 
                TYP_DOUBLE, TYP_RBFMESH, TYP_OCTREE, TYP_TMESH, TYP_BINARY}; | 
| 69 | 
> | 
enum {TYP_UNKNOWN, TYP_TEXT, TYP_ASCII, TYP_RGBE, TYP_XYZE, TYP_SPEC, | 
| 70 | 
> | 
                TYP_DEPTH, TYP_NORM, TYP_FLOAT, TYP_DOUBLE, | 
| 71 | 
> | 
                TYP_RBFMESH, TYP_OCTREE, TYP_TMESH, | 
| 72 | 
> | 
                TYP_ID8, TYP_ID16, TYP_ID24, TYP_BINARY}; | 
| 73 | 
  | 
                 | 
| 74 | 
  | 
#define has_header(t)   (!( 1L<<(t) & (1L<<TYP_TEXT | 1L<<TYP_BINARY) )) | 
| 75 | 
  | 
 | 
| 78 | 
  | 
                        "SOFTWARE", | 
| 79 | 
  | 
                        "CAPDATE", | 
| 80 | 
  | 
                        "GMT", | 
| 81 | 
+ | 
                        "FRAME", | 
| 82 | 
  | 
                        NULL    /* terminator */ | 
| 83 | 
  | 
                }; | 
| 84 | 
  | 
                                /* header variable settings */ | 
| 89 | 
  | 
#define adv_linecnt(htp)        (lin1cnt += (htp == &hdr1), \ | 
| 90 | 
  | 
                                        lin2cnt += (htp == &hdr2)) | 
| 91 | 
  | 
 | 
| 92 | 
+ | 
typedef struct {                /* dynamic line buffer */ | 
| 93 | 
+ | 
        char    *str; | 
| 94 | 
+ | 
        int     len; | 
| 95 | 
+ | 
        int     siz; | 
| 96 | 
+ | 
} LINEBUF; | 
| 97 | 
+ | 
 | 
| 98 | 
+ | 
#define init_line(bp)   ((bp)->str = NULL, (bp)->siz = 0) | 
| 99 | 
+ | 
                                /* 100 MByte limit on line buffer */ | 
| 100 | 
+ | 
#define MAXBUF          (100L<<20) | 
| 101 | 
+ | 
 | 
| 102 | 
  | 
                                /* input files */ | 
| 103 | 
  | 
char            *progname = NULL; | 
| 104 | 
  | 
const char      stdin_name[] = "<stdin>"; | 
| 105 | 
  | 
const char      *f1name=NULL, *f2name=NULL; | 
| 106 | 
  | 
FILE            *f1in=NULL, *f2in=NULL; | 
| 107 | 
+ | 
int             f1swap=0, f2swap=0; | 
| 108 | 
  | 
 | 
| 109 | 
  | 
                                /* running real differences */ | 
| 110 | 
  | 
double  diff2sum = 0; | 
| 116 | 
  | 
{ | 
| 117 | 
  | 
        fputs("Usage: ", stderr); | 
| 118 | 
  | 
        fputs(progname, stderr); | 
| 119 | 
< | 
        fputs(" [-h][-s|-w|-v][-rel min_test][-rms epsilon][-max epsilon] reference test\n", | 
| 119 | 
> | 
        fputs(" [-h][-c#][-s|-w|-v][-rel min_test][-rms epsilon][-max epsilon] reference test\n", | 
| 120 | 
  | 
                        stderr); | 
| 121 | 
  | 
        exit(2); | 
| 122 | 
  | 
} | 
| 123 | 
  | 
 | 
| 124 | 
+ | 
/* Read a text line, increasing buffer size as necessary */ | 
| 125 | 
+ | 
static int | 
| 126 | 
+ | 
read_line(LINEBUF *bp, FILE *fp) | 
| 127 | 
+ | 
{ | 
| 128 | 
+ | 
        static int      doneWarn = 0; | 
| 129 | 
+ | 
 | 
| 130 | 
+ | 
        bp->len = 0; | 
| 131 | 
+ | 
        if (!bp->str) { | 
| 132 | 
+ | 
                bp->str = (char *)malloc(bp->siz = 512); | 
| 133 | 
+ | 
                if (!bp->str) | 
| 134 | 
+ | 
                        goto memerr; | 
| 135 | 
+ | 
        } | 
| 136 | 
+ | 
        while (fgets(bp->str + bp->len, bp->siz - bp->len, fp)) { | 
| 137 | 
+ | 
                bp->len += strlen(bp->str + bp->len); | 
| 138 | 
+ | 
                if (bp->str[bp->len-1] == '\n') { | 
| 139 | 
+ | 
                        if (bp->len > 1 && bp->str[bp->len-2] == '\r') { | 
| 140 | 
+ | 
                                bp->str[--bp->len] = '\0'; | 
| 141 | 
+ | 
                                bp->str[bp->len-1] = '\n'; | 
| 142 | 
+ | 
                        } | 
| 143 | 
+ | 
                        if (escape_newlines && bp->len > 1 && | 
| 144 | 
+ | 
                                        bp->str[bp->len-2] == '\\') { | 
| 145 | 
+ | 
                                bp->str[--bp->len] = '\0'; | 
| 146 | 
+ | 
                                bp->str[bp->len-1] = ' '; | 
| 147 | 
+ | 
                                continue; | 
| 148 | 
+ | 
                        } | 
| 149 | 
+ | 
                        break;          /* found EOL */ | 
| 150 | 
+ | 
                } | 
| 151 | 
+ | 
                if (bp->len < bp->siz - 4) | 
| 152 | 
+ | 
                        continue;       /* at EOF? */ | 
| 153 | 
+ | 
                if (bp->siz >= MAXBUF) { | 
| 154 | 
+ | 
                        if ((report >= REP_WARN) & !doneWarn) { | 
| 155 | 
+ | 
                                fprintf(stderr, | 
| 156 | 
+ | 
                        "%s: warning - input line(s) past %ld MByte limit\n", | 
| 157 | 
+ | 
                                        progname, MAXBUF>>20); | 
| 158 | 
+ | 
                                doneWarn++; | 
| 159 | 
+ | 
                        } | 
| 160 | 
+ | 
                        break;          /* return MAXBUF partial line */ | 
| 161 | 
+ | 
                } | 
| 162 | 
+ | 
                if ((bp->siz += bp->siz/2) > MAXBUF) | 
| 163 | 
+ | 
                        bp->siz = MAXBUF; | 
| 164 | 
+ | 
                bp->str = (char *)realloc(bp->str, bp->siz); | 
| 165 | 
+ | 
                if (!bp->str) | 
| 166 | 
+ | 
                        goto memerr; | 
| 167 | 
+ | 
        } | 
| 168 | 
+ | 
        if (comment_c) {                /* elide comment? */ | 
| 169 | 
+ | 
                char    *cp = sskip2(bp->str,0); | 
| 170 | 
+ | 
                if (*cp == comment_c) { | 
| 171 | 
+ | 
                        *cp++ = '\n'; | 
| 172 | 
+ | 
                        *cp = '\0'; | 
| 173 | 
+ | 
                        bp->len = cp - bp->str; | 
| 174 | 
+ | 
                } | 
| 175 | 
+ | 
        } | 
| 176 | 
+ | 
        return(bp->len); | 
| 177 | 
+ | 
memerr: | 
| 178 | 
+ | 
        fprintf(stderr, | 
| 179 | 
+ | 
                "%s: out of memory in read_line() allocating %d byte buffer\n", | 
| 180 | 
+ | 
                        progname, bp->siz); | 
| 181 | 
+ | 
        exit(2); | 
| 182 | 
+ | 
} | 
| 183 | 
+ | 
 | 
| 184 | 
+ | 
/* Free line buffer */ | 
| 185 | 
+ | 
static void | 
| 186 | 
+ | 
free_line(LINEBUF *bp) | 
| 187 | 
+ | 
{ | 
| 188 | 
+ | 
        if (bp->str) free(bp->str); | 
| 189 | 
+ | 
        init_line(bp); | 
| 190 | 
+ | 
} | 
| 191 | 
+ | 
 | 
| 192 | 
  | 
/* Get type ID from name (or 0 if not found) */ | 
| 193 | 
  | 
static int | 
| 194 | 
  | 
xlate_type(const char *nm) | 
| 211 | 
  | 
 | 
| 212 | 
  | 
        if (rel_min > 0) {      /* doing relative differences? */ | 
| 213 | 
  | 
                double  av2 = .25*(r1*r1 + 2.*fabs(r1*r2) + r2*r2); | 
| 214 | 
< | 
                if (av2 > rel_min*rel_min) | 
| 215 | 
< | 
                        diff2 /= av2; | 
| 214 | 
> | 
                if (av2 < rel_min*rel_min) | 
| 215 | 
> | 
                        av2 = rel_min*rel_min; | 
| 216 | 
> | 
                diff2 /= av2; | 
| 217 | 
  | 
        } | 
| 218 | 
  | 
        if (max_lim >= 0 && diff2 > max_lim*max_lim) { | 
| 219 | 
  | 
                if (report != REP_QUIET) | 
| 235 | 
  | 
{ | 
| 236 | 
  | 
        int     p; | 
| 237 | 
  | 
 | 
| 238 | 
< | 
        if (!real_check(colval(c1,RED)+colval(c1,GRN)+colval(c1,BLU)*(1./3.), | 
| 239 | 
< | 
                        colval(c2,RED)+colval(c2,GRN)+colval(c2,BLU))*(1./3.)) | 
| 238 | 
> | 
        if (!real_check((colval(c1,RED)+colval(c1,GRN)+colval(c1,BLU))*(1./3.), | 
| 239 | 
> | 
                        (colval(c2,RED)+colval(c2,GRN)+colval(c2,BLU))*(1./3.))) | 
| 240 | 
  | 
                return(0); | 
| 241 | 
  | 
 | 
| 242 | 
  | 
        p = (colval(c1,GRN) > colval(c1,RED)) ? GRN : RED; | 
| 245 | 
  | 
        return(real_check(colval(c1,p), colval(c2,p))); | 
| 246 | 
  | 
} | 
| 247 | 
  | 
 | 
| 248 | 
+ | 
#if 1 | 
| 249 | 
+ | 
/* Compare two color spectra for equivalence */ | 
| 250 | 
+ | 
static int | 
| 251 | 
+ | 
spec_check(COLORV *sc1, COLORV *sc2) | 
| 252 | 
+ | 
{ | 
| 253 | 
+ | 
        int     p, k; | 
| 254 | 
+ | 
 | 
| 255 | 
+ | 
        if (!real_check(scolor_mean(sc1), scolor_mean(sc2))) | 
| 256 | 
+ | 
                return(0); | 
| 257 | 
+ | 
 | 
| 258 | 
+ | 
        p = 0;                          /* find max. component */ | 
| 259 | 
+ | 
        for (k = NCSAMP; --k; ) | 
| 260 | 
+ | 
                if (sc1[k] > sc1[p]) | 
| 261 | 
+ | 
                        p = k; | 
| 262 | 
+ | 
 | 
| 263 | 
+ | 
        return(real_check(sc1[p], sc2[p])); | 
| 264 | 
+ | 
} | 
| 265 | 
+ | 
#else | 
| 266 | 
+ | 
/* Compare two color spectra for equivalence */ | 
| 267 | 
+ | 
static int | 
| 268 | 
+ | 
spec_check(COLORV *sc1, COLORV *sc2) | 
| 269 | 
+ | 
{ | 
| 270 | 
+ | 
        COLOR   c1, c2; | 
| 271 | 
+ | 
        int     p; | 
| 272 | 
+ | 
 | 
| 273 | 
+ | 
        if (!real_check(scolor_mean(sc1), scolor_mean(sc2))) | 
| 274 | 
+ | 
                return(0); | 
| 275 | 
+ | 
                                        /* do comparisons in RGB space */ | 
| 276 | 
+ | 
        scolor_rgb(c1, sc1); | 
| 277 | 
+ | 
        scolor_rgb(c2, sc2); | 
| 278 | 
+ | 
 | 
| 279 | 
+ | 
        p = (colval(c1,GRN) > colval(c1,RED)) ? GRN : RED; | 
| 280 | 
+ | 
        if (colval(c1,BLU) > colval(c1,p)) p = BLU; | 
| 281 | 
+ | 
 | 
| 282 | 
+ | 
        return(real_check(colval(c1,p), colval(c2,p))); | 
| 283 | 
+ | 
} | 
| 284 | 
+ | 
#endif | 
| 285 | 
+ | 
 | 
| 286 | 
+ | 
/* Compare two normal directions for equivalence */ | 
| 287 | 
+ | 
static int | 
| 288 | 
+ | 
norm_check(FVECT nv1, FVECT nv2) | 
| 289 | 
+ | 
{ | 
| 290 | 
+ | 
        double  max2 = nv1[2]*nv2[2]; | 
| 291 | 
+ | 
        int     imax = 2; | 
| 292 | 
+ | 
        int     i = 2; | 
| 293 | 
+ | 
                                        /* identify largest component */ | 
| 294 | 
+ | 
        while (i--) { | 
| 295 | 
+ | 
                double  tm2 = nv1[i]*nv2[i]; | 
| 296 | 
+ | 
                if (tm2 > max2) { | 
| 297 | 
+ | 
                        imax = i; | 
| 298 | 
+ | 
                        max2 = tm2; | 
| 299 | 
+ | 
                } | 
| 300 | 
+ | 
        } | 
| 301 | 
+ | 
        i = 3;                          /* compare smaller components */ | 
| 302 | 
+ | 
        while (i--) { | 
| 303 | 
+ | 
                if (i == imax) | 
| 304 | 
+ | 
                        continue; | 
| 305 | 
+ | 
                if (!real_check(nv1[i], nv2[i])) | 
| 306 | 
+ | 
                        return(0); | 
| 307 | 
+ | 
        } | 
| 308 | 
+ | 
        return(1); | 
| 309 | 
+ | 
} | 
| 310 | 
+ | 
 | 
| 311 | 
  | 
/* Compare two strings for equivalence */ | 
| 312 | 
  | 
static int | 
| 313 | 
  | 
equiv_string(char *s1, char *s2) | 
| 380 | 
  | 
static int | 
| 381 | 
  | 
setheadvar(char *val, void *p) | 
| 382 | 
  | 
{ | 
| 383 | 
+ | 
        char    newval[128]; | 
| 384 | 
  | 
        LUTAB   *htp = (LUTAB *)p; | 
| 385 | 
  | 
        LUENT   *tep; | 
| 386 | 
  | 
        char    *key; | 
| 390 | 
  | 
        adv_linecnt(htp);       /* side-effect is to count lines */ | 
| 391 | 
  | 
        if (!isalpha(*val))     /* key must start line */ | 
| 392 | 
  | 
                return(0); | 
| 393 | 
+ | 
                                /* check if we need to swap binary data */ | 
| 394 | 
+ | 
        if ((n = isbigendian(val)) >= 0) { | 
| 395 | 
+ | 
                if (nativebigendian() == n) | 
| 396 | 
+ | 
                        return(0); | 
| 397 | 
+ | 
                f1swap += (htp == &hdr1); | 
| 398 | 
+ | 
                f2swap += (htp == &hdr2); | 
| 399 | 
+ | 
                return(0); | 
| 400 | 
+ | 
        } | 
| 401 | 
  | 
        key = val++; | 
| 402 | 
  | 
        while (*val && !isspace(*val) & (*val != '=')) | 
| 403 | 
  | 
                val++; | 
| 423 | 
  | 
                return(-1);     /* memory allocation error */ | 
| 424 | 
  | 
        if (!tep->key) | 
| 425 | 
  | 
                tep->key = strcpy(malloc(kln+1), key); | 
| 426 | 
< | 
        if (tep->data) | 
| 426 | 
> | 
        if (tep->data) {        /* check for special cases */ | 
| 427 | 
> | 
                if (!strcmp(key, "EXPOSURE")) { | 
| 428 | 
> | 
                        sprintf(newval, "%.6e", atof(tep->data)*atof(val)); | 
| 429 | 
> | 
                        vln = strlen(val = newval); | 
| 430 | 
> | 
                } | 
| 431 | 
  | 
                free(tep->data); | 
| 432 | 
+ | 
        } | 
| 433 | 
  | 
        tep->data = strcpy(malloc(vln+1), val); | 
| 434 | 
  | 
        return(1); | 
| 435 | 
  | 
} | 
| 538 | 
  | 
        } | 
| 539 | 
  | 
        if (c) | 
| 540 | 
  | 
                return(TYP_BINARY); | 
| 369 | 
– | 
        SET_FILE_TEXT(fin);                     /* originally set to binary */ | 
| 541 | 
  | 
        return(TYP_TEXT); | 
| 542 | 
  | 
badeof: | 
| 543 | 
  | 
        if (report != REP_QUIET) { | 
| 616 | 
  | 
static int | 
| 617 | 
  | 
compare_text() | 
| 618 | 
  | 
{ | 
| 619 | 
< | 
        char    l1buf[4096], l2buf[4096]; | 
| 619 | 
> | 
        LINEBUF l1buf, l2buf; | 
| 620 | 
  | 
 | 
| 621 | 
  | 
        if (report >= REP_VERBOSE) { | 
| 622 | 
  | 
                fputs(progname, stdout); | 
| 623 | 
< | 
                fputs(": comparing inputs as ASCII text\n", stdout); | 
| 623 | 
> | 
                fputs(": comparing inputs as ASCII text", stdout); | 
| 624 | 
> | 
                if (escape_newlines) | 
| 625 | 
> | 
                        fputs(", allowing escaped newlines", stdout); | 
| 626 | 
> | 
                if (comment_c) { | 
| 627 | 
> | 
                        fputs(", ignoring comments starting with '", stdout); | 
| 628 | 
> | 
                        fputc(comment_c, stdout); | 
| 629 | 
> | 
                        fputc('\'', stdout); | 
| 630 | 
> | 
                } | 
| 631 | 
> | 
                fputc('\n', stdout); | 
| 632 | 
  | 
        } | 
| 633 | 
< | 
                                                /* compare a line at a time */ | 
| 634 | 
< | 
        while (fgets(l1buf, sizeof(l1buf), f1in)) { | 
| 633 | 
> | 
        SET_FILE_TEXT(f1in);                    /* originally set to binary */ | 
| 634 | 
> | 
        SET_FILE_TEXT(f2in); | 
| 635 | 
> | 
        init_line(&l1buf); init_line(&l2buf);   /* compare a line at a time */ | 
| 636 | 
> | 
        while (read_line(&l1buf, f1in)) { | 
| 637 | 
  | 
                lin1cnt++; | 
| 638 | 
< | 
                if (!*sskip2(l1buf,0)) | 
| 638 | 
> | 
                if (!*sskip2(l1buf.str,0)) | 
| 639 | 
  | 
                        continue;               /* ignore empty lines */ | 
| 640 | 
< | 
                while (fgets(l2buf, sizeof(l2buf), f2in)) { | 
| 640 | 
> | 
 | 
| 641 | 
> | 
                while (read_line(&l2buf, f2in)) { | 
| 642 | 
  | 
                        lin2cnt++; | 
| 643 | 
< | 
                        if (*sskip2(l2buf,0)) | 
| 643 | 
> | 
                        if (*sskip2(l2buf.str,0)) | 
| 644 | 
  | 
                                break;          /* found other non-empty line */ | 
| 645 | 
  | 
                } | 
| 646 | 
< | 
                if (feof(f2in)) { | 
| 646 | 
> | 
                if (!l2buf.len) {               /* input 2 EOF? */ | 
| 647 | 
  | 
                        if (report != REP_QUIET) { | 
| 648 | 
  | 
                                fputs(f2name, stdout); | 
| 649 | 
  | 
                                fputs(": unexpected end-of-file\n", stdout); | 
| 650 | 
  | 
                        } | 
| 651 | 
+ | 
                        free_line(&l1buf); free_line(&l2buf); | 
| 652 | 
  | 
                        return(0); | 
| 653 | 
  | 
                } | 
| 654 | 
  | 
                                                /* compare non-empty lines */ | 
| 655 | 
< | 
                if (!equiv_string(l1buf, l2buf)) { | 
| 655 | 
> | 
                if (!equiv_string(l1buf.str, l2buf.str)) { | 
| 656 | 
  | 
                        if (report != REP_QUIET) { | 
| 657 | 
< | 
                                printf("%s: inputs '%s' and '%s' differ at line %d|%d\n", | 
| 658 | 
< | 
                                                progname, f1name, f2name, | 
| 659 | 
< | 
                                                lin1cnt, lin2cnt); | 
| 660 | 
< | 
                                if (report >= REP_VERBOSE) { | 
| 657 | 
> | 
                                printf("%s: inputs '%s' and '%s' differ at line %d", | 
| 658 | 
> | 
                                                progname, f1name, f2name, lin1cnt); | 
| 659 | 
> | 
                                if (lin1cnt != lin2cnt) | 
| 660 | 
> | 
                                        printf("|%d\n", lin2cnt); | 
| 661 | 
> | 
                                else | 
| 662 | 
> | 
                                        putchar('\n'); | 
| 663 | 
> | 
                                if ( report >= REP_VERBOSE && | 
| 664 | 
> | 
                                                (l1buf.len < 256) & | 
| 665 | 
> | 
                                                (l2buf.len < 256) ) { | 
| 666 | 
  | 
                                        fputs("------------- Mismatch -------------\n", stdout); | 
| 667 | 
  | 
                                        printf("%s@%d:\t%s", f1name, | 
| 668 | 
< | 
                                                        lin1cnt, l1buf); | 
| 668 | 
> | 
                                                        lin1cnt, l1buf.str); | 
| 669 | 
  | 
                                        printf("%s@%d:\t%s", f2name, | 
| 670 | 
< | 
                                                        lin2cnt, l2buf); | 
| 670 | 
> | 
                                                        lin2cnt, l2buf.str); | 
| 671 | 
  | 
                                } | 
| 672 | 
  | 
                        } | 
| 673 | 
+ | 
                        free_line(&l1buf); free_line(&l2buf); | 
| 674 | 
  | 
                        return(0); | 
| 675 | 
  | 
                } | 
| 676 | 
  | 
        } | 
| 677 | 
< | 
                                                /* check for EOF on input 2 */ | 
| 678 | 
< | 
        while (fgets(l2buf, sizeof(l2buf), f2in)) { | 
| 679 | 
< | 
                if (!*sskip2(l2buf,0)) | 
| 677 | 
> | 
        free_line(&l1buf);                      /* check for EOF on input 2 */ | 
| 678 | 
> | 
        while (read_line(&l2buf, f2in)) { | 
| 679 | 
> | 
                if (!*sskip2(l2buf.str,0)) | 
| 680 | 
  | 
                        continue; | 
| 681 | 
  | 
                if (report != REP_QUIET) { | 
| 682 | 
  | 
                        fputs(f1name, stdout); | 
| 683 | 
  | 
                        fputs(": unexpected end-of-file\n", stdout); | 
| 684 | 
  | 
                } | 
| 685 | 
+ | 
                free_line(&l2buf); | 
| 686 | 
  | 
                return(0); | 
| 687 | 
  | 
        } | 
| 688 | 
+ | 
        free_line(&l2buf); | 
| 689 | 
  | 
        return(good_RMS());                     /* final check for reals */ | 
| 690 | 
  | 
} | 
| 691 | 
  | 
 | 
| 692 | 
+ | 
/* Set resolution based on NROWS, NCOLS in header */ | 
| 693 | 
+ | 
static int | 
| 694 | 
+ | 
set_resolu(RESOLU *rs, LUTAB *htp) | 
| 695 | 
+ | 
{ | 
| 696 | 
+ | 
        const char      *val; | 
| 697 | 
+ | 
 | 
| 698 | 
+ | 
        rs->rt = PIXSTANDARD; | 
| 699 | 
+ | 
        val = (const char *)lu_find(htp, "NROWS")->data; | 
| 700 | 
+ | 
        if (!val) return(0); | 
| 701 | 
+ | 
        rs->yr = atoi(val); | 
| 702 | 
+ | 
        if (rs->yr <= 0) return(-1); | 
| 703 | 
+ | 
        val = (const char *)lu_find(htp, "NCOLS")->data; | 
| 704 | 
+ | 
        if (!val) return(0); | 
| 705 | 
+ | 
        rs->xr = atoi(val); | 
| 706 | 
+ | 
        if (rs->xr <= 0) return(-1); | 
| 707 | 
+ | 
        return(1); | 
| 708 | 
+ | 
} | 
| 709 | 
+ | 
 | 
| 710 | 
+ | 
/* Check image/map resolutions */ | 
| 711 | 
+ | 
static int | 
| 712 | 
+ | 
check_resolu(const char *class, RESOLU *r1p, RESOLU *r2p) | 
| 713 | 
+ | 
{ | 
| 714 | 
+ | 
        if (r1p->rt != r2p->rt) { | 
| 715 | 
+ | 
                if (report != REP_QUIET) | 
| 716 | 
+ | 
                        printf( | 
| 717 | 
+ | 
                        "%s: %ss '%s' and '%s' have different pixel ordering\n", | 
| 718 | 
+ | 
                                        progname, class, f1name, f2name); | 
| 719 | 
+ | 
                return(0); | 
| 720 | 
+ | 
        } | 
| 721 | 
+ | 
        if ((r1p->xr != r2p->xr) | (r1p->yr != r2p->yr)) { | 
| 722 | 
+ | 
                if (report != REP_QUIET) | 
| 723 | 
+ | 
                        printf( | 
| 724 | 
+ | 
                        "%s: %ss '%s' and '%s' are different sizes\n", | 
| 725 | 
+ | 
                                        progname, class, f1name, f2name); | 
| 726 | 
+ | 
                return(0); | 
| 727 | 
+ | 
        } | 
| 728 | 
+ | 
        return(1); | 
| 729 | 
+ | 
} | 
| 730 | 
+ | 
 | 
| 731 | 
  | 
/* Compare two inputs that are known to be RGBE or XYZE images */ | 
| 732 | 
  | 
static int | 
| 733 | 
  | 
compare_hdr() | 
| 742 | 
  | 
        } | 
| 743 | 
  | 
        fgetsresolu(&rs1, f1in); | 
| 744 | 
  | 
        fgetsresolu(&rs2, f2in); | 
| 745 | 
< | 
        if (rs1.rt != rs2.rt) { | 
| 516 | 
< | 
                if (report != REP_QUIET) | 
| 517 | 
< | 
                        printf( | 
| 518 | 
< | 
                        "%s: Images '%s' and '%s' have different pixel ordering\n", | 
| 519 | 
< | 
                                        progname, f1name, f2name); | 
| 745 | 
> | 
        if (!check_resolu("HDR image", &rs1, &rs2)) | 
| 746 | 
  | 
                return(0); | 
| 521 | 
– | 
        } | 
| 522 | 
– | 
        if ((rs1.xr != rs2.xr) | (rs1.yr != rs2.yr)) { | 
| 523 | 
– | 
                if (report != REP_QUIET) | 
| 524 | 
– | 
                        printf( | 
| 525 | 
– | 
                        "%s: Images '%s' and '%s' are different sizes\n", | 
| 526 | 
– | 
                                        progname, f1name, f2name); | 
| 527 | 
– | 
                return(0); | 
| 528 | 
– | 
        } | 
| 747 | 
  | 
        scan1 = (COLOR *)malloc(scanlen(&rs1)*sizeof(COLOR)); | 
| 748 | 
  | 
        scan2 = (COLOR *)malloc(scanlen(&rs2)*sizeof(COLOR)); | 
| 749 | 
  | 
        if (!scan1 | !scan2) { | 
| 764 | 
  | 
                        if (color_check(scan1[x], scan2[x])) | 
| 765 | 
  | 
                                continue; | 
| 766 | 
  | 
                        if (report != REP_QUIET) { | 
| 767 | 
< | 
                                printf( | 
| 550 | 
< | 
                                "%s: pixels at scanline %d offset %d differ\n", | 
| 767 | 
> | 
                                printf("%s: pixels at scanline %d offset %d differ\n", | 
| 768 | 
  | 
                                        progname, y, x); | 
| 769 | 
  | 
                                if (report >= REP_VERBOSE) { | 
| 770 | 
  | 
                                        printf("%s: (R,G,B)=(%g,%g,%g)\n", | 
| 787 | 
  | 
        return(good_RMS());                     /* final check of RMS */ | 
| 788 | 
  | 
} | 
| 789 | 
  | 
 | 
| 790 | 
+ | 
/* Compare two inputs that are known to be spectral images */ | 
| 791 | 
+ | 
static int | 
| 792 | 
+ | 
compare_spec() | 
| 793 | 
+ | 
{ | 
| 794 | 
+ | 
        static char     NCstr[] = NCOMPSTR; | 
| 795 | 
+ | 
        RESOLU          rs1, rs2; | 
| 796 | 
+ | 
        COLORV          *scan1, *scan2; | 
| 797 | 
+ | 
        const char      *val; | 
| 798 | 
+ | 
        int             x, y; | 
| 799 | 
+ | 
 | 
| 800 | 
+ | 
        if (report >= REP_VERBOSE) { | 
| 801 | 
+ | 
                fputs(progname, stdout); | 
| 802 | 
+ | 
                fputs(": comparing inputs as spectral images\n", stdout); | 
| 803 | 
+ | 
        } | 
| 804 | 
+ | 
        if (!(set_resolu(&rs1, &hdr1) || fgetsresolu(&rs1, f1in))) | 
| 805 | 
+ | 
                return(0); | 
| 806 | 
+ | 
        if (!(set_resolu(&rs2, &hdr2) || fgetsresolu(&rs2, f2in))) | 
| 807 | 
+ | 
                return(0); | 
| 808 | 
+ | 
        if (!check_resolu("Spectral image", &rs1, &rs2)) | 
| 809 | 
+ | 
                return(0); | 
| 810 | 
+ | 
        NCstr[LNCOMPSTR-1] = '\0'; | 
| 811 | 
+ | 
        val = (const char *)lu_find(&hdr1, NCstr)->data; | 
| 812 | 
+ | 
        if (!val || (NCSAMP = atoi(val)) < 3) { | 
| 813 | 
+ | 
                if (report != REP_QUIET) { | 
| 814 | 
+ | 
                        if (val) | 
| 815 | 
+ | 
                                printf("%s: illegal # components (%d) for spectral image\n", | 
| 816 | 
+ | 
                                        progname, NCSAMP); | 
| 817 | 
+ | 
                        else | 
| 818 | 
+ | 
                                printf("%s: missing %s in header for spectral image\n", | 
| 819 | 
+ | 
                                        progname, NCstr); | 
| 820 | 
+ | 
                } | 
| 821 | 
+ | 
                return(0); | 
| 822 | 
+ | 
        } | 
| 823 | 
+ | 
        scan1 = (COLORV *)malloc(sizeof(COLORV)*NCSAMP*scanlen(&rs1)); | 
| 824 | 
+ | 
        scan2 = (COLORV *)malloc(sizeof(COLORV)*NCSAMP*scanlen(&rs2)); | 
| 825 | 
+ | 
        if (!scan1 | !scan2) { | 
| 826 | 
+ | 
                fprintf(stderr, "%s: out of memory in compare_hdr()\n", progname); | 
| 827 | 
+ | 
                exit(2); | 
| 828 | 
+ | 
        } | 
| 829 | 
+ | 
        for (y = 0; y < numscans(&rs1); y++) { | 
| 830 | 
+ | 
                if ((freadsscan(scan1, NCSAMP, scanlen(&rs1), f1in) < 0) | | 
| 831 | 
+ | 
                                (freadsscan(scan2, NCSAMP, scanlen(&rs2), f2in) < 0)) { | 
| 832 | 
+ | 
                        if (report != REP_QUIET) | 
| 833 | 
+ | 
                                printf("%s: unexpected end-of-file\n", progname); | 
| 834 | 
+ | 
                        free(scan1); | 
| 835 | 
+ | 
                        free(scan2); | 
| 836 | 
+ | 
                        return(0); | 
| 837 | 
+ | 
                } | 
| 838 | 
+ | 
                for (x = 0; x < scanlen(&rs1); x++) { | 
| 839 | 
+ | 
                        if (spec_check(scan1+x*NCSAMP, scan2+x*NCSAMP)) | 
| 840 | 
+ | 
                                continue; | 
| 841 | 
+ | 
                        if (report != REP_QUIET) { | 
| 842 | 
+ | 
                                int     k; | 
| 843 | 
+ | 
                                printf("%s: spectra at scanline %d offset %d differ\n", | 
| 844 | 
+ | 
                                        progname, y, x); | 
| 845 | 
+ | 
                                if (report >= REP_VERBOSE) { | 
| 846 | 
+ | 
                                        printf("%s: spectrum =", f1name); | 
| 847 | 
+ | 
                                        for (k = 0; k < NCSAMP; k++) | 
| 848 | 
+ | 
                                                printf(" %g", scan1[x*NCSAMP+k]); | 
| 849 | 
+ | 
                                        fputc('\n', stdout); | 
| 850 | 
+ | 
                                        printf("%s: spectrum =", f2name); | 
| 851 | 
+ | 
                                        for (k = 0; k < NCSAMP; k++) | 
| 852 | 
+ | 
                                                printf(" %g", scan2[x*NCSAMP+k]); | 
| 853 | 
+ | 
                                        fputc('\n', stdout); | 
| 854 | 
+ | 
                                } | 
| 855 | 
+ | 
                        } | 
| 856 | 
+ | 
                        free(scan1); | 
| 857 | 
+ | 
                        free(scan2); | 
| 858 | 
+ | 
                        return(0); | 
| 859 | 
+ | 
                } | 
| 860 | 
+ | 
        } | 
| 861 | 
+ | 
        free(scan1); | 
| 862 | 
+ | 
        free(scan2); | 
| 863 | 
+ | 
        return(good_RMS());                     /* final check of RMS */ | 
| 864 | 
+ | 
} | 
| 865 | 
+ | 
 | 
| 866 | 
+ | 
/* Set reference depth based on header variable */ | 
| 867 | 
+ | 
static int | 
| 868 | 
+ | 
set_refdepth(DEPTHCODEC *dcp, LUTAB *htp) | 
| 869 | 
+ | 
{ | 
| 870 | 
+ | 
        static char     depthvar[] = DEPTHSTR; | 
| 871 | 
+ | 
        const char      *drval; | 
| 872 | 
+ | 
 | 
| 873 | 
+ | 
        depthvar[LDEPTHSTR-1] = '\0'; | 
| 874 | 
+ | 
        drval = (const char *)lu_find(htp, depthvar)->data; | 
| 875 | 
+ | 
        if (!drval) | 
| 876 | 
+ | 
                return(0); | 
| 877 | 
+ | 
        dcp->refdepth = atof(drval); | 
| 878 | 
+ | 
        if (dcp->refdepth <= 0) { | 
| 879 | 
+ | 
                if (report != REP_QUIET) { | 
| 880 | 
+ | 
                        fputs(dcp->inpname, stderr); | 
| 881 | 
+ | 
                        fputs(": bad reference depth '", stderr); | 
| 882 | 
+ | 
                        fputs(drval, stderr); | 
| 883 | 
+ | 
                        fputs("'\n", stderr); | 
| 884 | 
+ | 
                } | 
| 885 | 
+ | 
                return(-1); | 
| 886 | 
+ | 
        } | 
| 887 | 
+ | 
        return(1); | 
| 888 | 
+ | 
} | 
| 889 | 
+ | 
 | 
| 890 | 
+ | 
/* Compare two encoded depth maps */ | 
| 891 | 
+ | 
static int | 
| 892 | 
+ | 
compare_depth() | 
| 893 | 
+ | 
{ | 
| 894 | 
+ | 
        long            nread = 0; | 
| 895 | 
+ | 
        DEPTHCODEC      dc1, dc2; | 
| 896 | 
+ | 
 | 
| 897 | 
+ | 
        if (report >= REP_VERBOSE) { | 
| 898 | 
+ | 
                fputs(progname, stdout); | 
| 899 | 
+ | 
                fputs(": comparing inputs as depth maps\n", stdout); | 
| 900 | 
+ | 
        } | 
| 901 | 
+ | 
        set_dc_defaults(&dc1); | 
| 902 | 
+ | 
        dc1.hdrflags = HF_RESIN; | 
| 903 | 
+ | 
        dc1.finp = f1in; | 
| 904 | 
+ | 
        dc1.inpname = f1name; | 
| 905 | 
+ | 
        set_dc_defaults(&dc2); | 
| 906 | 
+ | 
        dc2.hdrflags = HF_RESIN; | 
| 907 | 
+ | 
        dc2.finp = f2in; | 
| 908 | 
+ | 
        dc2.inpname = f2name; | 
| 909 | 
+ | 
        if (report != REP_QUIET) { | 
| 910 | 
+ | 
                dc1.hdrflags |= HF_STDERR; | 
| 911 | 
+ | 
                dc2.hdrflags |= HF_STDERR; | 
| 912 | 
+ | 
        } | 
| 913 | 
+ | 
        if (!process_dc_header(&dc1, 0, NULL)) | 
| 914 | 
+ | 
                return(0); | 
| 915 | 
+ | 
        if (!process_dc_header(&dc2, 0, NULL)) | 
| 916 | 
+ | 
                return(0); | 
| 917 | 
+ | 
        if (!check_resolu("Depth map", &dc1.res, &dc2.res)) | 
| 918 | 
+ | 
                return(0); | 
| 919 | 
+ | 
        if (set_refdepth(&dc1, &hdr1) < 0) | 
| 920 | 
+ | 
                return(0); | 
| 921 | 
+ | 
        if (set_refdepth(&dc2, &hdr2) < 0) | 
| 922 | 
+ | 
                return(0); | 
| 923 | 
+ | 
        while (nread < dc1.res.xr*dc1.res.yr) { | 
| 924 | 
+ | 
                double  d1 = decode_depth_next(&dc1); | 
| 925 | 
+ | 
                double  d2 = decode_depth_next(&dc2); | 
| 926 | 
+ | 
                if ((d1 < 0) | (d2 < 0)) { | 
| 927 | 
+ | 
                        if (report != REP_QUIET) | 
| 928 | 
+ | 
                                printf("%s: unexpected end-of-file\n", | 
| 929 | 
+ | 
                                                progname); | 
| 930 | 
+ | 
                        return(0); | 
| 931 | 
+ | 
                } | 
| 932 | 
+ | 
                ++nread; | 
| 933 | 
+ | 
                if (real_check(d1, d2)) | 
| 934 | 
+ | 
                        continue; | 
| 935 | 
+ | 
                if (report != REP_QUIET) | 
| 936 | 
+ | 
                        printf("%s: %ld%s depth values differ\n", | 
| 937 | 
+ | 
                                        progname, nread, num_sfx(nread)); | 
| 938 | 
+ | 
                return(0); | 
| 939 | 
+ | 
        } | 
| 940 | 
+ | 
        return(good_RMS());             /* final check of RMS */ | 
| 941 | 
+ | 
} | 
| 942 | 
+ | 
 | 
| 943 | 
+ | 
/* Compare two encoded normal maps */ | 
| 944 | 
+ | 
static int | 
| 945 | 
+ | 
compare_norm() | 
| 946 | 
+ | 
{ | 
| 947 | 
+ | 
        long            nread = 0; | 
| 948 | 
+ | 
        NORMCODEC       nc1, nc2; | 
| 949 | 
+ | 
 | 
| 950 | 
+ | 
        if (report >= REP_VERBOSE) { | 
| 951 | 
+ | 
                fputs(progname, stdout); | 
| 952 | 
+ | 
                fputs(": comparing inputs as normal maps\n", stdout); | 
| 953 | 
+ | 
        } | 
| 954 | 
+ | 
        set_nc_defaults(&nc1); | 
| 955 | 
+ | 
        nc1.hdrflags = HF_RESIN; | 
| 956 | 
+ | 
        nc1.finp = f1in; | 
| 957 | 
+ | 
        nc1.inpname = f1name; | 
| 958 | 
+ | 
        set_nc_defaults(&nc2); | 
| 959 | 
+ | 
        nc2.hdrflags = HF_RESIN; | 
| 960 | 
+ | 
        nc2.finp = f2in; | 
| 961 | 
+ | 
        nc2.inpname = f2name; | 
| 962 | 
+ | 
        if (report != REP_QUIET) { | 
| 963 | 
+ | 
                nc1.hdrflags |= HF_STDERR; | 
| 964 | 
+ | 
                nc2.hdrflags |= HF_STDERR; | 
| 965 | 
+ | 
        } | 
| 966 | 
+ | 
        if (!process_nc_header(&nc1, 0, NULL)) | 
| 967 | 
+ | 
                return(0); | 
| 968 | 
+ | 
        if (!process_nc_header(&nc2, 0, NULL)) | 
| 969 | 
+ | 
                return(0); | 
| 970 | 
+ | 
        if (!check_resolu("Normal map", &nc1.res, &nc2.res)) | 
| 971 | 
+ | 
                return(0); | 
| 972 | 
+ | 
        while (nread < nc1.res.xr*nc1.res.yr) { | 
| 973 | 
+ | 
                FVECT   nv1, nv2; | 
| 974 | 
+ | 
                int     rv1 = decode_normal_next(nv1, &nc1); | 
| 975 | 
+ | 
                int     rv2 = decode_normal_next(nv2, &nc2); | 
| 976 | 
+ | 
                if ((rv1 < 0) | (rv2 < 0)) { | 
| 977 | 
+ | 
                        if (report != REP_QUIET) | 
| 978 | 
+ | 
                                printf("%s: unexpected end-of-file\n", | 
| 979 | 
+ | 
                                                progname); | 
| 980 | 
+ | 
                        return(0); | 
| 981 | 
+ | 
                } | 
| 982 | 
+ | 
                ++nread; | 
| 983 | 
+ | 
                if (rv1 == rv2 && (!rv1 || norm_check(nv1, nv2))) | 
| 984 | 
+ | 
                        continue; | 
| 985 | 
+ | 
                if (report != REP_QUIET) | 
| 986 | 
+ | 
                        printf("%s: %ld%s normal vectors differ\n", | 
| 987 | 
+ | 
                                        progname, nread, num_sfx(nread)); | 
| 988 | 
+ | 
                return(0); | 
| 989 | 
+ | 
        } | 
| 990 | 
+ | 
        return(good_RMS());             /* final check of RMS */ | 
| 991 | 
+ | 
} | 
| 992 | 
+ | 
 | 
| 993 | 
  | 
/* Compare two inputs that are known to be 32-bit floating-point data */ | 
| 994 | 
  | 
static int | 
| 995 | 
  | 
compare_float() | 
| 1005 | 
  | 
                if (!getbinary(&f2, sizeof(f2), 1, f2in)) | 
| 1006 | 
  | 
                        goto badeof; | 
| 1007 | 
  | 
                ++nread; | 
| 1008 | 
+ | 
                if (f1swap) swap32((char *)&f1, 1); | 
| 1009 | 
+ | 
                if (f2swap) swap32((char *)&f2, 1); | 
| 1010 | 
  | 
                if (real_check(f1, f2)) | 
| 1011 | 
  | 
                        continue; | 
| 1012 | 
  | 
                if (report != REP_QUIET) | 
| 1037 | 
  | 
                if (!getbinary(&f2, sizeof(f2), 1, f2in)) | 
| 1038 | 
  | 
                        goto badeof; | 
| 1039 | 
  | 
                ++nread; | 
| 1040 | 
+ | 
                if (f1swap) swap64((char *)&f1, 1); | 
| 1041 | 
+ | 
                if (f2swap) swap64((char *)&f2, 1); | 
| 1042 | 
  | 
                if (real_check(f1, f2)) | 
| 1043 | 
  | 
                        continue; | 
| 1044 | 
  | 
                if (report != REP_QUIET) | 
| 1067 | 
  | 
                case 'h':                       /* ignore header info. */ | 
| 1068 | 
  | 
                        ign_header = !ign_header; | 
| 1069 | 
  | 
                        continue; | 
| 1070 | 
+ | 
                case 'n':                       /* allow newline escapes */ | 
| 1071 | 
+ | 
                        escape_newlines = !escape_newlines; | 
| 1072 | 
+ | 
                        continue; | 
| 1073 | 
+ | 
                case 'c':                       /* ignore comments */ | 
| 1074 | 
+ | 
                        comment_c = argv[a][2]; | 
| 1075 | 
+ | 
                        continue; | 
| 1076 | 
  | 
                case 's':                       /* silent operation */ | 
| 1077 | 
  | 
                        report = REP_QUIET; | 
| 1078 | 
  | 
                        continue; | 
| 1133 | 
  | 
                return(2); | 
| 1134 | 
  | 
        if (typ1 != typ2) { | 
| 1135 | 
  | 
                if (report != REP_QUIET) | 
| 1136 | 
< | 
                        printf("%s: '%s' is %s and '%s' is %s\n", | 
| 1136 | 
> | 
                        printf("%s: '%s' format is %s and '%s' is %s\n", | 
| 1137 | 
  | 
                                        progname, f1name, file_type[typ1], | 
| 1138 | 
  | 
                                        f2name, file_type[typ2]); | 
| 1139 | 
  | 
                return(1); | 
| 1141 | 
  | 
        ign_header |= !has_header(typ1);        /* check headers if indicated */ | 
| 1142 | 
  | 
        if (!ign_header && !headers_match()) | 
| 1143 | 
  | 
                return(1); | 
| 714 | 
– | 
        lu_done(&hdr1); lu_done(&hdr2); | 
| 1144 | 
  | 
        if (!ign_header & (report >= REP_WARN)) { | 
| 716 | 
– | 
                if (typ1 == TYP_UNKNOWN) | 
| 717 | 
– | 
                        printf("%s: warning - unrecognized format, comparing as binary\n", | 
| 718 | 
– | 
                                        progname); | 
| 1145 | 
  | 
                if (lin1cnt != lin2cnt) | 
| 1146 | 
  | 
                        printf("%s: warning - headers are different lengths\n", | 
| 1147 | 
  | 
                                        progname); | 
| 1148 | 
+ | 
                if (typ1 == TYP_UNKNOWN) | 
| 1149 | 
+ | 
                        printf("%s: warning - unrecognized format\n", | 
| 1150 | 
+ | 
                                        progname); | 
| 1151 | 
  | 
        } | 
| 1152 | 
< | 
        if (report >= REP_VERBOSE) | 
| 1153 | 
< | 
                printf("%s: input file type is %s\n", | 
| 1154 | 
< | 
                                progname, file_type[typ1]); | 
| 1155 | 
< | 
 | 
| 1152 | 
> | 
        if (report >= REP_VERBOSE) { | 
| 1153 | 
> | 
                printf("%s: data format is %s\n", progname, file_type[typ1]); | 
| 1154 | 
> | 
                if ((typ1 == TYP_FLOAT) | (typ1 == TYP_DOUBLE)) { | 
| 1155 | 
> | 
                        if (f1swap) | 
| 1156 | 
> | 
                                printf("%s: input '%s' is byte-swapped\n", | 
| 1157 | 
> | 
                                                progname, f1name); | 
| 1158 | 
> | 
                        if (f2swap) | 
| 1159 | 
> | 
                                printf("%s: input '%s' is byte-swapped\n", | 
| 1160 | 
> | 
                                                progname, f2name); | 
| 1161 | 
> | 
                } | 
| 1162 | 
> | 
        } | 
| 1163 | 
  | 
        switch (typ1) {                         /* compare based on type */ | 
| 1164 | 
  | 
        case TYP_BINARY: | 
| 1165 | 
  | 
        case TYP_TMESH: | 
| 1166 | 
  | 
        case TYP_OCTREE: | 
| 1167 | 
  | 
        case TYP_RBFMESH: | 
| 1168 | 
+ | 
        case TYP_ID8: | 
| 1169 | 
+ | 
        case TYP_ID16: | 
| 1170 | 
+ | 
        case TYP_ID24: | 
| 1171 | 
  | 
        case TYP_UNKNOWN: | 
| 1172 | 
  | 
                return( !compare_binary() ); | 
| 1173 | 
  | 
        case TYP_TEXT: | 
| 1176 | 
  | 
        case TYP_RGBE: | 
| 1177 | 
  | 
        case TYP_XYZE: | 
| 1178 | 
  | 
                return( !compare_hdr() ); | 
| 1179 | 
+ | 
        case TYP_SPEC: | 
| 1180 | 
+ | 
                return( !compare_spec() ); | 
| 1181 | 
+ | 
        case TYP_DEPTH: | 
| 1182 | 
+ | 
                return( !compare_depth() ); | 
| 1183 | 
+ | 
        case TYP_NORM: | 
| 1184 | 
+ | 
                return( !compare_norm() ); | 
| 1185 | 
  | 
        case TYP_FLOAT: | 
| 1186 | 
  | 
                return( !compare_float() ); | 
| 1187 | 
  | 
        case TYP_DOUBLE: |