aboutsummaryrefslogtreecommitdiff
path: root/pkg/images/tv/iis/iism70/iislut.x
blob: 0781924746fa2f8dc5de595e365f025ac9cb676c (plain) (blame)
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
62
63
64
65
66
67
# Copyright(c) 1986 Association of Universities for Research in Astronomy Inc.

include <mach.h>
include "iis.h"
include "../lib/ids.h"

define	LUT_LMAX	255

# IISLUT -- Read and Write look up table.
# NOTE the ASYMMETRY ... written data is derived from end
# points, but read data is the full array (see zsnapinit,
# for instance, for read usage.)

procedure iislut (rw, frame, color, offset, n, data)

short	rw			# read or write
short	frame[ARB]		# frame array
short	color[ARB]		# color array
short	offset			# offset into lut
short	n			# number of data values
short	data[ARB]		# the data

int	command,len,x,y,z,t
short	iispack()
int	mapcolor()
pointer	sp, ldata

include "iis.com"

begin
	z = mapcolor (color)
	t = iispack(frame)
	if (t == GRCHAN) {
	    return
	}

	if ( rw == IDS_WRITE) {
	    if ( n < 4)
	        return
	    command = IWRITE+VRETRACE

	    # data space for manipulating lut information

	    call smark (sp)
	    call salloc (ldata, LEN_LUT, TY_SHORT)
	    call aclrs (Mems[ldata], LEN_LUT)

	    # We could have negative lut values, but don't bother for now
	    call idslfill (data, int(n), Mems[ldata], LEN_LUT, 0, LUT_LMAX)

	    len = LEN_LUT
	} else {
	    len = n
	    command = IREAD+VRETRACE
	}

	x = ADVXONTC
	y = 0

	call iishdr (command, len, LUT, x, y, z, t)

	if ( rw == IDS_WRITE) {
	    call iisio (Mems[ldata], len * SZB_CHAR)
	    call sfree (sp)
	} else
	    call iisio (data, len * SZB_CHAR)
end