1mlib_ImageScale(3MLIB) mediaLib Library Functions mlib_ImageScale(3MLIB)
2
3
4
6 mlib_ImageScale - linear scaling
7
9 cc [ flag... ] file... -lmlib [ library... ]
10 #include <mlib.h>
11
12 mlib_status mlib_ImageScale(mlib_image *dst,
13 const mlib_image *src, const mlib_s32 *alpha, const mlib_s32 *beta,
14 mlib_s32 shift);
15
16
18 The mlib_ImageScale() function performs a linear scaling on the pixels
19 of the source image by multiplying the data by a scale factor, shift‐
20 ing, and then adding an offset.
21
22
23 The following equation is used:
24
25 dst[x][y][i] = src[x][y][i] * alpha[i] * 2**(-shift) +
26 beta[i]
27
28
29
30 If the result of the operation underflows/overflows the minimum/maximum
31 value supported by the destination image, then it will be clamped to
32 the minimum/maximum value respectively.
33
34
35 See the following table for available variations of this linear scaling
36 function.
37
38
39
40
41 Type [*] BYTE SHORT USHORT INT FLOAT DOUBLE
42 ────────────────────────────────────────────────────────────────────────────────────────
43 MLIB_BYTE Y Y Y Y Y Y
44 ────────────────────────────────────────────────────────────────────────────────────────
45 MLIB_SHORT Y Y Y Y Y Y
46 ────────────────────────────────────────────────────────────────────────────────────────
47 MLIB_USHORT Y Y Y Y Y Y
48 ────────────────────────────────────────────────────────────────────────────────────────
49 MLIB_INT Y Y Y Y Y Y
50
51
52
53 [*] Each row represents a source data type. Each column represents a
54 destination data type.
55
57 The function takes the following arguments:
58
59 dst Pointer to destination image.
60
61
62 src Pointer to source image.
63
64
65 alpha Scaling factor. alpha[i] contains the scaling factor for chan‐
66 nel i.
67
68
69 beta Offset value. beta[i] contains the offset for channel i.
70
71
72 shift Right shifting factor.
73
74
76 The function returns MLIB_SUCCESS if successful. Otherwise it returns
77 MLIB_FAILURE.
78
80 See attributes(5) for descriptions of the following attributes:
81
82
83
84
85 ┌─────────────────────────────┬─────────────────────────────┐
86 │ ATTRIBUTE TYPE │ ATTRIBUTE VALUE │
87 ├─────────────────────────────┼─────────────────────────────┤
88 │Interface Stability │Committed │
89 ├─────────────────────────────┼─────────────────────────────┤
90 │MT-Level │MT-Safe │
91 └─────────────────────────────┴─────────────────────────────┘
92
94 mlib_ImageScale_Fp(3MLIB), mlib_ImageScale_Fp_Inp(3MLIB),
95 mlib_ImageScale_Inp(3MLIB), mlib_ImageScale2(3MLIB),
96 mlib_ImageScale2_Inp(3MLIB), attributes(5)
97
98
99
100SunOS 5.11 2 Mar 2007 mlib_ImageScale(3MLIB)