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 2.9 by schorsch, Tue Mar 30 16:13:01 2004 UTC vs.
Revision 2.12 by schorsch, Fri Mar 18 22:52:05 2016 UTC

# Line 48 | Line 48 | static const char      RCSid[] = "$Id$";
48   static struct tabent {
49          long    sum[3];         /* sum of colors using this entry */
50          int     n;              /* number of colors */
51 <        BYTE    ent[3];         /* current table value */
51 >        uby8    ent[3];         /* current table value */
52   }       *clrtab = NULL;
53                                  /* color cube partition */
54   static CNODE    *ctree = NULL;
55                                  /* our color correction map */
56 < static BYTE     clrmap[3][256];
56 > static uby8     clrmap[3][256];
57                                  /* histogram of colors used */
58   static unsigned short   histo[NRED][NGRN][NBLU];
59                                  /* initial color cube boundary */
# Line 93 | Line 93 | int    ncolors;
93   }
94  
95  
96 < extern int
96 > int
97   get_pixel(      /* get pixel for color */
98          COLOR   col,
99          dr_newcolrf_t *newcolr
# Line 101 | Line 101 | get_pixel(     /* get pixel for color */
101   {
102          int     r, g, b;
103          int     cv[3];
104 <        register CNODE  *tp;
105 <        register int    h;
104 >        CNODE   *tp;
105 >        int     h;
106                                                  /* map color */
107          r = map_col(col,RED);
108          g = map_col(col,GRN);
# Line 116 | Line 116 | get_pixel(     /* get pixel for color */
116                                                  /* find pixel in tree */
117          for (tp = ctree, h = 0; is_branch(*tp); h++)
118                  if (cv[prim(*tp)] < part(*tp))
119 <                        tp += 1<<h;             /* left branch */
119 >                        tp += (size_t)1<<h;             /* left branch */
120                  else
121 <                        tp += 1<<(h+1);         /* right branch */
121 >                        tp += (size_t)1<<(h+1);         /* right branch */
122          h = pval(*tp);
123                                                  /* add to color table */
124          clrtab[h].sum[RED] += r;
# Line 152 | Line 152 | void
152   make_gmap(gam)                  /* make gamma correction map */
153   double  gam;
154   {
155 <        register int    i;
155 >        int     i;
156          
157          for (i = 0; i < 256; i++)
158                  clrmap[RED][i] =
# Line 163 | Line 163 | double gam;
163  
164   void
165   set_cmap(rmap, gmap, bmap)      /* set custom color correction map */
166 < BYTE    *rmap, *gmap, *bmap;
166 > uby8    *rmap, *gmap, *bmap;
167   {
168          memcpy((void *)clrmap[RED], (void *)rmap, 256);
169          memcpy((void *)clrmap[GRN], (void *)gmap, 256);
# Line 173 | Line 173 | BYTE   *rmap, *gmap, *bmap;
173  
174   void
175   map_color(rgb, col)             /* map a color to a byte triplet */
176 < BYTE    rgb[3];
176 > uby8    rgb[3];
177   COLOR   col;
178   {
179          rgb[RED] = map_col(col,RED);
# Line 184 | Line 184 | COLOR  col;
184  
185   static void
186   cut(tree, level, box, c0, c1)           /* partition color space */
187 < register CNODE  *tree;
187 > CNODE   *tree;
188   int     level;
189 < register int    box[3][2];
189 > int     box[3][2];
190   int     c0, c1;
191   {
192          int     kb[3][2];
# Line 200 | Line 200 | int    c0, c1;
200          memcpy((void *)kb, (void *)box, sizeof(kb));
201                                                  /* do left (lesser) branch */
202          kb[prim(*tree)][1] = part(*tree);
203 <        cut(tree+(1<<level), level+1, kb, c0, (c0+c1)>>1);
203 >        cut(tree+((size_t)1<<level), level+1, kb, c0, (c0+c1)>>1);
204                                                  /* do right branch */
205          kb[prim(*tree)][0] = part(*tree);
206          kb[prim(*tree)][1] = box[prim(*tree)][1];
207 <        cut(tree+(1<<(level+1)), level+1, kb, (c0+c1)>>1, c1);
207 >        cut(tree+((size_t)1<<(level+1)), level+1, kb, (c0+c1)>>1, c1);
208   }
209  
210  
211   static int
212   split(box)                              /* find median cut for box */
213 < register int    box[3][2];
213 > int     box[3][2];
214   {
215   #define c0      r
216 <        register int    r, g, b;
216 >        int     r, g, b;
217          int     pri;
218          long    t[HMAX], med;
219                                          /* find dominant axis */

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines