ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/src/common/data.c
(Generate patch)

Comparing ray/src/common/data.c (file contents):
Revision 2.1 by greg, Fri Aug 2 18:47:25 2024 UTC vs.
Revision 2.4 by greg, Sun Mar 9 19:11:51 2025 UTC

# Line 343 | Line 343 | getspec(               /* load hyperspectral image as data */
343   #endif
344          if ((pp->arr.s = (uby8 *)malloc(i)) == NULL)
345                  goto memerr;
346 <        for (y = 0; y < ns; y++)                /* read each scanline */
346 >        for (y = ns; y-- > 0; )                 /* read each scanline */
347                  if (freadscolrs(pp->arr.s + y*sl*(si.nc+1), si.nc, sl, fp) < 0)
348                          goto readerr;
349          fclose(fp);
# Line 462 | Line 462 | data_interp(DATARRAY *dp, double *pt, double coef, DAT
462                  c0 = 1./(i-1 - x);
463                  c1 = -2.*c0;
464          } else if (x < i-1) {
465 <                c1 = 1./(i - x);
465 >                c1 = 1./(x - i);
466                  c0 = -2.*c1;
467          } else {
468                  c0 = i+1 - x;
# Line 481 | Line 481 | data_interp(DATARRAY *dp, double *pt, double coef, DAT
481                          double  f;
482                          sd.arr.s = dp->arr.s + i*stride;
483                          if ((sd.arr.s[sd.dim[0].ne] > 0) & ((-FTINY>c0)|(c0>FTINY))) {
484 <                                f = ldexp(c0, (int)sd.arr.s[sd.dim[0].ne]-(COLXS+8));
484 >                                f = c0 * cxponent[sd.arr.s[sd.dim[0].ne]];
485                                  for (i = sd.dim[0].ne; i--; )
486                                          rvec[i] += f*(sd.arr.s[i] + .5);
487                          }
488                          sd.arr.s += stride;
489                          if ((sd.arr.s[sd.dim[0].ne] > 0) & ((-FTINY>c1)|(c1>FTINY))) {
490 <                                f = ldexp(c1, (int)sd.arr.s[sd.dim[0].ne]-(COLXS+8));
490 >                                f = c1 * cxponent[sd.arr.s[sd.dim[0].ne]];
491                                  for (i = sd.dim[0].ne; i--; )
492                                          rvec[i] += f*(sd.arr.s[i] + .5);
493                          }
# Line 520 | Line 520 | data_interp(DATARRAY *dp, double *pt, double coef, DAT
520                          y0 = dp->arr.d[i];
521                          y1 = dp->arr.d[i+1];
522                  } else if (dp->type == SPECTY) {
523 <                        if (dp->arr.s[dp->dim[0].ne]) {
524 <                                double  f = dp->arr.s[dp->dim[0].ne]
525 <                                        ? ldexp(1., -(COLXS+8) +
526 <                                                (int)dp->arr.s[dp->dim[0].ne])
527 <                                        : 0.;
528 <                                y0 = f*(dp->arr.s[i] + 0.5);
529 <                                y1 = f*(dp->arr.s[i+1] + 0.5);
530 <                        } else
531 <                                y0 = y1 = 0.;
523 >                        double  f = cxponent[dp->arr.s[dp->dim[0].ne]];
524 >                        y0 = f*(dp->arr.s[i] + 0.5);
525 >                        y1 = f*(dp->arr.s[i+1] + 0.5);
526                  } else {
527                          y0 = colrval(dp->arr.c[i],dp->type);
528                          y1 = colrval(dp->arr.c[i+1],dp->type);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines