--- ray/src/util/rcode_depth.c 2019/07/19 01:24:33 2.3 +++ ray/src/util/rcode_depth.c 2019/08/14 21:00:14 2.6 @@ -1,5 +1,5 @@ #ifndef lint -static const char RCSid[] = "$Id: rcode_depth.c,v 2.3 2019/07/19 01:24:33 greg Exp $"; +static const char RCSid[] = "$Id: rcode_depth.c,v 2.6 2019/08/14 21:00:14 greg Exp $"; #endif /* * Encode and decode depth map using 16-bit integers @@ -27,12 +27,12 @@ usage_exit(int code) fputs("Usage: ", stderr); fputs(progname, stderr); fputs( - " [-d ref_depth/unit][-h[io]][-H[io]][-f[afd]] [input [output]]\n", + " [-d ref_depth/unit][-h[io]][-H[io]][-f[afd]] [input [output.dpt]]\n", stderr); fputs(" Or: ", stderr); fputs(progname, stderr); fputs( - " {-r|-p} [-i][-u][-h[io]][-H[io]][-f[afd]] [input [output]]\n", + " {-r|-p} [-i][-u][-h[io]][-H[io]][-f[afd]] [input.dpt [output]]\n", stderr); exit(code); } @@ -45,11 +45,11 @@ encode_depths(DEPTHCODEC *dcp) long nexpected = (long)dcp->res.xr * dcp->res.yr; if (dcp->inpfmt[0]) { - if (strcasestr(dcp->inpfmt, "ascii") != NULL) + if (strstr(dcp->inpfmt, "ascii") != NULL) dcp->format = 'a'; - else if (strcasestr(dcp->inpfmt, "float") != NULL) + else if (strstr(dcp->inpfmt, "float") != NULL) dcp->format = 'f'; - else if (strcasestr(dcp->inpfmt, "double") != NULL) + else if (strstr(dcp->inpfmt, "double") != NULL) dcp->format = 'd'; else { fputs(dcp->inpname, stderr); @@ -71,10 +71,14 @@ encode_depths(DEPTHCODEC *dcp) break; case 'f': ok = (getbinary(&f, sizeof(f), 1, dcp->finp) == 1); + if (dcp->swapped) + swap32((char *)&f, 1); d = f; break; case 'd': ok = (getbinary(&d, sizeof(d), 1, dcp->finp) == 1); + if (dcp->swapped) + swap64((char *)&d, 1); break; } if (!ok) @@ -383,7 +387,7 @@ main(int argc, char *argv[]) fputs(": -i option requires input resolution\n", stderr); usage_exit(1); } - dc.hdrflags &= ~(HF_HEADOUT|HF_RESOUT); + dc.hdrflags &= ~HF_RESOUT; } if (a < argc-2) { fputs(progname, stderr);