1mlib_ImageDivShift(3MLIB) mediaLib Library Functions mlib_ImageDivShift(3MLIB)
2
3
4
6 mlib_ImageDivShift - division with shifting
7
9 cc [ flag... ] file... -lmlib [ library... ]
10 #include <mlib.h>
11
12 mlib_status mlib_ImageDivShift(mlib_image *dst, const mlib_image *src1,
13 const mlib_image *src2, mlib_s32 shift);
14
15
17 The mlib_ImageDivShift() function divides the second source image into
18 the first source image 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] = src1[x][y][i] / src2[x][y][i] * 2**shift
26
27
28
29 In the case of src2[x][y][i] = 0,
30
31 dst[x][y][i] = 0 if src1[x][y][i] = 0
32 dst[x][y][i] = DATA_TYPE_MAX if src1[x][y][i] > 0
33 dst[x][y][i] = DATA_TYPE_MIN if src1[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 src1 Pointer to first source image.
48
49
50 src2 Pointer to second source image.
51
52
53 shift Left shifting factor. 0 ≤ shift ≤ 31.
54
55
57 The function returns MLIB_SUCCESS if successful. Otherwise it returns
58 MLIB_FAILURE.
59
61 See attributes(5) for descriptions of the following attributes:
62
63
64
65
66 ┌─────────────────────────────┬─────────────────────────────┐
67 │ ATTRIBUTE TYPE │ ATTRIBUTE VALUE │
68 ├─────────────────────────────┼─────────────────────────────┤
69 │Interface Stability │Committed │
70 ├─────────────────────────────┼─────────────────────────────┤
71 │MT-Level │MT-Safe │
72 └─────────────────────────────┴─────────────────────────────┘
73
75 mlib_ImageDivShift1_Inp(3MLIB), mlib_ImageDivShift2_Inp(3MLIB),
76 attributes(5)
77
78
79
80SunOS 5.11 2 Mar 2007 mlib_ImageDivShift(3MLIB)