Pixel Manipulation Routines

In order for application programs to process and manipulate pixels in a standard fashion, pixel manipulation routines were written. These routines were written to handle four data types and to run quickly in the general case but also to be able to handle the specific (and typically more computational) case. One subroutine performs an operation for all data types. Minimum error checking is done by a pixel manipulation routine. In most cases, a status is returned to the caller reflecting any errors caught by the routine while attempting to perform the operation. This allows a compromise for conflicting requirements. Some applications have certain actions they want taken in case of an error (such as in an arithmetic operation setting all outofrange pixels to a particular value) while other applications want to be told about errors so that they can stop processing. A success or failure status code gives the flexibility to handle both of these requirements with the same routine.

A pixel manipulation routine handles the different data types by passing the data type as an input parameter. The data type is then used by the pixel manipulation routine to call a specific version of the routine for the passed data type. Although this is a little more overhead, it greatly reduces the number of subroutines of which a programmer must keep track. It also keeps the versions for different data types of the routine in the same file, making it easier to update all versions at the same time.

The pixel manipulation routines adhere to the following coding standards for the purpose of optimization. First, all routines have been coded in C (to allow the programmer more flexibility with pointers and registers). Second, all variables that need to be accessed for each pixel are defined to be of type register. Third, the variable for the number of samples that is sent to the main pixel manipulation routine by address is sent to the specific version of the routine for the passed data type by value. Another optimizing guideline is to split the code for the general and the specific case. Things to look for here are multiplication or division by one or addition or subtraction of zero. Lastly, as many parameters as possible should be received by address, and the code should make use of efficient pointer arithmetic instead of array indexing.

A program can access these routines by linking in the following object library:

     $LASLIB/world.a 

This is a list of available Pixel Manipulation Routines:

pxadd.html
pxbtan.html
pxbtor.html
pxbxor.html
pxcomp.html
pxconv.html
pxcopy.html
pxdiv.html
pxe10.html
pxe255.html
pxe32k.html
pxfill.html
pxhiss.html
pxhist.html
pxindr.html
pxinx.html
pxinxd.html
pxinxr.html
pxl10.html
pxl255.html
pxland.html
pxline.html
pxlkup.html
pxlor.html
pxlxor.html
pxmax.html
pxmin.html
pxmnmx.html
pxmul.html
pxsamp.html
pxsub.html
pxswap.html
pxsys.html