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

Comparing ray/src/util/rttree_reduce.c (file contents):
Revision 2.16 by greg, Thu Aug 18 00:52:48 2016 UTC vs.
Revision 2.17 by greg, Wed May 31 03:26:46 2017 UTC

# Line 223 | Line 223 | read_double(float *rowp, int n)
223                  return(0);
224          }
225          if (rblen < n) {
226 <                rowbuf = (double *)realloc(rowbuf, sizeof(double)*(rblen=n));
226 >                if (rblen) free(rowbuf);
227 >                rowbuf = (double *)malloc(sizeof(double)*(rblen=n));
228                  if (rowbuf == NULL)
229                          error(SYSTEM, "out of memory in read_double");
230          }
# Line 283 | Line 284 | load_data(void)
284                  int     ix, ox;
285                  for (ix = 0; ix < 1<<(log2g-1); ix++)
286                          for (ox = 0; ox < 1<<log2g; ox++)
287 <                                (*readf)(datarr+(((ix<<log2g)+ox)<<log2g),
287 <                                                1<<log2g);
287 >                                (*readf)(&dval3(ix,ox,0), 1<<log2g);
288          } else /* ttrank == 4 */ {
289                  int     ix, iy, ox;
290                  for (ix = 0; ix < 1<<log2g; ix++)
291                      for (iy = 0; iy < 1<<log2g; iy++)
292                          for (ox = 0; ox < 1<<log2g; ox++)
293 <                                (*readf)(datarr +
294 <                                (((((ix<<log2g)+iy)<<log2g)+ox)<<log2g),
295 <                                                1<<log2g);
293 >                                (*readf)(&dval4(ix,iy,ox,0), 1<<log2g);
294          }
295          (*readf)(NULL, 0);      /* releases any buffers */
296          if (infmt == 'a') {
# Line 332 | Line 330 | do_reciprocity(void)
330                          }
331          } else /* ttrank == 4 */ {
332                  int     ix, iy, ox, oy;
333 <                for (ix = 1; ix < siz; ix++)
334 <                    for (iy = 1; iy < siz; iy++)
335 <                        for (ox = 0; ox < ix; ox++)
336 <                            for (oy = 0; oy < iy; oy++) {
333 >                for (ix = 0; ix < siz; ix++)
334 >                    for (iy = 0; iy < siz; iy++) {
335 >                        int     cnt = ix*siz + iy;
336 >                        for (ox = 0; cnt > 0; ox++)
337 >                            for (oy = 0; oy < siz; oy++) {
338                                  v1p = &dval4(siz-1-ix,siz-1-iy,ox,oy);
339                                  v2p = &dval4(siz-1-ox,siz-1-oy,ix,iy);
340                                  *v1p = *v2p = .5f*( *v1p + *v2p );
341 +                                if (--cnt <= 0)
342 +                                        break;
343                              }
344 +                    }
345          }
346   }
347  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines