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.7 by greg, Thu Jun 10 15:45:18 1993 UTC vs.
Revision 2.11 by greg, Mon Dec 12 12:15:51 1994 UTC

# Line 23 | Line 23 | static char SCCSid[] = "$SunId$ LBL";
23   #define part(cn)        ((cn)>>2)
24   #define prim(cn)        ((cn)&3)
25                                  /* our color table (global) */
26 < BYTE    clrtab[256][3];
26 > extern BYTE     clrtab[256][3];
27                                  /* histogram of colors / color assignments */
28   static unsigned histo[NRED][NGRN][NBLU];
29   #define cndx(c)         histo[((c)[RED]*NRED)>>8][((c)[GRN]*NGRN)>>8][((c)[BLU]*NBLU)>>8]
# Line 40 | Line 40 | static int     CLRCUBE[3][2] = {0,NRED,0,NGRN,0,NBLU};
40   #endif
41   #endif
42  
43 + static  cut(), mktabent(), closest(), addneigh(), setclosest();
44 + static int      split();
45 + static unsigned dist();
46  
47 < new_histo()             /* clear our histogram */
47 >
48 > new_histo(n)            /* clear our histogram */
49 > int     n;
50   {
51          bzero((char *)histo, sizeof(histo));
52 +        return(0);
53   }
54  
55  
# Line 77 | Line 83 | int    ncolors;
83   #ifdef CLOSEST
84          closest(ncolors);       /* ensure colors picked are closest */
85   #endif
86 +                                /* reset dithering function */
87 +        dith_colrs((BYTE *)NULL, (COLR *)NULL, 0);
88                                  /* return new color table size */
89          return(ncolors);
90   }
# Line 107 | Line 115 | register BYTE  *bs;
115   register COLR   *cs;
116   int     n;
117   {
118 <        static short    (*cerr)[3];
118 >        static short    (*cerr)[3] = NULL;
119          static int      N = 0;
120          int     err[3], errp[3];
121          register int    x, i;
122  
123          if (n != N) {           /* get error propogation array */
124 <                if (N)
125 <                        cerr = (short (*)[3])realloc((char *)cerr,
126 <                                        3*n*sizeof(short));
127 <                else
124 >                if (N) {
125 >                        free((char *)cerr);
126 >                        cerr = NULL;
127 >                }
128 >                if (n)
129                          cerr = (short (*)[3])malloc(3*n*sizeof(short));
130                  if (cerr == NULL) {
131                          N = 0;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines