1mlib_ImageLookUp(3MLIB)   mediaLib Library Functions   mlib_ImageLookUp(3MLIB)
2
3
4

NAME

6       mlib_ImageLookUp - table lookup
7

SYNOPSIS

9       cc [ flag... ] file... -lmlib [ library... ]
10       #include <mlib.h>
11
12       mlib_status mlib_ImageLookUp(mlib_image *dst, const mlib_image *src,
13            const void **table);
14
15

DESCRIPTION

17       The  mlib_ImageLookUp()  function maps the source image to the destina‐
18       tion image by using the user-specified lookup table.
19
20
21       The source and destination images must have the same width and  height.
22       The  source  image  can  be a single channel image or can have the same
23       number of channels as the destination image. One of the following equa‐
24       tions is used accordingly:
25
26         dst[x][y][i] = table[i][src[x][y][0]]
27         dst[x][y][i] = table[i][src[x][y][i]]
28
29
30
31       The  source  and  destination images can have different data types. See
32       the following table for available variations of the table lookup  func‐
33       tion on image types:
34
35
36
37
38          Type [*]      BYTE   SHORT       USHORT            INT        FLOAT       DOUBLE
39       ────────────────────────────────────────────────────────────────────────────────────────
40       MLIB_BIT         Y
41       MLIB_BYTE        Y      Y       Y                Y               Y       Y
42       ────────────────────────────────────────────────────────────────────────────────────────
43       MLIB_SHORT       Y      Y       Y                Y               Y       Y
44       ────────────────────────────────────────────────────────────────────────────────────────
45       MLIB_USHORT      Y      Y       Y                Y               Y       Y
46       ────────────────────────────────────────────────────────────────────────────────────────
47       MLIB_INT         Y      Y       Y                Y               Y       Y
48
49
50
51       [*]  Each  row  represents a source data type. Each column represents a
52       destination data type.
53

PARAMETERS

55       The function takes the following arguments:
56
57       dst      Pointer to destination image.
58
59
60       src      Pointer to source image.
61
62
63       table    Pointer to lookup table. The data type of the lookup table  is
64                the  same  as  the destination image. The number of entries in
65                the lookup table is determined by the type of the input image.
66                The format of the lookup table is:
67
68                table[channel][index]
69
70                The  MLIB_BIT  type  entries  are  indexed  from  0  to 1. The
71                MLIB_BYTE  type  entries  are  indexed  from  0  to  255.  The
72                MLIB_SHORT  type  entries  are indexed from -32768 to -1, then
73                from 0 to 32767. The MLIB_USHORT type entries are indexed from
74                0  to  65535.  The  MLIB_INT  type  entries  are  indexed from
75                -2147483648 to -1, and then from 0 to 2147483647.
76
77                If a table covering the full range of input data type  is  not
78                available or not realistic, which is mostly true for doing ta‐
79                ble lookup with an MLIB_INT input image, a smaller  table  can
80                be  used.   In  this  case, the pointer to the table has to be
81                adjusted as if it is pointing to the element for the  smallest
82                value  of  the  input  data type.  For example, to use a table
83                covering input data range  of  [-65536,  65535],  the  pointer
84                needs to be adjusted as follows:
85
86                table_16_32[0] += MLIB_S32_MIN + 65536;
87
88                This might cause a pointer arithmetic overflow in 32-bit mode,
89                but probably works if the  overflow  is  handled  as  a  wrap-
90                around.   If  possible, function mlib_ImageLookUp2() should be
91                used instead.
92
93

RETURN VALUES

95       The function returns MLIB_SUCCESS if successful. Otherwise  it  returns
96       MLIB_FAILURE.
97

ATTRIBUTES

99       See attributes(5) for descriptions of the following attributes:
100
101
102
103
104       ┌─────────────────────────────┬─────────────────────────────┐
105       │      ATTRIBUTE TYPE         │      ATTRIBUTE VALUE        │
106       ├─────────────────────────────┼─────────────────────────────┤
107       │Interface Stability          │Committed                    │
108       ├─────────────────────────────┼─────────────────────────────┤
109       │MT-Level                     │MT-Safe                      │
110       └─────────────────────────────┴─────────────────────────────┘
111

SEE ALSO

113       mlib_ImageLookUp_Inp(3MLIB),                  mlib_ImageLookUp2(3MLIB),
114       mlib_ImageLookUpMask(3MLIB), attributes(5)
115
116
117
118SunOS 5.11                        12 Sep 2007          mlib_ImageLookUp(3MLIB)
Impressum