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

Comparing ray/src/common/bsdf_t.c (file contents):
Revision 3.9 by greg, Wed Apr 27 23:05:51 2011 UTC vs.
Revision 3.23 by greg, Mon Aug 22 18:21:05 2011 UTC

# Line 10 | Line 10 | static const char RCSid[] = "$Id$";
10   *
11   */
12  
13 + #define _USE_MATH_DEFINES
14   #include "rtio.h"
15   #include <stdlib.h>
16   #include <math.h>
# Line 25 | Line 26 | typedef int    SDtreCallback(float val, const double *cmi
26  
27                                          /* reference width maximum (1.0) */
28   static const unsigned   iwbits = sizeof(unsigned)*4;
29 < static const unsigned   iwmax = (1<<(sizeof(unsigned)*4))-1;
29 > static const unsigned   iwmax = 1<<(sizeof(unsigned)*4);
30                                          /* maximum cumulative value */
31   static const unsigned   cumlmax = ~0;
32 +                                        /* constant z-vector */
33 + static const FVECT      zvec = {.0, .0, 1.};
34 +                                        /* quantization value */
35 + static double           quantum = 1./256.;
36  
37   /* Struct used for our distribution-building callback */
38   typedef struct {
# Line 61 | Line 66 | SDnewNode(int nd, int lg)
66          if (lg < 0) {
67                  st = (SDNode *)malloc(sizeof(SDNode) +
68                                  sizeof(st->u.t[0])*((1<<nd) - 1));
69 <                if (st != NULL)
65 <                        memset(st->u.t, 0, sizeof(st->u.t[0])<<nd);
66 <        } else
67 <                st = (SDNode *)malloc(sizeof(SDNode) +
68 <                                sizeof(st->u.v[0])*((1 << nd*lg) - 1));
69 <                
70 <        if (st == NULL) {
71 <                if (lg < 0)
69 >                if (st == NULL) {
70                          sprintf(SDerrorDetail,
71                                  "Cannot allocate %d branch BSDF tree", 1<<nd);
72 <                else
72 >                        return NULL;
73 >                }
74 >                memset(st->u.t, 0, sizeof(st->u.t[0])<<nd);
75 >        } else {
76 >                st = (SDNode *)malloc(sizeof(SDNode) +
77 >                                sizeof(st->u.v[0])*((1 << nd*lg) - 1));        
78 >                if (st == NULL) {
79                          sprintf(SDerrorDetail,
80                                  "Cannot allocate %d BSDF leaves", 1 << nd*lg);
81 <                return NULL;
81 >                        return NULL;
82 >                }
83          }
84          st->ndim = nd;
85          st->log2GR = lg;
# Line 85 | Line 90 | SDnewNode(int nd, int lg)
90   static void
91   SDfreeTre(SDNode *st)
92   {
93 <        int     i;
93 >        int     n;
94  
95          if (st == NULL)
96                  return;
97 <        for (i = (st->log2GR < 0) << st->ndim; i--; )
98 <                SDfreeTre(st->u.t[i]);
99 <        free((void *)st);
97 >        for (n = (st->log2GR < 0) << st->ndim; n--; )
98 >                SDfreeTre(st->u.t[n]);
99 >        free(st);
100   }
101  
102   /* Free a variable-resolution BSDF */
# Line 125 | Line 130 | fill_grid_branch(float *dptr, const float *sptr, int n
130   static float *
131   grid_branch_start(SDNode *st, int n)
132   {
133 <        unsigned        skipsiz = 1 << st->log2GR;
133 >        unsigned        skipsiz = 1 << (st->log2GR - 1);
134          float           *vptr = st->u.v;
135          int             i;
136  
137          for (i = st->ndim; i--; skipsiz <<= st->log2GR)
138                  if (1<<i & n)
139 <                        vptr += skipsiz >> 1;
139 >                        vptr += skipsiz;
140          return vptr;
141   }
142  
# Line 187 | Line 192 | SDsmallestLeaf(const SDNode *st)
192   static double
193   SDiterSum(const float *va, int nd, int shft, const int *imin, const int *imax)
194   {
195 <        const unsigned  skipsiz = 1 << nd*shft;
195 >        const unsigned  skipsiz = 1 << --nd*shft;
196          double          sum = .0;
197          int             i;
198 <        
198 >
199 >        va += *imin * skipsiz;
200 >
201          if (skipsiz == 1)
202                  for (i = *imin; i < *imax; i++)
203 <                        sum += va[i];
203 >                        sum += *va++;
204          else
205 <                for (i = *imin; i < *imax; i++)
206 <                        sum += SDiterSum(va + i*skipsiz,
200 <                                        nd-1, shft, imin+1, imax+1);
205 >                for (i = *imin; i < *imax; i++, va += skipsiz)
206 >                        sum += SDiterSum(va, nd, shft, imin+1, imax+1);
207          return sum;
208   }
209  
# Line 205 | Line 211 | SDiterSum(const float *va, int nd, int shft, const int
211   static double
212   SDavgTreBox(const SDNode *st, const double *bmin, const double *bmax)
213   {
208        int             imin[SD_MAXDIM], imax[SD_MAXDIM];
214          unsigned        n;
215          int             i;
216  
# Line 215 | Line 220 | SDavgTreBox(const SDNode *st, const double *bmin, cons
220          for (i = st->ndim; i--; ) {
221                  if (bmin[i] >= 1.)
222                          return .0;
223 <                if (bmax[i] <= .0)
223 >                if (bmax[i] <= 0)
224                          return .0;
225                  if (bmin[i] >= bmax[i])
226                          return .0;
# Line 223 | Line 228 | SDavgTreBox(const SDNode *st, const double *bmin, cons
228          if (st->log2GR < 0) {           /* iterate on subtree */
229                  double          sum = .0, wsum = 1e-20;
230                  double          sbmin[SD_MAXDIM], sbmax[SD_MAXDIM], w;
226
231                  for (n = 1 << st->ndim; n--; ) {
232                          w = 1.;
233                          for (i = st->ndim; i--; ) {
# Line 235 | Line 239 | SDavgTreBox(const SDNode *st, const double *bmin, cons
239                                  }
240                                  if (sbmin[i] < .0) sbmin[i] = .0;
241                                  if (sbmax[i] > 1.) sbmax[i] = 1.;
242 +                                if (sbmin[i] >= sbmax[i]) {
243 +                                        w = .0;
244 +                                        break;
245 +                                }
246                                  w *= sbmax[i] - sbmin[i];
247                          }
248                          if (w > 1e-10) {
# Line 243 | Line 251 | SDavgTreBox(const SDNode *st, const double *bmin, cons
251                          }
252                  }
253                  return sum / wsum;
254 +        } else {                        /* iterate over leaves */
255 +                int             imin[SD_MAXDIM], imax[SD_MAXDIM];
256 +
257 +                n = 1;
258 +                for (i = st->ndim; i--; ) {
259 +                        imin[i] = (bmin[i] <= 0) ? 0 :
260 +                                        (int)((1 << st->log2GR)*bmin[i]);
261 +                        imax[i] = (bmax[i] >= 1.) ? (1 << st->log2GR) :
262 +                                (int)((1 << st->log2GR)*bmax[i] + .999999);
263 +                        n *= imax[i] - imin[i];
264 +                }
265 +                if (n)
266 +                        return SDiterSum(st->u.v, st->ndim,
267 +                                        st->log2GR, imin, imax) / (double)n;
268          }
269 <        n = 1;                          /* iterate over leaves */
248 <        for (i = st->ndim; i--; ) {
249 <                imin[i] = (bmin[i] <= 0) ? 0
250 <                                : (int)((1 << st->log2GR)*bmin[i]);
251 <                imax[i] = (bmax[i] >= 1.) ? (1 << st->log2GR)
252 <                                : (int)((1 << st->log2GR)*bmax[i] + .999999);
253 <                n *= imax[i] - imin[i];
254 <        }
255 <        if (!n)
256 <                return .0;
257 <        
258 <        return SDiterSum(st->u.v, st->ndim, st->log2GR, imin, imax) / (double)n;
269 >        return .0;
270   }
271  
272   /* Recursive call for SDtraverseTre() */
# Line 270 | Line 281 | SDdotravTre(const SDNode *st, const double *pos, int c
281                                          /* in branches? */
282          if (st->log2GR < 0) {
283                  unsigned        skipmask = 0;
273
284                  csiz *= .5;
285                  for (i = st->ndim; i--; )
286                          if (1<<i & cmask)
287                                  if (pos[i] < cmin[i] + csiz)
288 <                                        for (n = 1 << st->ndim; n--; )
288 >                                        for (n = 1 << st->ndim; n--; ) {
289                                                  if (n & 1<<i)
290                                                          skipmask |= 1<<n;
291 +                                        }
292                                  else
293 <                                        for (n = 1 << st->ndim; n--; )
293 >                                        for (n = 1 << st->ndim; n--; ) {
294                                                  if (!(n & 1<<i))
295                                                          skipmask |= 1<<n;
296 +                                        }
297                  for (n = 1 << st->ndim; n--; ) {
298                          if (1<<n & skipmask)
299                                  continue;
# Line 315 | Line 327 | SDdotravTre(const SDNode *st, const double *pos, int c
327                                  clim[i][0] = 0;
328                                  clim[i][1] = 1 << st->log2GR;
329                          }
318                                        /* fill in unused dimensions */
319                for (i = SD_MAXDIM; i-- > st->ndim; ) {
320                        clim[i][0] = 0; clim[i][1] = 1;
321                }
330   #if (SD_MAXDIM == 4)
331                  bmin[0] = cmin[0] + csiz*clim[0][0];
332                  for (cpos[0] = clim[0][0]; cpos[0] < clim[0][1]; cpos[0]++) {
333                      bmin[1] = cmin[1] + csiz*clim[1][0];
334                      for (cpos[1] = clim[1][0]; cpos[1] < clim[1][1]; cpos[1]++) {
335                          bmin[2] = cmin[2] + csiz*clim[2][0];
336 <                        for (cpos[2] = clim[2][0]; cpos[2] < clim[2][1]; cpos[2]++) {
337 <                            bmin[3] = cmin[3] + csiz*(cpos[3] = clim[3][0]);
336 >                        if (st->ndim == 3) {
337 >                            cpos[2] = clim[2][0];
338                              n = cpos[0];
339 <                            for (i = 1; i < st->ndim; i++)
339 >                            for (i = 1; i < 3; i++)
340                                  n = (n << st->log2GR) + cpos[i];
341 <                            for ( ; cpos[3] < clim[3][1]; cpos[3]++) {
341 >                            for ( ; cpos[2] < clim[2][1]; cpos[2]++) {
342                                  rval += rv = (*cf)(st->u.v[n++], bmin, csiz, cptr);
343                                  if (rv < 0)
344                                      return rv;
345 <                                bmin[3] += csiz;
345 >                                bmin[2] += csiz;
346                              }
347 <                            bmin[2] += csiz;
347 >                        } else {
348 >                            for (cpos[2] = clim[2][0]; cpos[2] < clim[2][1]; cpos[2]++) {
349 >                                bmin[3] = cmin[3] + csiz*(cpos[3] = clim[3][0]);
350 >                                n = cpos[0];
351 >                                for (i = 1; i < 4; i++)
352 >                                    n = (n << st->log2GR) + cpos[i];
353 >                                for ( ; cpos[3] < clim[3][1]; cpos[3]++) {
354 >                                    rval += rv = (*cf)(st->u.v[n++], bmin, csiz, cptr);
355 >                                    if (rv < 0)
356 >                                        return rv;
357 >                                    bmin[3] += csiz;
358 >                                }
359 >                                bmin[2] += csiz;
360 >                            }
361                          }
362                          bmin[1] += csiz;
363                      }
# Line 411 | Line 432 | SDlookupTre(const SDNode *st, const double *pos, doubl
432   static float
433   SDqueryTre(const SDTre *sdt, const FVECT outVec, const FVECT inVec, double *hc)
434   {
414        static const FVECT      zvec = {.0, .0, 1.};
435          FVECT                   rOutVec;
436          double                  gridPos[4];
437  
# Line 433 | Line 453 | SDqueryTre(const SDTre *sdt, const FVECT outVec, const
453          }
454                                          /* convert vector coordinates */
455          if (sdt->st->ndim == 3) {
456 <                spinvector(rOutVec, outVec, zvec, -atan2(inVec[1],inVec[0]));
456 >                spinvector(rOutVec, outVec, zvec, -atan2(-inVec[1],-inVec[0]));
457                  gridPos[0] = .5 - .5*sqrt(inVec[0]*inVec[0] + inVec[1]*inVec[1]);
458                  SDdisk2square(gridPos+1, rOutVec[0], rOutVec[1]);
459          } else if (sdt->st->ndim == 4) {
# Line 474 | Line 494 | build_scaffold(float val, const double *cmin, double c
494                  sp->wmax = wid;
495          if (sp->alen >= sp->nall) {     /* need more space? */
496                  struct outdir_s *ndarr;
497 <                sp->nall += 8192;
497 >                sp->nall += 1024;
498                  ndarr = (struct outdir_s *)realloc(sp->darr,
499                                          sizeof(struct outdir_s)*sp->nall);
500 <                if (ndarr == NULL)
500 >                if (ndarr == NULL) {
501 >                        sprintf(SDerrorDetail,
502 >                                "Cannot grow scaffold to %u entries", sp->nall);
503                          return -1;      /* abort build */
504 +                }
505                  sp->darr = ndarr;
506          }
507                                          /* find Hilbert entry index */
508          bmin[0] = cmin[0]*(double)iwmax + .5;
509          bmin[1] = cmin[1]*(double)iwmax + .5;
510 <        bmax[0] = bmin[0] + wid;
511 <        bmax[1] = bmin[1] + wid;
510 >        bmax[0] = bmin[0] + wid-1;
511 >        bmax[1] = bmin[1] + wid-1;
512          hilbert_box_vtx(2, sizeof(bitmask_t), iwbits, 1, bmin, bmax);
513          sp->darr[sp->alen].hent = hilbert_c2i(2, iwbits, bmin);
514          sp->darr[sp->alen].wid = wid;
# Line 498 | Line 521 | build_scaffold(float val, const double *cmin, double c
521   static int
522   sscmp(const void *p1, const void *p2)
523   {
524 <        return (int)((*(const struct outdir_s *)p1).hent -
525 <                        (*(const struct outdir_s *)p2).hent);
524 >        unsigned        h1 = (*(const struct outdir_s *)p1).hent;
525 >        unsigned        h2 = (*(const struct outdir_s *)p2).hent;
526 >
527 >        if (h1 > h2)
528 >                return 1;
529 >        if (h1 < h2)
530 >                return -1;
531 >        return 0;
532   }
533  
534   /* Create a new cumulative distribution for the given input direction */
# Line 516 | Line 545 | make_cdist(const SDTre *sdt, const double *pos)
545          myScaffold.wmax = 0;
546          myScaffold.nic = sdt->st->ndim - 2;
547          myScaffold.alen = 0;
548 <        myScaffold.nall = 8192;
548 >        myScaffold.nall = 512;
549          myScaffold.darr = (struct outdir_s *)malloc(sizeof(struct outdir_s) *
550                                                          myScaffold.nall);
551          if (myScaffold.darr == NULL)
# Line 531 | Line 560 | make_cdist(const SDTre *sdt, const double *pos)
560          cd = (SDTreCDst *)malloc(sizeof(SDTreCDst) +
561                                  sizeof(cd->carr[0])*myScaffold.alen);
562          if (cd == NULL) {
563 +                sprintf(SDerrorDetail,
564 +                        "Cannot allocate %u entry cumulative distribution",
565 +                                myScaffold.alen);
566                  free(myScaffold.darr);
567                  return NULL;
568          }
569 +        cd->isodist = (myScaffold.nic == 1);
570                                          /* sort the distribution */
571          qsort(myScaffold.darr, cd->calen = myScaffold.alen,
572                                  sizeof(struct outdir_s), &sscmp);
# Line 544 | Line 577 | make_cdist(const SDTre *sdt, const double *pos)
577                  cd->clim[i][0] = floor(pos[i]/scale) * scale;
578                  cd->clim[i][1] = cd->clim[i][0] + scale;
579          }
580 +        if (cd->isodist) {              /* avoid issue in SDqueryTreProjSA() */
581 +                cd->clim[1][0] = cd->clim[0][0];
582 +                cd->clim[1][1] = cd->clim[0][1];
583 +        }
584          cd->max_psa = myScaffold.wmax / (double)iwmax;
585          cd->max_psa *= cd->max_psa * M_PI;
586          cd->sidef = sdt->sidef;
# Line 573 | Line 610 | SDgetTreCDist(const FVECT inVec, SDComponent *sdc)
610   {
611          const SDTre     *sdt;
612          double          inCoord[2];
576        int             vflags;
613          int             i;
614          SDTreCDst       *cd, *cdlast;
615                                          /* check arguments */
616          if ((inVec == NULL) | (sdc == NULL) ||
617                          (sdt = (SDTre *)sdc->dist) == NULL)
618                  return NULL;
619 <        if (sdt->st->ndim == 3)         /* isotropic BSDF? */
619 >        if (sdt->st->ndim == 3) {       /* isotropic BSDF? */
620                  inCoord[0] = .5 - .5*sqrt(inVec[0]*inVec[0] + inVec[1]*inVec[1]);
621 <        else if (sdt->st->ndim == 4)
621 >        } else if (sdt->st->ndim == 4) {
622                  SDdisk2square(inCoord, -inVec[0], -inVec[1]);
623 <        else
623 >        } else
624                  return NULL;            /* should be internal error */
625 +                                        /* quantize to avoid f.p. errors */
626 +        for (i = sdt->st->ndim - 2; i--; )
627 +                inCoord[i] = floor(inCoord[i]/quantum)*quantum + .5*quantum;
628          cdlast = NULL;                  /* check for direction in cache list */
629          for (cd = (SDTreCDst *)sdc->cdList; cd != NULL;
630 <                                cdlast = cd, cd = (SDTreCDst *)cd->next) {
630 >                                        cdlast = cd, cd = cd->next) {
631                  for (i = sdt->st->ndim - 2; i--; )
632                          if ((cd->clim[i][0] > inCoord[i]) |
633                                          (inCoord[i] >= cd->clim[i][1]))
# Line 600 | Line 639 | SDgetTreCDist(const FVECT inVec, SDComponent *sdc)
639                  cdlast = cd = make_cdist(sdt, inCoord);
640          if (cdlast != NULL) {           /* move entry to head of cache list */
641                  cdlast->next = cd->next;
642 <                cd->next = sdc->cdList;
642 >                cd->next = (SDTreCDst *)sdc->cdList;
643                  sdc->cdList = (SDCDst *)cd;
644          }
645          return (SDCDst *)cd;            /* ready to go */
# Line 663 | Line 702 | SDsampTreCDist(FVECT ioVec, double randX, const SDCDst
702          const SDTreCDst *cd = (const SDTreCDst *)cdp;
703          const unsigned  target = randX*cumlmax;
704          bitmask_t       hndx, hcoord[2];
705 <        double          gpos[3];
705 >        double          gpos[3], rotangle;
706          int             i, iupper, ilower;
707                                          /* check arguments */
708          if ((ioVec == NULL) | (cd == NULL))
# Line 676 | Line 715 | SDsampTreCDist(FVECT ioVec, double randX, const SDCDst
715                                          /* binary search to find position */
716          ilower = 0; iupper = cd->calen;
717          while ((i = (iupper + ilower) >> 1) != ilower)
718 <                if ((long)target >= (long)cd->carr[i].cuml)
718 >                if (target >= cd->carr[i].cuml)
719                          ilower = i;
720                  else
721                          iupper = i;
# Line 699 | Line 738 | SDsampTreCDist(FVECT ioVec, double randX, const SDCDst
738                                          /* emit from back? */
739          if (ioVec[2] > 0 ^ cd->sidef != SD_XMIT)
740                  gpos[2] = -gpos[2];
741 <        VCOPY(ioVec, gpos);
741 >        if (cd->isodist) {              /* rotate isotropic result */
742 >                rotangle = atan2(-ioVec[1],-ioVec[0]);
743 >                VCOPY(ioVec, gpos);
744 >                spinvector(ioVec, ioVec, zvec, rotangle);
745 >        } else
746 >                VCOPY(ioVec, gpos);
747          return SDEnone;
748   }
749  
# Line 712 | Line 756 | next_token(char **spp)
756          return **spp;
757   }
758  
759 < #define eat_token(spp,c)        (next_token(spp)==(c) ? *(*(spp))++ : 0)
759 > /* Advance pointer past matching token (or any token if c==0) */
760 > #define eat_token(spp,c)        (next_token(spp)==(c) ^ !(c) ? *(*(spp))++ : 0)
761  
762   /* Count words from this point in string to '}' */
763   static int
# Line 721 | Line 766 | count_values(char *cp)
766          int     n = 0;
767  
768          while (next_token(&cp) != '}' && *cp) {
769 <                if (*cp == '{')
770 <                        return -1;
771 <                while (*cp && (*cp != ',') & (*cp != '}') & !isspace(*cp))
727 <                        ++cp;
769 >                while (!isspace(*cp) & (*cp != ',') & (*cp != '}'))
770 >                        if (!*++cp)
771 >                                break;
772                  ++n;
773                  eat_token(&cp, ',');
774          }
# Line 769 | Line 813 | load_tree_data(char **spp, int nd)
813          } else {                        /* else load value grid */
814                  int     bsiz;
815                  n = count_values(*spp); /* see how big the grid is */
816 <                if (n <= 0) {
773 <                        strcpy(SDerrorDetail, "Bad tensor tree data");
774 <                        return NULL;
775 <                }
776 <                for (bsiz = 0; bsiz < 8*sizeof(size_t)-1; bsiz += nd)
816 >                for (bsiz = 0; bsiz < 8*sizeof(size_t); bsiz += nd)
817                          if (1<<bsiz == n)
818                                  break;
819                  if (bsiz >= 8*sizeof(size_t)) {
# Line 806 | Line 846 | get_extrema(SDSpectralDF *df)
846          double  stepWidth, dhemi, bmin[4], bmax[4];
847  
848          stepWidth = SDsmallestLeaf(st);
849 +        if (quantum > stepWidth)        /* adjust quantization factor */
850 +                quantum = stepWidth;
851          df->minProjSA = M_PI*stepWidth*stepWidth;
852          if (stepWidth < .03125)
853                  stepWidth = .03125;     /* 1/32 resolution good enough */
# Line 845 | Line 887 | load_bsdf_data(SDData *sd, ezxml_t wdb, int ndim)
887          SDSpectralDF    *df;
888          SDTre           *sdt;
889          char            *sdata;
848        int             i;
890                                          /* allocate BSDF component */
891          sdata = ezxml_txt(ezxml_child(wdb, "WavelengthDataDirection"));
892          if (!sdata)
# Line 922 | Line 963 | load_bsdf_data(SDData *sd, ezxml_t wdb, int ndim)
963   static float
964   SDgetTreMin(const SDNode *st)
965   {
966 <        float   vmin = 1./M_PI;
966 >        float   vmin = FHUGE;
967          int     n;
968  
969          if (st->log2GR < 0) {
# Line 950 | Line 991 | SDsubtractTreVal(SDNode *st, float val)
991                          SDsubtractTreVal(st->u.t[n], val);
992          } else {
993                  for (n = 1<<(st->ndim*st->log2GR); n--; )
994 <                        st->u.v[n] -= val;
994 >                        if ((st->u.v[n] -= val) < 0)
995 >                                st->u.v[n] = .0f;
996          }
997   }
998  
# Line 960 | Line 1002 | subtract_min(SDNode *st)
1002   {
1003          float   vmin;
1004                                          /* be sure to skip unused portion */
1005 <        if ((st->ndim == 3) & (st->log2GR < 0)) {
1006 <                float   v;
965 <                int     i;
1005 >        if (st->ndim == 3) {
1006 >                int     n;
1007                  vmin = 1./M_PI;
1008 <                for (i = 0; i < 4; i++) {
1009 <                        v = SDgetTreMin(st->u.t[i]);
1010 <                        if (v < vmin)
1011 <                                vmin = v;
1012 <                }
1008 >                if (st->log2GR < 0) {
1009 >                        for (n = 0; n < 8; n += 2) {
1010 >                                float   v = SDgetTreMin(st->u.t[n]);
1011 >                                if (v < vmin)
1012 >                                        vmin = v;
1013 >                        }
1014 >                } else if (st->log2GR) {
1015 >                        for (n = 1 << (3*st->log2GR - 1); n--; )
1016 >                                if (st->u.v[n] < vmin)
1017 >                                        vmin = st->u.v[n];
1018 >                } else
1019 >                        vmin = st->u.v[0];
1020          } else                          /* anisotropic covers entire tree */
1021                  vmin = SDgetTreMin(st);
1022  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines