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

Comparing ray/src/hd/rhd_ctab.c (file contents):
Revision 3.2 by greg, Sat Feb 22 02:07:24 2003 UTC vs.
Revision 3.5 by schorsch, Thu Jan 1 11:21:55 2004 UTC

# Line 16 | Line 16 | static const char      RCSid[] = "$Id$";
16   *      except there is no color mapping, since the tm library is used.
17   */
18  
19 + #include <string.h>
20 +
21   #include "standard.h"
22 + #include "rhdisp.h"
23   #include "color.h"
24                                  /* histogram resolution */
25   #define NRED            24
# Line 49 | Line 52 | static unsigned short  histo[NRED][NGRN][NBLU];
52                                  /* initial color cube boundary */
53   static int      CLRCUBE[3][2] = {{0,NRED},{0,NGRN},{0,NBLU}};
54  
55 < static int      split(), cut();
55 > static void cut(CNODE *tree, int level, int box[3][2], int c0, int c1);
56 > static int split(int box[3][2]);
57  
58  
59 < int
60 < new_ctab(ncolors)               /* start new color table with max ncolors */
61 < int     ncolors;
59 >
60 > extern int
61 > new_ctab(               /* start new color table with max ncolors */
62 >        int     ncolors
63 > )
64   {
65          int     treesize;
66  
# Line 76 | Line 82 | int    ncolors;
82                                  /* partition color space */
83          cut(ctree, 0, CLRCUBE, 0, ncolors);
84                                  /* clear histogram */
85 <        bzero((char *)histo, sizeof(histo));
85 >        memset((void *)histo, '\0', sizeof(histo));
86                                  /* return number of colors used */
87          return(ncolors);
88   }
89  
90  
91 < int
92 < get_pixel(rgb, set_pixel)       /* get pixel for color */
93 < BYTE    rgb[3];
94 < int     (*set_pixel)();
91 > extern int
92 > get_pixel(      /* get pixel for color */
93 >        BYTE    rgb[3],
94 >        void    (*set_pixel)(int h, int r, int g, int b)
95 > )
96   {
90        extern char     errmsg[];
97          int     r, g, b;
98          int     cv[3];
99          register CNODE  *tp;
# Line 127 | Line 133 | int    (*set_pixel)();
133                  clrtab[h].ent[GRN] = g; /* reassign pixel */
134                  clrtab[h].ent[BLU] = b;
135   #ifdef DEBUG
136 <                sprintf(errmsg, "pixel %d = (%d,%d,%d) (%d refs)\n",
137 <                                h, r, g, b, clrtab[h].n);
138 <                eputs(errmsg);
136 >                {
137 >                        extern char     errmsg[];
138 >                        sprintf(errmsg, "pixel %d = (%d,%d,%d) (%d refs)\n",
139 >                                        h, r, g, b, clrtab[h].n);
140 >                        eputs(errmsg);
141 >                }
142   #endif
143                  (*set_pixel)(h, r, g, b);
144          }
# Line 137 | Line 146 | int    (*set_pixel)();
146   }
147  
148  
149 < static
150 < cut(tree, level, box, c0, c1)           /* partition color space */
151 < register CNODE  *tree;
152 < int     level;
153 < register int    box[3][2];
154 < int     c0, c1;
149 > static void
150 > cut(            /* partition color space */
151 >        register CNODE  *tree,
152 >        int     level,
153 >        register int    box[3][2],
154 >        int     c0,
155 >        int     c1
156 > )
157   {
158          int     kb[3][2];
159          
# Line 152 | Line 163 | int    c0, c1;
163          }
164                                          /* split box */
165          *tree = split(box);
166 <        bcopy((char *)box, (char *)kb, sizeof(kb));
166 >        memcpy((void *)kb, (void *)box, sizeof(kb));
167                                                  /* do left (lesser) branch */
168          kb[prim(*tree)][1] = part(*tree);
169          cut(tree+(1<<level), level+1, kb, c0, (c0+c1)>>1);
# Line 164 | Line 175 | int    c0, c1;
175  
176  
177   static int
178 < split(box)                              /* find median cut for box */
179 < register int    box[3][2];
178 > split(                          /* find median cut for box */
179 >        register int    box[3][2]
180 > )
181   {
182   #define c0      r
183          register int    r, g, b;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines