| 1 |
schorsch |
3.11 |
/* RCSid: $Id: pcond.h,v 3.10 2003/02/22 02:07:27 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 |
|
|
|
| 12 |
schorsch |
3.11 |
#ifdef __cplusplus
|
| 13 |
|
|
extern "C" {
|
| 14 |
|
|
#endif
|
| 15 |
greg |
3.1 |
|
| 16 |
greg |
3.10 |
#ifndef ADJ_VEIL
|
| 17 |
|
|
#define ADJ_VEIL 0 /* adjust veil to preserve contrast? */
|
| 18 |
|
|
#endif
|
| 19 |
greg |
3.1 |
|
| 20 |
|
|
#define SWNORM 2.26 /* scotopic/photopic ratio for white */
|
| 21 |
|
|
#define WHTSEFFICACY (SWNORM*WHTEFFICACY)
|
| 22 |
|
|
|
| 23 |
greg |
3.3 |
#define BotMesopic 5.62e-3 /* top of scotopic range */
|
| 24 |
|
|
#define TopMesopic 5.62 /* bottom of photopic range */
|
| 25 |
|
|
|
| 26 |
greg |
3.10 |
#define FOVDIA (1.0*PI/180.0) /* foveal diameter (radians) */
|
| 27 |
greg |
3.1 |
|
| 28 |
|
|
#define HISTRES 100 /* histogram resolution */
|
| 29 |
gwlarson |
3.9 |
#define MAXPREHIST 1024 /* maximum precomputed histogram */
|
| 30 |
greg |
3.1 |
|
| 31 |
gwlarson |
3.8 |
#define LMIN 1e-7 /* minimum visible world luminance */
|
| 32 |
greg |
3.1 |
#define LMAX 1e5 /* 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) */
|
| 36 |
|
|
#define Lb(Bw) exp(Bw) /* inverse of brightness function */
|
| 37 |
|
|
#define Lb1(Bw) exp(Bw) /* first derivative of Lb(Bw) */
|
| 38 |
|
|
|
| 39 |
|
|
/* Flags of what to do */
|
| 40 |
greg |
3.2 |
#define DO_ACUITY 01
|
| 41 |
greg |
3.1 |
#define DO_VEIL 02
|
| 42 |
|
|
#define DO_HSENS 04
|
| 43 |
|
|
#define DO_COLOR 010
|
| 44 |
|
|
#define DO_CWEIGHT 020
|
| 45 |
greg |
3.5 |
#define DO_FIXHIST 040
|
| 46 |
gwlarson |
3.9 |
#define DO_PREHIST 0100
|
| 47 |
|
|
#define DO_LINEAR 0200
|
| 48 |
greg |
3.1 |
|
| 49 |
|
|
#define DO_HUMAN (DO_ACUITY|DO_VEIL|DO_HSENS|DO_COLOR)
|
| 50 |
|
|
|
| 51 |
|
|
extern int what2do; /* desired adjustments */
|
| 52 |
|
|
|
| 53 |
|
|
extern double ldmax; /* maximum output luminance */
|
| 54 |
greg |
3.7 |
extern double lddyn; /* display dynamic range */
|
| 55 |
|
|
extern double Bldmin, Bldmax; /* Bl(ldmax/lddyn) and Bl(ldmax) */
|
| 56 |
greg |
3.1 |
|
| 57 |
|
|
extern char *progname; /* global argv[0] */
|
| 58 |
|
|
|
| 59 |
|
|
extern char *infn; /* input file name */
|
| 60 |
|
|
extern FILE *infp; /* input stream */
|
| 61 |
|
|
extern double rgblum(), cielum(); /* luminance functions */
|
| 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 |
|
|
extern double hacuity(); /* human acuity func. (cycles/deg.) */
|
| 103 |
|
|
extern double htcontrs(); /* human contrast sens. func. */
|
| 104 |
greg |
3.10 |
extern double clampf(); /* histogram clamping function */
|
| 105 |
|
|
extern double crfactor(); /* contrast reduction factor */
|
| 106 |
greg |
3.1 |
|
| 107 |
|
|
extern COLOR *firstscan(); /* first processed scanline */
|
| 108 |
|
|
extern COLOR *nextscan(); /* next processed scanline */
|
| 109 |
schorsch |
3.11 |
|
| 110 |
|
|
#ifdef __cplusplus
|
| 111 |
|
|
}
|
| 112 |
|
|
#endif
|
| 113 |
|
|
#endif /* _RAD_PCOND_H_ */
|