1mlib_ImageConstDivShift(3MLmIeBd)iaLib Library Functimolnisb_ImageConstDivShift(3MLIB)
2
3
4
6 mlib_ImageConstDivShift - division into a constant, with shifting
7
9 cc [ flag... ] file... -lmlib [ library... ]
10 #include <mlib.h>
11
12 mlib_status mlib_ImageConstDivShift(mlib_image *dst, const mlib_image *src,
13 const mlib_s32 *c, mlib_s32 shift);
14
15
17 The mlib_ImageConstDivShift() function divides each pixel in an image
18 into a constant value on a pixel-by-pixel basis. It scales the result
19 by a left shift and writes the result to the destination image on a
20 pixel-by-pixel basis.
21
22
23 It uses the following equation:
24
25 dst[x][y][i] = c[i] / src[x][y][i] * 2**shift
26
27
28
29 In the case of src[x][y][i] = 0,
30
31 dst[x][y][i] = 0 if c[i] = 0
32 dst[x][y][i] = DATA_TYPE_MAX if c[i] > 0
33 dst[x][y][i] = DATA_TYPE_MIN if c[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 into 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_ImageConstDiv(3MLIB), mlib_ImageConstDiv_Fp(3MLIB), mlib_ImageCon‐
77 stDiv_Fp_Inp(3MLIB), mlib_ImageConstDiv_Inp(3MLIB), mlib_ImageConstDi‐
78 vShift_Inp(3MLIB), attributes(5)
79
80
81
82SunOS 5.11 2 Mar 2007 mlib_ImageConstDivShift(3MLIB)