Previous: Translation Routines Up: Translation Routines Next: x/ zvtrans_in
call xvtrans(buf, source, dest, npix) zvtrans(buf, source, dest, npix);
Translate pixels from one format to another. One of the translation setup routines must have been called first to set up the translation buffer. This routine is the only standard way to translate data in the VICAR system, both between host representations (e.g. VAX to IEEE) and between data types (e.g. integer to real). Any other routines to do translations should be merely syntactic sugar for this routine.
This routine is coded to be very efficient, so it may be called inside a tight loop with very little performance penalty.
BUF is the translation buffer that describes the translation to be performed. It is initialized by one of the translation setup routines. The internals of this buffer are unknown to the application program, with one exception, described below. Any other access to the internals of the buffer may cause your program to break in the future, as the structure may change without notice.
If the first integer in the translation buffer is NULL (0), then x/ zvtrans merely moves the data from the source to the destination, without any conversion. This can happen often when reading a file, where you don't know ahead of time what host representation the input data is in. If it turns out to be the native representation, no translation is necessary, and the first integer of the buffer will be 0. This fact can sometimes be used to avoid copying the data, making the program more efficient.
SOURCE is the source data buffer.
DEST is the destination data buffer. Note that it may not be the same as SOURCE, i.e. you can't translate in place or with overlapping buffers.
NPIX is the number of pixels to translate. Both SOURCE and DEST must be large enough to hold this many pixels; no checking is done. Note that this is the number of pixels, not the number of bytes, to translate.