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

Comparing ray/src/common/color.h (file contents):
Revision 1.4 by greg, Fri Oct 20 20:35:21 1989 UTC vs.
Revision 2.8 by greg, Wed Aug 17 11:07:56 1994 UTC

# Line 1 | Line 1
1 < /* Copyright (c) 1986 Regents of the University of California */
1 > /* Copyright (c) 1991 Regents of the University of California */
2  
3   /* SCCSid "$SunId$ LBL" */
4  
# Line 40 | Line 40 | typedef float  COLOR[3];       /* red, green, blue */
40  
41   #define  multcolor(c1,c2)       ((c1)[0]*=(c2)[0],(c1)[1]*=(c2)[1],(c1)[2]*=(c2)[2])
42  
43 < #define  bright(col)            (.30*(col)[RED]+.59*(col)[GRN]+.11*(col)[BLU])
43 > #ifdef  NTSC
44 > #define  CIE_x_r                0.670           /* standard NTSC primaries */
45 > #define  CIE_y_r                0.330
46 > #define  CIE_x_g                0.210
47 > #define  CIE_y_g                0.710
48 > #define  CIE_x_b                0.140
49 > #define  CIE_y_b                0.080
50 > #define  CIE_x_w                0.3333          /* use true white */
51 > #define  CIE_y_w                0.3333
52 > #else
53 > #define  CIE_x_r                0.640           /* nominal CRT primaries */
54 > #define  CIE_y_r                0.330
55 > #define  CIE_x_g                0.290
56 > #define  CIE_y_g                0.600
57 > #define  CIE_x_b                0.150
58 > #define  CIE_y_b                0.060
59 > #define  CIE_x_w                0.3333          /* use true white */
60 > #define  CIE_y_w                0.3333
61 > #endif
62  
63 + #define CIE_D           (       CIE_x_r*(CIE_y_g - CIE_y_b) + \
64 +                                CIE_x_g*(CIE_y_b - CIE_y_r) + \
65 +                                CIE_x_b*(CIE_y_r - CIE_y_g)     )
66 + #define CIE_C_rD        ( (1./CIE_y_w) * \
67 +                                ( CIE_x_w*(CIE_y_g - CIE_y_b) - \
68 +                                  CIE_y_w*(CIE_x_g - CIE_x_b) + \
69 +                                  CIE_x_g*CIE_y_b - CIE_x_b*CIE_y_g     ) )
70 + #define CIE_C_gD        ( (1./CIE_y_w) * \
71 +                                ( CIE_x_w*(CIE_y_b - CIE_y_r) - \
72 +                                  CIE_y_w*(CIE_x_b - CIE_x_r) - \
73 +                                  CIE_x_r*CIE_y_b + CIE_x_b*CIE_y_r     ) )
74 + #define CIE_C_bD        ( (1./CIE_y_w) * \
75 +                                ( CIE_x_w*(CIE_y_r - CIE_y_g) - \
76 +                                  CIE_y_w*(CIE_x_r - CIE_x_g) + \
77 +                                  CIE_x_r*CIE_y_g - CIE_x_g*CIE_y_r     ) )
78 +
79 + #define CIE_rf          (CIE_y_r*CIE_C_rD/CIE_D)
80 + #define CIE_gf          (CIE_y_g*CIE_C_gD/CIE_D)
81 + #define CIE_bf          (CIE_y_b*CIE_C_bD/CIE_D)
82 +
83 + #define  bright(col)    (CIE_rf*(col)[RED]+CIE_gf*(col)[GRN]+CIE_bf*(col)[BLU])
84 + #define  normbright(c)  ( ( (long)(CIE_rf*256.+.5)*(c)[RED] + \
85 +                            (long)(CIE_gf*256.+.5)*(c)[GRN] + \
86 +                            (long)(CIE_bf*256.+.5)*(c)[BLU] ) >> 8 )
87 +
88 +                                /* luminous efficacies over visible spectrum */
89 + #define  MAXEFFICACY            683.            /* defined maximum at 550 nm */
90 + #define  WHTEFFICACY            179.            /* uniform white light */
91 + #define  D65EFFICACY            203.            /* standard illuminant D65 */
92 + #define  INCEFFICACY            160.            /* illuminant A (incand.) */
93 + #define  SUNEFFICACY            208.            /* illuminant B (solar dir.) */
94 + #define  SKYEFFICACY            D65EFFICACY     /* skylight */
95 + #define  DAYEFFICACY            D65EFFICACY     /* combined sky and solar */
96 +
97 + #define  luminance(col)         (WHTEFFICACY * bright(col))
98 +
99   #define  intens(col)            ( (col)[0] > (col)[1] \
100                                  ? (col)[0] > (col)[2] ? (col)[0] : (col)[2] \
101                                  : (col)[1] > (col)[2] ? (col)[1] : (col)[2] )
# Line 50 | Line 104 | typedef float  COLOR[3];       /* red, green, blue */
104                                  ldexp((c)[p]+.5,(int)(c)[EXP]-(COLXS+8)) : \
105                                  0. )
106  
53 #define  normbright(c)          (int)((77L*(c)[RED]+151L*(c)[GRN]+28L*(c)[BLU])/256)
54
107   #define  WHTCOLOR               {1.0,1.0,1.0}
108   #define  BLKCOLOR               {0.0,0.0,0.0}
109   #define  WHTCOLR                {128,128,128,COLXS+1}
110   #define  BLKCOLR                {0,0,0,0}
111  
112 <                                /* definitions for resolution header */
113 < #define  XDECR                  1
62 < #define  YDECR                  2
63 < #define  YMAJOR                 4
112 >                                /* picture format identifier */
113 > #define  COLRFMT                "32-bit_rle_rgbe"
114  
115 < extern double  ldexp();
115 >                                /* macros for exposures */
116 > #define  EXPOSSTR               "EXPOSURE="
117 > #define  LEXPOSSTR              9
118 > #define  isexpos(hl)            (!strncmp(hl,EXPOSSTR,LEXPOSSTR))
119 > #define  exposval(hl)           atof((hl)+LEXPOSSTR)
120 > #define  fputexpos(ex,fp)       fprintf(fp,"%s%e\n",EXPOSSTR,ex)
121 >
122 >                                /* macros for pixel aspect ratios */
123 > #define  ASPECTSTR              "PIXASPECT="
124 > #define  LASPECTSTR             10
125 > #define  isaspect(hl)           (!strncmp(hl,ASPECTSTR,LASPECTSTR))
126 > #define  aspectval(hl)          atof((hl)+LASPECTSTR)
127 > #define  fputaspect(pa,fp)      fprintf(fp,"%s%f\n",ASPECTSTR,pa)
128 >
129 >                                /* macros for color correction */
130 > #define  COLCORSTR              "COLORCORR="
131 > #define  LCOLCORSTR             10
132 > #define  iscolcor(hl)           (!strncmp(hl,COLCORSTR,LCOLCORSTR))
133 > #define  colcorval(cc,hl)       sscanf(hl+LCOLCORSTR,"%f %f %f", \
134 >                                        &(cc)[RED],&(cc)[GRN],&(cc)[BLU])
135 > #define  fputcolcor(cc,fp)      fprintf(fp,"%s %f %f %f\n",COLCORSTR, \
136 >                                        (cc)[RED],(cc)[GRN],(cc)[BLU])
137 >
138 > #ifdef  DCL_ATOF
139 > extern double  atof(), ldexp(), frexp();
140 > #endif

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines