1 |
– |
/* Copyright (c) 1994 Regents of the University of California */ |
2 |
– |
|
1 |
|
#ifndef lint |
2 |
< |
static char SCCSid[] = "$SunId$ LBL"; |
2 |
> |
static const char RCSid[] = "$Id$"; |
3 |
|
#endif |
6 |
– |
|
4 |
|
/* |
5 |
|
* pf2.c - routines used by pfilt. |
6 |
|
*/ |
7 |
|
|
8 |
|
#include <stdio.h> |
9 |
|
|
10 |
+ |
#include <stdlib.h> |
11 |
+ |
|
12 |
|
#include <math.h> |
13 |
|
|
14 |
|
#include "random.h" |
35 |
|
|
36 |
|
extern COLOR exposure; /* exposure for frame */ |
37 |
|
|
38 |
+ |
extern double (*ourbright)(); /* brightness calculation function */ |
39 |
+ |
|
40 |
|
#define AVGLVL 0.5 /* target mean brightness */ |
41 |
|
|
42 |
|
double avgbrt; /* average picture brightness */ |
74 |
|
register COLOR *scan; |
75 |
|
int y; |
76 |
|
{ |
76 |
– |
extern char *malloc(); |
77 |
|
double cbrt; |
78 |
|
register int x; |
79 |
|
register HOTPIX *hp; |
80 |
|
|
81 |
|
for (x = 0; x < xres; x++) { |
82 |
|
|
83 |
< |
cbrt = bright(scan[x]); |
83 |
> |
cbrt = (*ourbright)(scan[x]); |
84 |
|
|
85 |
|
if (cbrt <= 0) |
86 |
|
continue; |
118 |
|
|
119 |
|
scalecolor(exposure, AVGLVL/avgbrt); |
120 |
|
|
121 |
< |
sprdfact = spread / (hotlvl * bright(exposure)) |
121 |
> |
sprdfact = spread / (hotlvl * (*ourbright)(exposure)) |
122 |
|
* ((double)xres*xres + (double)yres*yres) / 4.0; |
123 |
|
} |
124 |
|
|