mediaLib Library Functions mlibImageDataTypeConvert(3MLIB)
NAME
mlibImageDataTypeConvert - data type conversion
SYNOPSIS
cc [ flag... ] file... -lmlib [ library... ]
#include
mlibstatus mlibImageDataTypeConvert(mlibimage *dst, const mlibimage *src);
DESCRIPTION
The mlibImageDataTypeConvert() function converts between
data types MLIBIT, MLIBYTE, MLIBSHORT, MLIBUSHORT,
MLIBINT, MLIBFLOAT, and MLIBDOUBLE.
The input and output data images must have the same width,
height, and number of channels. Conversion to a smaller
pixel format clamps the source value to the dynamic range of
the destination pixel.
See the following table for available variations of the data
type conversion function.
Source Type Dest. Type Action
MLIBYTE MLIBIT (x > 0) ? 1 : 0
MLIBSHORT MLIBIT (x > 0) ? 1 : 0
MLIBUSHORT MLIBIT (x > 0) ? 1 : 0
MLIBINT MLIBIT (x > 0) ? 1 : 0
MLIBFLOAT MLIBIT (x > 0) ? 1 : 0
MLIBDOUBLE MLIBIT (x > 0) ? 1 : 0
MLIBIT MLIBYTE (x == 1) ? 1 : 0
MLIBSHORT MLIBYTE (mlibu8)clamp(x, 0, 255)
MLIBUSHORT MLIBYTE (mlibu8)clamp(x, 0, 255)
MLIBINT MLIBYTE (mlibu8)clamp(x, 0, 255)
MLIBFLOAT MLIBYTE (mlibu8)clamp(x, 0, 255)
MLIBDOUBLE MLIBYTE (mlibu8)clamp(x, 0, 255)
SunOS 5.11 Last change: 2 Mar 2007 1
mediaLib Library Functions mlibImageDataTypeConvert(3MLIB)
MLIBIT MLIBSHORT (x == 1) ? 1 : 0
MLIBYTE MLIBSHORT (mlibs16)x
MLIBUSHORT MLIBSHORT (mlibs16)clamp(x, -32768, 32767)
MLIBINT MLIBSHORT (mlibs16)clamp(x, -32768, 32767)
MLIBFLOAT MLIBSHORT (mlibs16)clamp(x, -32768, 32767)
MLIBDOUBLE MLIBSHORT (mlibs16)clamp(x, -32768, 32767)
MLIBIT MLIBUSHORT (x == 1) ? 1 : 0
MLIBYTE MLIBUSHORT (mlibu16)x
MLIBSHORT MLIBUSHORT (mlibu16)clamp(x, 0, 65535)
MLIBINT MLIBUSHORT (mlibu16)clamp(x, 0, 65535)
MLIBFLOAT MLIBUSHORT (mlibu16)clamp(x, 0, 65535)
MLIBDOUBLE MLIBUSHORT (mlibu16)clamp(x, 0, 65535)
MLIBIT MLIBINT (x == 1) ? 1 : 0
MLIBYTE MLIBINT (mlibs32)x
MLIBSHORT MLIBINT (mlibs32)x
MLIBUSHORT MLIBINT (mlibs32)x
MLIBFLOAT MLIBINT (mlibs32)clamp(x, -2147483647-1, 2147483647)
MLIBDOUBLE MLIBINT (mlibs32)clamp(x, -2147483647-1, 2147483647)
MLIBIT MLIBFLOAT (x == 1) ? 1.0 : 0.0
MLIBYTE MLIBFLOAT (mlibf32)x
MLIBSHORT MLIBFLOAT (mlibf32)x
MLIBUSHORT MLIBFLOAT (mlibf32)x
MLIBINT MLIBFLOAT (mlibf32)x
MLIBDOUBLE MLIBFLOAT (mlibf32)x
MLIBIT MLIBDOUBLE (x == 1) ? 1.0 : 0.0
MLIBYTE MLIBDOUBLE (mlibd64)x
SunOS 5.11 Last change: 2 Mar 2007 2
mediaLib Library Functions mlibImageDataTypeConvert(3MLIB)
MLIBSHORT MLIBDOUBLE (mlibd64)x
MLIBUSHORT MLIBDOUBLE (mlibd64)x
MLIBINT MLIBDOUBLE (mlibd64)x
MLIBFLOAT MLIBDOUBLE (mlibd64)x
The actions are defined in C-style pseudo-code. All type
casts follow the rules of standard C. clamp() can be defined
as a macro: #define clamp(x, low, high) (((x) < (low)) ?
(low) : (((x) > (high)) ? (high) : (x)))
PARAMETERS
The function takes the following arguments:
dst Pointer to destination image.
src Pointer to source image.
RETURN VALUES
The function returns MLIBSUCES if successful. Otherwise
it returns MLIBFAILURE.
ATRIBUTES
See attributes(5) for descriptions of the following attri-
butes:
ATRIBUTE TYPE ATRIBUTE VALUE
Interface Stability Committed
MT-Level MT-Safe
SEE ALSO
mlibImageReformat(3MLIB), attributes(5)
SunOS 5.11 Last change: 2 Mar 2007 3
|