| 1 |
< |
/* Copyright (c) 1986 Regents of the University of California */ |
| 1 |
> |
/* Copyright (c) 1992 Regents of the University of California */ |
| 2 |
|
|
| 3 |
|
#ifndef lint |
| 4 |
|
static char SCCSid[] = "$SunId$ LBL"; |
| 16 |
|
|
| 17 |
|
#include "color.h" |
| 18 |
|
|
| 19 |
< |
#define PI 3.14159265359 |
| 19 |
> |
#define PI 3.14159265359 |
| 20 |
|
|
| 21 |
< |
#define FTINY (1e-6) |
| 21 |
> |
#define FTINY (1e-6) |
| 22 |
|
|
| 23 |
|
extern int nrows, ncols; /* number of rows and columns for output */ |
| 24 |
|
|
| 36 |
|
|
| 37 |
|
extern COLOR exposure; /* exposure for frame */ |
| 38 |
|
|
| 39 |
< |
#define AVGLVL 0.5 /* target mean brightness */ |
| 39 |
> |
#define AVGLVL 0.5 /* target mean brightness */ |
| 40 |
|
|
| 41 |
< |
double avgbrt; /* average picture brightness */ |
| 41 |
> |
double avgbrt; /* average picture brightness */ |
| 42 |
|
|
| 43 |
< |
typedef struct hotpix { /* structure for avgbrt pixels */ |
| 43 |
> |
typedef struct hotpix { /* structure for avgbrt pixels */ |
| 44 |
|
struct hotpix *next; /* next in list */ |
| 45 |
|
COLOR val; /* pixel color */ |
| 46 |
|
short x, y; /* pixel position */ |
| 47 |
|
float slope; /* random slope for diffraction */ |
| 48 |
|
} HOTPIX; |
| 49 |
|
|
| 50 |
< |
HOTPIX *head; /* head of avgbrt pixel list */ |
| 50 |
> |
HOTPIX *head; /* head of avgbrt pixel list */ |
| 51 |
|
|
| 52 |
< |
double sprdfact; /* computed spread factor */ |
| 52 |
> |
double sprdfact; /* computed spread factor */ |
| 53 |
|
|
| 54 |
|
|
| 55 |
|
pass1init() /* prepare for first pass */ |
| 67 |
|
|
| 68 |
|
|
| 69 |
|
pass1scan(scan, y) /* process first pass scanline */ |
| 70 |
< |
register COLOR *scan; |
| 70 |
> |
register COLOR *scan; |
| 71 |
|
int y; |
| 72 |
|
{ |
| 73 |
|
extern char *malloc(); |
| 74 |
|
extern double tan(), sqrt(); |
| 75 |
< |
double cbrt; |
| 75 |
> |
double cbrt; |
| 76 |
|
register int x; |
| 77 |
< |
register HOTPIX *hp; |
| 77 |
> |
register HOTPIX *hp; |
| 78 |
|
|
| 79 |
|
for (x = 0; x < xres; x++) { |
| 80 |
|
|
| 118 |
|
|
| 119 |
|
|
| 120 |
|
pass2scan(scan, y) /* process final pass scanline */ |
| 121 |
< |
register COLOR *scan; |
| 121 |
> |
register COLOR *scan; |
| 122 |
|
int y; |
| 123 |
|
{ |
| 124 |
|
int xmin, xmax; |
| 125 |
|
register int x; |
| 126 |
< |
register HOTPIX *hp; |
| 126 |
> |
register HOTPIX *hp; |
| 127 |
|
|
| 128 |
|
for (hp = head; hp != NULL; hp = hp->next) { |
| 129 |
|
if (hp->slope > FTINY) { |
| 154 |
|
starpoint(fcol, x, y, hp) /* pixel is on the star's point */ |
| 155 |
|
COLOR fcol; |
| 156 |
|
int x, y; |
| 157 |
< |
register HOTPIX *hp; |
| 157 |
> |
register HOTPIX *hp; |
| 158 |
|
{ |
| 159 |
|
COLOR ctmp; |
| 160 |
< |
double d2; |
| 160 |
> |
double d2; |
| 161 |
|
|
| 162 |
|
d2 = (double)(x - hp->x)*(x - hp->x) + (double)(y - hp->y)*(y - hp->y); |
| 163 |
|
if (d2 > sprdfact) { |