1mlib_ImageDivConstShift(3MLmIeBd)iaLib Library Functimolnisb_ImageDivConstShift(3MLIB)
2
3
4
6 mlib_ImageDivConstShift - division by a constant, with shifting
7
9 cc [ flag... ] file... -lmlib [ library... ]
10 #include <mlib.h>
11
12 mlib_status mlib_ImageDivConstShift(mlib_image *dst, const mlib_image *src,
13 const mlib_s32 *c, mlib_s32 shift);
14
15
17 The mlib_ImageDivConstShift() function divides each pixel in an image
18 by a constant value on a pixel-by-pixel basis. It scales the result by
19 a left shift and writes the result to the destination image on a pixel-
20 by-pixel basis.
21
22
23 It uses the following equation:
24
25 dst[x][y][i] = src[x][y][i] / c[i] * 2**shift
26
27
28
29 In the case of c[i] = 0,
30
31 dst[x][y][i] = 0 if src[x][y][i] = 0
32 dst[x][y][i] = DATA_TYPE_MAX if src[x][y][i] > 0
33 dst[x][y][i] = DATA_TYPE_MIN if src[x][y][i] < 0
34
35
36
37 where DATA_TYPE is MLIB_U8, MLIB_S16, MLIB_U16, or MLIB_S32 for an
38 image of type MLIB_BYTE, MLIB_SHORT, MLIB_USHORT, or MLIB_INT, respec‐
39 tively.
40
42 The function takes the following arguments:
43
44 dst Pointer to destination image.
45
46
47 src Pointer to source image.
48
49
50 c Constant by which each pixel is divided. c[i] contains the
51 constant for channel i.
52
53
54 shift Left shifting factor. 0 ≤ shift ≤ 31.
55
56
58 The function returns MLIB_SUCCESS if successful. Otherwise it returns
59 MLIB_FAILURE.
60
62 See attributes(5) for descriptions of the following attributes:
63
64
65
66
67 ┌─────────────────────────────┬─────────────────────────────┐
68 │ ATTRIBUTE TYPE │ ATTRIBUTE VALUE │
69 ├─────────────────────────────┼─────────────────────────────┤
70 │Interface Stability │Committed │
71 ├─────────────────────────────┼─────────────────────────────┤
72 │MT-Level │MT-Safe │
73 └─────────────────────────────┴─────────────────────────────┘
74
76 mlib_ImageDivConstShift_Inp(3MLIB), attributes(5)
77
78
79
80SunOS 5.11 2 Mar 2007 mlib_ImageDivConstShift(3MLIB)