1mlib_ImageLookUpMask(3MLIB)mediaLib Library Functionsmlib_ImageLookUpMask(3MLIB)
2
3
4
6 mlib_ImageLookUpMask - table lookup with mask
7
9 cc [ flag... ] file... -lmlib [ library... ]
10 #include <mlib.h>
11
12 mlib_status mlib_ImageLookUpMask(mlib_image *dst, const mlib_image *src,
13 const void **table, mlib_s32 channels, mlib_s32 cmask);
14
15
17 The mlib_ImageLookUpMask() function maps the source image to the desti‐
18 nation image by using the user-specified lookup table and applying a
19 channel mask.
20
21
22 The source and destination images must have the same width and height.
23 The source image can be a single channel image or can have the same
24 number of channels as the destination image. One of the following equa‐
25 tions is used accordingly:
26
27 dst[x][y][i] = table[i][src[x][y][0]]
28 dst[x][y][i] = table[i][src[x][y][i]]
29
30
31
32 The source and destination images can have different data types. See
33 the following table for available variations of the table lookup func‐
34 tion on image types:
35
36
37
38
39 Type [*] BYTE SHORT USHORT INT FLOAT DOUBLE
40 ────────────────────────────────────────────────────────────────────────────────────────
41 MLIB_BIT Y
42 MLIB_BYTE Y Y Y Y Y Y
43 ────────────────────────────────────────────────────────────────────────────────────────
44 MLIB_SHORT Y Y Y Y Y Y
45 ────────────────────────────────────────────────────────────────────────────────────────
46 MLIB_USHORT Y Y Y Y Y Y
47 ────────────────────────────────────────────────────────────────────────────────────────
48 MLIB_INT Y Y Y Y Y Y
49
50
51
52 [*] Each row represents a source data type. Each column represents a
53 destination data type.
54
56 The function takes the following arguments:
57
58 dst Pointer to destination image.
59
60
61 src Pointer to source image.
62
63
64 table Pointer to lookup table. The data type of the lookup table
65 is the same as the destination image. The number of entries
66 in the lookup table is determined by the type of the input
67 image. The format of the lookup table is:
68
69 table[channel][index]
70
71 The MLIB_BIT type entries are indexed from 0 to 1. The
72 MLIB_BYTE type entries are indexed from 0 to 255. The
73 MLIB_SHORT type entries are indexed from -32768 to -1, then
74 from 0 to 32767. The MLIB_USHORT type entries are indexed
75 from 0 to 65535. The MLIB_INT type entries are indexed from
76 -2147483648 to -1, and then from 0 to 2147483647.
77
78
79 channels Number of channels in the lookup table. If the number of
80 channels is equal to 1, then the same table is applied to
81 all channels. Otherwise, the number of channels must be no
82 less than the number of valid 1s in the channel mask.
83
84
85 cmask Channel mask. Each bit of the mask represents a channel of
86 an image or a lookup table. Only the rightmost four bits of
87 cmask are considered, where the least significant bit of
88 cmask is for the last channel. The channels corresponding
89 to 0 bits of cmask are not processed or used. cmask is
90 always applied to the destination image dst. If the source
91 image src has the same number of channels as dst, then
92 cmask is also applied to src. Otherwise, each channel of
93 src is used for each cmask bit with a value of 1, in this
94 order: the first channel for the first 1 from the left in
95 cmask. If src has only one channel, then the same src chan‐
96 nel is used for every cmask bit with a value of 1. If the
97 lookup table has the same number of channels as dst, then
98 cmask is also applied to table. Otherwise, each table chan‐
99 nel is used for each cmask bit with a value of 1, in this
100 order: the first channel for the first 1 from the left in
101 cmask. If table has only one channel, then the same table
102 channel is used for every cmask bit with a value of 1.
103
104
106 The function returns MLIB_SUCCESS if successful. Otherwise it returns
107 MLIB_FAILURE.
108
110 See attributes(5) for descriptions of the following attributes:
111
112
113
114
115 ┌─────────────────────────────┬─────────────────────────────┐
116 │ ATTRIBUTE TYPE │ ATTRIBUTE VALUE │
117 ├─────────────────────────────┼─────────────────────────────┤
118 │Interface Stability │Committed │
119 ├─────────────────────────────┼─────────────────────────────┤
120 │MT-Level │MT-Safe │
121 └─────────────────────────────┴─────────────────────────────┘
122
124 mlib_ImageLookUp(3MLIB), mlib_ImageLookUp_Inp(3MLIB),
125 mlib_ImageLookUp2(3MLIB), attributes(5)
126
127
128
129SunOS 5.11 2 Mar 2007 mlib_ImageLookUpMask(3MLIB)