ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/src/px/pcond.h
Revision: 3.16
Committed: Sat Jun 7 05:09:46 2025 UTC (9 hours, 35 minutes ago) by greg
Content type: text/plain
Branch: MAIN
CVS Tags: HEAD
Changes since 3.15: +2 -1 lines
Log Message:
refactor: Put some declarations into "paths.h" and included in "platform.h"

File Contents

# User Rev Content
1 greg 3.16 /* RCSid: $Id: pcond.h,v 3.15 2017/11/30 18:43:05 greg Exp $ */
2 greg 3.1 /*
3     * Header file for picture file conditioning.
4     */
5 schorsch 3.11 #ifndef _RAD_PCOND_H_
6     #define _RAD_PCOND_H_
7 greg 3.1
8     #include "standard.h"
9     #include "color.h"
10     #include "view.h"
11 greg 3.16 #include "paths.h"
12 greg 3.1
13 schorsch 3.11 #ifdef __cplusplus
14     extern "C" {
15     #endif
16 greg 3.1
17 greg 3.10 #ifndef ADJ_VEIL
18     #define ADJ_VEIL 0 /* adjust veil to preserve contrast? */
19     #endif
20 greg 3.1
21     #define SWNORM 2.26 /* scotopic/photopic ratio for white */
22     #define WHTSEFFICACY (SWNORM*WHTEFFICACY)
23    
24 greg 3.3 #define BotMesopic 5.62e-3 /* top of scotopic range */
25     #define TopMesopic 5.62 /* bottom of photopic range */
26    
27 greg 3.10 #define FOVDIA (1.0*PI/180.0) /* foveal diameter (radians) */
28 greg 3.1
29     #define HISTRES 100 /* histogram resolution */
30 gwlarson 3.9 #define MAXPREHIST 1024 /* maximum precomputed histogram */
31 greg 3.1
32 gwlarson 3.8 #define LMIN 1e-7 /* minimum visible world luminance */
33 greg 3.15 #define LMAX 1e7 /* maximum visible world luminance */
34 greg 3.1
35     #define Bl(Lw) log(Lw) /* brightness function */
36     #define Bl1(Lw) (1.0/(Lw)) /* first derivative of Bl(Lw) */
37     #define Lb(Bw) exp(Bw) /* inverse of brightness function */
38     #define Lb1(Bw) exp(Bw) /* first derivative of Lb(Bw) */
39    
40     /* Flags of what to do */
41 greg 3.2 #define DO_ACUITY 01
42 greg 3.1 #define DO_VEIL 02
43     #define DO_HSENS 04
44     #define DO_COLOR 010
45     #define DO_CWEIGHT 020
46 greg 3.5 #define DO_FIXHIST 040
47 gwlarson 3.9 #define DO_PREHIST 0100
48     #define DO_LINEAR 0200
49 greg 3.1
50     #define DO_HUMAN (DO_ACUITY|DO_VEIL|DO_HSENS|DO_COLOR)
51    
52     extern int what2do; /* desired adjustments */
53    
54     extern double ldmax; /* maximum output luminance */
55 greg 3.7 extern double lddyn; /* display dynamic range */
56     extern double Bldmin, Bldmax; /* Bl(ldmax/lddyn) and Bl(ldmax) */
57 greg 3.1
58     extern char *progname; /* global argv[0] */
59    
60     extern char *infn; /* input file name */
61     extern FILE *infp; /* input stream */
62     extern double (*lumf)(); /* input luminance function */
63     extern double inpexp; /* input exposure value */
64    
65     #define plum(clr) ((*lumf)(clr,0)/inpexp)
66     #define slum(clr) ((*lumf)(clr,1)/inpexp)
67 greg 3.7
68     #define ldmin (ldmax/lddyn)
69 greg 3.1
70     extern COLOR *fovimg; /* foveal (1 degree) averaged image */
71 greg 3.10 extern int fvxr, fvyr; /* foveal image resolution */
72     extern float *crfimg; /* contrast reduction factors */
73 greg 3.1
74     #define fovscan(y) (fovimg+(y)*fvxr)
75 greg 3.10 #define crfscan(y) (crfimg+(y)*fvxr)
76 greg 3.5
77     extern double fixfrac; /* histogram share due to fixations */
78     extern short (*fixlst)[2]; /* fixation history list */
79     extern int nfixations; /* number of fixation points */
80 greg 3.1
81 greg 3.10 extern double bwhist[HISTRES]; /* luminance histogram */
82 greg 3.4 extern double histot; /* total count of histogram */
83 greg 3.1 extern double bwmin, bwmax; /* histogram limits */
84     extern double bwavg; /* mean brightness */
85    
86 greg 3.4 #define bwhi(B) (int)(HISTRES*((B)-bwmin)/(bwmax-bwmin))
87 greg 3.1
88     extern RGBPRIMP inprims; /* input primaries */
89     extern COLORMAT inrgb2xyz; /* convert input RGB to XYZ */
90    
91     extern RGBPRIMP outprims; /* output primaries */
92    
93     extern double scalef; /* linear scaling factor */
94    
95     extern VIEW ourview; /* picture view */
96     extern double pixaspect; /* pixel aspect ratio */
97     extern RESOLU inpres; /* input picture resolution */
98    
99     extern char *mbcalfile; /* macbethcal mapping file */
100 greg 3.6 extern char *cwarpfile; /* color warp mapping file */
101 greg 3.1
102    
103 schorsch 3.12
104     /* defined in pcond.c */
105     extern void syserror(char *s);
106    
107     /* defined in pcond2.c */
108     extern double rgblum(COLOR clr, int scotopic); /* compute (scotopic) luminance of RGB color */
109     extern double cielum(COLOR xyz, int scotopic); /* compute (scotopic) luminance of CIE color */
110     extern COLOR *nextscan(void); /* next processed scanline */
111     extern COLOR *firstscan(void); /* first processed scanline */
112    
113     /* defined in pcond3.c */
114     extern void getfixations(FILE *fp); /* load fixation history list */
115     extern void gethisto(FILE *fp); /* load precomputed luminance histogram */
116     extern void comphist(void); /* create foveal sampling histogram */
117     extern double htcontrs(double La); /* human contrast sens. func. */
118     extern double clampf(double La); /* histogram clamping function */
119     extern double crfactor(double La); /* contrast reduction factor */
120     extern int mkbrmap(void); /* make dynamic range map */
121     extern void putmapping(FILE *fp); /* put out mapping function */
122     extern void scotscan(COLOR *scan, int xres); /* apply scotopic color sensitivity loss */
123     extern void mapscan(COLOR *scan, int xres); /* apply tone mapping operator to scanline */
124    
125     /* defined in pcond4.c */
126     extern void compveil(void); /* compute veiling image */
127     #if ADJ_VEIL
128     extern void adjveil(void); /* adjust veil image */
129     #endif
130     extern void acuscan(COLOR *scln, int y); /* get acuity-sampled scanline */
131 greg 3.13 extern void addveil(COLOR *sl, int y); /* add veil to scanline */
132 greg 3.14 extern void initacuity(void); /* initialize variable acuity sampling */
133 schorsch 3.12 extern double hacuity(double La); /* human acuity func. (cycles/deg.) */
134 schorsch 3.11
135     #ifdef __cplusplus
136     }
137     #endif
138     #endif /* _RAD_PCOND_H_ */