aboutsummaryrefslogtreecommitdiff
path: root/sys/osb/iscl64.c
blob: 6a8b624cd615c9f8fe66543c05eff5b25a98d0b5 (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>


/* ISCL64 - Scale a pixel array stored as SPP chars to the desired type.
 */
ISCL64 (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;
    double *dp = (double *) calloc (*npix, sizeof (double));
    double *tmp;

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

    memmove (b, dp, (*npix * sizeof (double)));
}