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

Comparing ray/src/px/clrtab.c (file contents):
Revision 2.8 by greg, Thu Dec 9 11:57:15 1993 UTC vs.
Revision 2.14 by greg, Tue May 13 17:58:33 2003 UTC

# Line 1 | Line 1
1 /* Copyright (c) 1993 Regents of the University of California */
2
1   #ifndef lint
2 < static char SCCSid[] = "$SunId$ LBL";
2 > static const char       RCSid[] = "$Id$";
3   #endif
6
4   /*
5   * Simple median-cut color quantization based on colortab.c
6   */
# Line 23 | Line 20 | static char SCCSid[] = "$SunId$ LBL";
20   #define part(cn)        ((cn)>>2)
21   #define prim(cn)        ((cn)&3)
22                                  /* our color table (global) */
23 < BYTE    clrtab[256][3];
23 > extern BYTE     clrtab[256][3];
24                                  /* histogram of colors / color assignments */
25   static unsigned histo[NRED][NGRN][NBLU];
26   #define cndx(c)         histo[((c)[RED]*NRED)>>8][((c)[GRN]*NGRN)>>8][((c)[BLU]*NBLU)>>8]
# Line 40 | Line 37 | static int     CLRCUBE[3][2] = {0,NRED,0,NGRN,0,NBLU};
37   #endif
38   #endif
39  
40 + static  cut(), mktabent(), closest(), addneigh(), setclosest();
41 + static int      split();
42 + static unsigned dist();
43  
44 < new_histo()             /* clear our histogram */
44 >
45 > new_histo(n)            /* clear our histogram */
46 > int     n;
47   {
48 <        bzero((char *)histo, sizeof(histo));
48 >        bzero((void *)histo, sizeof(histo));
49 >        return(0);
50   }
51  
52  
# Line 77 | Line 80 | int    ncolors;
80   #ifdef CLOSEST
81          closest(ncolors);       /* ensure colors picked are closest */
82   #endif
83 +                                /* reset dithering function */
84 +        dith_colrs((BYTE *)NULL, (COLR *)NULL, 0);
85                                  /* return new color table size */
86          return(ncolors);
87   }
# Line 114 | Line 119 | int    n;
119  
120          if (n != N) {           /* get error propogation array */
121                  if (N) {
122 <                        free((char *)cerr);
122 >                        free((void *)cerr);
123                          cerr = NULL;
124                  }
125                  if (n)
# Line 125 | Line 130 | int    n;
130                          return;
131                  }
132                  N = n;
133 <                bzero((char *)cerr, 3*N*sizeof(short));
133 >                bzero((void *)cerr, 3*N*sizeof(short));
134          }
135          err[0] = err[1] = err[2] = 0;
136          for (x = 0; x < n; x++) {
# Line 164 | Line 169 | int    c0, c1;
169          }
170                                          /* split box */
171          branch = split(box);
172 <        bcopy((char *)box, (char *)kb, sizeof(kb));
172 >        bcopy((void *)box, (void *)kb, sizeof(kb));
173                                                  /* do left (lesser) branch */
174          kb[prim(branch)][1] = part(branch);
175          cut(kb, c0, (c0+c1)>>1);
# Line 332 | Line 337 | int    j;
337                  if (nl[i][t] == i) {            /* add to list */
338                          nl[i][t++] = j;
339                          if (t % NBSIZ == 0) {   /* enlarge list */
340 <                                if ((nnl = realloc(nl[i], t+NBSIZ)) == NULL)
340 >                                if ((nnl = realloc((void *)nl[i],
341 >                                                t+NBSIZ)) == NULL)
342                                          t--;
343                                  else
344                                          nl[i] = (BYTE *)nnl;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines