1 |
< |
/* Copyright (c) 1997 Regents of the University of California */ |
2 |
< |
|
3 |
< |
/* SCCSid "$SunId$ LBL" */ |
4 |
< |
|
1 |
> |
/* RCSid: $Id$ */ |
2 |
|
/* |
3 |
|
* Header file for picture file conditioning. |
4 |
|
*/ |
5 |
+ |
#ifndef _RAD_PCOND_H_ |
6 |
+ |
#define _RAD_PCOND_H_ |
7 |
|
|
8 |
|
#include "standard.h" |
10 |
– |
|
9 |
|
#include "color.h" |
12 |
– |
|
10 |
|
#include "view.h" |
11 |
|
|
12 |
< |
#include "resolu.h" |
12 |
> |
#ifdef __cplusplus |
13 |
> |
extern "C" { |
14 |
> |
#endif |
15 |
|
|
16 |
+ |
#ifndef ADJ_VEIL |
17 |
+ |
#define ADJ_VEIL 0 /* adjust veil to preserve contrast? */ |
18 |
+ |
#endif |
19 |
|
|
20 |
|
#define SWNORM 2.26 /* scotopic/photopic ratio for white */ |
21 |
|
#define WHTSEFFICACY (SWNORM*WHTEFFICACY) |
23 |
|
#define BotMesopic 5.62e-3 /* top of scotopic range */ |
24 |
|
#define TopMesopic 5.62 /* bottom of photopic range */ |
25 |
|
|
26 |
< |
#define FOVDIA (1.0*PI/180.) /* foveal diameter (radians) */ |
26 |
> |
#define FOVDIA (1.0*PI/180.0) /* foveal diameter (radians) */ |
27 |
|
|
28 |
|
#define HISTRES 100 /* histogram resolution */ |
29 |
+ |
#define MAXPREHIST 1024 /* maximum precomputed histogram */ |
30 |
|
|
31 |
< |
#define LMIN 1e-4 /* minimum visible world luminance */ |
32 |
< |
#define LMAX 1e5 /* maximum visible world luminance */ |
31 |
> |
#define LMIN 1e-7 /* minimum visible world luminance */ |
32 |
> |
#define LMAX 1e7 /* maximum visible world luminance */ |
33 |
|
|
34 |
|
#define Bl(Lw) log(Lw) /* brightness function */ |
35 |
|
#define Bl1(Lw) (1.0/(Lw)) /* first derivative of Bl(Lw) */ |
43 |
|
#define DO_COLOR 010 |
44 |
|
#define DO_CWEIGHT 020 |
45 |
|
#define DO_FIXHIST 040 |
46 |
< |
#define DO_LINEAR 0100 |
46 |
> |
#define DO_PREHIST 0100 |
47 |
> |
#define DO_LINEAR 0200 |
48 |
|
|
49 |
|
#define DO_HUMAN (DO_ACUITY|DO_VEIL|DO_HSENS|DO_COLOR) |
50 |
|
|
58 |
|
|
59 |
|
extern char *infn; /* input file name */ |
60 |
|
extern FILE *infp; /* input stream */ |
57 |
– |
extern double rgblum(), cielum(); /* luminance functions */ |
61 |
|
extern double (*lumf)(); /* input luminance function */ |
62 |
|
extern double inpexp; /* input exposure value */ |
63 |
|
|
67 |
|
#define ldmin (ldmax/lddyn) |
68 |
|
|
69 |
|
extern COLOR *fovimg; /* foveal (1 degree) averaged image */ |
70 |
< |
extern short fvxr, fvyr; /* foveal image resolution */ |
70 |
> |
extern int fvxr, fvyr; /* foveal image resolution */ |
71 |
> |
extern float *crfimg; /* contrast reduction factors */ |
72 |
|
|
73 |
|
#define fovscan(y) (fovimg+(y)*fvxr) |
74 |
+ |
#define crfscan(y) (crfimg+(y)*fvxr) |
75 |
|
|
76 |
|
extern double fixfrac; /* histogram share due to fixations */ |
77 |
|
extern short (*fixlst)[2]; /* fixation history list */ |
78 |
|
extern int nfixations; /* number of fixation points */ |
79 |
|
|
80 |
< |
extern float bwhist[HISTRES]; /* luminance histogram */ |
80 |
> |
extern double bwhist[HISTRES]; /* luminance histogram */ |
81 |
|
extern double histot; /* total count of histogram */ |
82 |
|
extern double bwmin, bwmax; /* histogram limits */ |
83 |
|
extern double bwavg; /* mean brightness */ |
98 |
|
extern char *mbcalfile; /* macbethcal mapping file */ |
99 |
|
extern char *cwarpfile; /* color warp mapping file */ |
100 |
|
|
96 |
– |
extern double hacuity(); /* human acuity func. (cycles/deg.) */ |
97 |
– |
extern double htcontrs(); /* human contrast sens. func. */ |
101 |
|
|
102 |
< |
extern COLOR *firstscan(); /* first processed scanline */ |
103 |
< |
extern COLOR *nextscan(); /* next processed scanline */ |
102 |
> |
|
103 |
> |
/* defined in pcond.c */ |
104 |
> |
extern void syserror(char *s); |
105 |
> |
|
106 |
> |
/* defined in pcond2.c */ |
107 |
> |
extern double rgblum(COLOR clr, int scotopic); /* compute (scotopic) luminance of RGB color */ |
108 |
> |
extern double cielum(COLOR xyz, int scotopic); /* compute (scotopic) luminance of CIE color */ |
109 |
> |
extern COLOR *nextscan(void); /* next processed scanline */ |
110 |
> |
extern COLOR *firstscan(void); /* first processed scanline */ |
111 |
> |
|
112 |
> |
/* defined in pcond3.c */ |
113 |
> |
extern void getfixations(FILE *fp); /* load fixation history list */ |
114 |
> |
extern void gethisto(FILE *fp); /* load precomputed luminance histogram */ |
115 |
> |
extern void comphist(void); /* create foveal sampling histogram */ |
116 |
> |
extern double htcontrs(double La); /* human contrast sens. func. */ |
117 |
> |
extern double clampf(double La); /* histogram clamping function */ |
118 |
> |
extern double crfactor(double La); /* contrast reduction factor */ |
119 |
> |
extern int mkbrmap(void); /* make dynamic range map */ |
120 |
> |
extern void putmapping(FILE *fp); /* put out mapping function */ |
121 |
> |
extern void scotscan(COLOR *scan, int xres); /* apply scotopic color sensitivity loss */ |
122 |
> |
extern void mapscan(COLOR *scan, int xres); /* apply tone mapping operator to scanline */ |
123 |
> |
|
124 |
> |
/* defined in pcond4.c */ |
125 |
> |
extern void compveil(void); /* compute veiling image */ |
126 |
> |
#if ADJ_VEIL |
127 |
> |
extern void adjveil(void); /* adjust veil image */ |
128 |
> |
#endif |
129 |
> |
extern void acuscan(COLOR *scln, int y); /* get acuity-sampled scanline */ |
130 |
> |
extern void addveil(COLOR *sl, int y); /* add veil to scanline */ |
131 |
> |
extern void initacuity(void); /* initialize variable acuity sampling */ |
132 |
> |
extern double hacuity(double La); /* human acuity func. (cycles/deg.) */ |
133 |
> |
|
134 |
> |
#ifdef __cplusplus |
135 |
> |
} |
136 |
> |
#endif |
137 |
> |
#endif /* _RAD_PCOND_H_ */ |