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

Comparing ray/src/common/colrops.c (file contents):
Revision 2.4 by greg, Fri Oct 2 16:00:51 1992 UTC vs.
Revision 2.8 by greg, Mon Mar 10 17:13:29 2003 UTC

# Line 1 | Line 1
1 /* Copyright (c) 1992 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   * Integer operations on COLR scanlines
6   */
7  
8 + #include "copyright.h"
9 +
10 + #include <math.h>
11   #include "color.h"
12  
13 #define NULL            0
14
13   extern char     *bmalloc();
14  
15   #define MAXGSHIFT       31              /* maximum shift for gamma table */
# Line 20 | Line 18 | static BYTE    *g_mant = NULL, *g_nexp = NULL;
18  
19   static BYTE     (*g_bval)[256] = NULL;
20  
23 #ifndef pow
24 extern double   pow();
25 #endif
21  
22 <
22 > int
23   setcolrcor(f, a2)               /* set brightness correction */
24   double  (*f)();
25   double  a2;
# Line 46 | Line 41 | double a2;
41   }
42  
43  
44 + int
45   setcolrinv(f, a2)               /* set inverse brightness correction */
46   double  (*f)();
47   double  a2;
# Line 60 | Line 56 | double a2;
56                                          /* compute gamb -> colr mapping */
57          i = 0;
58          mult = 256.0;
59 <        for (j = 255; j > 0; j--) {
60 <                while ((g_mant[j] = mult * (*f)(j/256.0, a2)) < 128) {
59 >        for (j = 256; j--; ) {
60 >                while ((g_mant[j] = mult * (*f)((j+.5)/256.0, a2)) < 128) {
61                          i++;
62                          mult *= 2.0;
63                  }
64                  g_nexp[j] = i;
65          }
70        g_mant[0] = 0;
71        g_nexp[0] = COLXS;
66          return(0);
67   }
68  
69  
70 + int
71   setcolrgam(g)                   /* set gamma conversion */
72   double  g;
73   {
# Line 82 | Line 77 | double g;
77   }
78  
79  
80 + int
81   colrs_gambs(scan, len)          /* convert scanline of colrs to gamma bytes */
82   register COLR   *scan;
83   int     len;
# Line 131 | Line 127 | int    len;
127   }
128  
129  
130 + int
131   gambs_colrs(scan, len)          /* convert gamma bytes to colr scanline */
132   register COLR   *scan;
133   int     len;
# Line 167 | Line 164 | int    len;
164   }
165  
166  
167 + void
168   shiftcolrs(scan, len, adjust)   /* shift a scanline of colors by 2^adjust */
169   register COLR   *scan;
170   register int    len;
# Line 188 | Line 186 | register int   adjust;
186   }
187  
188  
189 + void
190   normcolrs(scan, len, adjust)    /* normalize a scanline of colrs */
191   register COLR  *scan;
192   int  len;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines