mlib_ImageLookUpMask(3MLIBmediaLib Library Functionmlib_ImageLookUpMask(3MLIB)NAMEmlib_ImageLookUpMask - table lookup with mask
SYNOPSIS
cc [ flag... ] file... -lmlib [ library... ]
#include <mlib.h>
mlib_status mlib_ImageLookUpMask(mlib_image *dst, const mlib_image *src,
const void **table, mlib_s32 channels, mlib_s32 cmask);
DESCRIPTION
The mlib_ImageLookUpMask() function maps the source image to the desti‐
nation image by using the user-specified lookup table and applying a
channel mask.
The source and destination images must have the same width and height.
The source image can be a single channel image or can have the same
number of channels as the destination image. One of the following equa‐
tions is used accordingly:
dst[x][y][i] = table[i][src[x][y][0]]
dst[x][y][i] = table[i][src[x][y][i]]
The source and destination images can have different data types. See
the following table for available variations of the table lookup func‐
tion on image types:
Type [*] BYTE SHORT USHORT INT FLOAT DOUBLE
────────────────────────────────────────────────────────────────────────────────────────
MLIB_BIT Y
MLIB_BYTE Y Y Y Y Y Y
────────────────────────────────────────────────────────────────────────────────────────
MLIB_SHORT Y Y Y Y Y Y
────────────────────────────────────────────────────────────────────────────────────────
MLIB_USHORT Y Y Y Y Y Y
────────────────────────────────────────────────────────────────────────────────────────
MLIB_INT Y Y Y Y Y Y
[*] Each row represents a source data type. Each column represents a
destination data type.
PARAMETERS
The function takes the following arguments:
dst Pointer to destination image.
src Pointer to source image.
table Pointer to lookup table. The data type of the lookup table
is the same as the destination image. The number of entries
in the lookup table is determined by the type of the input
image. The format of the lookup table is:
table[channel][index]
The MLIB_BIT type entries are indexed from 0 to 1. The
MLIB_BYTE type entries are indexed from 0 to 255. The
MLIB_SHORT type entries are indexed from -32768 to -1, then
from 0 to 32767. The MLIB_USHORT type entries are indexed
from 0 to 65535. The MLIB_INT type entries are indexed from
-2147483648 to -1, and then from 0 to 2147483647.
channels Number of channels in the lookup table. If the number of
channels is equal to 1, then the same table is applied to
all channels. Otherwise, the number of channels must be no
less than the number of valid 1s in the channel mask.
cmask Channel mask. Each bit of the mask represents a channel of
an image or a lookup table. Only the rightmost four bits of
cmask are considered, where the least significant bit of
cmask is for the last channel. The channels corresponding
to 0 bits of cmask are not processed or used. cmask is
always applied to the destination image dst. If the source
image src has the same number of channels as dst, then
cmask is also applied to src. Otherwise, each channel of
src is used for each cmask bit with a value of 1, in this
order: the first channel for the first 1 from the left in
cmask. If src has only one channel, then the same src chan‐
nel is used for every cmask bit with a value of 1. If the
lookup table has the same number of channels as dst, then
cmask is also applied to table. Otherwise, each table chan‐
nel is used for each cmask bit with a value of 1, in this
order: the first channel for the first 1 from the left in
cmask. If table has only one channel, then the same table
channel is used for every cmask bit with a value of 1.
RETURN VALUES
The function returns MLIB_SUCCESS if successful. Otherwise it returns
MLIB_FAILURE.
ATTRIBUTES
See attributes(5) for descriptions of the following attributes:
┌─────────────────────────────┬─────────────────────────────┐
│ ATTRIBUTE TYPE │ ATTRIBUTE VALUE │
├─────────────────────────────┼─────────────────────────────┤
│Interface Stability │Committed │
├─────────────────────────────┼─────────────────────────────┤
│MT-Level │MT-Safe │
└─────────────────────────────┴─────────────────────────────┘
SEE ALSOmlib_ImageLookUp(3MLIB), mlib_ImageLookUp_Inp(3MLIB),
mlib_ImageLookUp2(3MLIB), attributes(5)SunOS 5.11 2 Mar 2007 mlib_ImageLookUpMask(3MLIB)