aboutsummaryrefslogtreecommitdiff
path: root/sys/osb/iscl32.c
blob: 75e5108207faa468ee0b51a0b76799e7972e518f (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
/* Copyright(c) 1986 Association of Universities for Research in Astronomy Inc.
 */

#define	import_spp
#define import_knames
#include <stdlib.h>
#include <iraf.h>


/* ISCL32 - Scale a pixel array stored as SPP chars to the desired type.
 */
ISCL32 (a, b, npix, bscale, bzero)
XCHAR	*a;			/* input array			*/
XCHAR	*b;			/* output array			*/
XINT	*npix;			/* number of bytes to swap	*/
XDOUBLE *bscale, *bzero;	/* scaling factors		*/
{
    int   i, pix;
    int   *ip = (int *) a;
    float *rp = (float *) calloc (*npix, sizeof (float));
    float *tmp;

    tmp = rp;
    for (i=0; i < *npix; i++) {
	pix = *ip;
	*tmp = (float) (pix * (*bscale) + (*bzero));
	tmp++, ip++;
    }

    memmove (b, rp, (*npix * sizeof (float)));
}