| 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 BotMesopic      5.62e-3         /* top of scotopic range */ | 
| 22 | #define TopMesopic      5.62            /* bottom of photopic range */ | 
| 23 |  | 
| 24 | #define FOVDIA          (1.0*PI/180.)   /* foveal diameter (radians) */ | 
| 25 |  | 
| 26 | #define HISTRES         100             /* histogram resolution */ | 
| 27 |  | 
| 28 | #define LMIN            1e-4            /* minimum visible world luminance */ | 
| 29 | #define LMAX            1e5             /* maximum visible world luminance */ | 
| 30 |  | 
| 31 | #define Bl(Lw)          log(Lw)         /* brightness function */ | 
| 32 | #define Bl1(Lw)         (1.0/(Lw))      /* first derivative of Bl(Lw) */ | 
| 33 | #define Lb(Bw)          exp(Bw)         /* inverse of brightness function */ | 
| 34 | #define Lb1(Bw)         exp(Bw)         /* first derivative of Lb(Bw) */ | 
| 35 |  | 
| 36 | /* Flags of what to do */ | 
| 37 | #define DO_ACUITY       01 | 
| 38 | #define DO_VEIL         02 | 
| 39 | #define DO_HSENS        04 | 
| 40 | #define DO_COLOR        010 | 
| 41 | #define DO_CWEIGHT      020 | 
| 42 | #define DO_LINEAR       040 | 
| 43 |  | 
| 44 | #define DO_HUMAN        (DO_ACUITY|DO_VEIL|DO_HSENS|DO_COLOR) | 
| 45 |  | 
| 46 | extern int      what2do;                /* desired adjustments */ | 
| 47 |  | 
| 48 | extern double   ldmax;                  /* maximum output luminance */ | 
| 49 | extern double   ldmin;                  /* minimum output luminance */ | 
| 50 | extern double   Bldmin, Bldmax;         /* Bl(ldmin) and Bl(ldmax) */ | 
| 51 |  | 
| 52 | extern char     *progname;              /* global argv[0] */ | 
| 53 |  | 
| 54 | extern char     *infn;                  /* input file name */ | 
| 55 | extern FILE     *infp;                  /* input stream */ | 
| 56 | extern double   rgblum(), cielum();     /* luminance functions */ | 
| 57 | extern double   (*lumf)();              /* input luminance function */ | 
| 58 | extern double   inpexp;                 /* input exposure value */ | 
| 59 |  | 
| 60 | #define plum(clr)       ((*lumf)(clr,0)/inpexp) | 
| 61 | #define slum(clr)       ((*lumf)(clr,1)/inpexp) | 
| 62 |  | 
| 63 | extern COLOR    *fovimg;                /* foveal (1 degree) averaged image */ | 
| 64 | extern short    fvxr, fvyr;             /* foveal image resolution */ | 
| 65 |  | 
| 66 | #define fovscan(y)      (fovimg+(y)*fvxr) | 
| 67 |  | 
| 68 | extern float    bwhist[HISTRES];        /* luminance histogram */ | 
| 69 | extern double   histot;                 /* total count of histogram */ | 
| 70 | extern double   bwmin, bwmax;           /* histogram limits */ | 
| 71 | extern double   bwavg;                  /* mean brightness */ | 
| 72 |  | 
| 73 | #define bwhi(B)         (int)(HISTRES*((B)-bwmin)/(bwmax-bwmin)) | 
| 74 |  | 
| 75 | extern RGBPRIMP inprims;                /* input primaries */ | 
| 76 | extern COLORMAT inrgb2xyz;              /* convert input RGB to XYZ */ | 
| 77 |  | 
| 78 | extern RGBPRIMP outprims;               /* output primaries */ | 
| 79 |  | 
| 80 | extern double   scalef;                 /* linear scaling factor */ | 
| 81 |  | 
| 82 | extern VIEW     ourview;                /* picture view */ | 
| 83 | extern double   pixaspect;              /* pixel aspect ratio */ | 
| 84 | extern RESOLU   inpres;                 /* input picture resolution */ | 
| 85 |  | 
| 86 | extern char     *mbcalfile;             /* macbethcal mapping file */ | 
| 87 |  | 
| 88 | extern double   hacuity();              /* human acuity func. (cycles/deg.) */ | 
| 89 | extern double   htcontrs();             /* human contrast sens. func. */ | 
| 90 |  | 
| 91 | extern COLOR    *firstscan();           /* first processed scanline */ | 
| 92 | extern COLOR    *nextscan();            /* next processed scanline */ |