From fa080de7afc95aa1c19a6e6fc0e0708ced2eadc4 Mon Sep 17 00:00:00 2001 From: Joseph Hunkeler Date: Wed, 8 Jul 2015 20:46:52 -0400 Subject: Initial commit --- sys/imio/tf/imgl1s.x | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 sys/imio/tf/imgl1s.x (limited to 'sys/imio/tf/imgl1s.x') diff --git a/sys/imio/tf/imgl1s.x b/sys/imio/tf/imgl1s.x new file mode 100644 index 00000000..bd226f31 --- /dev/null +++ b/sys/imio/tf/imgl1s.x @@ -0,0 +1,35 @@ +# Copyright(c) 1986 Association of Universities for Research in Astronomy Inc. + +include +include + +# IMGL1? -- Get a line from an apparently one dimensional image. If there +# is only one input buffer, no image section, we are not referencing out of +# bounds, and no datatype conversion needs to be performed, directly access +# the pixels to reduce the overhead per line. + +pointer procedure imgl1s (im) + +pointer im +int fd, nchars +long offset +pointer bp, imggss(), freadp() +errchk imopsf + +begin + repeat { + if (IM_FAST(im) == YES && IM_PIXTYPE(im) == TY_SHORT) { + fd = IM_PFD(im) + if (fd == NULL) { + call imopsf (im) + next + } + + offset = IM_PIXOFF(im) + nchars = IM_PHYSLEN(im,1) * SZ_SHORT + ifnoerr (bp = (freadp (fd, offset, nchars) - 1) / SZ_SHORT + 1) + return (bp) + } + return (imggss (im, long(1), IM_LEN(im,1), 1)) + } +end -- cgit