| 1 |
greg |
3.1 |
/* Copyright (c) 1996 Regents of the University of California */ |
| 2 |
|
|
|
| 3 |
|
|
/* SCCSid "$SunId$ LBL" */ |
| 4 |
|
|
|
| 5 |
|
|
/* |
| 6 |
|
|
* Header file for picture file conditioning. |
| 7 |
|
|
*/ |
| 8 |
|
|
|
| 9 |
|
|
#include "standard.h" |
| 10 |
|
|
|
| 11 |
|
|
#include "color.h" |
| 12 |
|
|
|
| 13 |
|
|
#include "view.h" |
| 14 |
|
|
|
| 15 |
|
|
#include "resolu.h" |
| 16 |
|
|
|
| 17 |
|
|
|
| 18 |
|
|
#define SWNORM 2.26 /* scotopic/photopic ratio for white */ |
| 19 |
|
|
#define WHTSEFFICACY (SWNORM*WHTEFFICACY) |
| 20 |
|
|
|
| 21 |
|
|
#define FOVDIA (1.0*PI/180.) /* foveal diameter (radians) */ |
| 22 |
|
|
|
| 23 |
|
|
#define HISTRES 100 /* histogram resolution */ |
| 24 |
|
|
|
| 25 |
|
|
#define LMIN 1e-4 /* minimum visible world luminance */ |
| 26 |
|
|
#define LMAX 1e5 /* maximum visible world luminance */ |
| 27 |
|
|
|
| 28 |
|
|
#define Bl(Lw) log(Lw) /* brightness function */ |
| 29 |
|
|
#define Bl1(Lw) (1.0/(Lw)) /* first derivative of Bl(Lw) */ |
| 30 |
|
|
#define Lb(Bw) exp(Bw) /* inverse of brightness function */ |
| 31 |
|
|
#define Lb1(Bw) exp(Bw) /* first derivative of Lb(Bw) */ |
| 32 |
|
|
|
| 33 |
|
|
/* Flags of what to do */ |
| 34 |
|
|
#define DO_ACUITY 01 |
| 35 |
|
|
#define DO_VEIL 02 |
| 36 |
|
|
#define DO_HSENS 04 |
| 37 |
|
|
#define DO_COLOR 010 |
| 38 |
|
|
#define DO_CWEIGHT 020 |
| 39 |
|
|
#define DO_LINEAR 040 |
| 40 |
|
|
|
| 41 |
|
|
#define DO_HUMAN (DO_ACUITY|DO_VEIL|DO_HSENS|DO_COLOR) |
| 42 |
|
|
|
| 43 |
|
|
extern int what2do; /* desired adjustments */ |
| 44 |
|
|
|
| 45 |
|
|
extern double ldmax; /* maximum output luminance */ |
| 46 |
|
|
extern double ldmin; /* minimum output luminance */ |
| 47 |
|
|
extern double Bldmin, Bldmax; /* Bl(ldmin) and Bl(ldmax) */ |
| 48 |
|
|
|
| 49 |
|
|
extern char *progname; /* global argv[0] */ |
| 50 |
|
|
|
| 51 |
|
|
extern char *infn; /* input file name */ |
| 52 |
|
|
extern FILE *infp; /* input stream */ |
| 53 |
|
|
extern double rgblum(), cielum(); /* luminance functions */ |
| 54 |
|
|
extern double (*lumf)(); /* input luminance function */ |
| 55 |
|
|
extern double inpexp; /* input exposure value */ |
| 56 |
|
|
|
| 57 |
|
|
#define plum(clr) ((*lumf)(clr,0)/inpexp) |
| 58 |
|
|
#define slum(clr) ((*lumf)(clr,1)/inpexp) |
| 59 |
|
|
|
| 60 |
|
|
extern COLOR *fovimg; /* foveal (1 degree) averaged image */ |
| 61 |
|
|
extern short fvxr, fvyr; /* foveal image resolution */ |
| 62 |
|
|
|
| 63 |
|
|
#define fovscan(y) (fovimg+(y)*fvxr) |
| 64 |
|
|
|
| 65 |
|
|
extern int bwhist[HISTRES]; /* luminance histogram */ |
| 66 |
|
|
extern long histot; /* total count of histogram */ |
| 67 |
|
|
extern double bwmin, bwmax; /* histogram limits */ |
| 68 |
|
|
extern double bwavg; /* mean brightness */ |
| 69 |
|
|
|
| 70 |
|
|
#define lwhc(L) bwhc(Bl(L)) |
| 71 |
|
|
#define bwhc(B) bwhist[(int)(HISTRES*((B)-bwmin)/(bwmax-bwmin))] |
| 72 |
|
|
|
| 73 |
|
|
extern RGBPRIMP inprims; /* input primaries */ |
| 74 |
|
|
extern COLORMAT inrgb2xyz; /* convert input RGB to XYZ */ |
| 75 |
|
|
|
| 76 |
|
|
extern RGBPRIMP outprims; /* output primaries */ |
| 77 |
|
|
|
| 78 |
|
|
extern double scalef; /* linear scaling factor */ |
| 79 |
|
|
|
| 80 |
|
|
extern VIEW ourview; /* picture view */ |
| 81 |
|
|
extern double pixaspect; /* pixel aspect ratio */ |
| 82 |
|
|
extern RESOLU inpres; /* input picture resolution */ |
| 83 |
|
|
|
| 84 |
|
|
extern char *mbcalfile; /* macbethcal mapping file */ |
| 85 |
|
|
|
| 86 |
|
|
struct mbc { /* data structure for macbethcal conditioning */ |
| 87 |
|
|
float xa[3][6], ya[3][6]; |
| 88 |
|
|
COLORMAT cmat; |
| 89 |
|
|
}; |
| 90 |
|
|
|
| 91 |
|
|
extern double hacuity(); /* human acuity func. (cycles/deg.) */ |
| 92 |
|
|
extern double htcontrs(); /* human contrast sens. func. */ |
| 93 |
|
|
|
| 94 |
|
|
extern COLOR *firstscan(); /* first processed scanline */ |
| 95 |
|
|
extern COLOR *nextscan(); /* next processed scanline */ |