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/vops/lz/amapi.x | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 sys/vops/lz/amapi.x (limited to 'sys/vops/lz/amapi.x') diff --git a/sys/vops/lz/amapi.x b/sys/vops/lz/amapi.x new file mode 100644 index 00000000..d559a130 --- /dev/null +++ b/sys/vops/lz/amapi.x @@ -0,0 +1,30 @@ +# Copyright(c) 1986 Association of Universities for Research in Astronomy Inc. + +# AMAP -- Vector linear transformation. Map the range of pixel values +# a1,a2 from a into the range b1,b2 in b. It is assumed that a1 < a2 +# and b1 < b2. + +procedure amapi (a, b, npix, a1, a2, b1, b2) + +int a[ARB], b[ARB] +int a1, a2, b1, b2 + +long minout, maxout, aoff, boff, pixval + +real scalar + +int npix, i + +begin + scalar = (real (b2) - real (b1)) / (real (a2) - real (a1)) + + minout = min (b1, b2) + maxout = max (b1, b2) + aoff = a1 + boff = b1 + + do i = 1, npix { + pixval = (a[i] - aoff) * scalar + b[i] = max(minout, min(maxout, pixval + boff)) + } +end -- cgit