--- ray/src/util/rcode_depth.c 2020/07/20 15:53:30 2.11 +++ ray/src/util/rcode_depth.c 2025/06/03 21:31:51 2.13 @@ -1,5 +1,5 @@ #ifndef lint -static const char RCSid[] = "$Id: rcode_depth.c,v 2.11 2020/07/20 15:53:30 greg Exp $"; +static const char RCSid[] = "$Id: rcode_depth.c,v 2.13 2025/06/03 21:31:51 greg Exp $"; #endif /* * Encode and decode depth map using 16-bit integers @@ -15,8 +15,6 @@ static const char RCSid[] = "$Id: rcode_depth.c,v 2.11 #include "fvect.h" #include "depthcodec.h" -char *progname; /* set in main() */ - enum {CV_FWD, CV_REV, CV_PTS}; @@ -162,16 +160,12 @@ pixel_depths(DEPTHCODEC *dcp, int unbuf) return 0; while (scanf("%d %d", &xy[0], &xy[1]) == 2) { - - loc2pix(xy, &dcp->res, - (xy[0]+.5)/dcp->res.xr, (xy[1]+.5)/dcp->res.yr); - + loc2pix(xy, &dcp->res, xy[0]/(double)dcp->res.xr, + xy[1]/(double)dcp->res.yr); d = decode_depth_pix(dcp, xy[0], xy[1]); if (d < -FTINY) return 0; - output_depth(dcp, d); - if (unbuf && fflush(stdout) == EOF) { fputs(progname, stderr); fputs(": write error on output\n", stderr); @@ -260,8 +254,8 @@ pixel_points(DEPTHCODEC *dcp, int unbuf) return 0; while (scanf("%d %d", &xy[0], &xy[1]) == 2) { - loc2pix(xy, &dcp->res, - (xy[0]+.5)/dcp->res.xr, (xy[1]+.5)/dcp->res.yr); + loc2pix(xy, &dcp->res, xy[0]/(double)dcp->res.xr, + xy[1]/(double)dcp->res.yr); if (get_worldpos_pix(wpos, dcp, xy[0], xy[1]) < 0) return 0; output_worldpos(dcp, wpos); @@ -289,8 +283,8 @@ main(int argc, char *argv[]) int unbuffered = 0; DEPTHCODEC dc; int a; - - progname = argv[0]; + /* set global progname */ + fixargv0(argv[0]); set_dc_defaults(&dc); dc.hdrflags = HF_ALL; for (a = 1; a < argc && argv[a][0] == '-'; a++)