1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
|
# Copyright(c) 1986 Association of Universities for Research in Astronomy Inc.
# IMSAMP -- Subsample a vector.
procedure imsamp (a, b, npix, sz_pixel, step)
char a[ARB], b[ARB]
int npix, sz_pixel, step, i, j, in, out, delta_in
begin
switch (sz_pixel) {
case SZ_SHORT:
call imsmps (a, b, npix, step)
case SZ_LONG:
call imsmpl (a, b, npix, step)
default: # flip odd sized elements
in = 0
out = 0
delta_in = sz_pixel * step
do j = 1, npix {
do i = 1, sz_pixel
b[out+i] = a[in+i]
in = in + delta_in
out = out + sz_pixel
}
}
end
# IMSMPS -- Sample an array of SHORT sized elements.
procedure imsmps (a, b, npix, step)
short a[ARB], b[npix]
int npix, step, ip, op
begin
ip = 1
do op = 1, npix {
b[op] = a[ip]
ip = ip + step
}
end
# IMSMPL -- Sample an array of LONG sized elements.
procedure imsmpl (a, b, npix, step)
long a[ARB], b[npix]
int npix, step, ip, op
begin
ip = 1
do op = 1, npix {
b[op] = a[ip]
ip = ip + step
}
end
|