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

Comparing ray/src/rt/colortab.c (file contents):
Revision 1.14 by greg, Thu Mar 29 12:43:07 1990 UTC vs.
Revision 2.2 by greg, Tue Oct 6 12:13:48 1992 UTC

# Line 1 | Line 1
1 < /* Copyright (c) 1989 Regents of the University of California */
1 > /* Copyright (c) 1992 Regents of the University of California */
2  
3   #ifndef lint
4   static char SCCSid[] = "$SunId$ LBL";
# Line 16 | Line 16 | static char SCCSid[] = "$SunId$ LBL";
16   *      distribution is correlated to the last.
17   */
18  
19 < #include "color.h"
19 > #include "standard.h"
20  
21 < #define NULL            0
21 > #include "color.h"
22                                  /* histogram resolution */
23   #define NRED            24
24   #define NGRN            32
# Line 33 | Line 33 | static char SCCSid[] = "$SunId$ LBL";
33                                  (int)(colval(c,p)*256.) : 255 ]
34                                  /* color partition tree */
35   #define CNODE           short
36 < #define set_branch(p,c) ((c)<<2|(p))
36 > #define set_branch(p,c) ((c)<<2|(p))
37   #define set_pval(pv)    ((pv)<<2|3)
38   #define is_branch(cn)   (((cn)&3)!=3)
39   #define is_pval(cn)     (((cn)&3)==3)
# Line 43 | Line 43 | static char SCCSid[] = "$SunId$ LBL";
43                                  /* our color table */
44   static struct tabent {
45          long    sum[3];         /* sum of colors using this entry */
46 <        long    n;              /* number of colors */
47 <        short   ent[3];         /* current table value */
46 >        int     n;              /* number of colors */
47 >        BYTE    ent[3];         /* current table value */
48   }       *clrtab = NULL;
49                                  /* color cube partition */
50   static CNODE    *ctree = NULL;
# Line 111 | Line 111 | int    (*set_pixel)();
111                  if (cv[prim(*tp)] < part(*tp))
112                          tp += 1<<h;             /* left branch */
113                  else
114 <                        tp += 1<<(h+1); /* right branch */
114 >                        tp += 1<<(h+1);         /* right branch */
115          h = pval(*tp);
116                                                  /* add to color table */
117          clrtab[h].sum[RED] += r;
# Line 128 | Line 128 | int    (*set_pixel)();
128                          (g-clrtab[h].ent[GRN])*(g-clrtab[h].ent[GRN]) +
129                          (b-clrtab[h].ent[BLU])*(b-clrtab[h].ent[BLU]) > MAXDST2) {
130                  clrtab[h].ent[RED] = r;
131 <                clrtab[h].ent[GRN] = g; /* reassign pixel */
131 >                clrtab[h].ent[GRN] = g; /* reassign pixel */
132                  clrtab[h].ent[BLU] = b;
133   #ifdef DEBUG
134                  sprintf(errmsg, "pixel %d = (%d,%d,%d) (%d refs)\n",
# Line 142 | Line 142 | int    (*set_pixel)();
142  
143  
144   make_gmap(gam)                  /* make gamma correction map */
145 < double  gam;
145 > double  gam;
146   {
147        extern double   pow();
147          register int    i;
148          
149          for (i = 0; i < 256; i++)
150                  clrmap[RED][i] =
151                  clrmap[GRN][i] =
152 <                clrmap[BLU][i] = 256.0 * pow(i/256.0, 1.0/gam);
152 >                clrmap[BLU][i] = 256.0 * pow((i+0.5)/256.0, 1.0/gam);
153   }
154  
155  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines