c_pixscale - Unscale and rescale a buffer of pixels

SYNTAX

FUNCTION c_pixscale(idtype, odtype, in, out, ns, iscale, ioffset, oscale, ooffset, rndopt)

    long *idtype;
    long *odtype;
    unsigned char *in;
    unsigned char *out;
    long *ns;
    float iscale;
    float ioffset;
    float oscale;
    float ooffset;
    long *rndopt;

PARAMETERS

idtype (long *, input)

Data type of the input buffer.

   EBYTE   (1) :	unsigned byte data
   EWORD   (2) :	signed two byte data
   ELONG   (3) : 	signed four byte data
   EREAL   (4) : 	four byte floating point data
   EDOUBLE (5) :	eight byte floating point data
   EUWORD  (7) :	unsigned two byte data
   EULONG  (8) :	unsigned four byte data

odtype (long *, input)

Data type of the output buffer.

   EBYTE   (1) :	unsigned byte data
   EWORD   (2) :	signed two byte data
   ELONG   (3) : 	signed four byte data
   EREAL   (4) : 	four byte floating point data
   EDOUBLE (5) :	eight byte floating point data
   EUWORD  (7) :	unsigned two byte data
   EULONG  (8) :	unsigned four byte data

in (unsigned char *, input)

Input buffer of pixel values to be rescaled.

out (unsigned char *, output)

Output buffer of rescaled pixel values.

ns (long *, input)

Number of samples in the input and output buffers.

iscale (float *, input)

Scaling factor used in the input buffer.

ioffset (float *, input)

Offset used in the input buffer.

oscale (float *, input)

Scaling factor to be applied to the output pixels.

ooffset (float *, input)

Offset to be applied to the output pixels.

rndopt (long *, input)

Rounding option. Rounding may be applied to output pixels in integer data types (EBYTE, EWORD, ELONG, EUWORD, and EULONG).

   = TRUE  (1) :	Round ouput pixels
   = FALSE (0) :	Do not round ouput pixels

DESCRIPTION

The c_pixscale() routine is used to unscale a buffer of pixels given an input scaling factor and offset and rescale the buffer using an output scaling factor and offset. The data type may be converted during the rescaling operation.

The pixel values in the input buffer are first unscaled using the formula:

                    pixel = (*in - ioffset) * iscale
and they are rescaled and stored in the output buffer using this formula:
                    *out = (pixel / oscale) + ooffset
If during scaling a value is generated that is too big or too small for the output data type, the return status will be set to TOOBIG and TOOSMALL, respectively. If the scaling generates some output pixels that are too big and some that are too small, the return status will be set to (TOOBIG | TOOSMALL).

RETURN VALUE

c_pixscale() returns

   E_SUCC             (0) --> Successful scaling within data type limits.
   TOOBIG            (77) --> Successful scaling; rescaling operation generated
			      a value too large for the output data type.
   TOOSMALL          (88) --> Successful scaling; rescaling operation generated
			      a value too small for the output data type.
   TOOBIG | TOOSMALL (93) --> Successful scaling; rescaling operation generated
                              value too big and too small for the output data 
			      type.